From 9f415efc609316ee748dcc771522077bcc50e3e6 Mon Sep 17 00:00:00 2001 From: Jakub Kicinski Date: Thu, 14 Mar 2024 14:13:36 -0700 Subject: [PATCH] move and rename the generated headers Users for the lib need to be able to include the generated headers. Using include is pretty ugly, rename the header, and link back to what the code-gen expected. Now library users can instead use: include Signed-off-by: Jakub Kicinski --- generated/devlink-user.h | 5411 +------------------------------- generated/dpll-user.h | 539 +--- generated/ethtool-user.h | 5538 +-------------------------------- generated/fou-user.h | 344 +- generated/handshake-user.h | 146 +- generated/mptcp_pm-user.h | 1049 +------ generated/netdev-user.h | 500 +-- generated/nfsd-user.h | 68 +- generated/nlctrl-user.h | 222 +- generated/ovs_datapath-user.h | 209 +- generated/ovs_flow-user.h | 2450 +-------------- generated/ovs_vport-user.h | 271 +- generated/psp-user.h | 369 +-- include/ynl-c/devlink.h | 5410 ++++++++++++++++++++++++++++++++ include/ynl-c/dpll.h | 538 ++++ include/ynl-c/ethtool.h | 5537 ++++++++++++++++++++++++++++++++ include/ynl-c/fou.h | 343 ++ include/ynl-c/handshake.h | 145 + include/ynl-c/mptcp_pm.h | 1048 +++++++ include/ynl-c/netdev.h | 499 +++ include/ynl-c/nfsd.h | 67 + include/ynl-c/nlctrl.h | 221 ++ include/ynl-c/ovs_datapath.h | 208 ++ include/ynl-c/ovs_flow.h | 2449 +++++++++++++++ include/ynl-c/ovs_vport.h | 270 ++ include/ynl-c/psp.h | 368 +++ update-from-kernel.sh | 9 + 27 files changed, 17125 insertions(+), 17103 deletions(-) mode change 100644 => 120000 generated/devlink-user.h mode change 100644 => 120000 generated/dpll-user.h mode change 100644 => 120000 generated/ethtool-user.h mode change 100644 => 120000 generated/fou-user.h mode change 100644 => 120000 generated/handshake-user.h mode change 100644 => 120000 generated/mptcp_pm-user.h mode change 100644 => 120000 generated/netdev-user.h mode change 100644 => 120000 generated/nfsd-user.h mode change 100644 => 120000 generated/nlctrl-user.h mode change 100644 => 120000 generated/ovs_datapath-user.h mode change 100644 => 120000 generated/ovs_flow-user.h mode change 100644 => 120000 generated/ovs_vport-user.h mode change 100644 => 120000 generated/psp-user.h create mode 100644 include/ynl-c/devlink.h create mode 100644 include/ynl-c/dpll.h create mode 100644 include/ynl-c/ethtool.h create mode 100644 include/ynl-c/fou.h create mode 100644 include/ynl-c/handshake.h create mode 100644 include/ynl-c/mptcp_pm.h create mode 100644 include/ynl-c/netdev.h create mode 100644 include/ynl-c/nfsd.h create mode 100644 include/ynl-c/nlctrl.h create mode 100644 include/ynl-c/ovs_datapath.h create mode 100644 include/ynl-c/ovs_flow.h create mode 100644 include/ynl-c/ovs_vport.h create mode 100644 include/ynl-c/psp.h diff --git a/generated/devlink-user.h b/generated/devlink-user.h deleted file mode 100644 index b54ee40..0000000 --- a/generated/devlink-user.h +++ /dev/null @@ -1,5410 +0,0 @@ -/* 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 header */ - -#ifndef _LINUX_DEVLINK_GEN_H -#define _LINUX_DEVLINK_GEN_H - -#include -#include -#include -#include -#include - -struct ynl_sock; - -extern const struct ynl_family ynl_devlink_family; - -/* Enums */ -const char *devlink_op_str(int op); -const char *devlink_sb_pool_type_str(enum devlink_sb_pool_type value); -const char *devlink_port_type_str(enum devlink_port_type value); -const char *devlink_port_flavour_str(enum devlink_port_flavour value); -const char *devlink_port_fn_state_str(enum devlink_port_fn_state value); -const char *devlink_port_fn_opstate_str(enum devlink_port_fn_opstate value); -const char *devlink_port_fn_attr_cap_str(enum devlink_port_fn_attr_cap value); -const char *devlink_rate_type_str(enum devlink_rate_type value); -const char * -devlink_sb_threshold_type_str(enum devlink_sb_threshold_type value); -const char *devlink_eswitch_mode_str(enum devlink_eswitch_mode value); -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_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 * -devlink_dpipe_action_type_str(enum devlink_dpipe_action_type value); -const char * -devlink_dpipe_field_mapping_type_str(enum devlink_dpipe_field_mapping_type value); -const char *devlink_resource_unit_str(enum devlink_resource_unit value); -const char *devlink_reload_action_str(enum devlink_reload_action value); -const char *devlink_param_cmode_str(enum devlink_param_cmode value); -const char *devlink_flash_overwrite_str(enum devlink_flash_overwrite value); -const char *devlink_trap_action_str(enum devlink_trap_action value); -const char *devlink_trap_type_str(enum devlink_trap_type value); - -/* Common nested types */ -struct devlink_dl_dpipe_match { - struct { - __u32 dpipe_match_type:1; - __u32 dpipe_header_id:1; - __u32 dpipe_header_global:1; - __u32 dpipe_header_index:1; - __u32 dpipe_field_id:1; - } _present; - - enum devlink_dpipe_match_type dpipe_match_type; - enum devlink_dpipe_header_id dpipe_header_id; - __u8 dpipe_header_global; - __u32 dpipe_header_index; - __u32 dpipe_field_id; -}; - -struct devlink_dl_dpipe_match_value { - struct { - __u32 dpipe_value_len; - __u32 dpipe_value_mask_len; - __u32 dpipe_value_mapping:1; - } _present; - - unsigned int n_dpipe_match; - struct devlink_dl_dpipe_match *dpipe_match; - void *dpipe_value; - void *dpipe_value_mask; - __u32 dpipe_value_mapping; -}; - -struct devlink_dl_dpipe_action { - struct { - __u32 dpipe_action_type:1; - __u32 dpipe_header_id:1; - __u32 dpipe_header_global:1; - __u32 dpipe_header_index:1; - __u32 dpipe_field_id:1; - } _present; - - enum devlink_dpipe_action_type dpipe_action_type; - enum devlink_dpipe_header_id dpipe_header_id; - __u8 dpipe_header_global; - __u32 dpipe_header_index; - __u32 dpipe_field_id; -}; - -struct devlink_dl_dpipe_action_value { - struct { - __u32 dpipe_value_len; - __u32 dpipe_value_mask_len; - __u32 dpipe_value_mapping:1; - } _present; - - unsigned int n_dpipe_action; - struct devlink_dl_dpipe_action *dpipe_action; - void *dpipe_value; - void *dpipe_value_mask; - __u32 dpipe_value_mapping; -}; - -struct devlink_dl_dpipe_field { - struct { - __u32 dpipe_field_name_len; - __u32 dpipe_field_id:1; - __u32 dpipe_field_bitwidth:1; - __u32 dpipe_field_mapping_type:1; - } _present; - - char *dpipe_field_name; - __u32 dpipe_field_id; - __u32 dpipe_field_bitwidth; - enum devlink_dpipe_field_mapping_type dpipe_field_mapping_type; -}; - -struct devlink_dl_resource { - struct { - __u32 resource_name_len; - __u32 resource_id:1; - __u32 resource_size:1; - __u32 resource_size_new:1; - __u32 resource_size_valid:1; - __u32 resource_size_min:1; - __u32 resource_size_max:1; - __u32 resource_size_gran:1; - __u32 resource_unit:1; - __u32 resource_occ:1; - } _present; - - char *resource_name; - __u64 resource_id; - __u64 resource_size; - __u64 resource_size_new; - __u8 resource_size_valid; - __u64 resource_size_min; - __u64 resource_size_max; - __u64 resource_size_gran; - enum devlink_resource_unit resource_unit; - __u64 resource_occ; -}; - -struct devlink_dl_param { - struct { - __u32 param_name_len; - __u32 param_generic:1; - __u32 param_type:1; - } _present; - - char *param_name; - __u8 param_type; -}; - -struct devlink_dl_region_snapshot { - struct { - __u32 region_snapshot_id:1; - } _present; - - __u32 region_snapshot_id; -}; - -struct devlink_dl_region_chunk { - struct { - __u32 region_chunk_data_len; - __u32 region_chunk_addr:1; - } _present; - - void *region_chunk_data; - __u64 region_chunk_addr; -}; - -struct devlink_dl_info_version { - struct { - __u32 info_version_name_len; - __u32 info_version_value_len; - } _present; - - char *info_version_name; - char *info_version_value; -}; - -struct devlink_dl_fmsg { - struct { - __u32 fmsg_obj_nest_start:1; - __u32 fmsg_pair_nest_start:1; - __u32 fmsg_arr_nest_start:1; - __u32 fmsg_nest_end:1; - __u32 fmsg_obj_name_len; - } _present; - - char *fmsg_obj_name; -}; - -struct devlink_dl_health_reporter { - struct { - __u32 health_reporter_name_len; - __u32 health_reporter_state:1; - __u32 health_reporter_err_count:1; - __u32 health_reporter_recover_count:1; - __u32 health_reporter_graceful_period:1; - __u32 health_reporter_auto_recover:1; - __u32 health_reporter_dump_ts:1; - __u32 health_reporter_dump_ts_ns:1; - __u32 health_reporter_auto_dump:1; - } _present; - - char *health_reporter_name; - __u8 health_reporter_state; - __u64 health_reporter_err_count; - __u64 health_reporter_recover_count; - __u64 health_reporter_graceful_period; - __u8 health_reporter_auto_recover; - __u64 health_reporter_dump_ts; - __u64 health_reporter_dump_ts_ns; - __u8 health_reporter_auto_dump; -}; - -struct devlink_dl_attr_stats { - struct { - __u32 stats_rx_packets:1; - __u32 stats_rx_bytes:1; - __u32 stats_rx_dropped:1; - } _present; - - __u64 stats_rx_packets; - __u64 stats_rx_bytes; - __u64 stats_rx_dropped; -}; - -struct devlink_dl_trap_metadata { - struct { - __u32 trap_metadata_type_in_port:1; - __u32 trap_metadata_type_fa_cookie:1; - } _present; -}; - -struct devlink_dl_port_function { - struct { - __u32 hw_addr_len; - __u32 state:1; - __u32 opstate:1; - __u32 caps:1; - } _present; - - void *hw_addr; - enum devlink_port_fn_state state; - enum devlink_port_fn_opstate opstate; - struct nla_bitfield32 caps; -}; - -struct devlink_dl_reload_stats_entry { - struct { - __u32 reload_stats_limit:1; - __u32 reload_stats_value:1; - } _present; - - __u8 reload_stats_limit; - __u32 reload_stats_value; -}; - -struct devlink_dl_reload_act_stats { - unsigned int n_reload_stats_entry; - struct devlink_dl_reload_stats_entry *reload_stats_entry; -}; - -struct devlink_dl_linecard_supported_types { - struct { - __u32 linecard_type_len; - } _present; - - char *linecard_type; -}; - -struct devlink_dl_selftest_id { - struct { - __u32 flash:1; - } _present; -}; - -struct devlink_dl_dpipe_table_matches { - unsigned int n_dpipe_match; - struct devlink_dl_dpipe_match *dpipe_match; -}; - -struct devlink_dl_dpipe_table_actions { - unsigned int n_dpipe_action; - struct devlink_dl_dpipe_action *dpipe_action; -}; - -struct devlink_dl_dpipe_entry_match_values { - unsigned int n_dpipe_match_value; - struct devlink_dl_dpipe_match_value *dpipe_match_value; -}; - -struct devlink_dl_dpipe_entry_action_values { - unsigned int n_dpipe_action_value; - struct devlink_dl_dpipe_action_value *dpipe_action_value; -}; - -struct devlink_dl_dpipe_header_fields { - unsigned int n_dpipe_field; - struct devlink_dl_dpipe_field *dpipe_field; -}; - -struct devlink_dl_resource_list { - unsigned int n_resource; - struct devlink_dl_resource *resource; -}; - -struct devlink_dl_region_snapshots { - struct { - __u32 region_snapshot:1; - } _present; - - struct devlink_dl_region_snapshot region_snapshot; -}; - -struct devlink_dl_region_chunks { - struct { - __u32 region_chunk:1; - } _present; - - struct devlink_dl_region_chunk region_chunk; -}; - -struct devlink_dl_reload_act_info { - struct { - __u32 reload_action:1; - } _present; - - enum devlink_reload_action reload_action; - unsigned int n_reload_action_stats; - struct devlink_dl_reload_act_stats *reload_action_stats; -}; - -struct devlink_dl_dpipe_table { - struct { - __u32 dpipe_table_name_len; - __u32 dpipe_table_size:1; - __u32 dpipe_table_matches:1; - __u32 dpipe_table_actions:1; - __u32 dpipe_table_counters_enabled:1; - __u32 dpipe_table_resource_id:1; - __u32 dpipe_table_resource_units:1; - } _present; - - char *dpipe_table_name; - __u64 dpipe_table_size; - struct devlink_dl_dpipe_table_matches dpipe_table_matches; - struct devlink_dl_dpipe_table_actions dpipe_table_actions; - __u8 dpipe_table_counters_enabled; - __u64 dpipe_table_resource_id; - __u64 dpipe_table_resource_units; -}; - -struct devlink_dl_dpipe_entry { - struct { - __u32 dpipe_entry_index:1; - __u32 dpipe_entry_match_values:1; - __u32 dpipe_entry_action_values:1; - __u32 dpipe_entry_counter:1; - } _present; - - __u64 dpipe_entry_index; - struct devlink_dl_dpipe_entry_match_values dpipe_entry_match_values; - struct devlink_dl_dpipe_entry_action_values dpipe_entry_action_values; - __u64 dpipe_entry_counter; -}; - -struct devlink_dl_dpipe_header { - struct { - __u32 dpipe_header_name_len; - __u32 dpipe_header_id:1; - __u32 dpipe_header_global:1; - __u32 dpipe_header_fields:1; - } _present; - - char *dpipe_header_name; - enum devlink_dpipe_header_id dpipe_header_id; - __u8 dpipe_header_global; - struct devlink_dl_dpipe_header_fields dpipe_header_fields; -}; - -struct devlink_dl_reload_stats { - unsigned int n_reload_action_info; - struct devlink_dl_reload_act_info *reload_action_info; -}; - -struct devlink_dl_dpipe_tables { - unsigned int n_dpipe_table; - struct devlink_dl_dpipe_table *dpipe_table; -}; - -struct devlink_dl_dpipe_entries { - unsigned int n_dpipe_entry; - struct devlink_dl_dpipe_entry *dpipe_entry; -}; - -struct devlink_dl_dpipe_headers { - unsigned int n_dpipe_header; - struct devlink_dl_dpipe_header *dpipe_header; -}; - -struct devlink_dl_dev_stats { - struct { - __u32 reload_stats:1; - __u32 remote_reload_stats:1; - } _present; - - struct devlink_dl_reload_stats reload_stats; - struct devlink_dl_reload_stats remote_reload_stats; -}; - -/* ============== DEVLINK_CMD_GET ============== */ -/* DEVLINK_CMD_GET - do */ -struct devlink_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_get_req *devlink_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_get_req)); -} -void devlink_get_req_free(struct devlink_get_req *req); - -static inline void -devlink_get_req_set_bus_name(struct devlink_get_req *req, const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_get_req_set_dev_name(struct devlink_get_req *req, const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 reload_failed:1; - __u32 dev_stats:1; - } _present; - - char *bus_name; - char *dev_name; - __u8 reload_failed; - struct devlink_dl_dev_stats dev_stats; -}; - -void devlink_get_rsp_free(struct devlink_get_rsp *rsp); - -/* - * Get devlink instances. - */ -struct devlink_get_rsp * -devlink_get(struct ynl_sock *ys, struct devlink_get_req *req); - -/* DEVLINK_CMD_GET - dump */ -struct devlink_get_list { - struct devlink_get_list *next; - struct devlink_get_rsp obj __attribute__((aligned(8))); -}; - -void devlink_get_list_free(struct devlink_get_list *rsp); - -struct devlink_get_list *devlink_get_dump(struct ynl_sock *ys); - -/* ============== DEVLINK_CMD_PORT_GET ============== */ -/* DEVLINK_CMD_PORT_GET - do */ -struct devlink_port_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; -}; - -static inline struct devlink_port_get_req *devlink_port_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_port_get_req)); -} -void devlink_port_get_req_free(struct devlink_port_get_req *req); - -static inline void -devlink_port_get_req_set_bus_name(struct devlink_port_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_port_get_req_set_dev_name(struct devlink_port_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_port_get_req_set_port_index(struct devlink_port_get_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} - -struct devlink_port_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; -}; - -void devlink_port_get_rsp_free(struct devlink_port_get_rsp *rsp); - -/* - * Get devlink port instances. - */ -struct devlink_port_get_rsp * -devlink_port_get(struct ynl_sock *ys, struct devlink_port_get_req *req); - -/* DEVLINK_CMD_PORT_GET - dump */ -struct devlink_port_get_req_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_port_get_req_dump * -devlink_port_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct devlink_port_get_req_dump)); -} -void devlink_port_get_req_dump_free(struct devlink_port_get_req_dump *req); - -static inline void -devlink_port_get_req_dump_set_bus_name(struct devlink_port_get_req_dump *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_port_get_req_dump_set_dev_name(struct devlink_port_get_req_dump *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_port_get_rsp_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; -}; - -struct devlink_port_get_rsp_list { - struct devlink_port_get_rsp_list *next; - struct devlink_port_get_rsp_dump obj __attribute__((aligned(8))); -}; - -void devlink_port_get_rsp_list_free(struct devlink_port_get_rsp_list *rsp); - -struct devlink_port_get_rsp_list * -devlink_port_get_dump(struct ynl_sock *ys, - struct devlink_port_get_req_dump *req); - -/* ============== DEVLINK_CMD_PORT_SET ============== */ -/* DEVLINK_CMD_PORT_SET - do */ -struct devlink_port_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 port_type:1; - __u32 port_function:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - enum devlink_port_type port_type; - struct devlink_dl_port_function port_function; -}; - -static inline struct devlink_port_set_req *devlink_port_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_port_set_req)); -} -void devlink_port_set_req_free(struct devlink_port_set_req *req); - -static inline void -devlink_port_set_req_set_bus_name(struct devlink_port_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_port_set_req_set_dev_name(struct devlink_port_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_port_set_req_set_port_index(struct devlink_port_set_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_port_set_req_set_port_type(struct devlink_port_set_req *req, - enum devlink_port_type port_type) -{ - req->_present.port_type = 1; - req->port_type = port_type; -} -static inline void -devlink_port_set_req_set_port_function_hw_addr(struct devlink_port_set_req *req, - const void *hw_addr, size_t len) -{ - free(req->port_function.hw_addr); - req->port_function._present.hw_addr_len = len; - req->port_function.hw_addr = malloc(req->port_function._present.hw_addr_len); - memcpy(req->port_function.hw_addr, hw_addr, req->port_function._present.hw_addr_len); -} -static inline void -devlink_port_set_req_set_port_function_state(struct devlink_port_set_req *req, - enum devlink_port_fn_state state) -{ - req->_present.port_function = 1; - req->port_function._present.state = 1; - req->port_function.state = state; -} -static inline void -devlink_port_set_req_set_port_function_opstate(struct devlink_port_set_req *req, - enum devlink_port_fn_opstate opstate) -{ - req->_present.port_function = 1; - req->port_function._present.opstate = 1; - req->port_function.opstate = opstate; -} -static inline void -devlink_port_set_req_set_port_function_caps(struct devlink_port_set_req *req, - struct nla_bitfield32 *caps) -{ - req->_present.port_function = 1; - req->port_function._present.caps = 1; - memcpy(&req->port_function.caps, caps, sizeof(struct nla_bitfield32)); -} - -/* - * Set devlink port instances. - */ -int devlink_port_set(struct ynl_sock *ys, struct devlink_port_set_req *req); - -/* ============== DEVLINK_CMD_PORT_NEW ============== */ -/* DEVLINK_CMD_PORT_NEW - do */ -struct devlink_port_new_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 port_flavour:1; - __u32 port_pci_pf_number:1; - __u32 port_pci_sf_number:1; - __u32 port_controller_number:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - enum devlink_port_flavour port_flavour; - __u16 port_pci_pf_number; - __u32 port_pci_sf_number; - __u32 port_controller_number; -}; - -static inline struct devlink_port_new_req *devlink_port_new_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_port_new_req)); -} -void devlink_port_new_req_free(struct devlink_port_new_req *req); - -static inline void -devlink_port_new_req_set_bus_name(struct devlink_port_new_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_port_new_req_set_dev_name(struct devlink_port_new_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_port_new_req_set_port_index(struct devlink_port_new_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_port_new_req_set_port_flavour(struct devlink_port_new_req *req, - enum devlink_port_flavour port_flavour) -{ - req->_present.port_flavour = 1; - req->port_flavour = port_flavour; -} -static inline void -devlink_port_new_req_set_port_pci_pf_number(struct devlink_port_new_req *req, - __u16 port_pci_pf_number) -{ - req->_present.port_pci_pf_number = 1; - req->port_pci_pf_number = port_pci_pf_number; -} -static inline void -devlink_port_new_req_set_port_pci_sf_number(struct devlink_port_new_req *req, - __u32 port_pci_sf_number) -{ - req->_present.port_pci_sf_number = 1; - req->port_pci_sf_number = port_pci_sf_number; -} -static inline void -devlink_port_new_req_set_port_controller_number(struct devlink_port_new_req *req, - __u32 port_controller_number) -{ - req->_present.port_controller_number = 1; - req->port_controller_number = port_controller_number; -} - -struct devlink_port_new_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; -}; - -void devlink_port_new_rsp_free(struct devlink_port_new_rsp *rsp); - -/* - * Create devlink port instances. - */ -struct devlink_port_new_rsp * -devlink_port_new(struct ynl_sock *ys, struct devlink_port_new_req *req); - -/* ============== DEVLINK_CMD_PORT_DEL ============== */ -/* DEVLINK_CMD_PORT_DEL - do */ -struct devlink_port_del_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; -}; - -static inline struct devlink_port_del_req *devlink_port_del_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_port_del_req)); -} -void devlink_port_del_req_free(struct devlink_port_del_req *req); - -static inline void -devlink_port_del_req_set_bus_name(struct devlink_port_del_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_port_del_req_set_dev_name(struct devlink_port_del_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_port_del_req_set_port_index(struct devlink_port_del_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} - -/* - * Delete devlink port instances. - */ -int devlink_port_del(struct ynl_sock *ys, struct devlink_port_del_req *req); - -/* ============== DEVLINK_CMD_PORT_SPLIT ============== */ -/* DEVLINK_CMD_PORT_SPLIT - do */ -struct devlink_port_split_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 port_split_count:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - __u32 port_split_count; -}; - -static inline struct devlink_port_split_req *devlink_port_split_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_port_split_req)); -} -void devlink_port_split_req_free(struct devlink_port_split_req *req); - -static inline void -devlink_port_split_req_set_bus_name(struct devlink_port_split_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_port_split_req_set_dev_name(struct devlink_port_split_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_port_split_req_set_port_index(struct devlink_port_split_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_port_split_req_set_port_split_count(struct devlink_port_split_req *req, - __u32 port_split_count) -{ - req->_present.port_split_count = 1; - req->port_split_count = port_split_count; -} - -/* - * Split devlink port instances. - */ -int devlink_port_split(struct ynl_sock *ys, struct devlink_port_split_req *req); - -/* ============== DEVLINK_CMD_PORT_UNSPLIT ============== */ -/* DEVLINK_CMD_PORT_UNSPLIT - do */ -struct devlink_port_unsplit_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; -}; - -static inline struct devlink_port_unsplit_req * -devlink_port_unsplit_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_port_unsplit_req)); -} -void devlink_port_unsplit_req_free(struct devlink_port_unsplit_req *req); - -static inline void -devlink_port_unsplit_req_set_bus_name(struct devlink_port_unsplit_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_port_unsplit_req_set_dev_name(struct devlink_port_unsplit_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_port_unsplit_req_set_port_index(struct devlink_port_unsplit_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} - -/* - * Unplit devlink port instances. - */ -int devlink_port_unsplit(struct ynl_sock *ys, - struct devlink_port_unsplit_req *req); - -/* ============== DEVLINK_CMD_SB_GET ============== */ -/* DEVLINK_CMD_SB_GET - do */ -struct devlink_sb_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 sb_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 sb_index; -}; - -static inline struct devlink_sb_get_req *devlink_sb_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_sb_get_req)); -} -void devlink_sb_get_req_free(struct devlink_sb_get_req *req); - -static inline void -devlink_sb_get_req_set_bus_name(struct devlink_sb_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_sb_get_req_set_dev_name(struct devlink_sb_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_sb_get_req_set_sb_index(struct devlink_sb_get_req *req, __u32 sb_index) -{ - req->_present.sb_index = 1; - req->sb_index = sb_index; -} - -struct devlink_sb_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 sb_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 sb_index; -}; - -void devlink_sb_get_rsp_free(struct devlink_sb_get_rsp *rsp); - -/* - * Get shared buffer instances. - */ -struct devlink_sb_get_rsp * -devlink_sb_get(struct ynl_sock *ys, struct devlink_sb_get_req *req); - -/* DEVLINK_CMD_SB_GET - dump */ -struct devlink_sb_get_req_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_sb_get_req_dump * -devlink_sb_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct devlink_sb_get_req_dump)); -} -void devlink_sb_get_req_dump_free(struct devlink_sb_get_req_dump *req); - -static inline void -devlink_sb_get_req_dump_set_bus_name(struct devlink_sb_get_req_dump *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_sb_get_req_dump_set_dev_name(struct devlink_sb_get_req_dump *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_sb_get_list { - struct devlink_sb_get_list *next; - struct devlink_sb_get_rsp obj __attribute__((aligned(8))); -}; - -void devlink_sb_get_list_free(struct devlink_sb_get_list *rsp); - -struct devlink_sb_get_list * -devlink_sb_get_dump(struct ynl_sock *ys, struct devlink_sb_get_req_dump *req); - -/* ============== DEVLINK_CMD_SB_POOL_GET ============== */ -/* DEVLINK_CMD_SB_POOL_GET - do */ -struct devlink_sb_pool_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 sb_index:1; - __u32 sb_pool_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 sb_index; - __u16 sb_pool_index; -}; - -static inline struct devlink_sb_pool_get_req * -devlink_sb_pool_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_sb_pool_get_req)); -} -void devlink_sb_pool_get_req_free(struct devlink_sb_pool_get_req *req); - -static inline void -devlink_sb_pool_get_req_set_bus_name(struct devlink_sb_pool_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_sb_pool_get_req_set_dev_name(struct devlink_sb_pool_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_sb_pool_get_req_set_sb_index(struct devlink_sb_pool_get_req *req, - __u32 sb_index) -{ - req->_present.sb_index = 1; - req->sb_index = sb_index; -} -static inline void -devlink_sb_pool_get_req_set_sb_pool_index(struct devlink_sb_pool_get_req *req, - __u16 sb_pool_index) -{ - req->_present.sb_pool_index = 1; - req->sb_pool_index = sb_pool_index; -} - -struct devlink_sb_pool_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 sb_index:1; - __u32 sb_pool_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 sb_index; - __u16 sb_pool_index; -}; - -void devlink_sb_pool_get_rsp_free(struct devlink_sb_pool_get_rsp *rsp); - -/* - * Get shared buffer pool instances. - */ -struct devlink_sb_pool_get_rsp * -devlink_sb_pool_get(struct ynl_sock *ys, struct devlink_sb_pool_get_req *req); - -/* DEVLINK_CMD_SB_POOL_GET - dump */ -struct devlink_sb_pool_get_req_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_sb_pool_get_req_dump * -devlink_sb_pool_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct devlink_sb_pool_get_req_dump)); -} -void -devlink_sb_pool_get_req_dump_free(struct devlink_sb_pool_get_req_dump *req); - -static inline void -devlink_sb_pool_get_req_dump_set_bus_name(struct devlink_sb_pool_get_req_dump *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_sb_pool_get_req_dump_set_dev_name(struct devlink_sb_pool_get_req_dump *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_sb_pool_get_list { - struct devlink_sb_pool_get_list *next; - struct devlink_sb_pool_get_rsp obj __attribute__((aligned(8))); -}; - -void devlink_sb_pool_get_list_free(struct devlink_sb_pool_get_list *rsp); - -struct devlink_sb_pool_get_list * -devlink_sb_pool_get_dump(struct ynl_sock *ys, - struct devlink_sb_pool_get_req_dump *req); - -/* ============== DEVLINK_CMD_SB_POOL_SET ============== */ -/* DEVLINK_CMD_SB_POOL_SET - do */ -struct devlink_sb_pool_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 sb_index:1; - __u32 sb_pool_index:1; - __u32 sb_pool_threshold_type:1; - __u32 sb_pool_size:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 sb_index; - __u16 sb_pool_index; - enum devlink_sb_threshold_type sb_pool_threshold_type; - __u32 sb_pool_size; -}; - -static inline struct devlink_sb_pool_set_req * -devlink_sb_pool_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_sb_pool_set_req)); -} -void devlink_sb_pool_set_req_free(struct devlink_sb_pool_set_req *req); - -static inline void -devlink_sb_pool_set_req_set_bus_name(struct devlink_sb_pool_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_sb_pool_set_req_set_dev_name(struct devlink_sb_pool_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_sb_pool_set_req_set_sb_index(struct devlink_sb_pool_set_req *req, - __u32 sb_index) -{ - req->_present.sb_index = 1; - req->sb_index = sb_index; -} -static inline void -devlink_sb_pool_set_req_set_sb_pool_index(struct devlink_sb_pool_set_req *req, - __u16 sb_pool_index) -{ - req->_present.sb_pool_index = 1; - req->sb_pool_index = sb_pool_index; -} -static inline void -devlink_sb_pool_set_req_set_sb_pool_threshold_type(struct devlink_sb_pool_set_req *req, - enum devlink_sb_threshold_type sb_pool_threshold_type) -{ - req->_present.sb_pool_threshold_type = 1; - req->sb_pool_threshold_type = sb_pool_threshold_type; -} -static inline void -devlink_sb_pool_set_req_set_sb_pool_size(struct devlink_sb_pool_set_req *req, - __u32 sb_pool_size) -{ - req->_present.sb_pool_size = 1; - req->sb_pool_size = sb_pool_size; -} - -/* - * Set shared buffer pool instances. - */ -int devlink_sb_pool_set(struct ynl_sock *ys, - struct devlink_sb_pool_set_req *req); - -/* ============== DEVLINK_CMD_SB_PORT_POOL_GET ============== */ -/* DEVLINK_CMD_SB_PORT_POOL_GET - do */ -struct devlink_sb_port_pool_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 sb_index:1; - __u32 sb_pool_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - __u32 sb_index; - __u16 sb_pool_index; -}; - -static inline struct devlink_sb_port_pool_get_req * -devlink_sb_port_pool_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_sb_port_pool_get_req)); -} -void -devlink_sb_port_pool_get_req_free(struct devlink_sb_port_pool_get_req *req); - -static inline void -devlink_sb_port_pool_get_req_set_bus_name(struct devlink_sb_port_pool_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_sb_port_pool_get_req_set_dev_name(struct devlink_sb_port_pool_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_sb_port_pool_get_req_set_port_index(struct devlink_sb_port_pool_get_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_sb_port_pool_get_req_set_sb_index(struct devlink_sb_port_pool_get_req *req, - __u32 sb_index) -{ - req->_present.sb_index = 1; - req->sb_index = sb_index; -} -static inline void -devlink_sb_port_pool_get_req_set_sb_pool_index(struct devlink_sb_port_pool_get_req *req, - __u16 sb_pool_index) -{ - req->_present.sb_pool_index = 1; - req->sb_pool_index = sb_pool_index; -} - -struct devlink_sb_port_pool_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 sb_index:1; - __u32 sb_pool_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - __u32 sb_index; - __u16 sb_pool_index; -}; - -void -devlink_sb_port_pool_get_rsp_free(struct devlink_sb_port_pool_get_rsp *rsp); - -/* - * Get shared buffer port-pool combinations and threshold. - */ -struct devlink_sb_port_pool_get_rsp * -devlink_sb_port_pool_get(struct ynl_sock *ys, - struct devlink_sb_port_pool_get_req *req); - -/* DEVLINK_CMD_SB_PORT_POOL_GET - dump */ -struct devlink_sb_port_pool_get_req_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_sb_port_pool_get_req_dump * -devlink_sb_port_pool_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct devlink_sb_port_pool_get_req_dump)); -} -void -devlink_sb_port_pool_get_req_dump_free(struct devlink_sb_port_pool_get_req_dump *req); - -static inline void -devlink_sb_port_pool_get_req_dump_set_bus_name(struct devlink_sb_port_pool_get_req_dump *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_sb_port_pool_get_req_dump_set_dev_name(struct devlink_sb_port_pool_get_req_dump *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_sb_port_pool_get_list { - struct devlink_sb_port_pool_get_list *next; - struct devlink_sb_port_pool_get_rsp obj __attribute__((aligned(8))); -}; - -void -devlink_sb_port_pool_get_list_free(struct devlink_sb_port_pool_get_list *rsp); - -struct devlink_sb_port_pool_get_list * -devlink_sb_port_pool_get_dump(struct ynl_sock *ys, - struct devlink_sb_port_pool_get_req_dump *req); - -/* ============== DEVLINK_CMD_SB_PORT_POOL_SET ============== */ -/* DEVLINK_CMD_SB_PORT_POOL_SET - do */ -struct devlink_sb_port_pool_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 sb_index:1; - __u32 sb_pool_index:1; - __u32 sb_threshold:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - __u32 sb_index; - __u16 sb_pool_index; - __u32 sb_threshold; -}; - -static inline struct devlink_sb_port_pool_set_req * -devlink_sb_port_pool_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_sb_port_pool_set_req)); -} -void -devlink_sb_port_pool_set_req_free(struct devlink_sb_port_pool_set_req *req); - -static inline void -devlink_sb_port_pool_set_req_set_bus_name(struct devlink_sb_port_pool_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_sb_port_pool_set_req_set_dev_name(struct devlink_sb_port_pool_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_sb_port_pool_set_req_set_port_index(struct devlink_sb_port_pool_set_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_sb_port_pool_set_req_set_sb_index(struct devlink_sb_port_pool_set_req *req, - __u32 sb_index) -{ - req->_present.sb_index = 1; - req->sb_index = sb_index; -} -static inline void -devlink_sb_port_pool_set_req_set_sb_pool_index(struct devlink_sb_port_pool_set_req *req, - __u16 sb_pool_index) -{ - req->_present.sb_pool_index = 1; - req->sb_pool_index = sb_pool_index; -} -static inline void -devlink_sb_port_pool_set_req_set_sb_threshold(struct devlink_sb_port_pool_set_req *req, - __u32 sb_threshold) -{ - req->_present.sb_threshold = 1; - req->sb_threshold = sb_threshold; -} - -/* - * Set shared buffer port-pool combinations and threshold. - */ -int devlink_sb_port_pool_set(struct ynl_sock *ys, - struct devlink_sb_port_pool_set_req *req); - -/* ============== DEVLINK_CMD_SB_TC_POOL_BIND_GET ============== */ -/* DEVLINK_CMD_SB_TC_POOL_BIND_GET - do */ -struct devlink_sb_tc_pool_bind_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 sb_index:1; - __u32 sb_pool_type:1; - __u32 sb_tc_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - __u32 sb_index; - enum devlink_sb_pool_type sb_pool_type; - __u16 sb_tc_index; -}; - -static inline struct devlink_sb_tc_pool_bind_get_req * -devlink_sb_tc_pool_bind_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_sb_tc_pool_bind_get_req)); -} -void -devlink_sb_tc_pool_bind_get_req_free(struct devlink_sb_tc_pool_bind_get_req *req); - -static inline void -devlink_sb_tc_pool_bind_get_req_set_bus_name(struct devlink_sb_tc_pool_bind_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_sb_tc_pool_bind_get_req_set_dev_name(struct devlink_sb_tc_pool_bind_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_sb_tc_pool_bind_get_req_set_port_index(struct devlink_sb_tc_pool_bind_get_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_sb_tc_pool_bind_get_req_set_sb_index(struct devlink_sb_tc_pool_bind_get_req *req, - __u32 sb_index) -{ - req->_present.sb_index = 1; - req->sb_index = sb_index; -} -static inline void -devlink_sb_tc_pool_bind_get_req_set_sb_pool_type(struct devlink_sb_tc_pool_bind_get_req *req, - enum devlink_sb_pool_type sb_pool_type) -{ - req->_present.sb_pool_type = 1; - req->sb_pool_type = sb_pool_type; -} -static inline void -devlink_sb_tc_pool_bind_get_req_set_sb_tc_index(struct devlink_sb_tc_pool_bind_get_req *req, - __u16 sb_tc_index) -{ - req->_present.sb_tc_index = 1; - req->sb_tc_index = sb_tc_index; -} - -struct devlink_sb_tc_pool_bind_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 sb_index:1; - __u32 sb_pool_type:1; - __u32 sb_tc_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - __u32 sb_index; - enum devlink_sb_pool_type sb_pool_type; - __u16 sb_tc_index; -}; - -void -devlink_sb_tc_pool_bind_get_rsp_free(struct devlink_sb_tc_pool_bind_get_rsp *rsp); - -/* - * Get shared buffer port-TC to pool bindings and threshold. - */ -struct devlink_sb_tc_pool_bind_get_rsp * -devlink_sb_tc_pool_bind_get(struct ynl_sock *ys, - struct devlink_sb_tc_pool_bind_get_req *req); - -/* DEVLINK_CMD_SB_TC_POOL_BIND_GET - dump */ -struct devlink_sb_tc_pool_bind_get_req_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_sb_tc_pool_bind_get_req_dump * -devlink_sb_tc_pool_bind_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct devlink_sb_tc_pool_bind_get_req_dump)); -} -void -devlink_sb_tc_pool_bind_get_req_dump_free(struct devlink_sb_tc_pool_bind_get_req_dump *req); - -static inline void -devlink_sb_tc_pool_bind_get_req_dump_set_bus_name(struct devlink_sb_tc_pool_bind_get_req_dump *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_sb_tc_pool_bind_get_req_dump_set_dev_name(struct devlink_sb_tc_pool_bind_get_req_dump *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_sb_tc_pool_bind_get_list { - struct devlink_sb_tc_pool_bind_get_list *next; - struct devlink_sb_tc_pool_bind_get_rsp obj __attribute__((aligned(8))); -}; - -void -devlink_sb_tc_pool_bind_get_list_free(struct devlink_sb_tc_pool_bind_get_list *rsp); - -struct devlink_sb_tc_pool_bind_get_list * -devlink_sb_tc_pool_bind_get_dump(struct ynl_sock *ys, - struct devlink_sb_tc_pool_bind_get_req_dump *req); - -/* ============== DEVLINK_CMD_SB_TC_POOL_BIND_SET ============== */ -/* DEVLINK_CMD_SB_TC_POOL_BIND_SET - do */ -struct devlink_sb_tc_pool_bind_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 sb_index:1; - __u32 sb_pool_index:1; - __u32 sb_pool_type:1; - __u32 sb_tc_index:1; - __u32 sb_threshold:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - __u32 sb_index; - __u16 sb_pool_index; - enum devlink_sb_pool_type sb_pool_type; - __u16 sb_tc_index; - __u32 sb_threshold; -}; - -static inline struct devlink_sb_tc_pool_bind_set_req * -devlink_sb_tc_pool_bind_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_sb_tc_pool_bind_set_req)); -} -void -devlink_sb_tc_pool_bind_set_req_free(struct devlink_sb_tc_pool_bind_set_req *req); - -static inline void -devlink_sb_tc_pool_bind_set_req_set_bus_name(struct devlink_sb_tc_pool_bind_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_sb_tc_pool_bind_set_req_set_dev_name(struct devlink_sb_tc_pool_bind_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_sb_tc_pool_bind_set_req_set_port_index(struct devlink_sb_tc_pool_bind_set_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_sb_tc_pool_bind_set_req_set_sb_index(struct devlink_sb_tc_pool_bind_set_req *req, - __u32 sb_index) -{ - req->_present.sb_index = 1; - req->sb_index = sb_index; -} -static inline void -devlink_sb_tc_pool_bind_set_req_set_sb_pool_index(struct devlink_sb_tc_pool_bind_set_req *req, - __u16 sb_pool_index) -{ - req->_present.sb_pool_index = 1; - req->sb_pool_index = sb_pool_index; -} -static inline void -devlink_sb_tc_pool_bind_set_req_set_sb_pool_type(struct devlink_sb_tc_pool_bind_set_req *req, - enum devlink_sb_pool_type sb_pool_type) -{ - req->_present.sb_pool_type = 1; - req->sb_pool_type = sb_pool_type; -} -static inline void -devlink_sb_tc_pool_bind_set_req_set_sb_tc_index(struct devlink_sb_tc_pool_bind_set_req *req, - __u16 sb_tc_index) -{ - req->_present.sb_tc_index = 1; - req->sb_tc_index = sb_tc_index; -} -static inline void -devlink_sb_tc_pool_bind_set_req_set_sb_threshold(struct devlink_sb_tc_pool_bind_set_req *req, - __u32 sb_threshold) -{ - req->_present.sb_threshold = 1; - req->sb_threshold = sb_threshold; -} - -/* - * Set shared buffer port-TC to pool bindings and threshold. - */ -int devlink_sb_tc_pool_bind_set(struct ynl_sock *ys, - struct devlink_sb_tc_pool_bind_set_req *req); - -/* ============== DEVLINK_CMD_SB_OCC_SNAPSHOT ============== */ -/* DEVLINK_CMD_SB_OCC_SNAPSHOT - do */ -struct devlink_sb_occ_snapshot_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 sb_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 sb_index; -}; - -static inline struct devlink_sb_occ_snapshot_req * -devlink_sb_occ_snapshot_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_sb_occ_snapshot_req)); -} -void devlink_sb_occ_snapshot_req_free(struct devlink_sb_occ_snapshot_req *req); - -static inline void -devlink_sb_occ_snapshot_req_set_bus_name(struct devlink_sb_occ_snapshot_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_sb_occ_snapshot_req_set_dev_name(struct devlink_sb_occ_snapshot_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_sb_occ_snapshot_req_set_sb_index(struct devlink_sb_occ_snapshot_req *req, - __u32 sb_index) -{ - req->_present.sb_index = 1; - req->sb_index = sb_index; -} - -/* - * Take occupancy snapshot of shared buffer. - */ -int devlink_sb_occ_snapshot(struct ynl_sock *ys, - struct devlink_sb_occ_snapshot_req *req); - -/* ============== DEVLINK_CMD_SB_OCC_MAX_CLEAR ============== */ -/* DEVLINK_CMD_SB_OCC_MAX_CLEAR - do */ -struct devlink_sb_occ_max_clear_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 sb_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 sb_index; -}; - -static inline struct devlink_sb_occ_max_clear_req * -devlink_sb_occ_max_clear_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_sb_occ_max_clear_req)); -} -void -devlink_sb_occ_max_clear_req_free(struct devlink_sb_occ_max_clear_req *req); - -static inline void -devlink_sb_occ_max_clear_req_set_bus_name(struct devlink_sb_occ_max_clear_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_sb_occ_max_clear_req_set_dev_name(struct devlink_sb_occ_max_clear_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_sb_occ_max_clear_req_set_sb_index(struct devlink_sb_occ_max_clear_req *req, - __u32 sb_index) -{ - req->_present.sb_index = 1; - req->sb_index = sb_index; -} - -/* - * Clear occupancy watermarks of shared buffer. - */ -int devlink_sb_occ_max_clear(struct ynl_sock *ys, - struct devlink_sb_occ_max_clear_req *req); - -/* ============== DEVLINK_CMD_ESWITCH_GET ============== */ -/* DEVLINK_CMD_ESWITCH_GET - do */ -struct devlink_eswitch_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_eswitch_get_req * -devlink_eswitch_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_eswitch_get_req)); -} -void devlink_eswitch_get_req_free(struct devlink_eswitch_get_req *req); - -static inline void -devlink_eswitch_get_req_set_bus_name(struct devlink_eswitch_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_eswitch_get_req_set_dev_name(struct devlink_eswitch_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_eswitch_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 eswitch_mode:1; - __u32 eswitch_inline_mode:1; - __u32 eswitch_encap_mode:1; - } _present; - - char *bus_name; - char *dev_name; - enum devlink_eswitch_mode eswitch_mode; - enum devlink_eswitch_inline_mode eswitch_inline_mode; - enum devlink_eswitch_encap_mode eswitch_encap_mode; -}; - -void devlink_eswitch_get_rsp_free(struct devlink_eswitch_get_rsp *rsp); - -/* - * Get eswitch attributes. - */ -struct devlink_eswitch_get_rsp * -devlink_eswitch_get(struct ynl_sock *ys, struct devlink_eswitch_get_req *req); - -/* ============== DEVLINK_CMD_ESWITCH_SET ============== */ -/* DEVLINK_CMD_ESWITCH_SET - do */ -struct devlink_eswitch_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 eswitch_mode:1; - __u32 eswitch_inline_mode:1; - __u32 eswitch_encap_mode:1; - } _present; - - char *bus_name; - char *dev_name; - enum devlink_eswitch_mode eswitch_mode; - enum devlink_eswitch_inline_mode eswitch_inline_mode; - enum devlink_eswitch_encap_mode eswitch_encap_mode; -}; - -static inline struct devlink_eswitch_set_req * -devlink_eswitch_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_eswitch_set_req)); -} -void devlink_eswitch_set_req_free(struct devlink_eswitch_set_req *req); - -static inline void -devlink_eswitch_set_req_set_bus_name(struct devlink_eswitch_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_eswitch_set_req_set_dev_name(struct devlink_eswitch_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_eswitch_set_req_set_eswitch_mode(struct devlink_eswitch_set_req *req, - enum devlink_eswitch_mode eswitch_mode) -{ - req->_present.eswitch_mode = 1; - req->eswitch_mode = eswitch_mode; -} -static inline void -devlink_eswitch_set_req_set_eswitch_inline_mode(struct devlink_eswitch_set_req *req, - enum devlink_eswitch_inline_mode eswitch_inline_mode) -{ - req->_present.eswitch_inline_mode = 1; - req->eswitch_inline_mode = eswitch_inline_mode; -} -static inline void -devlink_eswitch_set_req_set_eswitch_encap_mode(struct devlink_eswitch_set_req *req, - enum devlink_eswitch_encap_mode eswitch_encap_mode) -{ - req->_present.eswitch_encap_mode = 1; - req->eswitch_encap_mode = eswitch_encap_mode; -} - -/* - * Set eswitch attributes. - */ -int devlink_eswitch_set(struct ynl_sock *ys, - struct devlink_eswitch_set_req *req); - -/* ============== DEVLINK_CMD_DPIPE_TABLE_GET ============== */ -/* DEVLINK_CMD_DPIPE_TABLE_GET - do */ -struct devlink_dpipe_table_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 dpipe_table_name_len; - } _present; - - char *bus_name; - char *dev_name; - char *dpipe_table_name; -}; - -static inline struct devlink_dpipe_table_get_req * -devlink_dpipe_table_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_dpipe_table_get_req)); -} -void devlink_dpipe_table_get_req_free(struct devlink_dpipe_table_get_req *req); - -static inline void -devlink_dpipe_table_get_req_set_bus_name(struct devlink_dpipe_table_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_dpipe_table_get_req_set_dev_name(struct devlink_dpipe_table_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_dpipe_table_get_req_set_dpipe_table_name(struct devlink_dpipe_table_get_req *req, - const char *dpipe_table_name) -{ - free(req->dpipe_table_name); - req->_present.dpipe_table_name_len = strlen(dpipe_table_name); - req->dpipe_table_name = malloc(req->_present.dpipe_table_name_len + 1); - memcpy(req->dpipe_table_name, dpipe_table_name, req->_present.dpipe_table_name_len); - req->dpipe_table_name[req->_present.dpipe_table_name_len] = 0; -} - -struct devlink_dpipe_table_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 dpipe_tables:1; - } _present; - - char *bus_name; - char *dev_name; - struct devlink_dl_dpipe_tables dpipe_tables; -}; - -void devlink_dpipe_table_get_rsp_free(struct devlink_dpipe_table_get_rsp *rsp); - -/* - * Get dpipe table attributes. - */ -struct devlink_dpipe_table_get_rsp * -devlink_dpipe_table_get(struct ynl_sock *ys, - struct devlink_dpipe_table_get_req *req); - -/* ============== DEVLINK_CMD_DPIPE_ENTRIES_GET ============== */ -/* DEVLINK_CMD_DPIPE_ENTRIES_GET - do */ -struct devlink_dpipe_entries_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 dpipe_table_name_len; - } _present; - - char *bus_name; - char *dev_name; - char *dpipe_table_name; -}; - -static inline struct devlink_dpipe_entries_get_req * -devlink_dpipe_entries_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_dpipe_entries_get_req)); -} -void -devlink_dpipe_entries_get_req_free(struct devlink_dpipe_entries_get_req *req); - -static inline void -devlink_dpipe_entries_get_req_set_bus_name(struct devlink_dpipe_entries_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_dpipe_entries_get_req_set_dev_name(struct devlink_dpipe_entries_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_dpipe_entries_get_req_set_dpipe_table_name(struct devlink_dpipe_entries_get_req *req, - const char *dpipe_table_name) -{ - free(req->dpipe_table_name); - req->_present.dpipe_table_name_len = strlen(dpipe_table_name); - req->dpipe_table_name = malloc(req->_present.dpipe_table_name_len + 1); - memcpy(req->dpipe_table_name, dpipe_table_name, req->_present.dpipe_table_name_len); - req->dpipe_table_name[req->_present.dpipe_table_name_len] = 0; -} - -struct devlink_dpipe_entries_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 dpipe_entries:1; - } _present; - - char *bus_name; - char *dev_name; - struct devlink_dl_dpipe_entries dpipe_entries; -}; - -void -devlink_dpipe_entries_get_rsp_free(struct devlink_dpipe_entries_get_rsp *rsp); - -/* - * Get dpipe entries attributes. - */ -struct devlink_dpipe_entries_get_rsp * -devlink_dpipe_entries_get(struct ynl_sock *ys, - struct devlink_dpipe_entries_get_req *req); - -/* ============== DEVLINK_CMD_DPIPE_HEADERS_GET ============== */ -/* DEVLINK_CMD_DPIPE_HEADERS_GET - do */ -struct devlink_dpipe_headers_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_dpipe_headers_get_req * -devlink_dpipe_headers_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_dpipe_headers_get_req)); -} -void -devlink_dpipe_headers_get_req_free(struct devlink_dpipe_headers_get_req *req); - -static inline void -devlink_dpipe_headers_get_req_set_bus_name(struct devlink_dpipe_headers_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_dpipe_headers_get_req_set_dev_name(struct devlink_dpipe_headers_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_dpipe_headers_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 dpipe_headers:1; - } _present; - - char *bus_name; - char *dev_name; - struct devlink_dl_dpipe_headers dpipe_headers; -}; - -void -devlink_dpipe_headers_get_rsp_free(struct devlink_dpipe_headers_get_rsp *rsp); - -/* - * Get dpipe headers attributes. - */ -struct devlink_dpipe_headers_get_rsp * -devlink_dpipe_headers_get(struct ynl_sock *ys, - struct devlink_dpipe_headers_get_req *req); - -/* ============== DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET ============== */ -/* DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET - do */ -struct devlink_dpipe_table_counters_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 dpipe_table_name_len; - __u32 dpipe_table_counters_enabled:1; - } _present; - - char *bus_name; - char *dev_name; - char *dpipe_table_name; - __u8 dpipe_table_counters_enabled; -}; - -static inline struct devlink_dpipe_table_counters_set_req * -devlink_dpipe_table_counters_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_dpipe_table_counters_set_req)); -} -void -devlink_dpipe_table_counters_set_req_free(struct devlink_dpipe_table_counters_set_req *req); - -static inline void -devlink_dpipe_table_counters_set_req_set_bus_name(struct devlink_dpipe_table_counters_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_dpipe_table_counters_set_req_set_dev_name(struct devlink_dpipe_table_counters_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_dpipe_table_counters_set_req_set_dpipe_table_name(struct devlink_dpipe_table_counters_set_req *req, - const char *dpipe_table_name) -{ - free(req->dpipe_table_name); - req->_present.dpipe_table_name_len = strlen(dpipe_table_name); - req->dpipe_table_name = malloc(req->_present.dpipe_table_name_len + 1); - memcpy(req->dpipe_table_name, dpipe_table_name, req->_present.dpipe_table_name_len); - req->dpipe_table_name[req->_present.dpipe_table_name_len] = 0; -} -static inline void -devlink_dpipe_table_counters_set_req_set_dpipe_table_counters_enabled(struct devlink_dpipe_table_counters_set_req *req, - __u8 dpipe_table_counters_enabled) -{ - req->_present.dpipe_table_counters_enabled = 1; - req->dpipe_table_counters_enabled = dpipe_table_counters_enabled; -} - -/* - * Set dpipe counter attributes. - */ -int devlink_dpipe_table_counters_set(struct ynl_sock *ys, - struct devlink_dpipe_table_counters_set_req *req); - -/* ============== DEVLINK_CMD_RESOURCE_SET ============== */ -/* DEVLINK_CMD_RESOURCE_SET - do */ -struct devlink_resource_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 resource_id:1; - __u32 resource_size:1; - } _present; - - char *bus_name; - char *dev_name; - __u64 resource_id; - __u64 resource_size; -}; - -static inline struct devlink_resource_set_req * -devlink_resource_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_resource_set_req)); -} -void devlink_resource_set_req_free(struct devlink_resource_set_req *req); - -static inline void -devlink_resource_set_req_set_bus_name(struct devlink_resource_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_resource_set_req_set_dev_name(struct devlink_resource_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_resource_set_req_set_resource_id(struct devlink_resource_set_req *req, - __u64 resource_id) -{ - req->_present.resource_id = 1; - req->resource_id = resource_id; -} -static inline void -devlink_resource_set_req_set_resource_size(struct devlink_resource_set_req *req, - __u64 resource_size) -{ - req->_present.resource_size = 1; - req->resource_size = resource_size; -} - -/* - * Set resource attributes. - */ -int devlink_resource_set(struct ynl_sock *ys, - struct devlink_resource_set_req *req); - -/* ============== DEVLINK_CMD_RESOURCE_DUMP ============== */ -/* DEVLINK_CMD_RESOURCE_DUMP - do */ -struct devlink_resource_dump_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_resource_dump_req * -devlink_resource_dump_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_resource_dump_req)); -} -void devlink_resource_dump_req_free(struct devlink_resource_dump_req *req); - -static inline void -devlink_resource_dump_req_set_bus_name(struct devlink_resource_dump_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_resource_dump_req_set_dev_name(struct devlink_resource_dump_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_resource_dump_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 resource_list:1; - } _present; - - char *bus_name; - char *dev_name; - struct devlink_dl_resource_list resource_list; -}; - -void devlink_resource_dump_rsp_free(struct devlink_resource_dump_rsp *rsp); - -/* - * Get resource attributes. - */ -struct devlink_resource_dump_rsp * -devlink_resource_dump(struct ynl_sock *ys, - struct devlink_resource_dump_req *req); - -/* ============== DEVLINK_CMD_RELOAD ============== */ -/* DEVLINK_CMD_RELOAD - do */ -struct devlink_reload_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 reload_action:1; - __u32 reload_limits:1; - __u32 netns_pid:1; - __u32 netns_fd:1; - __u32 netns_id:1; - } _present; - - char *bus_name; - char *dev_name; - enum devlink_reload_action reload_action; - struct nla_bitfield32 reload_limits; - __u32 netns_pid; - __u32 netns_fd; - __u32 netns_id; -}; - -static inline struct devlink_reload_req *devlink_reload_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_reload_req)); -} -void devlink_reload_req_free(struct devlink_reload_req *req); - -static inline void -devlink_reload_req_set_bus_name(struct devlink_reload_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_reload_req_set_dev_name(struct devlink_reload_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_reload_req_set_reload_action(struct devlink_reload_req *req, - enum devlink_reload_action reload_action) -{ - req->_present.reload_action = 1; - req->reload_action = reload_action; -} -static inline void -devlink_reload_req_set_reload_limits(struct devlink_reload_req *req, - struct nla_bitfield32 *reload_limits) -{ - req->_present.reload_limits = 1; - memcpy(&req->reload_limits, reload_limits, sizeof(struct nla_bitfield32)); -} -static inline void -devlink_reload_req_set_netns_pid(struct devlink_reload_req *req, - __u32 netns_pid) -{ - req->_present.netns_pid = 1; - req->netns_pid = netns_pid; -} -static inline void -devlink_reload_req_set_netns_fd(struct devlink_reload_req *req, __u32 netns_fd) -{ - req->_present.netns_fd = 1; - req->netns_fd = netns_fd; -} -static inline void -devlink_reload_req_set_netns_id(struct devlink_reload_req *req, __u32 netns_id) -{ - req->_present.netns_id = 1; - req->netns_id = netns_id; -} - -struct devlink_reload_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 reload_actions_performed:1; - } _present; - - char *bus_name; - char *dev_name; - struct nla_bitfield32 reload_actions_performed; -}; - -void devlink_reload_rsp_free(struct devlink_reload_rsp *rsp); - -/* - * Reload devlink. - */ -struct devlink_reload_rsp * -devlink_reload(struct ynl_sock *ys, struct devlink_reload_req *req); - -/* ============== DEVLINK_CMD_PARAM_GET ============== */ -/* DEVLINK_CMD_PARAM_GET - do */ -struct devlink_param_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 param_name_len; - } _present; - - char *bus_name; - char *dev_name; - char *param_name; -}; - -static inline struct devlink_param_get_req *devlink_param_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_param_get_req)); -} -void devlink_param_get_req_free(struct devlink_param_get_req *req); - -static inline void -devlink_param_get_req_set_bus_name(struct devlink_param_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_param_get_req_set_dev_name(struct devlink_param_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_param_get_req_set_param_name(struct devlink_param_get_req *req, - const char *param_name) -{ - free(req->param_name); - req->_present.param_name_len = strlen(param_name); - req->param_name = malloc(req->_present.param_name_len + 1); - memcpy(req->param_name, param_name, req->_present.param_name_len); - req->param_name[req->_present.param_name_len] = 0; -} - -struct devlink_param_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 param_name_len; - } _present; - - char *bus_name; - char *dev_name; - char *param_name; -}; - -void devlink_param_get_rsp_free(struct devlink_param_get_rsp *rsp); - -/* - * Get param instances. - */ -struct devlink_param_get_rsp * -devlink_param_get(struct ynl_sock *ys, struct devlink_param_get_req *req); - -/* DEVLINK_CMD_PARAM_GET - dump */ -struct devlink_param_get_req_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_param_get_req_dump * -devlink_param_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct devlink_param_get_req_dump)); -} -void devlink_param_get_req_dump_free(struct devlink_param_get_req_dump *req); - -static inline void -devlink_param_get_req_dump_set_bus_name(struct devlink_param_get_req_dump *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_param_get_req_dump_set_dev_name(struct devlink_param_get_req_dump *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_param_get_list { - struct devlink_param_get_list *next; - struct devlink_param_get_rsp obj __attribute__((aligned(8))); -}; - -void devlink_param_get_list_free(struct devlink_param_get_list *rsp); - -struct devlink_param_get_list * -devlink_param_get_dump(struct ynl_sock *ys, - struct devlink_param_get_req_dump *req); - -/* ============== DEVLINK_CMD_PARAM_SET ============== */ -/* DEVLINK_CMD_PARAM_SET - do */ -struct devlink_param_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 param_name_len; - __u32 param_type:1; - __u32 param_value_cmode:1; - } _present; - - char *bus_name; - char *dev_name; - char *param_name; - __u8 param_type; - enum devlink_param_cmode param_value_cmode; -}; - -static inline struct devlink_param_set_req *devlink_param_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_param_set_req)); -} -void devlink_param_set_req_free(struct devlink_param_set_req *req); - -static inline void -devlink_param_set_req_set_bus_name(struct devlink_param_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_param_set_req_set_dev_name(struct devlink_param_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_param_set_req_set_param_name(struct devlink_param_set_req *req, - const char *param_name) -{ - free(req->param_name); - req->_present.param_name_len = strlen(param_name); - req->param_name = malloc(req->_present.param_name_len + 1); - memcpy(req->param_name, param_name, req->_present.param_name_len); - req->param_name[req->_present.param_name_len] = 0; -} -static inline void -devlink_param_set_req_set_param_type(struct devlink_param_set_req *req, - __u8 param_type) -{ - req->_present.param_type = 1; - req->param_type = param_type; -} -static inline void -devlink_param_set_req_set_param_value_cmode(struct devlink_param_set_req *req, - enum devlink_param_cmode param_value_cmode) -{ - req->_present.param_value_cmode = 1; - req->param_value_cmode = param_value_cmode; -} - -/* - * Set param instances. - */ -int devlink_param_set(struct ynl_sock *ys, struct devlink_param_set_req *req); - -/* ============== DEVLINK_CMD_REGION_GET ============== */ -/* DEVLINK_CMD_REGION_GET - do */ -struct devlink_region_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 region_name_len; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *region_name; -}; - -static inline struct devlink_region_get_req *devlink_region_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_region_get_req)); -} -void devlink_region_get_req_free(struct devlink_region_get_req *req); - -static inline void -devlink_region_get_req_set_bus_name(struct devlink_region_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_region_get_req_set_dev_name(struct devlink_region_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_region_get_req_set_port_index(struct devlink_region_get_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_region_get_req_set_region_name(struct devlink_region_get_req *req, - const char *region_name) -{ - free(req->region_name); - req->_present.region_name_len = strlen(region_name); - req->region_name = malloc(req->_present.region_name_len + 1); - memcpy(req->region_name, region_name, req->_present.region_name_len); - req->region_name[req->_present.region_name_len] = 0; -} - -struct devlink_region_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 region_name_len; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *region_name; -}; - -void devlink_region_get_rsp_free(struct devlink_region_get_rsp *rsp); - -/* - * Get region instances. - */ -struct devlink_region_get_rsp * -devlink_region_get(struct ynl_sock *ys, struct devlink_region_get_req *req); - -/* DEVLINK_CMD_REGION_GET - dump */ -struct devlink_region_get_req_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_region_get_req_dump * -devlink_region_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct devlink_region_get_req_dump)); -} -void devlink_region_get_req_dump_free(struct devlink_region_get_req_dump *req); - -static inline void -devlink_region_get_req_dump_set_bus_name(struct devlink_region_get_req_dump *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_region_get_req_dump_set_dev_name(struct devlink_region_get_req_dump *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_region_get_list { - struct devlink_region_get_list *next; - struct devlink_region_get_rsp obj __attribute__((aligned(8))); -}; - -void devlink_region_get_list_free(struct devlink_region_get_list *rsp); - -struct devlink_region_get_list * -devlink_region_get_dump(struct ynl_sock *ys, - struct devlink_region_get_req_dump *req); - -/* ============== DEVLINK_CMD_REGION_NEW ============== */ -/* DEVLINK_CMD_REGION_NEW - do */ -struct devlink_region_new_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 region_name_len; - __u32 region_snapshot_id:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *region_name; - __u32 region_snapshot_id; -}; - -static inline struct devlink_region_new_req *devlink_region_new_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_region_new_req)); -} -void devlink_region_new_req_free(struct devlink_region_new_req *req); - -static inline void -devlink_region_new_req_set_bus_name(struct devlink_region_new_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_region_new_req_set_dev_name(struct devlink_region_new_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_region_new_req_set_port_index(struct devlink_region_new_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_region_new_req_set_region_name(struct devlink_region_new_req *req, - const char *region_name) -{ - free(req->region_name); - req->_present.region_name_len = strlen(region_name); - req->region_name = malloc(req->_present.region_name_len + 1); - memcpy(req->region_name, region_name, req->_present.region_name_len); - req->region_name[req->_present.region_name_len] = 0; -} -static inline void -devlink_region_new_req_set_region_snapshot_id(struct devlink_region_new_req *req, - __u32 region_snapshot_id) -{ - req->_present.region_snapshot_id = 1; - req->region_snapshot_id = region_snapshot_id; -} - -struct devlink_region_new_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 region_name_len; - __u32 region_snapshot_id:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *region_name; - __u32 region_snapshot_id; -}; - -void devlink_region_new_rsp_free(struct devlink_region_new_rsp *rsp); - -/* - * Create region snapshot. - */ -struct devlink_region_new_rsp * -devlink_region_new(struct ynl_sock *ys, struct devlink_region_new_req *req); - -/* ============== DEVLINK_CMD_REGION_DEL ============== */ -/* DEVLINK_CMD_REGION_DEL - do */ -struct devlink_region_del_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 region_name_len; - __u32 region_snapshot_id:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *region_name; - __u32 region_snapshot_id; -}; - -static inline struct devlink_region_del_req *devlink_region_del_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_region_del_req)); -} -void devlink_region_del_req_free(struct devlink_region_del_req *req); - -static inline void -devlink_region_del_req_set_bus_name(struct devlink_region_del_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_region_del_req_set_dev_name(struct devlink_region_del_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_region_del_req_set_port_index(struct devlink_region_del_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_region_del_req_set_region_name(struct devlink_region_del_req *req, - const char *region_name) -{ - free(req->region_name); - req->_present.region_name_len = strlen(region_name); - req->region_name = malloc(req->_present.region_name_len + 1); - memcpy(req->region_name, region_name, req->_present.region_name_len); - req->region_name[req->_present.region_name_len] = 0; -} -static inline void -devlink_region_del_req_set_region_snapshot_id(struct devlink_region_del_req *req, - __u32 region_snapshot_id) -{ - req->_present.region_snapshot_id = 1; - req->region_snapshot_id = region_snapshot_id; -} - -/* - * Delete region snapshot. - */ -int devlink_region_del(struct ynl_sock *ys, struct devlink_region_del_req *req); - -/* ============== DEVLINK_CMD_REGION_READ ============== */ -/* DEVLINK_CMD_REGION_READ - dump */ -struct devlink_region_read_req_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 region_name_len; - __u32 region_snapshot_id:1; - __u32 region_direct:1; - __u32 region_chunk_addr:1; - __u32 region_chunk_len:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *region_name; - __u32 region_snapshot_id; - __u64 region_chunk_addr; - __u64 region_chunk_len; -}; - -static inline struct devlink_region_read_req_dump * -devlink_region_read_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct devlink_region_read_req_dump)); -} -void -devlink_region_read_req_dump_free(struct devlink_region_read_req_dump *req); - -static inline void -devlink_region_read_req_dump_set_bus_name(struct devlink_region_read_req_dump *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_region_read_req_dump_set_dev_name(struct devlink_region_read_req_dump *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_region_read_req_dump_set_port_index(struct devlink_region_read_req_dump *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_region_read_req_dump_set_region_name(struct devlink_region_read_req_dump *req, - const char *region_name) -{ - free(req->region_name); - req->_present.region_name_len = strlen(region_name); - req->region_name = malloc(req->_present.region_name_len + 1); - memcpy(req->region_name, region_name, req->_present.region_name_len); - req->region_name[req->_present.region_name_len] = 0; -} -static inline void -devlink_region_read_req_dump_set_region_snapshot_id(struct devlink_region_read_req_dump *req, - __u32 region_snapshot_id) -{ - req->_present.region_snapshot_id = 1; - req->region_snapshot_id = region_snapshot_id; -} -static inline void -devlink_region_read_req_dump_set_region_direct(struct devlink_region_read_req_dump *req) -{ - req->_present.region_direct = 1; -} -static inline void -devlink_region_read_req_dump_set_region_chunk_addr(struct devlink_region_read_req_dump *req, - __u64 region_chunk_addr) -{ - req->_present.region_chunk_addr = 1; - req->region_chunk_addr = region_chunk_addr; -} -static inline void -devlink_region_read_req_dump_set_region_chunk_len(struct devlink_region_read_req_dump *req, - __u64 region_chunk_len) -{ - req->_present.region_chunk_len = 1; - req->region_chunk_len = region_chunk_len; -} - -struct devlink_region_read_rsp_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 region_name_len; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *region_name; -}; - -struct devlink_region_read_rsp_list { - struct devlink_region_read_rsp_list *next; - struct devlink_region_read_rsp_dump obj __attribute__((aligned(8))); -}; - -void -devlink_region_read_rsp_list_free(struct devlink_region_read_rsp_list *rsp); - -struct devlink_region_read_rsp_list * -devlink_region_read_dump(struct ynl_sock *ys, - struct devlink_region_read_req_dump *req); - -/* ============== DEVLINK_CMD_PORT_PARAM_GET ============== */ -/* DEVLINK_CMD_PORT_PARAM_GET - do */ -struct devlink_port_param_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; -}; - -static inline struct devlink_port_param_get_req * -devlink_port_param_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_port_param_get_req)); -} -void devlink_port_param_get_req_free(struct devlink_port_param_get_req *req); - -static inline void -devlink_port_param_get_req_set_bus_name(struct devlink_port_param_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_port_param_get_req_set_dev_name(struct devlink_port_param_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_port_param_get_req_set_port_index(struct devlink_port_param_get_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} - -struct devlink_port_param_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; -}; - -void devlink_port_param_get_rsp_free(struct devlink_port_param_get_rsp *rsp); - -/* - * Get port param instances. - */ -struct devlink_port_param_get_rsp * -devlink_port_param_get(struct ynl_sock *ys, - struct devlink_port_param_get_req *req); - -/* DEVLINK_CMD_PORT_PARAM_GET - dump */ -struct devlink_port_param_get_list { - struct devlink_port_param_get_list *next; - struct devlink_port_param_get_rsp obj __attribute__((aligned(8))); -}; - -void devlink_port_param_get_list_free(struct devlink_port_param_get_list *rsp); - -struct devlink_port_param_get_list * -devlink_port_param_get_dump(struct ynl_sock *ys); - -/* ============== DEVLINK_CMD_PORT_PARAM_SET ============== */ -/* DEVLINK_CMD_PORT_PARAM_SET - do */ -struct devlink_port_param_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; -}; - -static inline struct devlink_port_param_set_req * -devlink_port_param_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_port_param_set_req)); -} -void devlink_port_param_set_req_free(struct devlink_port_param_set_req *req); - -static inline void -devlink_port_param_set_req_set_bus_name(struct devlink_port_param_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_port_param_set_req_set_dev_name(struct devlink_port_param_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_port_param_set_req_set_port_index(struct devlink_port_param_set_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} - -/* - * Set port param instances. - */ -int devlink_port_param_set(struct ynl_sock *ys, - struct devlink_port_param_set_req *req); - -/* ============== DEVLINK_CMD_INFO_GET ============== */ -/* DEVLINK_CMD_INFO_GET - do */ -struct devlink_info_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_info_get_req *devlink_info_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_info_get_req)); -} -void devlink_info_get_req_free(struct devlink_info_get_req *req); - -static inline void -devlink_info_get_req_set_bus_name(struct devlink_info_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_info_get_req_set_dev_name(struct devlink_info_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_info_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 info_driver_name_len; - __u32 info_serial_number_len; - } _present; - - char *bus_name; - char *dev_name; - char *info_driver_name; - char *info_serial_number; - unsigned int n_info_version_fixed; - struct devlink_dl_info_version *info_version_fixed; - unsigned int n_info_version_running; - struct devlink_dl_info_version *info_version_running; - unsigned int n_info_version_stored; - struct devlink_dl_info_version *info_version_stored; -}; - -void devlink_info_get_rsp_free(struct devlink_info_get_rsp *rsp); - -/* - * Get device information, like driver name, hardware and firmware versions etc. - */ -struct devlink_info_get_rsp * -devlink_info_get(struct ynl_sock *ys, struct devlink_info_get_req *req); - -/* DEVLINK_CMD_INFO_GET - dump */ -struct devlink_info_get_list { - struct devlink_info_get_list *next; - struct devlink_info_get_rsp obj __attribute__((aligned(8))); -}; - -void devlink_info_get_list_free(struct devlink_info_get_list *rsp); - -struct devlink_info_get_list *devlink_info_get_dump(struct ynl_sock *ys); - -/* ============== DEVLINK_CMD_HEALTH_REPORTER_GET ============== */ -/* DEVLINK_CMD_HEALTH_REPORTER_GET - do */ -struct devlink_health_reporter_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 health_reporter_name_len; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *health_reporter_name; -}; - -static inline struct devlink_health_reporter_get_req * -devlink_health_reporter_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_health_reporter_get_req)); -} -void -devlink_health_reporter_get_req_free(struct devlink_health_reporter_get_req *req); - -static inline void -devlink_health_reporter_get_req_set_bus_name(struct devlink_health_reporter_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_health_reporter_get_req_set_dev_name(struct devlink_health_reporter_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_health_reporter_get_req_set_port_index(struct devlink_health_reporter_get_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_health_reporter_get_req_set_health_reporter_name(struct devlink_health_reporter_get_req *req, - const char *health_reporter_name) -{ - free(req->health_reporter_name); - req->_present.health_reporter_name_len = strlen(health_reporter_name); - req->health_reporter_name = malloc(req->_present.health_reporter_name_len + 1); - memcpy(req->health_reporter_name, health_reporter_name, req->_present.health_reporter_name_len); - req->health_reporter_name[req->_present.health_reporter_name_len] = 0; -} - -struct devlink_health_reporter_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 health_reporter_name_len; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *health_reporter_name; -}; - -void -devlink_health_reporter_get_rsp_free(struct devlink_health_reporter_get_rsp *rsp); - -/* - * Get health reporter instances. - */ -struct devlink_health_reporter_get_rsp * -devlink_health_reporter_get(struct ynl_sock *ys, - struct devlink_health_reporter_get_req *req); - -/* DEVLINK_CMD_HEALTH_REPORTER_GET - dump */ -struct devlink_health_reporter_get_req_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; -}; - -static inline struct devlink_health_reporter_get_req_dump * -devlink_health_reporter_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct devlink_health_reporter_get_req_dump)); -} -void -devlink_health_reporter_get_req_dump_free(struct devlink_health_reporter_get_req_dump *req); - -static inline void -devlink_health_reporter_get_req_dump_set_bus_name(struct devlink_health_reporter_get_req_dump *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_health_reporter_get_req_dump_set_dev_name(struct devlink_health_reporter_get_req_dump *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_health_reporter_get_req_dump_set_port_index(struct devlink_health_reporter_get_req_dump *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} - -struct devlink_health_reporter_get_list { - struct devlink_health_reporter_get_list *next; - struct devlink_health_reporter_get_rsp obj __attribute__((aligned(8))); -}; - -void -devlink_health_reporter_get_list_free(struct devlink_health_reporter_get_list *rsp); - -struct devlink_health_reporter_get_list * -devlink_health_reporter_get_dump(struct ynl_sock *ys, - struct devlink_health_reporter_get_req_dump *req); - -/* ============== DEVLINK_CMD_HEALTH_REPORTER_SET ============== */ -/* DEVLINK_CMD_HEALTH_REPORTER_SET - do */ -struct devlink_health_reporter_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 health_reporter_name_len; - __u32 health_reporter_graceful_period:1; - __u32 health_reporter_auto_recover:1; - __u32 health_reporter_auto_dump:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *health_reporter_name; - __u64 health_reporter_graceful_period; - __u8 health_reporter_auto_recover; - __u8 health_reporter_auto_dump; -}; - -static inline struct devlink_health_reporter_set_req * -devlink_health_reporter_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_health_reporter_set_req)); -} -void -devlink_health_reporter_set_req_free(struct devlink_health_reporter_set_req *req); - -static inline void -devlink_health_reporter_set_req_set_bus_name(struct devlink_health_reporter_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_health_reporter_set_req_set_dev_name(struct devlink_health_reporter_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_health_reporter_set_req_set_port_index(struct devlink_health_reporter_set_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_health_reporter_set_req_set_health_reporter_name(struct devlink_health_reporter_set_req *req, - const char *health_reporter_name) -{ - free(req->health_reporter_name); - req->_present.health_reporter_name_len = strlen(health_reporter_name); - req->health_reporter_name = malloc(req->_present.health_reporter_name_len + 1); - memcpy(req->health_reporter_name, health_reporter_name, req->_present.health_reporter_name_len); - req->health_reporter_name[req->_present.health_reporter_name_len] = 0; -} -static inline void -devlink_health_reporter_set_req_set_health_reporter_graceful_period(struct devlink_health_reporter_set_req *req, - __u64 health_reporter_graceful_period) -{ - req->_present.health_reporter_graceful_period = 1; - req->health_reporter_graceful_period = health_reporter_graceful_period; -} -static inline void -devlink_health_reporter_set_req_set_health_reporter_auto_recover(struct devlink_health_reporter_set_req *req, - __u8 health_reporter_auto_recover) -{ - req->_present.health_reporter_auto_recover = 1; - req->health_reporter_auto_recover = health_reporter_auto_recover; -} -static inline void -devlink_health_reporter_set_req_set_health_reporter_auto_dump(struct devlink_health_reporter_set_req *req, - __u8 health_reporter_auto_dump) -{ - req->_present.health_reporter_auto_dump = 1; - req->health_reporter_auto_dump = health_reporter_auto_dump; -} - -/* - * Set health reporter instances. - */ -int devlink_health_reporter_set(struct ynl_sock *ys, - struct devlink_health_reporter_set_req *req); - -/* ============== DEVLINK_CMD_HEALTH_REPORTER_RECOVER ============== */ -/* DEVLINK_CMD_HEALTH_REPORTER_RECOVER - do */ -struct devlink_health_reporter_recover_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 health_reporter_name_len; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *health_reporter_name; -}; - -static inline struct devlink_health_reporter_recover_req * -devlink_health_reporter_recover_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_health_reporter_recover_req)); -} -void -devlink_health_reporter_recover_req_free(struct devlink_health_reporter_recover_req *req); - -static inline void -devlink_health_reporter_recover_req_set_bus_name(struct devlink_health_reporter_recover_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_health_reporter_recover_req_set_dev_name(struct devlink_health_reporter_recover_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_health_reporter_recover_req_set_port_index(struct devlink_health_reporter_recover_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_health_reporter_recover_req_set_health_reporter_name(struct devlink_health_reporter_recover_req *req, - const char *health_reporter_name) -{ - free(req->health_reporter_name); - req->_present.health_reporter_name_len = strlen(health_reporter_name); - req->health_reporter_name = malloc(req->_present.health_reporter_name_len + 1); - memcpy(req->health_reporter_name, health_reporter_name, req->_present.health_reporter_name_len); - req->health_reporter_name[req->_present.health_reporter_name_len] = 0; -} - -/* - * Recover health reporter instances. - */ -int devlink_health_reporter_recover(struct ynl_sock *ys, - struct devlink_health_reporter_recover_req *req); - -/* ============== DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE ============== */ -/* DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE - do */ -struct devlink_health_reporter_diagnose_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 health_reporter_name_len; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *health_reporter_name; -}; - -static inline struct devlink_health_reporter_diagnose_req * -devlink_health_reporter_diagnose_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_health_reporter_diagnose_req)); -} -void -devlink_health_reporter_diagnose_req_free(struct devlink_health_reporter_diagnose_req *req); - -static inline void -devlink_health_reporter_diagnose_req_set_bus_name(struct devlink_health_reporter_diagnose_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_health_reporter_diagnose_req_set_dev_name(struct devlink_health_reporter_diagnose_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_health_reporter_diagnose_req_set_port_index(struct devlink_health_reporter_diagnose_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_health_reporter_diagnose_req_set_health_reporter_name(struct devlink_health_reporter_diagnose_req *req, - const char *health_reporter_name) -{ - free(req->health_reporter_name); - req->_present.health_reporter_name_len = strlen(health_reporter_name); - req->health_reporter_name = malloc(req->_present.health_reporter_name_len + 1); - memcpy(req->health_reporter_name, health_reporter_name, req->_present.health_reporter_name_len); - req->health_reporter_name[req->_present.health_reporter_name_len] = 0; -} - -/* - * Diagnose health reporter instances. - */ -int devlink_health_reporter_diagnose(struct ynl_sock *ys, - struct devlink_health_reporter_diagnose_req *req); - -/* ============== DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET ============== */ -/* DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET - dump */ -struct devlink_health_reporter_dump_get_req_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 health_reporter_name_len; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *health_reporter_name; -}; - -static inline struct devlink_health_reporter_dump_get_req_dump * -devlink_health_reporter_dump_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct devlink_health_reporter_dump_get_req_dump)); -} -void -devlink_health_reporter_dump_get_req_dump_free(struct devlink_health_reporter_dump_get_req_dump *req); - -static inline void -devlink_health_reporter_dump_get_req_dump_set_bus_name(struct devlink_health_reporter_dump_get_req_dump *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_health_reporter_dump_get_req_dump_set_dev_name(struct devlink_health_reporter_dump_get_req_dump *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_health_reporter_dump_get_req_dump_set_port_index(struct devlink_health_reporter_dump_get_req_dump *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_health_reporter_dump_get_req_dump_set_health_reporter_name(struct devlink_health_reporter_dump_get_req_dump *req, - const char *health_reporter_name) -{ - free(req->health_reporter_name); - req->_present.health_reporter_name_len = strlen(health_reporter_name); - req->health_reporter_name = malloc(req->_present.health_reporter_name_len + 1); - memcpy(req->health_reporter_name, health_reporter_name, req->_present.health_reporter_name_len); - req->health_reporter_name[req->_present.health_reporter_name_len] = 0; -} - -struct devlink_health_reporter_dump_get_rsp_dump { - struct { - __u32 fmsg:1; - } _present; - - struct devlink_dl_fmsg fmsg; -}; - -struct devlink_health_reporter_dump_get_rsp_list { - struct devlink_health_reporter_dump_get_rsp_list *next; - struct devlink_health_reporter_dump_get_rsp_dump obj __attribute__((aligned(8))); -}; - -void -devlink_health_reporter_dump_get_rsp_list_free(struct devlink_health_reporter_dump_get_rsp_list *rsp); - -struct devlink_health_reporter_dump_get_rsp_list * -devlink_health_reporter_dump_get_dump(struct ynl_sock *ys, - struct devlink_health_reporter_dump_get_req_dump *req); - -/* ============== DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR ============== */ -/* DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR - do */ -struct devlink_health_reporter_dump_clear_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 health_reporter_name_len; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *health_reporter_name; -}; - -static inline struct devlink_health_reporter_dump_clear_req * -devlink_health_reporter_dump_clear_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_health_reporter_dump_clear_req)); -} -void -devlink_health_reporter_dump_clear_req_free(struct devlink_health_reporter_dump_clear_req *req); - -static inline void -devlink_health_reporter_dump_clear_req_set_bus_name(struct devlink_health_reporter_dump_clear_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_health_reporter_dump_clear_req_set_dev_name(struct devlink_health_reporter_dump_clear_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_health_reporter_dump_clear_req_set_port_index(struct devlink_health_reporter_dump_clear_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_health_reporter_dump_clear_req_set_health_reporter_name(struct devlink_health_reporter_dump_clear_req *req, - const char *health_reporter_name) -{ - free(req->health_reporter_name); - req->_present.health_reporter_name_len = strlen(health_reporter_name); - req->health_reporter_name = malloc(req->_present.health_reporter_name_len + 1); - memcpy(req->health_reporter_name, health_reporter_name, req->_present.health_reporter_name_len); - req->health_reporter_name[req->_present.health_reporter_name_len] = 0; -} - -/* - * Clear dump of health reporter instances. - */ -int devlink_health_reporter_dump_clear(struct ynl_sock *ys, - struct devlink_health_reporter_dump_clear_req *req); - -/* ============== DEVLINK_CMD_FLASH_UPDATE ============== */ -/* DEVLINK_CMD_FLASH_UPDATE - do */ -struct devlink_flash_update_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 flash_update_file_name_len; - __u32 flash_update_component_len; - __u32 flash_update_overwrite_mask:1; - } _present; - - char *bus_name; - char *dev_name; - char *flash_update_file_name; - char *flash_update_component; - struct nla_bitfield32 flash_update_overwrite_mask; -}; - -static inline struct devlink_flash_update_req * -devlink_flash_update_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_flash_update_req)); -} -void devlink_flash_update_req_free(struct devlink_flash_update_req *req); - -static inline void -devlink_flash_update_req_set_bus_name(struct devlink_flash_update_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_flash_update_req_set_dev_name(struct devlink_flash_update_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_flash_update_req_set_flash_update_file_name(struct devlink_flash_update_req *req, - const char *flash_update_file_name) -{ - free(req->flash_update_file_name); - req->_present.flash_update_file_name_len = strlen(flash_update_file_name); - req->flash_update_file_name = malloc(req->_present.flash_update_file_name_len + 1); - memcpy(req->flash_update_file_name, flash_update_file_name, req->_present.flash_update_file_name_len); - req->flash_update_file_name[req->_present.flash_update_file_name_len] = 0; -} -static inline void -devlink_flash_update_req_set_flash_update_component(struct devlink_flash_update_req *req, - const char *flash_update_component) -{ - free(req->flash_update_component); - req->_present.flash_update_component_len = strlen(flash_update_component); - req->flash_update_component = malloc(req->_present.flash_update_component_len + 1); - memcpy(req->flash_update_component, flash_update_component, req->_present.flash_update_component_len); - req->flash_update_component[req->_present.flash_update_component_len] = 0; -} -static inline void -devlink_flash_update_req_set_flash_update_overwrite_mask(struct devlink_flash_update_req *req, - struct nla_bitfield32 *flash_update_overwrite_mask) -{ - req->_present.flash_update_overwrite_mask = 1; - memcpy(&req->flash_update_overwrite_mask, flash_update_overwrite_mask, sizeof(struct nla_bitfield32)); -} - -/* - * Flash update devlink instances. - */ -int devlink_flash_update(struct ynl_sock *ys, - struct devlink_flash_update_req *req); - -/* ============== DEVLINK_CMD_TRAP_GET ============== */ -/* DEVLINK_CMD_TRAP_GET - do */ -struct devlink_trap_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 trap_name_len; - } _present; - - char *bus_name; - char *dev_name; - char *trap_name; -}; - -static inline struct devlink_trap_get_req *devlink_trap_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_trap_get_req)); -} -void devlink_trap_get_req_free(struct devlink_trap_get_req *req); - -static inline void -devlink_trap_get_req_set_bus_name(struct devlink_trap_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_trap_get_req_set_dev_name(struct devlink_trap_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_trap_get_req_set_trap_name(struct devlink_trap_get_req *req, - const char *trap_name) -{ - free(req->trap_name); - req->_present.trap_name_len = strlen(trap_name); - req->trap_name = malloc(req->_present.trap_name_len + 1); - memcpy(req->trap_name, trap_name, req->_present.trap_name_len); - req->trap_name[req->_present.trap_name_len] = 0; -} - -struct devlink_trap_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 trap_name_len; - } _present; - - char *bus_name; - char *dev_name; - char *trap_name; -}; - -void devlink_trap_get_rsp_free(struct devlink_trap_get_rsp *rsp); - -/* - * Get trap instances. - */ -struct devlink_trap_get_rsp * -devlink_trap_get(struct ynl_sock *ys, struct devlink_trap_get_req *req); - -/* DEVLINK_CMD_TRAP_GET - dump */ -struct devlink_trap_get_req_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_trap_get_req_dump * -devlink_trap_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct devlink_trap_get_req_dump)); -} -void devlink_trap_get_req_dump_free(struct devlink_trap_get_req_dump *req); - -static inline void -devlink_trap_get_req_dump_set_bus_name(struct devlink_trap_get_req_dump *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_trap_get_req_dump_set_dev_name(struct devlink_trap_get_req_dump *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_trap_get_list { - struct devlink_trap_get_list *next; - struct devlink_trap_get_rsp obj __attribute__((aligned(8))); -}; - -void devlink_trap_get_list_free(struct devlink_trap_get_list *rsp); - -struct devlink_trap_get_list * -devlink_trap_get_dump(struct ynl_sock *ys, - struct devlink_trap_get_req_dump *req); - -/* ============== DEVLINK_CMD_TRAP_SET ============== */ -/* DEVLINK_CMD_TRAP_SET - do */ -struct devlink_trap_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 trap_name_len; - __u32 trap_action:1; - } _present; - - char *bus_name; - char *dev_name; - char *trap_name; - enum devlink_trap_action trap_action; -}; - -static inline struct devlink_trap_set_req *devlink_trap_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_trap_set_req)); -} -void devlink_trap_set_req_free(struct devlink_trap_set_req *req); - -static inline void -devlink_trap_set_req_set_bus_name(struct devlink_trap_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_trap_set_req_set_dev_name(struct devlink_trap_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_trap_set_req_set_trap_name(struct devlink_trap_set_req *req, - const char *trap_name) -{ - free(req->trap_name); - req->_present.trap_name_len = strlen(trap_name); - req->trap_name = malloc(req->_present.trap_name_len + 1); - memcpy(req->trap_name, trap_name, req->_present.trap_name_len); - req->trap_name[req->_present.trap_name_len] = 0; -} -static inline void -devlink_trap_set_req_set_trap_action(struct devlink_trap_set_req *req, - enum devlink_trap_action trap_action) -{ - req->_present.trap_action = 1; - req->trap_action = trap_action; -} - -/* - * Set trap instances. - */ -int devlink_trap_set(struct ynl_sock *ys, struct devlink_trap_set_req *req); - -/* ============== DEVLINK_CMD_TRAP_GROUP_GET ============== */ -/* DEVLINK_CMD_TRAP_GROUP_GET - do */ -struct devlink_trap_group_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 trap_group_name_len; - } _present; - - char *bus_name; - char *dev_name; - char *trap_group_name; -}; - -static inline struct devlink_trap_group_get_req * -devlink_trap_group_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_trap_group_get_req)); -} -void devlink_trap_group_get_req_free(struct devlink_trap_group_get_req *req); - -static inline void -devlink_trap_group_get_req_set_bus_name(struct devlink_trap_group_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_trap_group_get_req_set_dev_name(struct devlink_trap_group_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_trap_group_get_req_set_trap_group_name(struct devlink_trap_group_get_req *req, - const char *trap_group_name) -{ - free(req->trap_group_name); - req->_present.trap_group_name_len = strlen(trap_group_name); - req->trap_group_name = malloc(req->_present.trap_group_name_len + 1); - memcpy(req->trap_group_name, trap_group_name, req->_present.trap_group_name_len); - req->trap_group_name[req->_present.trap_group_name_len] = 0; -} - -struct devlink_trap_group_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 trap_group_name_len; - } _present; - - char *bus_name; - char *dev_name; - char *trap_group_name; -}; - -void devlink_trap_group_get_rsp_free(struct devlink_trap_group_get_rsp *rsp); - -/* - * Get trap group instances. - */ -struct devlink_trap_group_get_rsp * -devlink_trap_group_get(struct ynl_sock *ys, - struct devlink_trap_group_get_req *req); - -/* DEVLINK_CMD_TRAP_GROUP_GET - dump */ -struct devlink_trap_group_get_req_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_trap_group_get_req_dump * -devlink_trap_group_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct devlink_trap_group_get_req_dump)); -} -void -devlink_trap_group_get_req_dump_free(struct devlink_trap_group_get_req_dump *req); - -static inline void -devlink_trap_group_get_req_dump_set_bus_name(struct devlink_trap_group_get_req_dump *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_trap_group_get_req_dump_set_dev_name(struct devlink_trap_group_get_req_dump *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_trap_group_get_list { - struct devlink_trap_group_get_list *next; - struct devlink_trap_group_get_rsp obj __attribute__((aligned(8))); -}; - -void devlink_trap_group_get_list_free(struct devlink_trap_group_get_list *rsp); - -struct devlink_trap_group_get_list * -devlink_trap_group_get_dump(struct ynl_sock *ys, - struct devlink_trap_group_get_req_dump *req); - -/* ============== DEVLINK_CMD_TRAP_GROUP_SET ============== */ -/* DEVLINK_CMD_TRAP_GROUP_SET - do */ -struct devlink_trap_group_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 trap_group_name_len; - __u32 trap_action:1; - __u32 trap_policer_id:1; - } _present; - - char *bus_name; - char *dev_name; - char *trap_group_name; - enum devlink_trap_action trap_action; - __u32 trap_policer_id; -}; - -static inline struct devlink_trap_group_set_req * -devlink_trap_group_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_trap_group_set_req)); -} -void devlink_trap_group_set_req_free(struct devlink_trap_group_set_req *req); - -static inline void -devlink_trap_group_set_req_set_bus_name(struct devlink_trap_group_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_trap_group_set_req_set_dev_name(struct devlink_trap_group_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_trap_group_set_req_set_trap_group_name(struct devlink_trap_group_set_req *req, - const char *trap_group_name) -{ - free(req->trap_group_name); - req->_present.trap_group_name_len = strlen(trap_group_name); - req->trap_group_name = malloc(req->_present.trap_group_name_len + 1); - memcpy(req->trap_group_name, trap_group_name, req->_present.trap_group_name_len); - req->trap_group_name[req->_present.trap_group_name_len] = 0; -} -static inline void -devlink_trap_group_set_req_set_trap_action(struct devlink_trap_group_set_req *req, - enum devlink_trap_action trap_action) -{ - req->_present.trap_action = 1; - req->trap_action = trap_action; -} -static inline void -devlink_trap_group_set_req_set_trap_policer_id(struct devlink_trap_group_set_req *req, - __u32 trap_policer_id) -{ - req->_present.trap_policer_id = 1; - req->trap_policer_id = trap_policer_id; -} - -/* - * Set trap group instances. - */ -int devlink_trap_group_set(struct ynl_sock *ys, - struct devlink_trap_group_set_req *req); - -/* ============== DEVLINK_CMD_TRAP_POLICER_GET ============== */ -/* DEVLINK_CMD_TRAP_POLICER_GET - do */ -struct devlink_trap_policer_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 trap_policer_id:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 trap_policer_id; -}; - -static inline struct devlink_trap_policer_get_req * -devlink_trap_policer_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_trap_policer_get_req)); -} -void -devlink_trap_policer_get_req_free(struct devlink_trap_policer_get_req *req); - -static inline void -devlink_trap_policer_get_req_set_bus_name(struct devlink_trap_policer_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_trap_policer_get_req_set_dev_name(struct devlink_trap_policer_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_trap_policer_get_req_set_trap_policer_id(struct devlink_trap_policer_get_req *req, - __u32 trap_policer_id) -{ - req->_present.trap_policer_id = 1; - req->trap_policer_id = trap_policer_id; -} - -struct devlink_trap_policer_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 trap_policer_id:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 trap_policer_id; -}; - -void -devlink_trap_policer_get_rsp_free(struct devlink_trap_policer_get_rsp *rsp); - -/* - * Get trap policer instances. - */ -struct devlink_trap_policer_get_rsp * -devlink_trap_policer_get(struct ynl_sock *ys, - struct devlink_trap_policer_get_req *req); - -/* DEVLINK_CMD_TRAP_POLICER_GET - dump */ -struct devlink_trap_policer_get_req_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_trap_policer_get_req_dump * -devlink_trap_policer_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct devlink_trap_policer_get_req_dump)); -} -void -devlink_trap_policer_get_req_dump_free(struct devlink_trap_policer_get_req_dump *req); - -static inline void -devlink_trap_policer_get_req_dump_set_bus_name(struct devlink_trap_policer_get_req_dump *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_trap_policer_get_req_dump_set_dev_name(struct devlink_trap_policer_get_req_dump *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_trap_policer_get_list { - struct devlink_trap_policer_get_list *next; - struct devlink_trap_policer_get_rsp obj __attribute__((aligned(8))); -}; - -void -devlink_trap_policer_get_list_free(struct devlink_trap_policer_get_list *rsp); - -struct devlink_trap_policer_get_list * -devlink_trap_policer_get_dump(struct ynl_sock *ys, - struct devlink_trap_policer_get_req_dump *req); - -/* ============== DEVLINK_CMD_TRAP_POLICER_SET ============== */ -/* DEVLINK_CMD_TRAP_POLICER_SET - do */ -struct devlink_trap_policer_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 trap_policer_id:1; - __u32 trap_policer_rate:1; - __u32 trap_policer_burst:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 trap_policer_id; - __u64 trap_policer_rate; - __u64 trap_policer_burst; -}; - -static inline struct devlink_trap_policer_set_req * -devlink_trap_policer_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_trap_policer_set_req)); -} -void -devlink_trap_policer_set_req_free(struct devlink_trap_policer_set_req *req); - -static inline void -devlink_trap_policer_set_req_set_bus_name(struct devlink_trap_policer_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_trap_policer_set_req_set_dev_name(struct devlink_trap_policer_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_trap_policer_set_req_set_trap_policer_id(struct devlink_trap_policer_set_req *req, - __u32 trap_policer_id) -{ - req->_present.trap_policer_id = 1; - req->trap_policer_id = trap_policer_id; -} -static inline void -devlink_trap_policer_set_req_set_trap_policer_rate(struct devlink_trap_policer_set_req *req, - __u64 trap_policer_rate) -{ - req->_present.trap_policer_rate = 1; - req->trap_policer_rate = trap_policer_rate; -} -static inline void -devlink_trap_policer_set_req_set_trap_policer_burst(struct devlink_trap_policer_set_req *req, - __u64 trap_policer_burst) -{ - req->_present.trap_policer_burst = 1; - req->trap_policer_burst = trap_policer_burst; -} - -/* - * Get trap policer instances. - */ -int devlink_trap_policer_set(struct ynl_sock *ys, - struct devlink_trap_policer_set_req *req); - -/* ============== DEVLINK_CMD_HEALTH_REPORTER_TEST ============== */ -/* DEVLINK_CMD_HEALTH_REPORTER_TEST - do */ -struct devlink_health_reporter_test_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 health_reporter_name_len; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *health_reporter_name; -}; - -static inline struct devlink_health_reporter_test_req * -devlink_health_reporter_test_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_health_reporter_test_req)); -} -void -devlink_health_reporter_test_req_free(struct devlink_health_reporter_test_req *req); - -static inline void -devlink_health_reporter_test_req_set_bus_name(struct devlink_health_reporter_test_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_health_reporter_test_req_set_dev_name(struct devlink_health_reporter_test_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_health_reporter_test_req_set_port_index(struct devlink_health_reporter_test_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_health_reporter_test_req_set_health_reporter_name(struct devlink_health_reporter_test_req *req, - const char *health_reporter_name) -{ - free(req->health_reporter_name); - req->_present.health_reporter_name_len = strlen(health_reporter_name); - req->health_reporter_name = malloc(req->_present.health_reporter_name_len + 1); - memcpy(req->health_reporter_name, health_reporter_name, req->_present.health_reporter_name_len); - req->health_reporter_name[req->_present.health_reporter_name_len] = 0; -} - -/* - * Test health reporter instances. - */ -int devlink_health_reporter_test(struct ynl_sock *ys, - struct devlink_health_reporter_test_req *req); - -/* ============== DEVLINK_CMD_RATE_GET ============== */ -/* DEVLINK_CMD_RATE_GET - do */ -struct devlink_rate_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 rate_node_name_len; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *rate_node_name; -}; - -static inline struct devlink_rate_get_req *devlink_rate_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_rate_get_req)); -} -void devlink_rate_get_req_free(struct devlink_rate_get_req *req); - -static inline void -devlink_rate_get_req_set_bus_name(struct devlink_rate_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_rate_get_req_set_dev_name(struct devlink_rate_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_rate_get_req_set_port_index(struct devlink_rate_get_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} -static inline void -devlink_rate_get_req_set_rate_node_name(struct devlink_rate_get_req *req, - const char *rate_node_name) -{ - free(req->rate_node_name); - req->_present.rate_node_name_len = strlen(rate_node_name); - req->rate_node_name = malloc(req->_present.rate_node_name_len + 1); - memcpy(req->rate_node_name, rate_node_name, req->_present.rate_node_name_len); - req->rate_node_name[req->_present.rate_node_name_len] = 0; -} - -struct devlink_rate_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - __u32 rate_node_name_len; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; - char *rate_node_name; -}; - -void devlink_rate_get_rsp_free(struct devlink_rate_get_rsp *rsp); - -/* - * Get rate instances. - */ -struct devlink_rate_get_rsp * -devlink_rate_get(struct ynl_sock *ys, struct devlink_rate_get_req *req); - -/* DEVLINK_CMD_RATE_GET - dump */ -struct devlink_rate_get_req_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_rate_get_req_dump * -devlink_rate_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct devlink_rate_get_req_dump)); -} -void devlink_rate_get_req_dump_free(struct devlink_rate_get_req_dump *req); - -static inline void -devlink_rate_get_req_dump_set_bus_name(struct devlink_rate_get_req_dump *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_rate_get_req_dump_set_dev_name(struct devlink_rate_get_req_dump *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_rate_get_list { - struct devlink_rate_get_list *next; - struct devlink_rate_get_rsp obj __attribute__((aligned(8))); -}; - -void devlink_rate_get_list_free(struct devlink_rate_get_list *rsp); - -struct devlink_rate_get_list * -devlink_rate_get_dump(struct ynl_sock *ys, - struct devlink_rate_get_req_dump *req); - -/* ============== DEVLINK_CMD_RATE_SET ============== */ -/* DEVLINK_CMD_RATE_SET - do */ -struct devlink_rate_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 rate_node_name_len; - __u32 rate_tx_share:1; - __u32 rate_tx_max:1; - __u32 rate_tx_priority:1; - __u32 rate_tx_weight:1; - __u32 rate_parent_node_name_len; - } _present; - - char *bus_name; - char *dev_name; - char *rate_node_name; - __u64 rate_tx_share; - __u64 rate_tx_max; - __u32 rate_tx_priority; - __u32 rate_tx_weight; - char *rate_parent_node_name; -}; - -static inline struct devlink_rate_set_req *devlink_rate_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_rate_set_req)); -} -void devlink_rate_set_req_free(struct devlink_rate_set_req *req); - -static inline void -devlink_rate_set_req_set_bus_name(struct devlink_rate_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_rate_set_req_set_dev_name(struct devlink_rate_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_rate_set_req_set_rate_node_name(struct devlink_rate_set_req *req, - const char *rate_node_name) -{ - free(req->rate_node_name); - req->_present.rate_node_name_len = strlen(rate_node_name); - req->rate_node_name = malloc(req->_present.rate_node_name_len + 1); - memcpy(req->rate_node_name, rate_node_name, req->_present.rate_node_name_len); - req->rate_node_name[req->_present.rate_node_name_len] = 0; -} -static inline void -devlink_rate_set_req_set_rate_tx_share(struct devlink_rate_set_req *req, - __u64 rate_tx_share) -{ - req->_present.rate_tx_share = 1; - req->rate_tx_share = rate_tx_share; -} -static inline void -devlink_rate_set_req_set_rate_tx_max(struct devlink_rate_set_req *req, - __u64 rate_tx_max) -{ - req->_present.rate_tx_max = 1; - req->rate_tx_max = rate_tx_max; -} -static inline void -devlink_rate_set_req_set_rate_tx_priority(struct devlink_rate_set_req *req, - __u32 rate_tx_priority) -{ - req->_present.rate_tx_priority = 1; - req->rate_tx_priority = rate_tx_priority; -} -static inline void -devlink_rate_set_req_set_rate_tx_weight(struct devlink_rate_set_req *req, - __u32 rate_tx_weight) -{ - req->_present.rate_tx_weight = 1; - req->rate_tx_weight = rate_tx_weight; -} -static inline void -devlink_rate_set_req_set_rate_parent_node_name(struct devlink_rate_set_req *req, - const char *rate_parent_node_name) -{ - free(req->rate_parent_node_name); - req->_present.rate_parent_node_name_len = strlen(rate_parent_node_name); - req->rate_parent_node_name = malloc(req->_present.rate_parent_node_name_len + 1); - 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; -} - -/* - * Set rate instances. - */ -int devlink_rate_set(struct ynl_sock *ys, struct devlink_rate_set_req *req); - -/* ============== DEVLINK_CMD_RATE_NEW ============== */ -/* DEVLINK_CMD_RATE_NEW - do */ -struct devlink_rate_new_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 rate_node_name_len; - __u32 rate_tx_share:1; - __u32 rate_tx_max:1; - __u32 rate_tx_priority:1; - __u32 rate_tx_weight:1; - __u32 rate_parent_node_name_len; - } _present; - - char *bus_name; - char *dev_name; - char *rate_node_name; - __u64 rate_tx_share; - __u64 rate_tx_max; - __u32 rate_tx_priority; - __u32 rate_tx_weight; - char *rate_parent_node_name; -}; - -static inline struct devlink_rate_new_req *devlink_rate_new_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_rate_new_req)); -} -void devlink_rate_new_req_free(struct devlink_rate_new_req *req); - -static inline void -devlink_rate_new_req_set_bus_name(struct devlink_rate_new_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_rate_new_req_set_dev_name(struct devlink_rate_new_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_rate_new_req_set_rate_node_name(struct devlink_rate_new_req *req, - const char *rate_node_name) -{ - free(req->rate_node_name); - req->_present.rate_node_name_len = strlen(rate_node_name); - req->rate_node_name = malloc(req->_present.rate_node_name_len + 1); - memcpy(req->rate_node_name, rate_node_name, req->_present.rate_node_name_len); - req->rate_node_name[req->_present.rate_node_name_len] = 0; -} -static inline void -devlink_rate_new_req_set_rate_tx_share(struct devlink_rate_new_req *req, - __u64 rate_tx_share) -{ - req->_present.rate_tx_share = 1; - req->rate_tx_share = rate_tx_share; -} -static inline void -devlink_rate_new_req_set_rate_tx_max(struct devlink_rate_new_req *req, - __u64 rate_tx_max) -{ - req->_present.rate_tx_max = 1; - req->rate_tx_max = rate_tx_max; -} -static inline void -devlink_rate_new_req_set_rate_tx_priority(struct devlink_rate_new_req *req, - __u32 rate_tx_priority) -{ - req->_present.rate_tx_priority = 1; - req->rate_tx_priority = rate_tx_priority; -} -static inline void -devlink_rate_new_req_set_rate_tx_weight(struct devlink_rate_new_req *req, - __u32 rate_tx_weight) -{ - req->_present.rate_tx_weight = 1; - req->rate_tx_weight = rate_tx_weight; -} -static inline void -devlink_rate_new_req_set_rate_parent_node_name(struct devlink_rate_new_req *req, - const char *rate_parent_node_name) -{ - free(req->rate_parent_node_name); - req->_present.rate_parent_node_name_len = strlen(rate_parent_node_name); - req->rate_parent_node_name = malloc(req->_present.rate_parent_node_name_len + 1); - 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; -} - -/* - * Create rate instances. - */ -int devlink_rate_new(struct ynl_sock *ys, struct devlink_rate_new_req *req); - -/* ============== DEVLINK_CMD_RATE_DEL ============== */ -/* DEVLINK_CMD_RATE_DEL - do */ -struct devlink_rate_del_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 rate_node_name_len; - } _present; - - char *bus_name; - char *dev_name; - char *rate_node_name; -}; - -static inline struct devlink_rate_del_req *devlink_rate_del_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_rate_del_req)); -} -void devlink_rate_del_req_free(struct devlink_rate_del_req *req); - -static inline void -devlink_rate_del_req_set_bus_name(struct devlink_rate_del_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_rate_del_req_set_dev_name(struct devlink_rate_del_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_rate_del_req_set_rate_node_name(struct devlink_rate_del_req *req, - const char *rate_node_name) -{ - free(req->rate_node_name); - req->_present.rate_node_name_len = strlen(rate_node_name); - req->rate_node_name = malloc(req->_present.rate_node_name_len + 1); - memcpy(req->rate_node_name, rate_node_name, req->_present.rate_node_name_len); - req->rate_node_name[req->_present.rate_node_name_len] = 0; -} - -/* - * Delete rate instances. - */ -int devlink_rate_del(struct ynl_sock *ys, struct devlink_rate_del_req *req); - -/* ============== DEVLINK_CMD_LINECARD_GET ============== */ -/* DEVLINK_CMD_LINECARD_GET - do */ -struct devlink_linecard_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 linecard_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 linecard_index; -}; - -static inline struct devlink_linecard_get_req * -devlink_linecard_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_linecard_get_req)); -} -void devlink_linecard_get_req_free(struct devlink_linecard_get_req *req); - -static inline void -devlink_linecard_get_req_set_bus_name(struct devlink_linecard_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_linecard_get_req_set_dev_name(struct devlink_linecard_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_linecard_get_req_set_linecard_index(struct devlink_linecard_get_req *req, - __u32 linecard_index) -{ - req->_present.linecard_index = 1; - req->linecard_index = linecard_index; -} - -struct devlink_linecard_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 linecard_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 linecard_index; -}; - -void devlink_linecard_get_rsp_free(struct devlink_linecard_get_rsp *rsp); - -/* - * Get line card instances. - */ -struct devlink_linecard_get_rsp * -devlink_linecard_get(struct ynl_sock *ys, struct devlink_linecard_get_req *req); - -/* DEVLINK_CMD_LINECARD_GET - dump */ -struct devlink_linecard_get_req_dump { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_linecard_get_req_dump * -devlink_linecard_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct devlink_linecard_get_req_dump)); -} -void -devlink_linecard_get_req_dump_free(struct devlink_linecard_get_req_dump *req); - -static inline void -devlink_linecard_get_req_dump_set_bus_name(struct devlink_linecard_get_req_dump *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_linecard_get_req_dump_set_dev_name(struct devlink_linecard_get_req_dump *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_linecard_get_list { - struct devlink_linecard_get_list *next; - struct devlink_linecard_get_rsp obj __attribute__((aligned(8))); -}; - -void devlink_linecard_get_list_free(struct devlink_linecard_get_list *rsp); - -struct devlink_linecard_get_list * -devlink_linecard_get_dump(struct ynl_sock *ys, - struct devlink_linecard_get_req_dump *req); - -/* ============== DEVLINK_CMD_LINECARD_SET ============== */ -/* DEVLINK_CMD_LINECARD_SET - do */ -struct devlink_linecard_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 linecard_index:1; - __u32 linecard_type_len; - } _present; - - char *bus_name; - char *dev_name; - __u32 linecard_index; - char *linecard_type; -}; - -static inline struct devlink_linecard_set_req * -devlink_linecard_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_linecard_set_req)); -} -void devlink_linecard_set_req_free(struct devlink_linecard_set_req *req); - -static inline void -devlink_linecard_set_req_set_bus_name(struct devlink_linecard_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_linecard_set_req_set_dev_name(struct devlink_linecard_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_linecard_set_req_set_linecard_index(struct devlink_linecard_set_req *req, - __u32 linecard_index) -{ - req->_present.linecard_index = 1; - req->linecard_index = linecard_index; -} -static inline void -devlink_linecard_set_req_set_linecard_type(struct devlink_linecard_set_req *req, - const char *linecard_type) -{ - free(req->linecard_type); - req->_present.linecard_type_len = strlen(linecard_type); - req->linecard_type = malloc(req->_present.linecard_type_len + 1); - memcpy(req->linecard_type, linecard_type, req->_present.linecard_type_len); - req->linecard_type[req->_present.linecard_type_len] = 0; -} - -/* - * Set line card instances. - */ -int devlink_linecard_set(struct ynl_sock *ys, - struct devlink_linecard_set_req *req); - -/* ============== DEVLINK_CMD_SELFTESTS_GET ============== */ -/* DEVLINK_CMD_SELFTESTS_GET - do */ -struct devlink_selftests_get_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -static inline struct devlink_selftests_get_req * -devlink_selftests_get_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_selftests_get_req)); -} -void devlink_selftests_get_req_free(struct devlink_selftests_get_req *req); - -static inline void -devlink_selftests_get_req_set_bus_name(struct devlink_selftests_get_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_selftests_get_req_set_dev_name(struct devlink_selftests_get_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} - -struct devlink_selftests_get_rsp { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - } _present; - - char *bus_name; - char *dev_name; -}; - -void devlink_selftests_get_rsp_free(struct devlink_selftests_get_rsp *rsp); - -/* - * Get device selftest instances. - */ -struct devlink_selftests_get_rsp * -devlink_selftests_get(struct ynl_sock *ys, - struct devlink_selftests_get_req *req); - -/* DEVLINK_CMD_SELFTESTS_GET - dump */ -struct devlink_selftests_get_list { - struct devlink_selftests_get_list *next; - struct devlink_selftests_get_rsp obj __attribute__((aligned(8))); -}; - -void devlink_selftests_get_list_free(struct devlink_selftests_get_list *rsp); - -struct devlink_selftests_get_list * -devlink_selftests_get_dump(struct ynl_sock *ys); - -/* ============== DEVLINK_CMD_SELFTESTS_RUN ============== */ -/* DEVLINK_CMD_SELFTESTS_RUN - do */ -struct devlink_selftests_run_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 selftests:1; - } _present; - - char *bus_name; - char *dev_name; - struct devlink_dl_selftest_id selftests; -}; - -static inline struct devlink_selftests_run_req * -devlink_selftests_run_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_selftests_run_req)); -} -void devlink_selftests_run_req_free(struct devlink_selftests_run_req *req); - -static inline void -devlink_selftests_run_req_set_bus_name(struct devlink_selftests_run_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_selftests_run_req_set_dev_name(struct devlink_selftests_run_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_selftests_run_req_set_selftests_flash(struct devlink_selftests_run_req *req) -{ - req->_present.selftests = 1; - req->selftests._present.flash = 1; -} - -/* - * Run device selftest instances. - */ -int devlink_selftests_run(struct ynl_sock *ys, - struct devlink_selftests_run_req *req); - -/* ============== DEVLINK_CMD_NOTIFY_FILTER_SET ============== */ -/* DEVLINK_CMD_NOTIFY_FILTER_SET - do */ -struct devlink_notify_filter_set_req { - struct { - __u32 bus_name_len; - __u32 dev_name_len; - __u32 port_index:1; - } _present; - - char *bus_name; - char *dev_name; - __u32 port_index; -}; - -static inline struct devlink_notify_filter_set_req * -devlink_notify_filter_set_req_alloc(void) -{ - return calloc(1, sizeof(struct devlink_notify_filter_set_req)); -} -void -devlink_notify_filter_set_req_free(struct devlink_notify_filter_set_req *req); - -static inline void -devlink_notify_filter_set_req_set_bus_name(struct devlink_notify_filter_set_req *req, - const char *bus_name) -{ - free(req->bus_name); - req->_present.bus_name_len = strlen(bus_name); - req->bus_name = malloc(req->_present.bus_name_len + 1); - memcpy(req->bus_name, bus_name, req->_present.bus_name_len); - req->bus_name[req->_present.bus_name_len] = 0; -} -static inline void -devlink_notify_filter_set_req_set_dev_name(struct devlink_notify_filter_set_req *req, - const char *dev_name) -{ - free(req->dev_name); - req->_present.dev_name_len = strlen(dev_name); - req->dev_name = malloc(req->_present.dev_name_len + 1); - memcpy(req->dev_name, dev_name, req->_present.dev_name_len); - req->dev_name[req->_present.dev_name_len] = 0; -} -static inline void -devlink_notify_filter_set_req_set_port_index(struct devlink_notify_filter_set_req *req, - __u32 port_index) -{ - req->_present.port_index = 1; - req->port_index = port_index; -} - -/* - * Set notification messages socket filter. - */ -int devlink_notify_filter_set(struct ynl_sock *ys, - struct devlink_notify_filter_set_req *req); - -#endif /* _LINUX_DEVLINK_GEN_H */ diff --git a/generated/devlink-user.h b/generated/devlink-user.h new file mode 120000 index 0000000..ad80630 --- /dev/null +++ b/generated/devlink-user.h @@ -0,0 +1 @@ +../include/ynl-c/devlink.h \ No newline at end of file diff --git a/generated/dpll-user.h b/generated/dpll-user.h deleted file mode 100644 index 9055d42..0000000 --- a/generated/dpll-user.h +++ /dev/null @@ -1,538 +0,0 @@ -/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ -/* Do not edit directly, auto-generated from: */ -/* Documentation/netlink/specs/dpll.yaml */ -/* YNL-GEN user header */ - -#ifndef _LINUX_DPLL_GEN_H -#define _LINUX_DPLL_GEN_H - -#include -#include -#include -#include - -struct ynl_sock; - -extern const struct ynl_family ynl_dpll_family; - -/* Enums */ -const char *dpll_op_str(int op); -const char *dpll_mode_str(enum dpll_mode value); -const char *dpll_lock_status_str(enum dpll_lock_status value); -const char *dpll_lock_status_error_str(enum dpll_lock_status_error value); -const char *dpll_type_str(enum dpll_type value); -const char *dpll_pin_type_str(enum dpll_pin_type value); -const char *dpll_pin_direction_str(enum dpll_pin_direction value); -const char *dpll_pin_state_str(enum dpll_pin_state value); -const char *dpll_pin_capabilities_str(enum dpll_pin_capabilities value); - -/* Common nested types */ -struct dpll_frequency_range { - struct { - __u32 frequency_min:1; - __u32 frequency_max:1; - } _present; - - __u64 frequency_min; - __u64 frequency_max; -}; - -struct dpll_pin_parent_device { - struct { - __u32 parent_id:1; - __u32 direction:1; - __u32 prio:1; - __u32 state:1; - __u32 phase_offset:1; - } _present; - - __u32 parent_id; - enum dpll_pin_direction direction; - __u32 prio; - enum dpll_pin_state state; - __s64 phase_offset; -}; - -struct dpll_pin_parent_pin { - struct { - __u32 parent_id:1; - __u32 state:1; - } _present; - - __u32 parent_id; - enum dpll_pin_state state; -}; - -/* ============== DPLL_CMD_DEVICE_ID_GET ============== */ -/* DPLL_CMD_DEVICE_ID_GET - do */ -struct dpll_device_id_get_req { - struct { - __u32 module_name_len; - __u32 clock_id:1; - __u32 type:1; - } _present; - - char *module_name; - __u64 clock_id; - enum dpll_type type; -}; - -static inline struct dpll_device_id_get_req *dpll_device_id_get_req_alloc(void) -{ - return calloc(1, sizeof(struct dpll_device_id_get_req)); -} -void dpll_device_id_get_req_free(struct dpll_device_id_get_req *req); - -static inline void -dpll_device_id_get_req_set_module_name(struct dpll_device_id_get_req *req, - const char *module_name) -{ - free(req->module_name); - req->_present.module_name_len = strlen(module_name); - req->module_name = malloc(req->_present.module_name_len + 1); - memcpy(req->module_name, module_name, req->_present.module_name_len); - req->module_name[req->_present.module_name_len] = 0; -} -static inline void -dpll_device_id_get_req_set_clock_id(struct dpll_device_id_get_req *req, - __u64 clock_id) -{ - req->_present.clock_id = 1; - req->clock_id = clock_id; -} -static inline void -dpll_device_id_get_req_set_type(struct dpll_device_id_get_req *req, - enum dpll_type type) -{ - req->_present.type = 1; - req->type = type; -} - -struct dpll_device_id_get_rsp { - struct { - __u32 id:1; - } _present; - - __u32 id; -}; - -void dpll_device_id_get_rsp_free(struct dpll_device_id_get_rsp *rsp); - -/* - * Get id of dpll device that matches given attributes - - */ -struct dpll_device_id_get_rsp * -dpll_device_id_get(struct ynl_sock *ys, struct dpll_device_id_get_req *req); - -/* ============== DPLL_CMD_DEVICE_GET ============== */ -/* DPLL_CMD_DEVICE_GET - do */ -struct dpll_device_get_req { - struct { - __u32 id:1; - } _present; - - __u32 id; -}; - -static inline struct dpll_device_get_req *dpll_device_get_req_alloc(void) -{ - return calloc(1, sizeof(struct dpll_device_get_req)); -} -void dpll_device_get_req_free(struct dpll_device_get_req *req); - -static inline void -dpll_device_get_req_set_id(struct dpll_device_get_req *req, __u32 id) -{ - req->_present.id = 1; - req->id = id; -} - -struct dpll_device_get_rsp { - struct { - __u32 id:1; - __u32 module_name_len; - __u32 mode:1; - __u32 lock_status:1; - __u32 lock_status_error:1; - __u32 temp:1; - __u32 clock_id:1; - __u32 type:1; - } _present; - - __u32 id; - char *module_name; - enum dpll_mode mode; - unsigned int n_mode_supported; - __u32 *mode_supported; - enum dpll_lock_status lock_status; - enum dpll_lock_status_error lock_status_error; - __s32 temp; - __u64 clock_id; - enum dpll_type type; -}; - -void dpll_device_get_rsp_free(struct dpll_device_get_rsp *rsp); - -/* - * Get list of DPLL devices (dump) or attributes of a single dpll device - - */ -struct dpll_device_get_rsp * -dpll_device_get(struct ynl_sock *ys, struct dpll_device_get_req *req); - -/* DPLL_CMD_DEVICE_GET - dump */ -struct dpll_device_get_list { - struct dpll_device_get_list *next; - struct dpll_device_get_rsp obj __attribute__((aligned(8))); -}; - -void dpll_device_get_list_free(struct dpll_device_get_list *rsp); - -struct dpll_device_get_list *dpll_device_get_dump(struct ynl_sock *ys); - -/* DPLL_CMD_DEVICE_GET - notify */ -struct dpll_device_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct dpll_device_get_ntf *ntf); - struct dpll_device_get_rsp obj __attribute__((aligned(8))); -}; - -void dpll_device_get_ntf_free(struct dpll_device_get_ntf *rsp); - -/* ============== DPLL_CMD_DEVICE_SET ============== */ -/* DPLL_CMD_DEVICE_SET - do */ -struct dpll_device_set_req { - struct { - __u32 id:1; - } _present; - - __u32 id; -}; - -static inline struct dpll_device_set_req *dpll_device_set_req_alloc(void) -{ - return calloc(1, sizeof(struct dpll_device_set_req)); -} -void dpll_device_set_req_free(struct dpll_device_set_req *req); - -static inline void -dpll_device_set_req_set_id(struct dpll_device_set_req *req, __u32 id) -{ - req->_present.id = 1; - req->id = id; -} - -/* - * Set attributes for a DPLL device - */ -int dpll_device_set(struct ynl_sock *ys, struct dpll_device_set_req *req); - -/* ============== DPLL_CMD_PIN_ID_GET ============== */ -/* DPLL_CMD_PIN_ID_GET - do */ -struct dpll_pin_id_get_req { - struct { - __u32 module_name_len; - __u32 clock_id:1; - __u32 board_label_len; - __u32 panel_label_len; - __u32 package_label_len; - __u32 type:1; - } _present; - - char *module_name; - __u64 clock_id; - char *board_label; - char *panel_label; - char *package_label; - enum dpll_pin_type type; -}; - -static inline struct dpll_pin_id_get_req *dpll_pin_id_get_req_alloc(void) -{ - return calloc(1, sizeof(struct dpll_pin_id_get_req)); -} -void dpll_pin_id_get_req_free(struct dpll_pin_id_get_req *req); - -static inline void -dpll_pin_id_get_req_set_module_name(struct dpll_pin_id_get_req *req, - const char *module_name) -{ - free(req->module_name); - req->_present.module_name_len = strlen(module_name); - req->module_name = malloc(req->_present.module_name_len + 1); - memcpy(req->module_name, module_name, req->_present.module_name_len); - req->module_name[req->_present.module_name_len] = 0; -} -static inline void -dpll_pin_id_get_req_set_clock_id(struct dpll_pin_id_get_req *req, - __u64 clock_id) -{ - req->_present.clock_id = 1; - req->clock_id = clock_id; -} -static inline void -dpll_pin_id_get_req_set_board_label(struct dpll_pin_id_get_req *req, - const char *board_label) -{ - free(req->board_label); - req->_present.board_label_len = strlen(board_label); - req->board_label = malloc(req->_present.board_label_len + 1); - memcpy(req->board_label, board_label, req->_present.board_label_len); - req->board_label[req->_present.board_label_len] = 0; -} -static inline void -dpll_pin_id_get_req_set_panel_label(struct dpll_pin_id_get_req *req, - const char *panel_label) -{ - free(req->panel_label); - req->_present.panel_label_len = strlen(panel_label); - req->panel_label = malloc(req->_present.panel_label_len + 1); - memcpy(req->panel_label, panel_label, req->_present.panel_label_len); - req->panel_label[req->_present.panel_label_len] = 0; -} -static inline void -dpll_pin_id_get_req_set_package_label(struct dpll_pin_id_get_req *req, - const char *package_label) -{ - free(req->package_label); - req->_present.package_label_len = strlen(package_label); - req->package_label = malloc(req->_present.package_label_len + 1); - memcpy(req->package_label, package_label, req->_present.package_label_len); - req->package_label[req->_present.package_label_len] = 0; -} -static inline void -dpll_pin_id_get_req_set_type(struct dpll_pin_id_get_req *req, - enum dpll_pin_type type) -{ - req->_present.type = 1; - req->type = type; -} - -struct dpll_pin_id_get_rsp { - struct { - __u32 id:1; - } _present; - - __u32 id; -}; - -void dpll_pin_id_get_rsp_free(struct dpll_pin_id_get_rsp *rsp); - -/* - * Get id of a pin that matches given attributes - - */ -struct dpll_pin_id_get_rsp * -dpll_pin_id_get(struct ynl_sock *ys, struct dpll_pin_id_get_req *req); - -/* ============== DPLL_CMD_PIN_GET ============== */ -/* DPLL_CMD_PIN_GET - do */ -struct dpll_pin_get_req { - struct { - __u32 id:1; - } _present; - - __u32 id; -}; - -static inline struct dpll_pin_get_req *dpll_pin_get_req_alloc(void) -{ - return calloc(1, sizeof(struct dpll_pin_get_req)); -} -void dpll_pin_get_req_free(struct dpll_pin_get_req *req); - -static inline void -dpll_pin_get_req_set_id(struct dpll_pin_get_req *req, __u32 id) -{ - req->_present.id = 1; - req->id = id; -} - -struct dpll_pin_get_rsp { - struct { - __u32 id:1; - __u32 board_label_len; - __u32 panel_label_len; - __u32 package_label_len; - __u32 type:1; - __u32 frequency:1; - __u32 capabilities:1; - __u32 phase_adjust_min:1; - __u32 phase_adjust_max:1; - __u32 phase_adjust:1; - __u32 fractional_frequency_offset:1; - } _present; - - __u32 id; - char *board_label; - char *panel_label; - char *package_label; - enum dpll_pin_type type; - __u64 frequency; - unsigned int n_frequency_supported; - struct dpll_frequency_range *frequency_supported; - __u32 capabilities; - unsigned int n_parent_device; - struct dpll_pin_parent_device *parent_device; - unsigned int n_parent_pin; - struct dpll_pin_parent_pin *parent_pin; - __s32 phase_adjust_min; - __s32 phase_adjust_max; - __s32 phase_adjust; - __s64 fractional_frequency_offset; -}; - -void dpll_pin_get_rsp_free(struct dpll_pin_get_rsp *rsp); - -/* - * Get list of pins and its attributes. -- dump request without any attributes given - list all the pins in the - system -- dump request with target dpll - list all the pins registered with - a given dpll device -- do request with target dpll and target pin - single pin attributes - - */ -struct dpll_pin_get_rsp * -dpll_pin_get(struct ynl_sock *ys, struct dpll_pin_get_req *req); - -/* DPLL_CMD_PIN_GET - dump */ -struct dpll_pin_get_req_dump { - struct { - __u32 id:1; - } _present; - - __u32 id; -}; - -static inline struct dpll_pin_get_req_dump *dpll_pin_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct dpll_pin_get_req_dump)); -} -void dpll_pin_get_req_dump_free(struct dpll_pin_get_req_dump *req); - -static inline void -dpll_pin_get_req_dump_set_id(struct dpll_pin_get_req_dump *req, __u32 id) -{ - req->_present.id = 1; - req->id = id; -} - -struct dpll_pin_get_list { - struct dpll_pin_get_list *next; - struct dpll_pin_get_rsp obj __attribute__((aligned(8))); -}; - -void dpll_pin_get_list_free(struct dpll_pin_get_list *rsp); - -struct dpll_pin_get_list * -dpll_pin_get_dump(struct ynl_sock *ys, struct dpll_pin_get_req_dump *req); - -/* DPLL_CMD_PIN_GET - notify */ -struct dpll_pin_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct dpll_pin_get_ntf *ntf); - struct dpll_pin_get_rsp obj __attribute__((aligned(8))); -}; - -void dpll_pin_get_ntf_free(struct dpll_pin_get_ntf *rsp); - -/* ============== DPLL_CMD_PIN_SET ============== */ -/* DPLL_CMD_PIN_SET - do */ -struct dpll_pin_set_req { - struct { - __u32 id:1; - __u32 frequency:1; - __u32 direction:1; - __u32 prio:1; - __u32 state:1; - __u32 phase_adjust:1; - } _present; - - __u32 id; - __u64 frequency; - enum dpll_pin_direction direction; - __u32 prio; - enum dpll_pin_state state; - unsigned int n_parent_device; - struct dpll_pin_parent_device *parent_device; - unsigned int n_parent_pin; - struct dpll_pin_parent_pin *parent_pin; - __s32 phase_adjust; -}; - -static inline struct dpll_pin_set_req *dpll_pin_set_req_alloc(void) -{ - return calloc(1, sizeof(struct dpll_pin_set_req)); -} -void dpll_pin_set_req_free(struct dpll_pin_set_req *req); - -static inline void -dpll_pin_set_req_set_id(struct dpll_pin_set_req *req, __u32 id) -{ - req->_present.id = 1; - req->id = id; -} -static inline void -dpll_pin_set_req_set_frequency(struct dpll_pin_set_req *req, __u64 frequency) -{ - req->_present.frequency = 1; - req->frequency = frequency; -} -static inline void -dpll_pin_set_req_set_direction(struct dpll_pin_set_req *req, - enum dpll_pin_direction direction) -{ - req->_present.direction = 1; - req->direction = direction; -} -static inline void -dpll_pin_set_req_set_prio(struct dpll_pin_set_req *req, __u32 prio) -{ - req->_present.prio = 1; - req->prio = prio; -} -static inline void -dpll_pin_set_req_set_state(struct dpll_pin_set_req *req, - enum dpll_pin_state state) -{ - req->_present.state = 1; - req->state = state; -} -static inline void -__dpll_pin_set_req_set_parent_device(struct dpll_pin_set_req *req, - struct dpll_pin_parent_device *parent_device, - unsigned int n_parent_device) -{ - free(req->parent_device); - req->parent_device = parent_device; - req->n_parent_device = n_parent_device; -} -static inline void -__dpll_pin_set_req_set_parent_pin(struct dpll_pin_set_req *req, - struct dpll_pin_parent_pin *parent_pin, - unsigned int n_parent_pin) -{ - free(req->parent_pin); - req->parent_pin = parent_pin; - req->n_parent_pin = n_parent_pin; -} -static inline void -dpll_pin_set_req_set_phase_adjust(struct dpll_pin_set_req *req, - __s32 phase_adjust) -{ - req->_present.phase_adjust = 1; - req->phase_adjust = phase_adjust; -} - -/* - * Set attributes of a target pin - */ -int dpll_pin_set(struct ynl_sock *ys, struct dpll_pin_set_req *req); - -#endif /* _LINUX_DPLL_GEN_H */ diff --git a/generated/dpll-user.h b/generated/dpll-user.h new file mode 120000 index 0000000..a9cd176 --- /dev/null +++ b/generated/dpll-user.h @@ -0,0 +1 @@ +../include/ynl-c/dpll.h \ No newline at end of file diff --git a/generated/ethtool-user.h b/generated/ethtool-user.h deleted file mode 100644 index ebaf14f..0000000 --- a/generated/ethtool-user.h +++ /dev/null @@ -1,5537 +0,0 @@ -/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ -/* Do not edit directly, auto-generated from: */ -/* Documentation/netlink/specs/ethtool.yaml */ -/* YNL-GEN user header */ -/* YNL-ARG --user-header linux/ethtool_netlink.h --exclude-op stats-get */ - -#ifndef _LINUX_ETHTOOL_GEN_H -#define _LINUX_ETHTOOL_GEN_H - -#include -#include -#include -#include - -struct ynl_sock; - -extern const struct ynl_family ynl_ethtool_family; - -/* Enums */ -const char *ethtool_op_str(int op); -const char *ethtool_udp_tunnel_type_str(int value); -const char *ethtool_stringset_str(enum ethtool_stringset value); - -/* Common nested types */ -struct ethtool_header { - struct { - __u32 dev_index:1; - __u32 dev_name_len; - __u32 flags:1; - } _present; - - __u32 dev_index; - char *dev_name; - __u32 flags; -}; - -struct ethtool_pause_stat { - struct { - __u32 tx_frames:1; - __u32 rx_frames:1; - } _present; - - __u64 tx_frames; - __u64 rx_frames; -}; - -struct ethtool_cable_test_tdr_cfg { - struct { - __u32 first:1; - __u32 last:1; - __u32 step:1; - __u32 pair:1; - } _present; - - __u32 first; - __u32 last; - __u32 step; - __u8 pair; -}; - -struct ethtool_fec_stat { - struct { - __u32 corrected_len; - __u32 uncorr_len; - __u32 corr_bits_len; - } _present; - - void *corrected; - void *uncorr; - void *corr_bits; -}; - -struct ethtool_mm_stat { - struct { - __u32 reassembly_errors:1; - __u32 smd_errors:1; - __u32 reassembly_ok:1; - __u32 rx_frag_count:1; - __u32 tx_frag_count:1; - __u32 hold_count:1; - } _present; - - __u64 reassembly_errors; - __u64 smd_errors; - __u64 reassembly_ok; - __u64 rx_frag_count; - __u64 tx_frag_count; - __u64 hold_count; -}; - -struct ethtool_cable_result { - struct { - __u32 pair:1; - __u32 code:1; - } _present; - - __u8 pair; - __u8 code; -}; - -struct ethtool_cable_fault_length { - struct { - __u32 pair:1; - __u32 cm:1; - } _present; - - __u8 pair; - __u32 cm; -}; - -struct ethtool_bitset_bit { - struct { - __u32 index:1; - __u32 name_len; - __u32 value:1; - } _present; - - __u32 index; - char *name; -}; - -struct ethtool_tunnel_udp_entry { - struct { - __u32 port:1; - __u32 type:1; - } _present; - - __u16 port /* big-endian */; - int type; -}; - -struct ethtool_string { - struct { - __u32 index:1; - __u32 value_len; - } _present; - - __u32 index; - char *value; -}; - -struct ethtool_cable_nest { - struct { - __u32 result:1; - __u32 fault_length:1; - } _present; - - struct ethtool_cable_result result; - struct ethtool_cable_fault_length fault_length; -}; - -struct ethtool_bitset_bits { - unsigned int n_bit; - struct ethtool_bitset_bit *bit; -}; - -struct ethtool_strings { - unsigned int n_string; - struct ethtool_string *string; -}; - -struct ethtool_bitset { - struct { - __u32 nomask:1; - __u32 size:1; - __u32 bits:1; - } _present; - - __u32 size; - struct ethtool_bitset_bits bits; -}; - -struct ethtool_stringset_ { - struct { - __u32 id:1; - __u32 count:1; - } _present; - - __u32 id; - __u32 count; - unsigned int n_strings; - struct ethtool_strings *strings; -}; - -struct ethtool_tunnel_udp_table { - struct { - __u32 size:1; - __u32 types:1; - } _present; - - __u32 size; - struct ethtool_bitset types; - unsigned int n_entry; - struct ethtool_tunnel_udp_entry *entry; -}; - -struct ethtool_stringsets { - unsigned int n_stringset; - struct ethtool_stringset_ *stringset; -}; - -struct ethtool_tunnel_udp { - struct { - __u32 table:1; - } _present; - - struct ethtool_tunnel_udp_table table; -}; - -/* ============== ETHTOOL_MSG_STRSET_GET ============== */ -/* ETHTOOL_MSG_STRSET_GET - do */ -struct ethtool_strset_get_req { - struct { - __u32 header:1; - __u32 stringsets:1; - __u32 counts_only:1; - } _present; - - struct ethtool_header header; - struct ethtool_stringsets stringsets; -}; - -static inline struct ethtool_strset_get_req *ethtool_strset_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_strset_get_req)); -} -void ethtool_strset_get_req_free(struct ethtool_strset_get_req *req); - -static inline void -ethtool_strset_get_req_set_header_dev_index(struct ethtool_strset_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_strset_get_req_set_header_dev_name(struct ethtool_strset_get_req *req, - const char *dev_name) -{ - 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_strset_get_req_set_header_flags(struct ethtool_strset_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -__ethtool_strset_get_req_set_stringsets_stringset(struct ethtool_strset_get_req *req, - struct ethtool_stringset_ *stringset, - unsigned int n_stringset) -{ - free(req->stringsets.stringset); - req->stringsets.stringset = stringset; - req->stringsets.n_stringset = n_stringset; -} -static inline void -ethtool_strset_get_req_set_counts_only(struct ethtool_strset_get_req *req) -{ - req->_present.counts_only = 1; -} - -struct ethtool_strset_get_rsp { - struct { - __u32 header:1; - __u32 stringsets:1; - } _present; - - struct ethtool_header header; - struct ethtool_stringsets stringsets; -}; - -void ethtool_strset_get_rsp_free(struct ethtool_strset_get_rsp *rsp); - -/* - * Get string set from the kernel. - */ -struct ethtool_strset_get_rsp * -ethtool_strset_get(struct ynl_sock *ys, struct ethtool_strset_get_req *req); - -/* ETHTOOL_MSG_STRSET_GET - dump */ -struct ethtool_strset_get_req_dump { - struct { - __u32 header:1; - __u32 stringsets:1; - __u32 counts_only:1; - } _present; - - struct ethtool_header header; - struct ethtool_stringsets stringsets; -}; - -static inline struct ethtool_strset_get_req_dump * -ethtool_strset_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_strset_get_req_dump)); -} -void ethtool_strset_get_req_dump_free(struct ethtool_strset_get_req_dump *req); - -static inline void -ethtool_strset_get_req_dump_set_header_dev_index(struct ethtool_strset_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_strset_get_req_dump_set_header_dev_name(struct ethtool_strset_get_req_dump *req, - const char *dev_name) -{ - 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_strset_get_req_dump_set_header_flags(struct ethtool_strset_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -__ethtool_strset_get_req_dump_set_stringsets_stringset(struct ethtool_strset_get_req_dump *req, - struct ethtool_stringset_ *stringset, - unsigned int n_stringset) -{ - free(req->stringsets.stringset); - req->stringsets.stringset = stringset; - req->stringsets.n_stringset = n_stringset; -} -static inline void -ethtool_strset_get_req_dump_set_counts_only(struct ethtool_strset_get_req_dump *req) -{ - req->_present.counts_only = 1; -} - -struct ethtool_strset_get_list { - struct ethtool_strset_get_list *next; - struct ethtool_strset_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_strset_get_list_free(struct ethtool_strset_get_list *rsp); - -struct ethtool_strset_get_list * -ethtool_strset_get_dump(struct ynl_sock *ys, - struct ethtool_strset_get_req_dump *req); - -/* ============== ETHTOOL_MSG_LINKINFO_GET ============== */ -/* ETHTOOL_MSG_LINKINFO_GET - do */ -struct ethtool_linkinfo_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_linkinfo_get_req * -ethtool_linkinfo_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_linkinfo_get_req)); -} -void ethtool_linkinfo_get_req_free(struct ethtool_linkinfo_get_req *req); - -static inline void -ethtool_linkinfo_get_req_set_header_dev_index(struct ethtool_linkinfo_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_linkinfo_get_req_set_header_dev_name(struct ethtool_linkinfo_get_req *req, - const char *dev_name) -{ - 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_linkinfo_get_req_set_header_flags(struct ethtool_linkinfo_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_linkinfo_get_rsp { - struct { - __u32 header:1; - __u32 port:1; - __u32 phyaddr:1; - __u32 tp_mdix:1; - __u32 tp_mdix_ctrl:1; - __u32 transceiver:1; - } _present; - - struct ethtool_header header; - __u8 port; - __u8 phyaddr; - __u8 tp_mdix; - __u8 tp_mdix_ctrl; - __u8 transceiver; -}; - -void ethtool_linkinfo_get_rsp_free(struct ethtool_linkinfo_get_rsp *rsp); - -/* - * Get link info. - */ -struct ethtool_linkinfo_get_rsp * -ethtool_linkinfo_get(struct ynl_sock *ys, struct ethtool_linkinfo_get_req *req); - -/* ETHTOOL_MSG_LINKINFO_GET - dump */ -struct ethtool_linkinfo_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_linkinfo_get_req_dump * -ethtool_linkinfo_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_linkinfo_get_req_dump)); -} -void -ethtool_linkinfo_get_req_dump_free(struct ethtool_linkinfo_get_req_dump *req); - -static inline void -ethtool_linkinfo_get_req_dump_set_header_dev_index(struct ethtool_linkinfo_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_linkinfo_get_req_dump_set_header_dev_name(struct ethtool_linkinfo_get_req_dump *req, - const char *dev_name) -{ - 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_linkinfo_get_req_dump_set_header_flags(struct ethtool_linkinfo_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_linkinfo_get_list { - struct ethtool_linkinfo_get_list *next; - struct ethtool_linkinfo_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_linkinfo_get_list_free(struct ethtool_linkinfo_get_list *rsp); - -struct ethtool_linkinfo_get_list * -ethtool_linkinfo_get_dump(struct ynl_sock *ys, - struct ethtool_linkinfo_get_req_dump *req); - -/* ETHTOOL_MSG_LINKINFO_GET - notify */ -struct ethtool_linkinfo_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_linkinfo_get_ntf *ntf); - struct ethtool_linkinfo_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_linkinfo_get_ntf_free(struct ethtool_linkinfo_get_ntf *rsp); - -/* ============== ETHTOOL_MSG_LINKINFO_SET ============== */ -/* ETHTOOL_MSG_LINKINFO_SET - do */ -struct ethtool_linkinfo_set_req { - struct { - __u32 header:1; - __u32 port:1; - __u32 phyaddr:1; - __u32 tp_mdix:1; - __u32 tp_mdix_ctrl:1; - __u32 transceiver:1; - } _present; - - struct ethtool_header header; - __u8 port; - __u8 phyaddr; - __u8 tp_mdix; - __u8 tp_mdix_ctrl; - __u8 transceiver; -}; - -static inline struct ethtool_linkinfo_set_req * -ethtool_linkinfo_set_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_linkinfo_set_req)); -} -void ethtool_linkinfo_set_req_free(struct ethtool_linkinfo_set_req *req); - -static inline void -ethtool_linkinfo_set_req_set_header_dev_index(struct ethtool_linkinfo_set_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_linkinfo_set_req_set_header_dev_name(struct ethtool_linkinfo_set_req *req, - const char *dev_name) -{ - 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_linkinfo_set_req_set_header_flags(struct ethtool_linkinfo_set_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_linkinfo_set_req_set_port(struct ethtool_linkinfo_set_req *req, - __u8 port) -{ - req->_present.port = 1; - req->port = port; -} -static inline void -ethtool_linkinfo_set_req_set_phyaddr(struct ethtool_linkinfo_set_req *req, - __u8 phyaddr) -{ - req->_present.phyaddr = 1; - req->phyaddr = phyaddr; -} -static inline void -ethtool_linkinfo_set_req_set_tp_mdix(struct ethtool_linkinfo_set_req *req, - __u8 tp_mdix) -{ - req->_present.tp_mdix = 1; - req->tp_mdix = tp_mdix; -} -static inline void -ethtool_linkinfo_set_req_set_tp_mdix_ctrl(struct ethtool_linkinfo_set_req *req, - __u8 tp_mdix_ctrl) -{ - req->_present.tp_mdix_ctrl = 1; - req->tp_mdix_ctrl = tp_mdix_ctrl; -} -static inline void -ethtool_linkinfo_set_req_set_transceiver(struct ethtool_linkinfo_set_req *req, - __u8 transceiver) -{ - req->_present.transceiver = 1; - req->transceiver = transceiver; -} - -/* - * Set link info. - */ -int ethtool_linkinfo_set(struct ynl_sock *ys, - struct ethtool_linkinfo_set_req *req); - -/* ============== ETHTOOL_MSG_LINKMODES_GET ============== */ -/* ETHTOOL_MSG_LINKMODES_GET - do */ -struct ethtool_linkmodes_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_linkmodes_get_req * -ethtool_linkmodes_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_linkmodes_get_req)); -} -void ethtool_linkmodes_get_req_free(struct ethtool_linkmodes_get_req *req); - -static inline void -ethtool_linkmodes_get_req_set_header_dev_index(struct ethtool_linkmodes_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_linkmodes_get_req_set_header_dev_name(struct ethtool_linkmodes_get_req *req, - const char *dev_name) -{ - 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_linkmodes_get_req_set_header_flags(struct ethtool_linkmodes_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_linkmodes_get_rsp { - struct { - __u32 header:1; - __u32 autoneg:1; - __u32 ours:1; - __u32 peer:1; - __u32 speed:1; - __u32 duplex:1; - __u32 master_slave_cfg:1; - __u32 master_slave_state:1; - __u32 lanes:1; - __u32 rate_matching:1; - } _present; - - struct ethtool_header header; - __u8 autoneg; - struct ethtool_bitset ours; - struct ethtool_bitset peer; - __u32 speed; - __u8 duplex; - __u8 master_slave_cfg; - __u8 master_slave_state; - __u32 lanes; - __u8 rate_matching; -}; - -void ethtool_linkmodes_get_rsp_free(struct ethtool_linkmodes_get_rsp *rsp); - -/* - * Get link modes. - */ -struct ethtool_linkmodes_get_rsp * -ethtool_linkmodes_get(struct ynl_sock *ys, - struct ethtool_linkmodes_get_req *req); - -/* ETHTOOL_MSG_LINKMODES_GET - dump */ -struct ethtool_linkmodes_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_linkmodes_get_req_dump * -ethtool_linkmodes_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_linkmodes_get_req_dump)); -} -void -ethtool_linkmodes_get_req_dump_free(struct ethtool_linkmodes_get_req_dump *req); - -static inline void -ethtool_linkmodes_get_req_dump_set_header_dev_index(struct ethtool_linkmodes_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_linkmodes_get_req_dump_set_header_dev_name(struct ethtool_linkmodes_get_req_dump *req, - const char *dev_name) -{ - 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_linkmodes_get_req_dump_set_header_flags(struct ethtool_linkmodes_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_linkmodes_get_list { - struct ethtool_linkmodes_get_list *next; - struct ethtool_linkmodes_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_linkmodes_get_list_free(struct ethtool_linkmodes_get_list *rsp); - -struct ethtool_linkmodes_get_list * -ethtool_linkmodes_get_dump(struct ynl_sock *ys, - struct ethtool_linkmodes_get_req_dump *req); - -/* ETHTOOL_MSG_LINKMODES_GET - notify */ -struct ethtool_linkmodes_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_linkmodes_get_ntf *ntf); - struct ethtool_linkmodes_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_linkmodes_get_ntf_free(struct ethtool_linkmodes_get_ntf *rsp); - -/* ============== ETHTOOL_MSG_LINKMODES_SET ============== */ -/* ETHTOOL_MSG_LINKMODES_SET - do */ -struct ethtool_linkmodes_set_req { - struct { - __u32 header:1; - __u32 autoneg:1; - __u32 ours:1; - __u32 peer:1; - __u32 speed:1; - __u32 duplex:1; - __u32 master_slave_cfg:1; - __u32 master_slave_state:1; - __u32 lanes:1; - __u32 rate_matching:1; - } _present; - - struct ethtool_header header; - __u8 autoneg; - struct ethtool_bitset ours; - struct ethtool_bitset peer; - __u32 speed; - __u8 duplex; - __u8 master_slave_cfg; - __u8 master_slave_state; - __u32 lanes; - __u8 rate_matching; -}; - -static inline struct ethtool_linkmodes_set_req * -ethtool_linkmodes_set_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_linkmodes_set_req)); -} -void ethtool_linkmodes_set_req_free(struct ethtool_linkmodes_set_req *req); - -static inline void -ethtool_linkmodes_set_req_set_header_dev_index(struct ethtool_linkmodes_set_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_linkmodes_set_req_set_header_dev_name(struct ethtool_linkmodes_set_req *req, - const char *dev_name) -{ - 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_linkmodes_set_req_set_header_flags(struct ethtool_linkmodes_set_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_linkmodes_set_req_set_autoneg(struct ethtool_linkmodes_set_req *req, - __u8 autoneg) -{ - req->_present.autoneg = 1; - req->autoneg = autoneg; -} -static inline void -ethtool_linkmodes_set_req_set_ours_nomask(struct ethtool_linkmodes_set_req *req) -{ - req->_present.ours = 1; - req->ours._present.nomask = 1; -} -static inline void -ethtool_linkmodes_set_req_set_ours_size(struct ethtool_linkmodes_set_req *req, - __u32 size) -{ - req->_present.ours = 1; - req->ours._present.size = 1; - req->ours.size = size; -} -static inline void -__ethtool_linkmodes_set_req_set_ours_bits_bit(struct ethtool_linkmodes_set_req *req, - struct ethtool_bitset_bit *bit, - unsigned int n_bit) -{ - free(req->ours.bits.bit); - req->ours.bits.bit = bit; - req->ours.bits.n_bit = n_bit; -} -static inline void -ethtool_linkmodes_set_req_set_peer_nomask(struct ethtool_linkmodes_set_req *req) -{ - req->_present.peer = 1; - req->peer._present.nomask = 1; -} -static inline void -ethtool_linkmodes_set_req_set_peer_size(struct ethtool_linkmodes_set_req *req, - __u32 size) -{ - req->_present.peer = 1; - req->peer._present.size = 1; - req->peer.size = size; -} -static inline void -__ethtool_linkmodes_set_req_set_peer_bits_bit(struct ethtool_linkmodes_set_req *req, - struct ethtool_bitset_bit *bit, - unsigned int n_bit) -{ - free(req->peer.bits.bit); - req->peer.bits.bit = bit; - req->peer.bits.n_bit = n_bit; -} -static inline void -ethtool_linkmodes_set_req_set_speed(struct ethtool_linkmodes_set_req *req, - __u32 speed) -{ - req->_present.speed = 1; - req->speed = speed; -} -static inline void -ethtool_linkmodes_set_req_set_duplex(struct ethtool_linkmodes_set_req *req, - __u8 duplex) -{ - req->_present.duplex = 1; - req->duplex = duplex; -} -static inline void -ethtool_linkmodes_set_req_set_master_slave_cfg(struct ethtool_linkmodes_set_req *req, - __u8 master_slave_cfg) -{ - req->_present.master_slave_cfg = 1; - req->master_slave_cfg = master_slave_cfg; -} -static inline void -ethtool_linkmodes_set_req_set_master_slave_state(struct ethtool_linkmodes_set_req *req, - __u8 master_slave_state) -{ - req->_present.master_slave_state = 1; - req->master_slave_state = master_slave_state; -} -static inline void -ethtool_linkmodes_set_req_set_lanes(struct ethtool_linkmodes_set_req *req, - __u32 lanes) -{ - req->_present.lanes = 1; - req->lanes = lanes; -} -static inline void -ethtool_linkmodes_set_req_set_rate_matching(struct ethtool_linkmodes_set_req *req, - __u8 rate_matching) -{ - req->_present.rate_matching = 1; - req->rate_matching = rate_matching; -} - -/* - * Set link modes. - */ -int ethtool_linkmodes_set(struct ynl_sock *ys, - struct ethtool_linkmodes_set_req *req); - -/* ============== ETHTOOL_MSG_LINKSTATE_GET ============== */ -/* ETHTOOL_MSG_LINKSTATE_GET - do */ -struct ethtool_linkstate_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_linkstate_get_req * -ethtool_linkstate_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_linkstate_get_req)); -} -void ethtool_linkstate_get_req_free(struct ethtool_linkstate_get_req *req); - -static inline void -ethtool_linkstate_get_req_set_header_dev_index(struct ethtool_linkstate_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_linkstate_get_req_set_header_dev_name(struct ethtool_linkstate_get_req *req, - const char *dev_name) -{ - 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_linkstate_get_req_set_header_flags(struct ethtool_linkstate_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_linkstate_get_rsp { - struct { - __u32 header:1; - __u32 link:1; - __u32 sqi:1; - __u32 sqi_max:1; - __u32 ext_state:1; - __u32 ext_substate:1; - __u32 ext_down_cnt:1; - } _present; - - struct ethtool_header header; - __u8 link; - __u32 sqi; - __u32 sqi_max; - __u8 ext_state; - __u8 ext_substate; - __u32 ext_down_cnt; -}; - -void ethtool_linkstate_get_rsp_free(struct ethtool_linkstate_get_rsp *rsp); - -/* - * Get link state. - */ -struct ethtool_linkstate_get_rsp * -ethtool_linkstate_get(struct ynl_sock *ys, - struct ethtool_linkstate_get_req *req); - -/* ETHTOOL_MSG_LINKSTATE_GET - dump */ -struct ethtool_linkstate_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_linkstate_get_req_dump * -ethtool_linkstate_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_linkstate_get_req_dump)); -} -void -ethtool_linkstate_get_req_dump_free(struct ethtool_linkstate_get_req_dump *req); - -static inline void -ethtool_linkstate_get_req_dump_set_header_dev_index(struct ethtool_linkstate_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_linkstate_get_req_dump_set_header_dev_name(struct ethtool_linkstate_get_req_dump *req, - const char *dev_name) -{ - 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_linkstate_get_req_dump_set_header_flags(struct ethtool_linkstate_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_linkstate_get_list { - struct ethtool_linkstate_get_list *next; - struct ethtool_linkstate_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_linkstate_get_list_free(struct ethtool_linkstate_get_list *rsp); - -struct ethtool_linkstate_get_list * -ethtool_linkstate_get_dump(struct ynl_sock *ys, - struct ethtool_linkstate_get_req_dump *req); - -/* ============== ETHTOOL_MSG_DEBUG_GET ============== */ -/* ETHTOOL_MSG_DEBUG_GET - do */ -struct ethtool_debug_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_debug_get_req *ethtool_debug_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_debug_get_req)); -} -void ethtool_debug_get_req_free(struct ethtool_debug_get_req *req); - -static inline void -ethtool_debug_get_req_set_header_dev_index(struct ethtool_debug_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_debug_get_req_set_header_dev_name(struct ethtool_debug_get_req *req, - const char *dev_name) -{ - 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_debug_get_req_set_header_flags(struct ethtool_debug_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_debug_get_rsp { - struct { - __u32 header:1; - __u32 msgmask:1; - } _present; - - struct ethtool_header header; - struct ethtool_bitset msgmask; -}; - -void ethtool_debug_get_rsp_free(struct ethtool_debug_get_rsp *rsp); - -/* - * Get debug message mask. - */ -struct ethtool_debug_get_rsp * -ethtool_debug_get(struct ynl_sock *ys, struct ethtool_debug_get_req *req); - -/* ETHTOOL_MSG_DEBUG_GET - dump */ -struct ethtool_debug_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_debug_get_req_dump * -ethtool_debug_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_debug_get_req_dump)); -} -void ethtool_debug_get_req_dump_free(struct ethtool_debug_get_req_dump *req); - -static inline void -ethtool_debug_get_req_dump_set_header_dev_index(struct ethtool_debug_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_debug_get_req_dump_set_header_dev_name(struct ethtool_debug_get_req_dump *req, - const char *dev_name) -{ - 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_debug_get_req_dump_set_header_flags(struct ethtool_debug_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_debug_get_list { - struct ethtool_debug_get_list *next; - struct ethtool_debug_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_debug_get_list_free(struct ethtool_debug_get_list *rsp); - -struct ethtool_debug_get_list * -ethtool_debug_get_dump(struct ynl_sock *ys, - struct ethtool_debug_get_req_dump *req); - -/* ETHTOOL_MSG_DEBUG_GET - notify */ -struct ethtool_debug_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_debug_get_ntf *ntf); - struct ethtool_debug_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_debug_get_ntf_free(struct ethtool_debug_get_ntf *rsp); - -/* ============== ETHTOOL_MSG_DEBUG_SET ============== */ -/* ETHTOOL_MSG_DEBUG_SET - do */ -struct ethtool_debug_set_req { - struct { - __u32 header:1; - __u32 msgmask:1; - } _present; - - struct ethtool_header header; - struct ethtool_bitset msgmask; -}; - -static inline struct ethtool_debug_set_req *ethtool_debug_set_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_debug_set_req)); -} -void ethtool_debug_set_req_free(struct ethtool_debug_set_req *req); - -static inline void -ethtool_debug_set_req_set_header_dev_index(struct ethtool_debug_set_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_debug_set_req_set_header_dev_name(struct ethtool_debug_set_req *req, - const char *dev_name) -{ - 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_debug_set_req_set_header_flags(struct ethtool_debug_set_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_debug_set_req_set_msgmask_nomask(struct ethtool_debug_set_req *req) -{ - req->_present.msgmask = 1; - req->msgmask._present.nomask = 1; -} -static inline void -ethtool_debug_set_req_set_msgmask_size(struct ethtool_debug_set_req *req, - __u32 size) -{ - req->_present.msgmask = 1; - req->msgmask._present.size = 1; - req->msgmask.size = size; -} -static inline void -__ethtool_debug_set_req_set_msgmask_bits_bit(struct ethtool_debug_set_req *req, - struct ethtool_bitset_bit *bit, - unsigned int n_bit) -{ - free(req->msgmask.bits.bit); - req->msgmask.bits.bit = bit; - req->msgmask.bits.n_bit = n_bit; -} - -/* - * Set debug message mask. - */ -int ethtool_debug_set(struct ynl_sock *ys, struct ethtool_debug_set_req *req); - -/* ============== ETHTOOL_MSG_WOL_GET ============== */ -/* ETHTOOL_MSG_WOL_GET - do */ -struct ethtool_wol_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_wol_get_req *ethtool_wol_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_wol_get_req)); -} -void ethtool_wol_get_req_free(struct ethtool_wol_get_req *req); - -static inline void -ethtool_wol_get_req_set_header_dev_index(struct ethtool_wol_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_wol_get_req_set_header_dev_name(struct ethtool_wol_get_req *req, - const char *dev_name) -{ - 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_wol_get_req_set_header_flags(struct ethtool_wol_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_wol_get_rsp { - struct { - __u32 header:1; - __u32 modes:1; - __u32 sopass_len; - } _present; - - struct ethtool_header header; - struct ethtool_bitset modes; - void *sopass; -}; - -void ethtool_wol_get_rsp_free(struct ethtool_wol_get_rsp *rsp); - -/* - * Get WOL params. - */ -struct ethtool_wol_get_rsp * -ethtool_wol_get(struct ynl_sock *ys, struct ethtool_wol_get_req *req); - -/* ETHTOOL_MSG_WOL_GET - dump */ -struct ethtool_wol_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_wol_get_req_dump * -ethtool_wol_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_wol_get_req_dump)); -} -void ethtool_wol_get_req_dump_free(struct ethtool_wol_get_req_dump *req); - -static inline void -ethtool_wol_get_req_dump_set_header_dev_index(struct ethtool_wol_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_wol_get_req_dump_set_header_dev_name(struct ethtool_wol_get_req_dump *req, - const char *dev_name) -{ - 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_wol_get_req_dump_set_header_flags(struct ethtool_wol_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_wol_get_list { - struct ethtool_wol_get_list *next; - struct ethtool_wol_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_wol_get_list_free(struct ethtool_wol_get_list *rsp); - -struct ethtool_wol_get_list * -ethtool_wol_get_dump(struct ynl_sock *ys, struct ethtool_wol_get_req_dump *req); - -/* ETHTOOL_MSG_WOL_GET - notify */ -struct ethtool_wol_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_wol_get_ntf *ntf); - struct ethtool_wol_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_wol_get_ntf_free(struct ethtool_wol_get_ntf *rsp); - -/* ============== ETHTOOL_MSG_WOL_SET ============== */ -/* ETHTOOL_MSG_WOL_SET - do */ -struct ethtool_wol_set_req { - struct { - __u32 header:1; - __u32 modes:1; - __u32 sopass_len; - } _present; - - struct ethtool_header header; - struct ethtool_bitset modes; - void *sopass; -}; - -static inline struct ethtool_wol_set_req *ethtool_wol_set_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_wol_set_req)); -} -void ethtool_wol_set_req_free(struct ethtool_wol_set_req *req); - -static inline void -ethtool_wol_set_req_set_header_dev_index(struct ethtool_wol_set_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_wol_set_req_set_header_dev_name(struct ethtool_wol_set_req *req, - const char *dev_name) -{ - 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_wol_set_req_set_header_flags(struct ethtool_wol_set_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_wol_set_req_set_modes_nomask(struct ethtool_wol_set_req *req) -{ - req->_present.modes = 1; - req->modes._present.nomask = 1; -} -static inline void -ethtool_wol_set_req_set_modes_size(struct ethtool_wol_set_req *req, __u32 size) -{ - req->_present.modes = 1; - req->modes._present.size = 1; - req->modes.size = size; -} -static inline void -__ethtool_wol_set_req_set_modes_bits_bit(struct ethtool_wol_set_req *req, - struct ethtool_bitset_bit *bit, - unsigned int n_bit) -{ - free(req->modes.bits.bit); - req->modes.bits.bit = bit; - req->modes.bits.n_bit = n_bit; -} -static inline void -ethtool_wol_set_req_set_sopass(struct ethtool_wol_set_req *req, - const void *sopass, size_t len) -{ - free(req->sopass); - req->_present.sopass_len = len; - req->sopass = malloc(req->_present.sopass_len); - memcpy(req->sopass, sopass, req->_present.sopass_len); -} - -/* - * Set WOL params. - */ -int ethtool_wol_set(struct ynl_sock *ys, struct ethtool_wol_set_req *req); - -/* ============== ETHTOOL_MSG_FEATURES_GET ============== */ -/* ETHTOOL_MSG_FEATURES_GET - do */ -struct ethtool_features_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_features_get_req * -ethtool_features_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_features_get_req)); -} -void ethtool_features_get_req_free(struct ethtool_features_get_req *req); - -static inline void -ethtool_features_get_req_set_header_dev_index(struct ethtool_features_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_features_get_req_set_header_dev_name(struct ethtool_features_get_req *req, - const char *dev_name) -{ - 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_features_get_req_set_header_flags(struct ethtool_features_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_features_get_rsp { - struct { - __u32 header:1; - __u32 hw:1; - __u32 wanted:1; - __u32 active:1; - __u32 nochange:1; - } _present; - - struct ethtool_header header; - struct ethtool_bitset hw; - struct ethtool_bitset wanted; - struct ethtool_bitset active; - struct ethtool_bitset nochange; -}; - -void ethtool_features_get_rsp_free(struct ethtool_features_get_rsp *rsp); - -/* - * Get features. - */ -struct ethtool_features_get_rsp * -ethtool_features_get(struct ynl_sock *ys, struct ethtool_features_get_req *req); - -/* ETHTOOL_MSG_FEATURES_GET - dump */ -struct ethtool_features_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_features_get_req_dump * -ethtool_features_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_features_get_req_dump)); -} -void -ethtool_features_get_req_dump_free(struct ethtool_features_get_req_dump *req); - -static inline void -ethtool_features_get_req_dump_set_header_dev_index(struct ethtool_features_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_features_get_req_dump_set_header_dev_name(struct ethtool_features_get_req_dump *req, - const char *dev_name) -{ - 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_features_get_req_dump_set_header_flags(struct ethtool_features_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_features_get_list { - struct ethtool_features_get_list *next; - struct ethtool_features_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_features_get_list_free(struct ethtool_features_get_list *rsp); - -struct ethtool_features_get_list * -ethtool_features_get_dump(struct ynl_sock *ys, - struct ethtool_features_get_req_dump *req); - -/* ETHTOOL_MSG_FEATURES_GET - notify */ -struct ethtool_features_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_features_get_ntf *ntf); - struct ethtool_features_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_features_get_ntf_free(struct ethtool_features_get_ntf *rsp); - -/* ============== ETHTOOL_MSG_FEATURES_SET ============== */ -/* ETHTOOL_MSG_FEATURES_SET - do */ -struct ethtool_features_set_req { - struct { - __u32 header:1; - __u32 hw:1; - __u32 wanted:1; - __u32 active:1; - __u32 nochange:1; - } _present; - - struct ethtool_header header; - struct ethtool_bitset hw; - struct ethtool_bitset wanted; - struct ethtool_bitset active; - struct ethtool_bitset nochange; -}; - -static inline struct ethtool_features_set_req * -ethtool_features_set_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_features_set_req)); -} -void ethtool_features_set_req_free(struct ethtool_features_set_req *req); - -static inline void -ethtool_features_set_req_set_header_dev_index(struct ethtool_features_set_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_features_set_req_set_header_dev_name(struct ethtool_features_set_req *req, - const char *dev_name) -{ - 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_features_set_req_set_header_flags(struct ethtool_features_set_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_features_set_req_set_hw_nomask(struct ethtool_features_set_req *req) -{ - req->_present.hw = 1; - req->hw._present.nomask = 1; -} -static inline void -ethtool_features_set_req_set_hw_size(struct ethtool_features_set_req *req, - __u32 size) -{ - req->_present.hw = 1; - req->hw._present.size = 1; - req->hw.size = size; -} -static inline void -__ethtool_features_set_req_set_hw_bits_bit(struct ethtool_features_set_req *req, - struct ethtool_bitset_bit *bit, - unsigned int n_bit) -{ - free(req->hw.bits.bit); - req->hw.bits.bit = bit; - req->hw.bits.n_bit = n_bit; -} -static inline void -ethtool_features_set_req_set_wanted_nomask(struct ethtool_features_set_req *req) -{ - req->_present.wanted = 1; - req->wanted._present.nomask = 1; -} -static inline void -ethtool_features_set_req_set_wanted_size(struct ethtool_features_set_req *req, - __u32 size) -{ - req->_present.wanted = 1; - req->wanted._present.size = 1; - req->wanted.size = size; -} -static inline void -__ethtool_features_set_req_set_wanted_bits_bit(struct ethtool_features_set_req *req, - struct ethtool_bitset_bit *bit, - unsigned int n_bit) -{ - free(req->wanted.bits.bit); - req->wanted.bits.bit = bit; - req->wanted.bits.n_bit = n_bit; -} -static inline void -ethtool_features_set_req_set_active_nomask(struct ethtool_features_set_req *req) -{ - req->_present.active = 1; - req->active._present.nomask = 1; -} -static inline void -ethtool_features_set_req_set_active_size(struct ethtool_features_set_req *req, - __u32 size) -{ - req->_present.active = 1; - req->active._present.size = 1; - req->active.size = size; -} -static inline void -__ethtool_features_set_req_set_active_bits_bit(struct ethtool_features_set_req *req, - struct ethtool_bitset_bit *bit, - unsigned int n_bit) -{ - free(req->active.bits.bit); - req->active.bits.bit = bit; - req->active.bits.n_bit = n_bit; -} -static inline void -ethtool_features_set_req_set_nochange_nomask(struct ethtool_features_set_req *req) -{ - req->_present.nochange = 1; - req->nochange._present.nomask = 1; -} -static inline void -ethtool_features_set_req_set_nochange_size(struct ethtool_features_set_req *req, - __u32 size) -{ - req->_present.nochange = 1; - req->nochange._present.size = 1; - req->nochange.size = size; -} -static inline void -__ethtool_features_set_req_set_nochange_bits_bit(struct ethtool_features_set_req *req, - struct ethtool_bitset_bit *bit, - unsigned int n_bit) -{ - free(req->nochange.bits.bit); - req->nochange.bits.bit = bit; - req->nochange.bits.n_bit = n_bit; -} - -struct ethtool_features_set_rsp { - struct { - __u32 header:1; - __u32 hw:1; - __u32 wanted:1; - __u32 active:1; - __u32 nochange:1; - } _present; - - struct ethtool_header header; - struct ethtool_bitset hw; - struct ethtool_bitset wanted; - struct ethtool_bitset active; - struct ethtool_bitset nochange; -}; - -void ethtool_features_set_rsp_free(struct ethtool_features_set_rsp *rsp); - -/* - * Set features. - */ -struct ethtool_features_set_rsp * -ethtool_features_set(struct ynl_sock *ys, struct ethtool_features_set_req *req); - -/* ============== ETHTOOL_MSG_PRIVFLAGS_GET ============== */ -/* ETHTOOL_MSG_PRIVFLAGS_GET - do */ -struct ethtool_privflags_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_privflags_get_req * -ethtool_privflags_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_privflags_get_req)); -} -void ethtool_privflags_get_req_free(struct ethtool_privflags_get_req *req); - -static inline void -ethtool_privflags_get_req_set_header_dev_index(struct ethtool_privflags_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_privflags_get_req_set_header_dev_name(struct ethtool_privflags_get_req *req, - const char *dev_name) -{ - 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_privflags_get_req_set_header_flags(struct ethtool_privflags_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_privflags_get_rsp { - struct { - __u32 header:1; - __u32 flags:1; - } _present; - - struct ethtool_header header; - struct ethtool_bitset flags; -}; - -void ethtool_privflags_get_rsp_free(struct ethtool_privflags_get_rsp *rsp); - -/* - * Get device private flags. - */ -struct ethtool_privflags_get_rsp * -ethtool_privflags_get(struct ynl_sock *ys, - struct ethtool_privflags_get_req *req); - -/* ETHTOOL_MSG_PRIVFLAGS_GET - dump */ -struct ethtool_privflags_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_privflags_get_req_dump * -ethtool_privflags_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_privflags_get_req_dump)); -} -void -ethtool_privflags_get_req_dump_free(struct ethtool_privflags_get_req_dump *req); - -static inline void -ethtool_privflags_get_req_dump_set_header_dev_index(struct ethtool_privflags_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_privflags_get_req_dump_set_header_dev_name(struct ethtool_privflags_get_req_dump *req, - const char *dev_name) -{ - 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_privflags_get_req_dump_set_header_flags(struct ethtool_privflags_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_privflags_get_list { - struct ethtool_privflags_get_list *next; - struct ethtool_privflags_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_privflags_get_list_free(struct ethtool_privflags_get_list *rsp); - -struct ethtool_privflags_get_list * -ethtool_privflags_get_dump(struct ynl_sock *ys, - struct ethtool_privflags_get_req_dump *req); - -/* ETHTOOL_MSG_PRIVFLAGS_GET - notify */ -struct ethtool_privflags_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_privflags_get_ntf *ntf); - struct ethtool_privflags_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_privflags_get_ntf_free(struct ethtool_privflags_get_ntf *rsp); - -/* ============== ETHTOOL_MSG_PRIVFLAGS_SET ============== */ -/* ETHTOOL_MSG_PRIVFLAGS_SET - do */ -struct ethtool_privflags_set_req { - struct { - __u32 header:1; - __u32 flags:1; - } _present; - - struct ethtool_header header; - struct ethtool_bitset flags; -}; - -static inline struct ethtool_privflags_set_req * -ethtool_privflags_set_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_privflags_set_req)); -} -void ethtool_privflags_set_req_free(struct ethtool_privflags_set_req *req); - -static inline void -ethtool_privflags_set_req_set_header_dev_index(struct ethtool_privflags_set_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_privflags_set_req_set_header_dev_name(struct ethtool_privflags_set_req *req, - const char *dev_name) -{ - 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_privflags_set_req_set_header_flags(struct ethtool_privflags_set_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_privflags_set_req_set_flags_nomask(struct ethtool_privflags_set_req *req) -{ - req->_present.flags = 1; - req->flags._present.nomask = 1; -} -static inline void -ethtool_privflags_set_req_set_flags_size(struct ethtool_privflags_set_req *req, - __u32 size) -{ - req->_present.flags = 1; - req->flags._present.size = 1; - req->flags.size = size; -} -static inline void -__ethtool_privflags_set_req_set_flags_bits_bit(struct ethtool_privflags_set_req *req, - struct ethtool_bitset_bit *bit, - unsigned int n_bit) -{ - free(req->flags.bits.bit); - req->flags.bits.bit = bit; - req->flags.bits.n_bit = n_bit; -} - -/* - * Set device private flags. - */ -int ethtool_privflags_set(struct ynl_sock *ys, - struct ethtool_privflags_set_req *req); - -/* ============== ETHTOOL_MSG_RINGS_GET ============== */ -/* ETHTOOL_MSG_RINGS_GET - do */ -struct ethtool_rings_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_rings_get_req *ethtool_rings_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_rings_get_req)); -} -void ethtool_rings_get_req_free(struct ethtool_rings_get_req *req); - -static inline void -ethtool_rings_get_req_set_header_dev_index(struct ethtool_rings_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_rings_get_req_set_header_dev_name(struct ethtool_rings_get_req *req, - const char *dev_name) -{ - 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_rings_get_req_set_header_flags(struct ethtool_rings_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_rings_get_rsp { - struct { - __u32 header:1; - __u32 rx_max:1; - __u32 rx_mini_max:1; - __u32 rx_jumbo_max:1; - __u32 tx_max:1; - __u32 rx:1; - __u32 rx_mini:1; - __u32 rx_jumbo:1; - __u32 tx:1; - __u32 rx_buf_len:1; - __u32 tcp_data_split:1; - __u32 cqe_size:1; - __u32 tx_push:1; - __u32 rx_push:1; - __u32 tx_push_buf_len:1; - __u32 tx_push_buf_len_max:1; - } _present; - - struct ethtool_header header; - __u32 rx_max; - __u32 rx_mini_max; - __u32 rx_jumbo_max; - __u32 tx_max; - __u32 rx; - __u32 rx_mini; - __u32 rx_jumbo; - __u32 tx; - __u32 rx_buf_len; - __u8 tcp_data_split; - __u32 cqe_size; - __u8 tx_push; - __u8 rx_push; - __u32 tx_push_buf_len; - __u32 tx_push_buf_len_max; -}; - -void ethtool_rings_get_rsp_free(struct ethtool_rings_get_rsp *rsp); - -/* - * Get ring params. - */ -struct ethtool_rings_get_rsp * -ethtool_rings_get(struct ynl_sock *ys, struct ethtool_rings_get_req *req); - -/* ETHTOOL_MSG_RINGS_GET - dump */ -struct ethtool_rings_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_rings_get_req_dump * -ethtool_rings_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_rings_get_req_dump)); -} -void ethtool_rings_get_req_dump_free(struct ethtool_rings_get_req_dump *req); - -static inline void -ethtool_rings_get_req_dump_set_header_dev_index(struct ethtool_rings_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_rings_get_req_dump_set_header_dev_name(struct ethtool_rings_get_req_dump *req, - const char *dev_name) -{ - 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_rings_get_req_dump_set_header_flags(struct ethtool_rings_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_rings_get_list { - struct ethtool_rings_get_list *next; - struct ethtool_rings_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_rings_get_list_free(struct ethtool_rings_get_list *rsp); - -struct ethtool_rings_get_list * -ethtool_rings_get_dump(struct ynl_sock *ys, - struct ethtool_rings_get_req_dump *req); - -/* ETHTOOL_MSG_RINGS_GET - notify */ -struct ethtool_rings_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_rings_get_ntf *ntf); - struct ethtool_rings_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_rings_get_ntf_free(struct ethtool_rings_get_ntf *rsp); - -/* ============== ETHTOOL_MSG_RINGS_SET ============== */ -/* ETHTOOL_MSG_RINGS_SET - do */ -struct ethtool_rings_set_req { - struct { - __u32 header:1; - __u32 rx_max:1; - __u32 rx_mini_max:1; - __u32 rx_jumbo_max:1; - __u32 tx_max:1; - __u32 rx:1; - __u32 rx_mini:1; - __u32 rx_jumbo:1; - __u32 tx:1; - __u32 rx_buf_len:1; - __u32 tcp_data_split:1; - __u32 cqe_size:1; - __u32 tx_push:1; - __u32 rx_push:1; - __u32 tx_push_buf_len:1; - __u32 tx_push_buf_len_max:1; - } _present; - - struct ethtool_header header; - __u32 rx_max; - __u32 rx_mini_max; - __u32 rx_jumbo_max; - __u32 tx_max; - __u32 rx; - __u32 rx_mini; - __u32 rx_jumbo; - __u32 tx; - __u32 rx_buf_len; - __u8 tcp_data_split; - __u32 cqe_size; - __u8 tx_push; - __u8 rx_push; - __u32 tx_push_buf_len; - __u32 tx_push_buf_len_max; -}; - -static inline struct ethtool_rings_set_req *ethtool_rings_set_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_rings_set_req)); -} -void ethtool_rings_set_req_free(struct ethtool_rings_set_req *req); - -static inline void -ethtool_rings_set_req_set_header_dev_index(struct ethtool_rings_set_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_rings_set_req_set_header_dev_name(struct ethtool_rings_set_req *req, - const char *dev_name) -{ - 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_rings_set_req_set_header_flags(struct ethtool_rings_set_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_rings_set_req_set_rx_max(struct ethtool_rings_set_req *req, - __u32 rx_max) -{ - req->_present.rx_max = 1; - req->rx_max = rx_max; -} -static inline void -ethtool_rings_set_req_set_rx_mini_max(struct ethtool_rings_set_req *req, - __u32 rx_mini_max) -{ - req->_present.rx_mini_max = 1; - req->rx_mini_max = rx_mini_max; -} -static inline void -ethtool_rings_set_req_set_rx_jumbo_max(struct ethtool_rings_set_req *req, - __u32 rx_jumbo_max) -{ - req->_present.rx_jumbo_max = 1; - req->rx_jumbo_max = rx_jumbo_max; -} -static inline void -ethtool_rings_set_req_set_tx_max(struct ethtool_rings_set_req *req, - __u32 tx_max) -{ - req->_present.tx_max = 1; - req->tx_max = tx_max; -} -static inline void -ethtool_rings_set_req_set_rx(struct ethtool_rings_set_req *req, __u32 rx) -{ - req->_present.rx = 1; - req->rx = rx; -} -static inline void -ethtool_rings_set_req_set_rx_mini(struct ethtool_rings_set_req *req, - __u32 rx_mini) -{ - req->_present.rx_mini = 1; - req->rx_mini = rx_mini; -} -static inline void -ethtool_rings_set_req_set_rx_jumbo(struct ethtool_rings_set_req *req, - __u32 rx_jumbo) -{ - req->_present.rx_jumbo = 1; - req->rx_jumbo = rx_jumbo; -} -static inline void -ethtool_rings_set_req_set_tx(struct ethtool_rings_set_req *req, __u32 tx) -{ - req->_present.tx = 1; - req->tx = tx; -} -static inline void -ethtool_rings_set_req_set_rx_buf_len(struct ethtool_rings_set_req *req, - __u32 rx_buf_len) -{ - req->_present.rx_buf_len = 1; - req->rx_buf_len = rx_buf_len; -} -static inline void -ethtool_rings_set_req_set_tcp_data_split(struct ethtool_rings_set_req *req, - __u8 tcp_data_split) -{ - req->_present.tcp_data_split = 1; - req->tcp_data_split = tcp_data_split; -} -static inline void -ethtool_rings_set_req_set_cqe_size(struct ethtool_rings_set_req *req, - __u32 cqe_size) -{ - req->_present.cqe_size = 1; - req->cqe_size = cqe_size; -} -static inline void -ethtool_rings_set_req_set_tx_push(struct ethtool_rings_set_req *req, - __u8 tx_push) -{ - req->_present.tx_push = 1; - req->tx_push = tx_push; -} -static inline void -ethtool_rings_set_req_set_rx_push(struct ethtool_rings_set_req *req, - __u8 rx_push) -{ - req->_present.rx_push = 1; - req->rx_push = rx_push; -} -static inline void -ethtool_rings_set_req_set_tx_push_buf_len(struct ethtool_rings_set_req *req, - __u32 tx_push_buf_len) -{ - req->_present.tx_push_buf_len = 1; - req->tx_push_buf_len = tx_push_buf_len; -} -static inline void -ethtool_rings_set_req_set_tx_push_buf_len_max(struct ethtool_rings_set_req *req, - __u32 tx_push_buf_len_max) -{ - req->_present.tx_push_buf_len_max = 1; - req->tx_push_buf_len_max = tx_push_buf_len_max; -} - -/* - * Set ring params. - */ -int ethtool_rings_set(struct ynl_sock *ys, struct ethtool_rings_set_req *req); - -/* ============== ETHTOOL_MSG_CHANNELS_GET ============== */ -/* ETHTOOL_MSG_CHANNELS_GET - do */ -struct ethtool_channels_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_channels_get_req * -ethtool_channels_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_channels_get_req)); -} -void ethtool_channels_get_req_free(struct ethtool_channels_get_req *req); - -static inline void -ethtool_channels_get_req_set_header_dev_index(struct ethtool_channels_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_channels_get_req_set_header_dev_name(struct ethtool_channels_get_req *req, - const char *dev_name) -{ - 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_channels_get_req_set_header_flags(struct ethtool_channels_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_channels_get_rsp { - struct { - __u32 header:1; - __u32 rx_max:1; - __u32 tx_max:1; - __u32 other_max:1; - __u32 combined_max:1; - __u32 rx_count:1; - __u32 tx_count:1; - __u32 other_count:1; - __u32 combined_count:1; - } _present; - - struct ethtool_header header; - __u32 rx_max; - __u32 tx_max; - __u32 other_max; - __u32 combined_max; - __u32 rx_count; - __u32 tx_count; - __u32 other_count; - __u32 combined_count; -}; - -void ethtool_channels_get_rsp_free(struct ethtool_channels_get_rsp *rsp); - -/* - * Get channel params. - */ -struct ethtool_channels_get_rsp * -ethtool_channels_get(struct ynl_sock *ys, struct ethtool_channels_get_req *req); - -/* ETHTOOL_MSG_CHANNELS_GET - dump */ -struct ethtool_channels_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_channels_get_req_dump * -ethtool_channels_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_channels_get_req_dump)); -} -void -ethtool_channels_get_req_dump_free(struct ethtool_channels_get_req_dump *req); - -static inline void -ethtool_channels_get_req_dump_set_header_dev_index(struct ethtool_channels_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_channels_get_req_dump_set_header_dev_name(struct ethtool_channels_get_req_dump *req, - const char *dev_name) -{ - 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_channels_get_req_dump_set_header_flags(struct ethtool_channels_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_channels_get_list { - struct ethtool_channels_get_list *next; - struct ethtool_channels_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_channels_get_list_free(struct ethtool_channels_get_list *rsp); - -struct ethtool_channels_get_list * -ethtool_channels_get_dump(struct ynl_sock *ys, - struct ethtool_channels_get_req_dump *req); - -/* ETHTOOL_MSG_CHANNELS_GET - notify */ -struct ethtool_channels_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_channels_get_ntf *ntf); - struct ethtool_channels_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_channels_get_ntf_free(struct ethtool_channels_get_ntf *rsp); - -/* ============== ETHTOOL_MSG_CHANNELS_SET ============== */ -/* ETHTOOL_MSG_CHANNELS_SET - do */ -struct ethtool_channels_set_req { - struct { - __u32 header:1; - __u32 rx_max:1; - __u32 tx_max:1; - __u32 other_max:1; - __u32 combined_max:1; - __u32 rx_count:1; - __u32 tx_count:1; - __u32 other_count:1; - __u32 combined_count:1; - } _present; - - struct ethtool_header header; - __u32 rx_max; - __u32 tx_max; - __u32 other_max; - __u32 combined_max; - __u32 rx_count; - __u32 tx_count; - __u32 other_count; - __u32 combined_count; -}; - -static inline struct ethtool_channels_set_req * -ethtool_channels_set_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_channels_set_req)); -} -void ethtool_channels_set_req_free(struct ethtool_channels_set_req *req); - -static inline void -ethtool_channels_set_req_set_header_dev_index(struct ethtool_channels_set_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_channels_set_req_set_header_dev_name(struct ethtool_channels_set_req *req, - const char *dev_name) -{ - 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_channels_set_req_set_header_flags(struct ethtool_channels_set_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_channels_set_req_set_rx_max(struct ethtool_channels_set_req *req, - __u32 rx_max) -{ - req->_present.rx_max = 1; - req->rx_max = rx_max; -} -static inline void -ethtool_channels_set_req_set_tx_max(struct ethtool_channels_set_req *req, - __u32 tx_max) -{ - req->_present.tx_max = 1; - req->tx_max = tx_max; -} -static inline void -ethtool_channels_set_req_set_other_max(struct ethtool_channels_set_req *req, - __u32 other_max) -{ - req->_present.other_max = 1; - req->other_max = other_max; -} -static inline void -ethtool_channels_set_req_set_combined_max(struct ethtool_channels_set_req *req, - __u32 combined_max) -{ - req->_present.combined_max = 1; - req->combined_max = combined_max; -} -static inline void -ethtool_channels_set_req_set_rx_count(struct ethtool_channels_set_req *req, - __u32 rx_count) -{ - req->_present.rx_count = 1; - req->rx_count = rx_count; -} -static inline void -ethtool_channels_set_req_set_tx_count(struct ethtool_channels_set_req *req, - __u32 tx_count) -{ - req->_present.tx_count = 1; - req->tx_count = tx_count; -} -static inline void -ethtool_channels_set_req_set_other_count(struct ethtool_channels_set_req *req, - __u32 other_count) -{ - req->_present.other_count = 1; - req->other_count = other_count; -} -static inline void -ethtool_channels_set_req_set_combined_count(struct ethtool_channels_set_req *req, - __u32 combined_count) -{ - req->_present.combined_count = 1; - req->combined_count = combined_count; -} - -/* - * Set channel params. - */ -int ethtool_channels_set(struct ynl_sock *ys, - struct ethtool_channels_set_req *req); - -/* ============== ETHTOOL_MSG_COALESCE_GET ============== */ -/* ETHTOOL_MSG_COALESCE_GET - do */ -struct ethtool_coalesce_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_coalesce_get_req * -ethtool_coalesce_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_coalesce_get_req)); -} -void ethtool_coalesce_get_req_free(struct ethtool_coalesce_get_req *req); - -static inline void -ethtool_coalesce_get_req_set_header_dev_index(struct ethtool_coalesce_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_coalesce_get_req_set_header_dev_name(struct ethtool_coalesce_get_req *req, - const char *dev_name) -{ - 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_coalesce_get_req_set_header_flags(struct ethtool_coalesce_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_coalesce_get_rsp { - struct { - __u32 header:1; - __u32 rx_usecs:1; - __u32 rx_max_frames:1; - __u32 rx_usecs_irq:1; - __u32 rx_max_frames_irq:1; - __u32 tx_usecs:1; - __u32 tx_max_frames:1; - __u32 tx_usecs_irq:1; - __u32 tx_max_frames_irq:1; - __u32 stats_block_usecs:1; - __u32 use_adaptive_rx:1; - __u32 use_adaptive_tx:1; - __u32 pkt_rate_low:1; - __u32 rx_usecs_low:1; - __u32 rx_max_frames_low:1; - __u32 tx_usecs_low:1; - __u32 tx_max_frames_low:1; - __u32 pkt_rate_high:1; - __u32 rx_usecs_high:1; - __u32 rx_max_frames_high:1; - __u32 tx_usecs_high:1; - __u32 tx_max_frames_high:1; - __u32 rate_sample_interval:1; - __u32 use_cqe_mode_tx:1; - __u32 use_cqe_mode_rx:1; - __u32 tx_aggr_max_bytes:1; - __u32 tx_aggr_max_frames:1; - __u32 tx_aggr_time_usecs:1; - } _present; - - struct ethtool_header header; - __u32 rx_usecs; - __u32 rx_max_frames; - __u32 rx_usecs_irq; - __u32 rx_max_frames_irq; - __u32 tx_usecs; - __u32 tx_max_frames; - __u32 tx_usecs_irq; - __u32 tx_max_frames_irq; - __u32 stats_block_usecs; - __u8 use_adaptive_rx; - __u8 use_adaptive_tx; - __u32 pkt_rate_low; - __u32 rx_usecs_low; - __u32 rx_max_frames_low; - __u32 tx_usecs_low; - __u32 tx_max_frames_low; - __u32 pkt_rate_high; - __u32 rx_usecs_high; - __u32 rx_max_frames_high; - __u32 tx_usecs_high; - __u32 tx_max_frames_high; - __u32 rate_sample_interval; - __u8 use_cqe_mode_tx; - __u8 use_cqe_mode_rx; - __u32 tx_aggr_max_bytes; - __u32 tx_aggr_max_frames; - __u32 tx_aggr_time_usecs; -}; - -void ethtool_coalesce_get_rsp_free(struct ethtool_coalesce_get_rsp *rsp); - -/* - * Get coalesce params. - */ -struct ethtool_coalesce_get_rsp * -ethtool_coalesce_get(struct ynl_sock *ys, struct ethtool_coalesce_get_req *req); - -/* ETHTOOL_MSG_COALESCE_GET - dump */ -struct ethtool_coalesce_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_coalesce_get_req_dump * -ethtool_coalesce_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_coalesce_get_req_dump)); -} -void -ethtool_coalesce_get_req_dump_free(struct ethtool_coalesce_get_req_dump *req); - -static inline void -ethtool_coalesce_get_req_dump_set_header_dev_index(struct ethtool_coalesce_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_coalesce_get_req_dump_set_header_dev_name(struct ethtool_coalesce_get_req_dump *req, - const char *dev_name) -{ - 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_coalesce_get_req_dump_set_header_flags(struct ethtool_coalesce_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_coalesce_get_list { - struct ethtool_coalesce_get_list *next; - struct ethtool_coalesce_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_coalesce_get_list_free(struct ethtool_coalesce_get_list *rsp); - -struct ethtool_coalesce_get_list * -ethtool_coalesce_get_dump(struct ynl_sock *ys, - struct ethtool_coalesce_get_req_dump *req); - -/* ETHTOOL_MSG_COALESCE_GET - notify */ -struct ethtool_coalesce_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_coalesce_get_ntf *ntf); - struct ethtool_coalesce_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_coalesce_get_ntf_free(struct ethtool_coalesce_get_ntf *rsp); - -/* ============== ETHTOOL_MSG_COALESCE_SET ============== */ -/* ETHTOOL_MSG_COALESCE_SET - do */ -struct ethtool_coalesce_set_req { - struct { - __u32 header:1; - __u32 rx_usecs:1; - __u32 rx_max_frames:1; - __u32 rx_usecs_irq:1; - __u32 rx_max_frames_irq:1; - __u32 tx_usecs:1; - __u32 tx_max_frames:1; - __u32 tx_usecs_irq:1; - __u32 tx_max_frames_irq:1; - __u32 stats_block_usecs:1; - __u32 use_adaptive_rx:1; - __u32 use_adaptive_tx:1; - __u32 pkt_rate_low:1; - __u32 rx_usecs_low:1; - __u32 rx_max_frames_low:1; - __u32 tx_usecs_low:1; - __u32 tx_max_frames_low:1; - __u32 pkt_rate_high:1; - __u32 rx_usecs_high:1; - __u32 rx_max_frames_high:1; - __u32 tx_usecs_high:1; - __u32 tx_max_frames_high:1; - __u32 rate_sample_interval:1; - __u32 use_cqe_mode_tx:1; - __u32 use_cqe_mode_rx:1; - __u32 tx_aggr_max_bytes:1; - __u32 tx_aggr_max_frames:1; - __u32 tx_aggr_time_usecs:1; - } _present; - - struct ethtool_header header; - __u32 rx_usecs; - __u32 rx_max_frames; - __u32 rx_usecs_irq; - __u32 rx_max_frames_irq; - __u32 tx_usecs; - __u32 tx_max_frames; - __u32 tx_usecs_irq; - __u32 tx_max_frames_irq; - __u32 stats_block_usecs; - __u8 use_adaptive_rx; - __u8 use_adaptive_tx; - __u32 pkt_rate_low; - __u32 rx_usecs_low; - __u32 rx_max_frames_low; - __u32 tx_usecs_low; - __u32 tx_max_frames_low; - __u32 pkt_rate_high; - __u32 rx_usecs_high; - __u32 rx_max_frames_high; - __u32 tx_usecs_high; - __u32 tx_max_frames_high; - __u32 rate_sample_interval; - __u8 use_cqe_mode_tx; - __u8 use_cqe_mode_rx; - __u32 tx_aggr_max_bytes; - __u32 tx_aggr_max_frames; - __u32 tx_aggr_time_usecs; -}; - -static inline struct ethtool_coalesce_set_req * -ethtool_coalesce_set_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_coalesce_set_req)); -} -void ethtool_coalesce_set_req_free(struct ethtool_coalesce_set_req *req); - -static inline void -ethtool_coalesce_set_req_set_header_dev_index(struct ethtool_coalesce_set_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_coalesce_set_req_set_header_dev_name(struct ethtool_coalesce_set_req *req, - const char *dev_name) -{ - 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_coalesce_set_req_set_header_flags(struct ethtool_coalesce_set_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_coalesce_set_req_set_rx_usecs(struct ethtool_coalesce_set_req *req, - __u32 rx_usecs) -{ - req->_present.rx_usecs = 1; - req->rx_usecs = rx_usecs; -} -static inline void -ethtool_coalesce_set_req_set_rx_max_frames(struct ethtool_coalesce_set_req *req, - __u32 rx_max_frames) -{ - req->_present.rx_max_frames = 1; - req->rx_max_frames = rx_max_frames; -} -static inline void -ethtool_coalesce_set_req_set_rx_usecs_irq(struct ethtool_coalesce_set_req *req, - __u32 rx_usecs_irq) -{ - req->_present.rx_usecs_irq = 1; - req->rx_usecs_irq = rx_usecs_irq; -} -static inline void -ethtool_coalesce_set_req_set_rx_max_frames_irq(struct ethtool_coalesce_set_req *req, - __u32 rx_max_frames_irq) -{ - req->_present.rx_max_frames_irq = 1; - req->rx_max_frames_irq = rx_max_frames_irq; -} -static inline void -ethtool_coalesce_set_req_set_tx_usecs(struct ethtool_coalesce_set_req *req, - __u32 tx_usecs) -{ - req->_present.tx_usecs = 1; - req->tx_usecs = tx_usecs; -} -static inline void -ethtool_coalesce_set_req_set_tx_max_frames(struct ethtool_coalesce_set_req *req, - __u32 tx_max_frames) -{ - req->_present.tx_max_frames = 1; - req->tx_max_frames = tx_max_frames; -} -static inline void -ethtool_coalesce_set_req_set_tx_usecs_irq(struct ethtool_coalesce_set_req *req, - __u32 tx_usecs_irq) -{ - req->_present.tx_usecs_irq = 1; - req->tx_usecs_irq = tx_usecs_irq; -} -static inline void -ethtool_coalesce_set_req_set_tx_max_frames_irq(struct ethtool_coalesce_set_req *req, - __u32 tx_max_frames_irq) -{ - req->_present.tx_max_frames_irq = 1; - req->tx_max_frames_irq = tx_max_frames_irq; -} -static inline void -ethtool_coalesce_set_req_set_stats_block_usecs(struct ethtool_coalesce_set_req *req, - __u32 stats_block_usecs) -{ - req->_present.stats_block_usecs = 1; - req->stats_block_usecs = stats_block_usecs; -} -static inline void -ethtool_coalesce_set_req_set_use_adaptive_rx(struct ethtool_coalesce_set_req *req, - __u8 use_adaptive_rx) -{ - req->_present.use_adaptive_rx = 1; - req->use_adaptive_rx = use_adaptive_rx; -} -static inline void -ethtool_coalesce_set_req_set_use_adaptive_tx(struct ethtool_coalesce_set_req *req, - __u8 use_adaptive_tx) -{ - req->_present.use_adaptive_tx = 1; - req->use_adaptive_tx = use_adaptive_tx; -} -static inline void -ethtool_coalesce_set_req_set_pkt_rate_low(struct ethtool_coalesce_set_req *req, - __u32 pkt_rate_low) -{ - req->_present.pkt_rate_low = 1; - req->pkt_rate_low = pkt_rate_low; -} -static inline void -ethtool_coalesce_set_req_set_rx_usecs_low(struct ethtool_coalesce_set_req *req, - __u32 rx_usecs_low) -{ - req->_present.rx_usecs_low = 1; - req->rx_usecs_low = rx_usecs_low; -} -static inline void -ethtool_coalesce_set_req_set_rx_max_frames_low(struct ethtool_coalesce_set_req *req, - __u32 rx_max_frames_low) -{ - req->_present.rx_max_frames_low = 1; - req->rx_max_frames_low = rx_max_frames_low; -} -static inline void -ethtool_coalesce_set_req_set_tx_usecs_low(struct ethtool_coalesce_set_req *req, - __u32 tx_usecs_low) -{ - req->_present.tx_usecs_low = 1; - req->tx_usecs_low = tx_usecs_low; -} -static inline void -ethtool_coalesce_set_req_set_tx_max_frames_low(struct ethtool_coalesce_set_req *req, - __u32 tx_max_frames_low) -{ - req->_present.tx_max_frames_low = 1; - req->tx_max_frames_low = tx_max_frames_low; -} -static inline void -ethtool_coalesce_set_req_set_pkt_rate_high(struct ethtool_coalesce_set_req *req, - __u32 pkt_rate_high) -{ - req->_present.pkt_rate_high = 1; - req->pkt_rate_high = pkt_rate_high; -} -static inline void -ethtool_coalesce_set_req_set_rx_usecs_high(struct ethtool_coalesce_set_req *req, - __u32 rx_usecs_high) -{ - req->_present.rx_usecs_high = 1; - req->rx_usecs_high = rx_usecs_high; -} -static inline void -ethtool_coalesce_set_req_set_rx_max_frames_high(struct ethtool_coalesce_set_req *req, - __u32 rx_max_frames_high) -{ - req->_present.rx_max_frames_high = 1; - req->rx_max_frames_high = rx_max_frames_high; -} -static inline void -ethtool_coalesce_set_req_set_tx_usecs_high(struct ethtool_coalesce_set_req *req, - __u32 tx_usecs_high) -{ - req->_present.tx_usecs_high = 1; - req->tx_usecs_high = tx_usecs_high; -} -static inline void -ethtool_coalesce_set_req_set_tx_max_frames_high(struct ethtool_coalesce_set_req *req, - __u32 tx_max_frames_high) -{ - req->_present.tx_max_frames_high = 1; - req->tx_max_frames_high = tx_max_frames_high; -} -static inline void -ethtool_coalesce_set_req_set_rate_sample_interval(struct ethtool_coalesce_set_req *req, - __u32 rate_sample_interval) -{ - req->_present.rate_sample_interval = 1; - req->rate_sample_interval = rate_sample_interval; -} -static inline void -ethtool_coalesce_set_req_set_use_cqe_mode_tx(struct ethtool_coalesce_set_req *req, - __u8 use_cqe_mode_tx) -{ - req->_present.use_cqe_mode_tx = 1; - req->use_cqe_mode_tx = use_cqe_mode_tx; -} -static inline void -ethtool_coalesce_set_req_set_use_cqe_mode_rx(struct ethtool_coalesce_set_req *req, - __u8 use_cqe_mode_rx) -{ - req->_present.use_cqe_mode_rx = 1; - req->use_cqe_mode_rx = use_cqe_mode_rx; -} -static inline void -ethtool_coalesce_set_req_set_tx_aggr_max_bytes(struct ethtool_coalesce_set_req *req, - __u32 tx_aggr_max_bytes) -{ - req->_present.tx_aggr_max_bytes = 1; - req->tx_aggr_max_bytes = tx_aggr_max_bytes; -} -static inline void -ethtool_coalesce_set_req_set_tx_aggr_max_frames(struct ethtool_coalesce_set_req *req, - __u32 tx_aggr_max_frames) -{ - req->_present.tx_aggr_max_frames = 1; - req->tx_aggr_max_frames = tx_aggr_max_frames; -} -static inline void -ethtool_coalesce_set_req_set_tx_aggr_time_usecs(struct ethtool_coalesce_set_req *req, - __u32 tx_aggr_time_usecs) -{ - req->_present.tx_aggr_time_usecs = 1; - req->tx_aggr_time_usecs = tx_aggr_time_usecs; -} - -/* - * Set coalesce params. - */ -int ethtool_coalesce_set(struct ynl_sock *ys, - struct ethtool_coalesce_set_req *req); - -/* ============== ETHTOOL_MSG_PAUSE_GET ============== */ -/* ETHTOOL_MSG_PAUSE_GET - do */ -struct ethtool_pause_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_pause_get_req *ethtool_pause_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_pause_get_req)); -} -void ethtool_pause_get_req_free(struct ethtool_pause_get_req *req); - -static inline void -ethtool_pause_get_req_set_header_dev_index(struct ethtool_pause_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_pause_get_req_set_header_dev_name(struct ethtool_pause_get_req *req, - const char *dev_name) -{ - 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_pause_get_req_set_header_flags(struct ethtool_pause_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_pause_get_rsp { - struct { - __u32 header:1; - __u32 autoneg:1; - __u32 rx:1; - __u32 tx:1; - __u32 stats:1; - __u32 stats_src:1; - } _present; - - struct ethtool_header header; - __u8 autoneg; - __u8 rx; - __u8 tx; - struct ethtool_pause_stat stats; - __u32 stats_src; -}; - -void ethtool_pause_get_rsp_free(struct ethtool_pause_get_rsp *rsp); - -/* - * Get pause params. - */ -struct ethtool_pause_get_rsp * -ethtool_pause_get(struct ynl_sock *ys, struct ethtool_pause_get_req *req); - -/* ETHTOOL_MSG_PAUSE_GET - dump */ -struct ethtool_pause_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_pause_get_req_dump * -ethtool_pause_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_pause_get_req_dump)); -} -void ethtool_pause_get_req_dump_free(struct ethtool_pause_get_req_dump *req); - -static inline void -ethtool_pause_get_req_dump_set_header_dev_index(struct ethtool_pause_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_pause_get_req_dump_set_header_dev_name(struct ethtool_pause_get_req_dump *req, - const char *dev_name) -{ - 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_pause_get_req_dump_set_header_flags(struct ethtool_pause_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_pause_get_list { - struct ethtool_pause_get_list *next; - struct ethtool_pause_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_pause_get_list_free(struct ethtool_pause_get_list *rsp); - -struct ethtool_pause_get_list * -ethtool_pause_get_dump(struct ynl_sock *ys, - struct ethtool_pause_get_req_dump *req); - -/* ETHTOOL_MSG_PAUSE_GET - notify */ -struct ethtool_pause_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_pause_get_ntf *ntf); - struct ethtool_pause_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_pause_get_ntf_free(struct ethtool_pause_get_ntf *rsp); - -/* ============== ETHTOOL_MSG_PAUSE_SET ============== */ -/* ETHTOOL_MSG_PAUSE_SET - do */ -struct ethtool_pause_set_req { - struct { - __u32 header:1; - __u32 autoneg:1; - __u32 rx:1; - __u32 tx:1; - __u32 stats:1; - __u32 stats_src:1; - } _present; - - struct ethtool_header header; - __u8 autoneg; - __u8 rx; - __u8 tx; - struct ethtool_pause_stat stats; - __u32 stats_src; -}; - -static inline struct ethtool_pause_set_req *ethtool_pause_set_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_pause_set_req)); -} -void ethtool_pause_set_req_free(struct ethtool_pause_set_req *req); - -static inline void -ethtool_pause_set_req_set_header_dev_index(struct ethtool_pause_set_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_pause_set_req_set_header_dev_name(struct ethtool_pause_set_req *req, - const char *dev_name) -{ - 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_pause_set_req_set_header_flags(struct ethtool_pause_set_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_pause_set_req_set_autoneg(struct ethtool_pause_set_req *req, - __u8 autoneg) -{ - req->_present.autoneg = 1; - req->autoneg = autoneg; -} -static inline void -ethtool_pause_set_req_set_rx(struct ethtool_pause_set_req *req, __u8 rx) -{ - req->_present.rx = 1; - req->rx = rx; -} -static inline void -ethtool_pause_set_req_set_tx(struct ethtool_pause_set_req *req, __u8 tx) -{ - req->_present.tx = 1; - req->tx = tx; -} -static inline void -ethtool_pause_set_req_set_stats_tx_frames(struct ethtool_pause_set_req *req, - __u64 tx_frames) -{ - req->_present.stats = 1; - req->stats._present.tx_frames = 1; - req->stats.tx_frames = tx_frames; -} -static inline void -ethtool_pause_set_req_set_stats_rx_frames(struct ethtool_pause_set_req *req, - __u64 rx_frames) -{ - req->_present.stats = 1; - req->stats._present.rx_frames = 1; - req->stats.rx_frames = rx_frames; -} -static inline void -ethtool_pause_set_req_set_stats_src(struct ethtool_pause_set_req *req, - __u32 stats_src) -{ - req->_present.stats_src = 1; - req->stats_src = stats_src; -} - -/* - * Set pause params. - */ -int ethtool_pause_set(struct ynl_sock *ys, struct ethtool_pause_set_req *req); - -/* ============== ETHTOOL_MSG_EEE_GET ============== */ -/* ETHTOOL_MSG_EEE_GET - do */ -struct ethtool_eee_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_eee_get_req *ethtool_eee_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_eee_get_req)); -} -void ethtool_eee_get_req_free(struct ethtool_eee_get_req *req); - -static inline void -ethtool_eee_get_req_set_header_dev_index(struct ethtool_eee_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_eee_get_req_set_header_dev_name(struct ethtool_eee_get_req *req, - const char *dev_name) -{ - 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_eee_get_req_set_header_flags(struct ethtool_eee_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_eee_get_rsp { - struct { - __u32 header:1; - __u32 modes_ours:1; - __u32 modes_peer:1; - __u32 active:1; - __u32 enabled:1; - __u32 tx_lpi_enabled:1; - __u32 tx_lpi_timer:1; - } _present; - - struct ethtool_header header; - struct ethtool_bitset modes_ours; - struct ethtool_bitset modes_peer; - __u8 active; - __u8 enabled; - __u8 tx_lpi_enabled; - __u32 tx_lpi_timer; -}; - -void ethtool_eee_get_rsp_free(struct ethtool_eee_get_rsp *rsp); - -/* - * Get eee params. - */ -struct ethtool_eee_get_rsp * -ethtool_eee_get(struct ynl_sock *ys, struct ethtool_eee_get_req *req); - -/* ETHTOOL_MSG_EEE_GET - dump */ -struct ethtool_eee_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_eee_get_req_dump * -ethtool_eee_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_eee_get_req_dump)); -} -void ethtool_eee_get_req_dump_free(struct ethtool_eee_get_req_dump *req); - -static inline void -ethtool_eee_get_req_dump_set_header_dev_index(struct ethtool_eee_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_eee_get_req_dump_set_header_dev_name(struct ethtool_eee_get_req_dump *req, - const char *dev_name) -{ - 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_eee_get_req_dump_set_header_flags(struct ethtool_eee_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_eee_get_list { - struct ethtool_eee_get_list *next; - struct ethtool_eee_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_eee_get_list_free(struct ethtool_eee_get_list *rsp); - -struct ethtool_eee_get_list * -ethtool_eee_get_dump(struct ynl_sock *ys, struct ethtool_eee_get_req_dump *req); - -/* ETHTOOL_MSG_EEE_GET - notify */ -struct ethtool_eee_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_eee_get_ntf *ntf); - struct ethtool_eee_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_eee_get_ntf_free(struct ethtool_eee_get_ntf *rsp); - -/* ============== ETHTOOL_MSG_EEE_SET ============== */ -/* ETHTOOL_MSG_EEE_SET - do */ -struct ethtool_eee_set_req { - struct { - __u32 header:1; - __u32 modes_ours:1; - __u32 modes_peer:1; - __u32 active:1; - __u32 enabled:1; - __u32 tx_lpi_enabled:1; - __u32 tx_lpi_timer:1; - } _present; - - struct ethtool_header header; - struct ethtool_bitset modes_ours; - struct ethtool_bitset modes_peer; - __u8 active; - __u8 enabled; - __u8 tx_lpi_enabled; - __u32 tx_lpi_timer; -}; - -static inline struct ethtool_eee_set_req *ethtool_eee_set_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_eee_set_req)); -} -void ethtool_eee_set_req_free(struct ethtool_eee_set_req *req); - -static inline void -ethtool_eee_set_req_set_header_dev_index(struct ethtool_eee_set_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_eee_set_req_set_header_dev_name(struct ethtool_eee_set_req *req, - const char *dev_name) -{ - 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_eee_set_req_set_header_flags(struct ethtool_eee_set_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_eee_set_req_set_modes_ours_nomask(struct ethtool_eee_set_req *req) -{ - req->_present.modes_ours = 1; - req->modes_ours._present.nomask = 1; -} -static inline void -ethtool_eee_set_req_set_modes_ours_size(struct ethtool_eee_set_req *req, - __u32 size) -{ - req->_present.modes_ours = 1; - req->modes_ours._present.size = 1; - req->modes_ours.size = size; -} -static inline void -__ethtool_eee_set_req_set_modes_ours_bits_bit(struct ethtool_eee_set_req *req, - struct ethtool_bitset_bit *bit, - unsigned int n_bit) -{ - free(req->modes_ours.bits.bit); - req->modes_ours.bits.bit = bit; - req->modes_ours.bits.n_bit = n_bit; -} -static inline void -ethtool_eee_set_req_set_modes_peer_nomask(struct ethtool_eee_set_req *req) -{ - req->_present.modes_peer = 1; - req->modes_peer._present.nomask = 1; -} -static inline void -ethtool_eee_set_req_set_modes_peer_size(struct ethtool_eee_set_req *req, - __u32 size) -{ - req->_present.modes_peer = 1; - req->modes_peer._present.size = 1; - req->modes_peer.size = size; -} -static inline void -__ethtool_eee_set_req_set_modes_peer_bits_bit(struct ethtool_eee_set_req *req, - struct ethtool_bitset_bit *bit, - unsigned int n_bit) -{ - free(req->modes_peer.bits.bit); - req->modes_peer.bits.bit = bit; - req->modes_peer.bits.n_bit = n_bit; -} -static inline void -ethtool_eee_set_req_set_active(struct ethtool_eee_set_req *req, __u8 active) -{ - req->_present.active = 1; - req->active = active; -} -static inline void -ethtool_eee_set_req_set_enabled(struct ethtool_eee_set_req *req, __u8 enabled) -{ - req->_present.enabled = 1; - req->enabled = enabled; -} -static inline void -ethtool_eee_set_req_set_tx_lpi_enabled(struct ethtool_eee_set_req *req, - __u8 tx_lpi_enabled) -{ - req->_present.tx_lpi_enabled = 1; - req->tx_lpi_enabled = tx_lpi_enabled; -} -static inline void -ethtool_eee_set_req_set_tx_lpi_timer(struct ethtool_eee_set_req *req, - __u32 tx_lpi_timer) -{ - req->_present.tx_lpi_timer = 1; - req->tx_lpi_timer = tx_lpi_timer; -} - -/* - * Set eee params. - */ -int ethtool_eee_set(struct ynl_sock *ys, struct ethtool_eee_set_req *req); - -/* ============== ETHTOOL_MSG_TSINFO_GET ============== */ -/* ETHTOOL_MSG_TSINFO_GET - do */ -struct ethtool_tsinfo_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_tsinfo_get_req *ethtool_tsinfo_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_tsinfo_get_req)); -} -void ethtool_tsinfo_get_req_free(struct ethtool_tsinfo_get_req *req); - -static inline void -ethtool_tsinfo_get_req_set_header_dev_index(struct ethtool_tsinfo_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_tsinfo_get_req_set_header_dev_name(struct ethtool_tsinfo_get_req *req, - const char *dev_name) -{ - 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_tsinfo_get_req_set_header_flags(struct ethtool_tsinfo_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_tsinfo_get_rsp { - struct { - __u32 header:1; - __u32 timestamping:1; - __u32 tx_types:1; - __u32 rx_filters:1; - __u32 phc_index:1; - } _present; - - struct ethtool_header header; - struct ethtool_bitset timestamping; - struct ethtool_bitset tx_types; - struct ethtool_bitset rx_filters; - __u32 phc_index; -}; - -void ethtool_tsinfo_get_rsp_free(struct ethtool_tsinfo_get_rsp *rsp); - -/* - * Get tsinfo params. - */ -struct ethtool_tsinfo_get_rsp * -ethtool_tsinfo_get(struct ynl_sock *ys, struct ethtool_tsinfo_get_req *req); - -/* ETHTOOL_MSG_TSINFO_GET - dump */ -struct ethtool_tsinfo_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_tsinfo_get_req_dump * -ethtool_tsinfo_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_tsinfo_get_req_dump)); -} -void ethtool_tsinfo_get_req_dump_free(struct ethtool_tsinfo_get_req_dump *req); - -static inline void -ethtool_tsinfo_get_req_dump_set_header_dev_index(struct ethtool_tsinfo_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_tsinfo_get_req_dump_set_header_dev_name(struct ethtool_tsinfo_get_req_dump *req, - const char *dev_name) -{ - 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_tsinfo_get_req_dump_set_header_flags(struct ethtool_tsinfo_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_tsinfo_get_list { - struct ethtool_tsinfo_get_list *next; - struct ethtool_tsinfo_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_tsinfo_get_list_free(struct ethtool_tsinfo_get_list *rsp); - -struct ethtool_tsinfo_get_list * -ethtool_tsinfo_get_dump(struct ynl_sock *ys, - struct ethtool_tsinfo_get_req_dump *req); - -/* ============== ETHTOOL_MSG_CABLE_TEST_ACT ============== */ -/* ETHTOOL_MSG_CABLE_TEST_ACT - do */ -struct ethtool_cable_test_act_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_cable_test_act_req * -ethtool_cable_test_act_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_cable_test_act_req)); -} -void ethtool_cable_test_act_req_free(struct ethtool_cable_test_act_req *req); - -static inline void -ethtool_cable_test_act_req_set_header_dev_index(struct ethtool_cable_test_act_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_cable_test_act_req_set_header_dev_name(struct ethtool_cable_test_act_req *req, - const char *dev_name) -{ - 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_cable_test_act_req_set_header_flags(struct ethtool_cable_test_act_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -/* - * Cable test. - */ -int ethtool_cable_test_act(struct ynl_sock *ys, - struct ethtool_cable_test_act_req *req); - -/* ============== ETHTOOL_MSG_CABLE_TEST_TDR_ACT ============== */ -/* ETHTOOL_MSG_CABLE_TEST_TDR_ACT - do */ -struct ethtool_cable_test_tdr_act_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_cable_test_tdr_act_req * -ethtool_cable_test_tdr_act_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_cable_test_tdr_act_req)); -} -void -ethtool_cable_test_tdr_act_req_free(struct ethtool_cable_test_tdr_act_req *req); - -static inline void -ethtool_cable_test_tdr_act_req_set_header_dev_index(struct ethtool_cable_test_tdr_act_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_cable_test_tdr_act_req_set_header_dev_name(struct ethtool_cable_test_tdr_act_req *req, - const char *dev_name) -{ - 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_cable_test_tdr_act_req_set_header_flags(struct ethtool_cable_test_tdr_act_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -/* - * Cable test TDR. - */ -int ethtool_cable_test_tdr_act(struct ynl_sock *ys, - struct ethtool_cable_test_tdr_act_req *req); - -/* ============== ETHTOOL_MSG_TUNNEL_INFO_GET ============== */ -/* ETHTOOL_MSG_TUNNEL_INFO_GET - do */ -struct ethtool_tunnel_info_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_tunnel_info_get_req * -ethtool_tunnel_info_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_tunnel_info_get_req)); -} -void ethtool_tunnel_info_get_req_free(struct ethtool_tunnel_info_get_req *req); - -static inline void -ethtool_tunnel_info_get_req_set_header_dev_index(struct ethtool_tunnel_info_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_tunnel_info_get_req_set_header_dev_name(struct ethtool_tunnel_info_get_req *req, - const char *dev_name) -{ - 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_tunnel_info_get_req_set_header_flags(struct ethtool_tunnel_info_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_tunnel_info_get_rsp { - struct { - __u32 header:1; - __u32 udp_ports:1; - } _present; - - struct ethtool_header header; - struct ethtool_tunnel_udp udp_ports; -}; - -void ethtool_tunnel_info_get_rsp_free(struct ethtool_tunnel_info_get_rsp *rsp); - -/* - * Get tsinfo params. - */ -struct ethtool_tunnel_info_get_rsp * -ethtool_tunnel_info_get(struct ynl_sock *ys, - struct ethtool_tunnel_info_get_req *req); - -/* ETHTOOL_MSG_TUNNEL_INFO_GET - dump */ -struct ethtool_tunnel_info_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_tunnel_info_get_req_dump * -ethtool_tunnel_info_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_tunnel_info_get_req_dump)); -} -void -ethtool_tunnel_info_get_req_dump_free(struct ethtool_tunnel_info_get_req_dump *req); - -static inline void -ethtool_tunnel_info_get_req_dump_set_header_dev_index(struct ethtool_tunnel_info_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_tunnel_info_get_req_dump_set_header_dev_name(struct ethtool_tunnel_info_get_req_dump *req, - const char *dev_name) -{ - 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_tunnel_info_get_req_dump_set_header_flags(struct ethtool_tunnel_info_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_tunnel_info_get_list { - struct ethtool_tunnel_info_get_list *next; - struct ethtool_tunnel_info_get_rsp obj __attribute__((aligned(8))); -}; - -void -ethtool_tunnel_info_get_list_free(struct ethtool_tunnel_info_get_list *rsp); - -struct ethtool_tunnel_info_get_list * -ethtool_tunnel_info_get_dump(struct ynl_sock *ys, - struct ethtool_tunnel_info_get_req_dump *req); - -/* ============== ETHTOOL_MSG_FEC_GET ============== */ -/* ETHTOOL_MSG_FEC_GET - do */ -struct ethtool_fec_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_fec_get_req *ethtool_fec_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_fec_get_req)); -} -void ethtool_fec_get_req_free(struct ethtool_fec_get_req *req); - -static inline void -ethtool_fec_get_req_set_header_dev_index(struct ethtool_fec_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_fec_get_req_set_header_dev_name(struct ethtool_fec_get_req *req, - const char *dev_name) -{ - 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_fec_get_req_set_header_flags(struct ethtool_fec_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_fec_get_rsp { - struct { - __u32 header:1; - __u32 modes:1; - __u32 auto_:1; - __u32 active:1; - __u32 stats:1; - } _present; - - struct ethtool_header header; - struct ethtool_bitset modes; - __u8 auto_; - __u32 active; - struct ethtool_fec_stat stats; -}; - -void ethtool_fec_get_rsp_free(struct ethtool_fec_get_rsp *rsp); - -/* - * Get FEC params. - */ -struct ethtool_fec_get_rsp * -ethtool_fec_get(struct ynl_sock *ys, struct ethtool_fec_get_req *req); - -/* ETHTOOL_MSG_FEC_GET - dump */ -struct ethtool_fec_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_fec_get_req_dump * -ethtool_fec_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_fec_get_req_dump)); -} -void ethtool_fec_get_req_dump_free(struct ethtool_fec_get_req_dump *req); - -static inline void -ethtool_fec_get_req_dump_set_header_dev_index(struct ethtool_fec_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_fec_get_req_dump_set_header_dev_name(struct ethtool_fec_get_req_dump *req, - const char *dev_name) -{ - 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_fec_get_req_dump_set_header_flags(struct ethtool_fec_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_fec_get_list { - struct ethtool_fec_get_list *next; - struct ethtool_fec_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_fec_get_list_free(struct ethtool_fec_get_list *rsp); - -struct ethtool_fec_get_list * -ethtool_fec_get_dump(struct ynl_sock *ys, struct ethtool_fec_get_req_dump *req); - -/* ETHTOOL_MSG_FEC_GET - notify */ -struct ethtool_fec_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_fec_get_ntf *ntf); - struct ethtool_fec_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_fec_get_ntf_free(struct ethtool_fec_get_ntf *rsp); - -/* ============== ETHTOOL_MSG_FEC_SET ============== */ -/* ETHTOOL_MSG_FEC_SET - do */ -struct ethtool_fec_set_req { - struct { - __u32 header:1; - __u32 modes:1; - __u32 auto_:1; - __u32 active:1; - __u32 stats:1; - } _present; - - struct ethtool_header header; - struct ethtool_bitset modes; - __u8 auto_; - __u32 active; - struct ethtool_fec_stat stats; -}; - -static inline struct ethtool_fec_set_req *ethtool_fec_set_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_fec_set_req)); -} -void ethtool_fec_set_req_free(struct ethtool_fec_set_req *req); - -static inline void -ethtool_fec_set_req_set_header_dev_index(struct ethtool_fec_set_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_fec_set_req_set_header_dev_name(struct ethtool_fec_set_req *req, - const char *dev_name) -{ - 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_fec_set_req_set_header_flags(struct ethtool_fec_set_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_fec_set_req_set_modes_nomask(struct ethtool_fec_set_req *req) -{ - req->_present.modes = 1; - req->modes._present.nomask = 1; -} -static inline void -ethtool_fec_set_req_set_modes_size(struct ethtool_fec_set_req *req, __u32 size) -{ - req->_present.modes = 1; - req->modes._present.size = 1; - req->modes.size = size; -} -static inline void -__ethtool_fec_set_req_set_modes_bits_bit(struct ethtool_fec_set_req *req, - struct ethtool_bitset_bit *bit, - unsigned int n_bit) -{ - free(req->modes.bits.bit); - req->modes.bits.bit = bit; - req->modes.bits.n_bit = n_bit; -} -static inline void -ethtool_fec_set_req_set_auto_(struct ethtool_fec_set_req *req, __u8 auto_) -{ - req->_present.auto_ = 1; - req->auto_ = auto_; -} -static inline void -ethtool_fec_set_req_set_active(struct ethtool_fec_set_req *req, __u32 active) -{ - req->_present.active = 1; - req->active = active; -} -static inline void -ethtool_fec_set_req_set_stats_corrected(struct ethtool_fec_set_req *req, - const void *corrected, size_t len) -{ - free(req->stats.corrected); - req->stats._present.corrected_len = len; - req->stats.corrected = malloc(req->stats._present.corrected_len); - memcpy(req->stats.corrected, corrected, req->stats._present.corrected_len); -} -static inline void -ethtool_fec_set_req_set_stats_uncorr(struct ethtool_fec_set_req *req, - const void *uncorr, size_t len) -{ - free(req->stats.uncorr); - req->stats._present.uncorr_len = len; - req->stats.uncorr = malloc(req->stats._present.uncorr_len); - memcpy(req->stats.uncorr, uncorr, req->stats._present.uncorr_len); -} -static inline void -ethtool_fec_set_req_set_stats_corr_bits(struct ethtool_fec_set_req *req, - const void *corr_bits, size_t len) -{ - free(req->stats.corr_bits); - req->stats._present.corr_bits_len = len; - req->stats.corr_bits = malloc(req->stats._present.corr_bits_len); - memcpy(req->stats.corr_bits, corr_bits, req->stats._present.corr_bits_len); -} - -/* - * Set FEC params. - */ -int ethtool_fec_set(struct ynl_sock *ys, struct ethtool_fec_set_req *req); - -/* ============== ETHTOOL_MSG_MODULE_EEPROM_GET ============== */ -/* ETHTOOL_MSG_MODULE_EEPROM_GET - do */ -struct ethtool_module_eeprom_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_module_eeprom_get_req * -ethtool_module_eeprom_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_module_eeprom_get_req)); -} -void -ethtool_module_eeprom_get_req_free(struct ethtool_module_eeprom_get_req *req); - -static inline void -ethtool_module_eeprom_get_req_set_header_dev_index(struct ethtool_module_eeprom_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_module_eeprom_get_req_set_header_dev_name(struct ethtool_module_eeprom_get_req *req, - const char *dev_name) -{ - 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_module_eeprom_get_req_set_header_flags(struct ethtool_module_eeprom_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_module_eeprom_get_rsp { - struct { - __u32 header:1; - __u32 offset:1; - __u32 length:1; - __u32 page:1; - __u32 bank:1; - __u32 i2c_address:1; - __u32 data_len; - } _present; - - struct ethtool_header header; - __u32 offset; - __u32 length; - __u8 page; - __u8 bank; - __u8 i2c_address; - void *data; -}; - -void -ethtool_module_eeprom_get_rsp_free(struct ethtool_module_eeprom_get_rsp *rsp); - -/* - * Get module EEPROM params. - */ -struct ethtool_module_eeprom_get_rsp * -ethtool_module_eeprom_get(struct ynl_sock *ys, - struct ethtool_module_eeprom_get_req *req); - -/* ETHTOOL_MSG_MODULE_EEPROM_GET - dump */ -struct ethtool_module_eeprom_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_module_eeprom_get_req_dump * -ethtool_module_eeprom_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_module_eeprom_get_req_dump)); -} -void -ethtool_module_eeprom_get_req_dump_free(struct ethtool_module_eeprom_get_req_dump *req); - -static inline void -ethtool_module_eeprom_get_req_dump_set_header_dev_index(struct ethtool_module_eeprom_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_module_eeprom_get_req_dump_set_header_dev_name(struct ethtool_module_eeprom_get_req_dump *req, - const char *dev_name) -{ - 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_module_eeprom_get_req_dump_set_header_flags(struct ethtool_module_eeprom_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_module_eeprom_get_list { - struct ethtool_module_eeprom_get_list *next; - struct ethtool_module_eeprom_get_rsp obj __attribute__((aligned(8))); -}; - -void -ethtool_module_eeprom_get_list_free(struct ethtool_module_eeprom_get_list *rsp); - -struct ethtool_module_eeprom_get_list * -ethtool_module_eeprom_get_dump(struct ynl_sock *ys, - struct ethtool_module_eeprom_get_req_dump *req); - -/* ============== ETHTOOL_MSG_PHC_VCLOCKS_GET ============== */ -/* ETHTOOL_MSG_PHC_VCLOCKS_GET - do */ -struct ethtool_phc_vclocks_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_phc_vclocks_get_req * -ethtool_phc_vclocks_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_phc_vclocks_get_req)); -} -void ethtool_phc_vclocks_get_req_free(struct ethtool_phc_vclocks_get_req *req); - -static inline void -ethtool_phc_vclocks_get_req_set_header_dev_index(struct ethtool_phc_vclocks_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_phc_vclocks_get_req_set_header_dev_name(struct ethtool_phc_vclocks_get_req *req, - const char *dev_name) -{ - 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_phc_vclocks_get_req_set_header_flags(struct ethtool_phc_vclocks_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_phc_vclocks_get_rsp { - struct { - __u32 header:1; - __u32 num:1; - } _present; - - struct ethtool_header header; - __u32 num; -}; - -void ethtool_phc_vclocks_get_rsp_free(struct ethtool_phc_vclocks_get_rsp *rsp); - -/* - * Get PHC VCLOCKs. - */ -struct ethtool_phc_vclocks_get_rsp * -ethtool_phc_vclocks_get(struct ynl_sock *ys, - struct ethtool_phc_vclocks_get_req *req); - -/* ETHTOOL_MSG_PHC_VCLOCKS_GET - dump */ -struct ethtool_phc_vclocks_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_phc_vclocks_get_req_dump * -ethtool_phc_vclocks_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_phc_vclocks_get_req_dump)); -} -void -ethtool_phc_vclocks_get_req_dump_free(struct ethtool_phc_vclocks_get_req_dump *req); - -static inline void -ethtool_phc_vclocks_get_req_dump_set_header_dev_index(struct ethtool_phc_vclocks_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_phc_vclocks_get_req_dump_set_header_dev_name(struct ethtool_phc_vclocks_get_req_dump *req, - const char *dev_name) -{ - 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_phc_vclocks_get_req_dump_set_header_flags(struct ethtool_phc_vclocks_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_phc_vclocks_get_list { - struct ethtool_phc_vclocks_get_list *next; - struct ethtool_phc_vclocks_get_rsp obj __attribute__((aligned(8))); -}; - -void -ethtool_phc_vclocks_get_list_free(struct ethtool_phc_vclocks_get_list *rsp); - -struct ethtool_phc_vclocks_get_list * -ethtool_phc_vclocks_get_dump(struct ynl_sock *ys, - struct ethtool_phc_vclocks_get_req_dump *req); - -/* ============== ETHTOOL_MSG_MODULE_GET ============== */ -/* ETHTOOL_MSG_MODULE_GET - do */ -struct ethtool_module_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_module_get_req *ethtool_module_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_module_get_req)); -} -void ethtool_module_get_req_free(struct ethtool_module_get_req *req); - -static inline void -ethtool_module_get_req_set_header_dev_index(struct ethtool_module_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_module_get_req_set_header_dev_name(struct ethtool_module_get_req *req, - const char *dev_name) -{ - 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_module_get_req_set_header_flags(struct ethtool_module_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_module_get_rsp { - struct { - __u32 header:1; - __u32 power_mode_policy:1; - __u32 power_mode:1; - } _present; - - struct ethtool_header header; - __u8 power_mode_policy; - __u8 power_mode; -}; - -void ethtool_module_get_rsp_free(struct ethtool_module_get_rsp *rsp); - -/* - * Get module params. - */ -struct ethtool_module_get_rsp * -ethtool_module_get(struct ynl_sock *ys, struct ethtool_module_get_req *req); - -/* ETHTOOL_MSG_MODULE_GET - dump */ -struct ethtool_module_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_module_get_req_dump * -ethtool_module_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_module_get_req_dump)); -} -void ethtool_module_get_req_dump_free(struct ethtool_module_get_req_dump *req); - -static inline void -ethtool_module_get_req_dump_set_header_dev_index(struct ethtool_module_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_module_get_req_dump_set_header_dev_name(struct ethtool_module_get_req_dump *req, - const char *dev_name) -{ - 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_module_get_req_dump_set_header_flags(struct ethtool_module_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_module_get_list { - struct ethtool_module_get_list *next; - struct ethtool_module_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_module_get_list_free(struct ethtool_module_get_list *rsp); - -struct ethtool_module_get_list * -ethtool_module_get_dump(struct ynl_sock *ys, - struct ethtool_module_get_req_dump *req); - -/* ETHTOOL_MSG_MODULE_GET - notify */ -struct ethtool_module_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_module_get_ntf *ntf); - struct ethtool_module_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_module_get_ntf_free(struct ethtool_module_get_ntf *rsp); - -/* ============== ETHTOOL_MSG_MODULE_SET ============== */ -/* ETHTOOL_MSG_MODULE_SET - do */ -struct ethtool_module_set_req { - struct { - __u32 header:1; - __u32 power_mode_policy:1; - __u32 power_mode:1; - } _present; - - struct ethtool_header header; - __u8 power_mode_policy; - __u8 power_mode; -}; - -static inline struct ethtool_module_set_req *ethtool_module_set_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_module_set_req)); -} -void ethtool_module_set_req_free(struct ethtool_module_set_req *req); - -static inline void -ethtool_module_set_req_set_header_dev_index(struct ethtool_module_set_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_module_set_req_set_header_dev_name(struct ethtool_module_set_req *req, - const char *dev_name) -{ - 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_module_set_req_set_header_flags(struct ethtool_module_set_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_module_set_req_set_power_mode_policy(struct ethtool_module_set_req *req, - __u8 power_mode_policy) -{ - req->_present.power_mode_policy = 1; - req->power_mode_policy = power_mode_policy; -} -static inline void -ethtool_module_set_req_set_power_mode(struct ethtool_module_set_req *req, - __u8 power_mode) -{ - req->_present.power_mode = 1; - req->power_mode = power_mode; -} - -/* - * Set module params. - */ -int ethtool_module_set(struct ynl_sock *ys, struct ethtool_module_set_req *req); - -/* ============== ETHTOOL_MSG_PSE_GET ============== */ -/* ETHTOOL_MSG_PSE_GET - do */ -struct ethtool_pse_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_pse_get_req *ethtool_pse_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_pse_get_req)); -} -void ethtool_pse_get_req_free(struct ethtool_pse_get_req *req); - -static inline void -ethtool_pse_get_req_set_header_dev_index(struct ethtool_pse_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_pse_get_req_set_header_dev_name(struct ethtool_pse_get_req *req, - const char *dev_name) -{ - 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_pse_get_req_set_header_flags(struct ethtool_pse_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_pse_get_rsp { - struct { - __u32 header:1; - __u32 admin_state:1; - __u32 admin_control:1; - __u32 pw_d_status:1; - } _present; - - struct ethtool_header header; - __u32 admin_state; - __u32 admin_control; - __u32 pw_d_status; -}; - -void ethtool_pse_get_rsp_free(struct ethtool_pse_get_rsp *rsp); - -/* - * Get Power Sourcing Equipment params. - */ -struct ethtool_pse_get_rsp * -ethtool_pse_get(struct ynl_sock *ys, struct ethtool_pse_get_req *req); - -/* ETHTOOL_MSG_PSE_GET - dump */ -struct ethtool_pse_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_pse_get_req_dump * -ethtool_pse_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_pse_get_req_dump)); -} -void ethtool_pse_get_req_dump_free(struct ethtool_pse_get_req_dump *req); - -static inline void -ethtool_pse_get_req_dump_set_header_dev_index(struct ethtool_pse_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_pse_get_req_dump_set_header_dev_name(struct ethtool_pse_get_req_dump *req, - const char *dev_name) -{ - 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_pse_get_req_dump_set_header_flags(struct ethtool_pse_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_pse_get_list { - struct ethtool_pse_get_list *next; - struct ethtool_pse_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_pse_get_list_free(struct ethtool_pse_get_list *rsp); - -struct ethtool_pse_get_list * -ethtool_pse_get_dump(struct ynl_sock *ys, struct ethtool_pse_get_req_dump *req); - -/* ============== ETHTOOL_MSG_PSE_SET ============== */ -/* ETHTOOL_MSG_PSE_SET - do */ -struct ethtool_pse_set_req { - struct { - __u32 header:1; - __u32 admin_state:1; - __u32 admin_control:1; - __u32 pw_d_status:1; - } _present; - - struct ethtool_header header; - __u32 admin_state; - __u32 admin_control; - __u32 pw_d_status; -}; - -static inline struct ethtool_pse_set_req *ethtool_pse_set_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_pse_set_req)); -} -void ethtool_pse_set_req_free(struct ethtool_pse_set_req *req); - -static inline void -ethtool_pse_set_req_set_header_dev_index(struct ethtool_pse_set_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_pse_set_req_set_header_dev_name(struct ethtool_pse_set_req *req, - const char *dev_name) -{ - 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_pse_set_req_set_header_flags(struct ethtool_pse_set_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_pse_set_req_set_admin_state(struct ethtool_pse_set_req *req, - __u32 admin_state) -{ - req->_present.admin_state = 1; - req->admin_state = admin_state; -} -static inline void -ethtool_pse_set_req_set_admin_control(struct ethtool_pse_set_req *req, - __u32 admin_control) -{ - req->_present.admin_control = 1; - req->admin_control = admin_control; -} -static inline void -ethtool_pse_set_req_set_pw_d_status(struct ethtool_pse_set_req *req, - __u32 pw_d_status) -{ - req->_present.pw_d_status = 1; - req->pw_d_status = pw_d_status; -} - -/* - * Set Power Sourcing Equipment params. - */ -int ethtool_pse_set(struct ynl_sock *ys, struct ethtool_pse_set_req *req); - -/* ============== ETHTOOL_MSG_RSS_GET ============== */ -/* ETHTOOL_MSG_RSS_GET - do */ -struct ethtool_rss_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_rss_get_req *ethtool_rss_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_rss_get_req)); -} -void ethtool_rss_get_req_free(struct ethtool_rss_get_req *req); - -static inline void -ethtool_rss_get_req_set_header_dev_index(struct ethtool_rss_get_req *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_set_header_dev_name(struct ethtool_rss_get_req *req, - const char *dev_name) -{ - 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_set_header_flags(struct ethtool_rss_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_rss_get_rsp { - struct { - __u32 header:1; - __u32 context:1; - __u32 hfunc:1; - __u32 indir_len; - __u32 hkey_len; - __u32 input_xfrm:1; - } _present; - - struct ethtool_header header; - __u32 context; - __u32 hfunc; - void *indir; - void *hkey; - __u32 input_xfrm; -}; - -void ethtool_rss_get_rsp_free(struct ethtool_rss_get_rsp *rsp); - -/* - * Get RSS params. - */ -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; - } _present; - - struct ethtool_header header; -}; - -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) -{ - 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; -} - -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 { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_plca_get_cfg_req * -ethtool_plca_get_cfg_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_plca_get_cfg_req)); -} -void ethtool_plca_get_cfg_req_free(struct ethtool_plca_get_cfg_req *req); - -static inline void -ethtool_plca_get_cfg_req_set_header_dev_index(struct ethtool_plca_get_cfg_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_plca_get_cfg_req_set_header_dev_name(struct ethtool_plca_get_cfg_req *req, - const char *dev_name) -{ - 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_plca_get_cfg_req_set_header_flags(struct ethtool_plca_get_cfg_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_plca_get_cfg_rsp { - struct { - __u32 header:1; - __u32 version:1; - __u32 enabled:1; - __u32 status:1; - __u32 node_cnt:1; - __u32 node_id:1; - __u32 to_tmr:1; - __u32 burst_cnt:1; - __u32 burst_tmr:1; - } _present; - - struct ethtool_header header; - __u16 version; - __u8 enabled; - __u8 status; - __u32 node_cnt; - __u32 node_id; - __u32 to_tmr; - __u32 burst_cnt; - __u32 burst_tmr; -}; - -void ethtool_plca_get_cfg_rsp_free(struct ethtool_plca_get_cfg_rsp *rsp); - -/* - * Get PLCA params. - */ -struct ethtool_plca_get_cfg_rsp * -ethtool_plca_get_cfg(struct ynl_sock *ys, struct ethtool_plca_get_cfg_req *req); - -/* ETHTOOL_MSG_PLCA_GET_CFG - dump */ -struct ethtool_plca_get_cfg_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_plca_get_cfg_req_dump * -ethtool_plca_get_cfg_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_plca_get_cfg_req_dump)); -} -void -ethtool_plca_get_cfg_req_dump_free(struct ethtool_plca_get_cfg_req_dump *req); - -static inline void -ethtool_plca_get_cfg_req_dump_set_header_dev_index(struct ethtool_plca_get_cfg_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_plca_get_cfg_req_dump_set_header_dev_name(struct ethtool_plca_get_cfg_req_dump *req, - const char *dev_name) -{ - 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_plca_get_cfg_req_dump_set_header_flags(struct ethtool_plca_get_cfg_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_plca_get_cfg_list { - struct ethtool_plca_get_cfg_list *next; - struct ethtool_plca_get_cfg_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_plca_get_cfg_list_free(struct ethtool_plca_get_cfg_list *rsp); - -struct ethtool_plca_get_cfg_list * -ethtool_plca_get_cfg_dump(struct ynl_sock *ys, - struct ethtool_plca_get_cfg_req_dump *req); - -/* ETHTOOL_MSG_PLCA_GET_CFG - notify */ -struct ethtool_plca_get_cfg_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_plca_get_cfg_ntf *ntf); - struct ethtool_plca_get_cfg_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_plca_get_cfg_ntf_free(struct ethtool_plca_get_cfg_ntf *rsp); - -/* ============== ETHTOOL_MSG_PLCA_SET_CFG ============== */ -/* ETHTOOL_MSG_PLCA_SET_CFG - do */ -struct ethtool_plca_set_cfg_req { - struct { - __u32 header:1; - __u32 version:1; - __u32 enabled:1; - __u32 status:1; - __u32 node_cnt:1; - __u32 node_id:1; - __u32 to_tmr:1; - __u32 burst_cnt:1; - __u32 burst_tmr:1; - } _present; - - struct ethtool_header header; - __u16 version; - __u8 enabled; - __u8 status; - __u32 node_cnt; - __u32 node_id; - __u32 to_tmr; - __u32 burst_cnt; - __u32 burst_tmr; -}; - -static inline struct ethtool_plca_set_cfg_req * -ethtool_plca_set_cfg_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_plca_set_cfg_req)); -} -void ethtool_plca_set_cfg_req_free(struct ethtool_plca_set_cfg_req *req); - -static inline void -ethtool_plca_set_cfg_req_set_header_dev_index(struct ethtool_plca_set_cfg_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_plca_set_cfg_req_set_header_dev_name(struct ethtool_plca_set_cfg_req *req, - const char *dev_name) -{ - 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_plca_set_cfg_req_set_header_flags(struct ethtool_plca_set_cfg_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_plca_set_cfg_req_set_version(struct ethtool_plca_set_cfg_req *req, - __u16 version) -{ - req->_present.version = 1; - req->version = version; -} -static inline void -ethtool_plca_set_cfg_req_set_enabled(struct ethtool_plca_set_cfg_req *req, - __u8 enabled) -{ - req->_present.enabled = 1; - req->enabled = enabled; -} -static inline void -ethtool_plca_set_cfg_req_set_status(struct ethtool_plca_set_cfg_req *req, - __u8 status) -{ - req->_present.status = 1; - req->status = status; -} -static inline void -ethtool_plca_set_cfg_req_set_node_cnt(struct ethtool_plca_set_cfg_req *req, - __u32 node_cnt) -{ - req->_present.node_cnt = 1; - req->node_cnt = node_cnt; -} -static inline void -ethtool_plca_set_cfg_req_set_node_id(struct ethtool_plca_set_cfg_req *req, - __u32 node_id) -{ - req->_present.node_id = 1; - req->node_id = node_id; -} -static inline void -ethtool_plca_set_cfg_req_set_to_tmr(struct ethtool_plca_set_cfg_req *req, - __u32 to_tmr) -{ - req->_present.to_tmr = 1; - req->to_tmr = to_tmr; -} -static inline void -ethtool_plca_set_cfg_req_set_burst_cnt(struct ethtool_plca_set_cfg_req *req, - __u32 burst_cnt) -{ - req->_present.burst_cnt = 1; - req->burst_cnt = burst_cnt; -} -static inline void -ethtool_plca_set_cfg_req_set_burst_tmr(struct ethtool_plca_set_cfg_req *req, - __u32 burst_tmr) -{ - req->_present.burst_tmr = 1; - req->burst_tmr = burst_tmr; -} - -/* - * Set PLCA params. - */ -int ethtool_plca_set_cfg(struct ynl_sock *ys, - struct ethtool_plca_set_cfg_req *req); - -/* ============== ETHTOOL_MSG_PLCA_GET_STATUS ============== */ -/* ETHTOOL_MSG_PLCA_GET_STATUS - do */ -struct ethtool_plca_get_status_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_plca_get_status_req * -ethtool_plca_get_status_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_plca_get_status_req)); -} -void ethtool_plca_get_status_req_free(struct ethtool_plca_get_status_req *req); - -static inline void -ethtool_plca_get_status_req_set_header_dev_index(struct ethtool_plca_get_status_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_plca_get_status_req_set_header_dev_name(struct ethtool_plca_get_status_req *req, - const char *dev_name) -{ - 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_plca_get_status_req_set_header_flags(struct ethtool_plca_get_status_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_plca_get_status_rsp { - struct { - __u32 header:1; - __u32 version:1; - __u32 enabled:1; - __u32 status:1; - __u32 node_cnt:1; - __u32 node_id:1; - __u32 to_tmr:1; - __u32 burst_cnt:1; - __u32 burst_tmr:1; - } _present; - - struct ethtool_header header; - __u16 version; - __u8 enabled; - __u8 status; - __u32 node_cnt; - __u32 node_id; - __u32 to_tmr; - __u32 burst_cnt; - __u32 burst_tmr; -}; - -void ethtool_plca_get_status_rsp_free(struct ethtool_plca_get_status_rsp *rsp); - -/* - * Get PLCA status params. - */ -struct ethtool_plca_get_status_rsp * -ethtool_plca_get_status(struct ynl_sock *ys, - struct ethtool_plca_get_status_req *req); - -/* ETHTOOL_MSG_PLCA_GET_STATUS - dump */ -struct ethtool_plca_get_status_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_plca_get_status_req_dump * -ethtool_plca_get_status_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_plca_get_status_req_dump)); -} -void -ethtool_plca_get_status_req_dump_free(struct ethtool_plca_get_status_req_dump *req); - -static inline void -ethtool_plca_get_status_req_dump_set_header_dev_index(struct ethtool_plca_get_status_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_plca_get_status_req_dump_set_header_dev_name(struct ethtool_plca_get_status_req_dump *req, - const char *dev_name) -{ - 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_plca_get_status_req_dump_set_header_flags(struct ethtool_plca_get_status_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_plca_get_status_list { - struct ethtool_plca_get_status_list *next; - struct ethtool_plca_get_status_rsp obj __attribute__((aligned(8))); -}; - -void -ethtool_plca_get_status_list_free(struct ethtool_plca_get_status_list *rsp); - -struct ethtool_plca_get_status_list * -ethtool_plca_get_status_dump(struct ynl_sock *ys, - struct ethtool_plca_get_status_req_dump *req); - -/* ============== ETHTOOL_MSG_MM_GET ============== */ -/* ETHTOOL_MSG_MM_GET - do */ -struct ethtool_mm_get_req { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_mm_get_req *ethtool_mm_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_mm_get_req)); -} -void ethtool_mm_get_req_free(struct ethtool_mm_get_req *req); - -static inline void -ethtool_mm_get_req_set_header_dev_index(struct ethtool_mm_get_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_mm_get_req_set_header_dev_name(struct ethtool_mm_get_req *req, - const char *dev_name) -{ - 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_mm_get_req_set_header_flags(struct ethtool_mm_get_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_mm_get_rsp { - struct { - __u32 header:1; - __u32 pmac_enabled:1; - __u32 tx_enabled:1; - __u32 tx_active:1; - __u32 tx_min_frag_size:1; - __u32 rx_min_frag_size:1; - __u32 verify_enabled:1; - __u32 verify_time:1; - __u32 max_verify_time:1; - __u32 stats:1; - } _present; - - struct ethtool_header header; - __u8 pmac_enabled; - __u8 tx_enabled; - __u8 tx_active; - __u32 tx_min_frag_size; - __u32 rx_min_frag_size; - __u8 verify_enabled; - __u32 verify_time; - __u32 max_verify_time; - struct ethtool_mm_stat stats; -}; - -void ethtool_mm_get_rsp_free(struct ethtool_mm_get_rsp *rsp); - -/* - * Get MAC Merge configuration and state - */ -struct ethtool_mm_get_rsp * -ethtool_mm_get(struct ynl_sock *ys, struct ethtool_mm_get_req *req); - -/* ETHTOOL_MSG_MM_GET - dump */ -struct ethtool_mm_get_req_dump { - struct { - __u32 header:1; - } _present; - - struct ethtool_header header; -}; - -static inline struct ethtool_mm_get_req_dump * -ethtool_mm_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_mm_get_req_dump)); -} -void ethtool_mm_get_req_dump_free(struct ethtool_mm_get_req_dump *req); - -static inline void -ethtool_mm_get_req_dump_set_header_dev_index(struct ethtool_mm_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_mm_get_req_dump_set_header_dev_name(struct ethtool_mm_get_req_dump *req, - const char *dev_name) -{ - 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_mm_get_req_dump_set_header_flags(struct ethtool_mm_get_req_dump *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} - -struct ethtool_mm_get_list { - struct ethtool_mm_get_list *next; - struct ethtool_mm_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_mm_get_list_free(struct ethtool_mm_get_list *rsp); - -struct ethtool_mm_get_list * -ethtool_mm_get_dump(struct ynl_sock *ys, struct ethtool_mm_get_req_dump *req); - -/* ETHTOOL_MSG_MM_GET - notify */ -struct ethtool_mm_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_mm_get_ntf *ntf); - struct ethtool_mm_get_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_mm_get_ntf_free(struct ethtool_mm_get_ntf *rsp); - -/* ============== ETHTOOL_MSG_MM_SET ============== */ -/* ETHTOOL_MSG_MM_SET - do */ -struct ethtool_mm_set_req { - struct { - __u32 header:1; - __u32 verify_enabled:1; - __u32 verify_time:1; - __u32 tx_enabled:1; - __u32 pmac_enabled:1; - __u32 tx_min_frag_size:1; - } _present; - - struct ethtool_header header; - __u8 verify_enabled; - __u32 verify_time; - __u8 tx_enabled; - __u8 pmac_enabled; - __u32 tx_min_frag_size; -}; - -static inline struct ethtool_mm_set_req *ethtool_mm_set_req_alloc(void) -{ - return calloc(1, sizeof(struct ethtool_mm_set_req)); -} -void ethtool_mm_set_req_free(struct ethtool_mm_set_req *req); - -static inline void -ethtool_mm_set_req_set_header_dev_index(struct ethtool_mm_set_req *req, - __u32 dev_index) -{ - req->_present.header = 1; - req->header._present.dev_index = 1; - req->header.dev_index = dev_index; -} -static inline void -ethtool_mm_set_req_set_header_dev_name(struct ethtool_mm_set_req *req, - const char *dev_name) -{ - 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_mm_set_req_set_header_flags(struct ethtool_mm_set_req *req, - __u32 flags) -{ - req->_present.header = 1; - req->header._present.flags = 1; - req->header.flags = flags; -} -static inline void -ethtool_mm_set_req_set_verify_enabled(struct ethtool_mm_set_req *req, - __u8 verify_enabled) -{ - req->_present.verify_enabled = 1; - req->verify_enabled = verify_enabled; -} -static inline void -ethtool_mm_set_req_set_verify_time(struct ethtool_mm_set_req *req, - __u32 verify_time) -{ - req->_present.verify_time = 1; - req->verify_time = verify_time; -} -static inline void -ethtool_mm_set_req_set_tx_enabled(struct ethtool_mm_set_req *req, - __u8 tx_enabled) -{ - req->_present.tx_enabled = 1; - req->tx_enabled = tx_enabled; -} -static inline void -ethtool_mm_set_req_set_pmac_enabled(struct ethtool_mm_set_req *req, - __u8 pmac_enabled) -{ - req->_present.pmac_enabled = 1; - req->pmac_enabled = pmac_enabled; -} -static inline void -ethtool_mm_set_req_set_tx_min_frag_size(struct ethtool_mm_set_req *req, - __u32 tx_min_frag_size) -{ - req->_present.tx_min_frag_size = 1; - req->tx_min_frag_size = tx_min_frag_size; -} - -/* - * Set MAC Merge configuration - */ -int ethtool_mm_set(struct ynl_sock *ys, struct ethtool_mm_set_req *req); - -/* ETHTOOL_MSG_CABLE_TEST_NTF - event */ -struct ethtool_cable_test_ntf_rsp { - struct { - __u32 header:1; - __u32 status:1; - } _present; - - struct ethtool_header header; - __u8 status; -}; - -struct ethtool_cable_test_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_cable_test_ntf *ntf); - struct ethtool_cable_test_ntf_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_cable_test_ntf_free(struct ethtool_cable_test_ntf *rsp); - -/* ETHTOOL_MSG_CABLE_TEST_TDR_NTF - event */ -struct ethtool_cable_test_tdr_ntf_rsp { - struct { - __u32 header:1; - __u32 status:1; - __u32 nest:1; - } _present; - - struct ethtool_header header; - __u8 status; - struct ethtool_cable_nest nest; -}; - -struct ethtool_cable_test_tdr_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct ethtool_cable_test_tdr_ntf *ntf); - struct ethtool_cable_test_tdr_ntf_rsp obj __attribute__((aligned(8))); -}; - -void ethtool_cable_test_tdr_ntf_free(struct ethtool_cable_test_tdr_ntf *rsp); - -#endif /* _LINUX_ETHTOOL_GEN_H */ diff --git a/generated/ethtool-user.h b/generated/ethtool-user.h new file mode 120000 index 0000000..48c4d21 --- /dev/null +++ b/generated/ethtool-user.h @@ -0,0 +1 @@ +../include/ynl-c/ethtool.h \ No newline at end of file diff --git a/generated/fou-user.h b/generated/fou-user.h deleted file mode 100644 index fd56671..0000000 --- a/generated/fou-user.h +++ /dev/null @@ -1,343 +0,0 @@ -/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ -/* Do not edit directly, auto-generated from: */ -/* Documentation/netlink/specs/fou.yaml */ -/* YNL-GEN user header */ - -#ifndef _LINUX_FOU_GEN_H -#define _LINUX_FOU_GEN_H - -#include -#include -#include -#include - -struct ynl_sock; - -extern const struct ynl_family ynl_fou_family; - -/* Enums */ -const char *fou_op_str(int op); -const char *fou_encap_type_str(int value); - -/* Common nested types */ -/* ============== FOU_CMD_ADD ============== */ -/* FOU_CMD_ADD - do */ -struct fou_add_req { - struct { - __u32 port:1; - __u32 ipproto:1; - __u32 type:1; - __u32 remcsum_nopartial:1; - __u32 local_v4:1; - __u32 peer_v4:1; - __u32 local_v6_len; - __u32 peer_v6_len; - __u32 peer_port:1; - __u32 ifindex:1; - } _present; - - __u16 port /* big-endian */; - __u8 ipproto; - __u8 type; - __u32 local_v4; - __u32 peer_v4; - void *local_v6; - void *peer_v6; - __u16 peer_port /* big-endian */; - __s32 ifindex; -}; - -static inline struct fou_add_req *fou_add_req_alloc(void) -{ - return calloc(1, sizeof(struct fou_add_req)); -} -void fou_add_req_free(struct fou_add_req *req); - -static inline void -fou_add_req_set_port(struct fou_add_req *req, __u16 port /* big-endian */) -{ - req->_present.port = 1; - req->port = port; -} -static inline void -fou_add_req_set_ipproto(struct fou_add_req *req, __u8 ipproto) -{ - req->_present.ipproto = 1; - req->ipproto = ipproto; -} -static inline void fou_add_req_set_type(struct fou_add_req *req, __u8 type) -{ - req->_present.type = 1; - req->type = type; -} -static inline void fou_add_req_set_remcsum_nopartial(struct fou_add_req *req) -{ - req->_present.remcsum_nopartial = 1; -} -static inline void -fou_add_req_set_local_v4(struct fou_add_req *req, __u32 local_v4) -{ - req->_present.local_v4 = 1; - req->local_v4 = local_v4; -} -static inline void -fou_add_req_set_peer_v4(struct fou_add_req *req, __u32 peer_v4) -{ - req->_present.peer_v4 = 1; - req->peer_v4 = peer_v4; -} -static inline void -fou_add_req_set_local_v6(struct fou_add_req *req, const void *local_v6, - size_t len) -{ - free(req->local_v6); - req->_present.local_v6_len = len; - req->local_v6 = malloc(req->_present.local_v6_len); - memcpy(req->local_v6, local_v6, req->_present.local_v6_len); -} -static inline void -fou_add_req_set_peer_v6(struct fou_add_req *req, const void *peer_v6, - size_t len) -{ - free(req->peer_v6); - req->_present.peer_v6_len = len; - req->peer_v6 = malloc(req->_present.peer_v6_len); - memcpy(req->peer_v6, peer_v6, req->_present.peer_v6_len); -} -static inline void -fou_add_req_set_peer_port(struct fou_add_req *req, - __u16 peer_port /* big-endian */) -{ - req->_present.peer_port = 1; - req->peer_port = peer_port; -} -static inline void -fou_add_req_set_ifindex(struct fou_add_req *req, __s32 ifindex) -{ - req->_present.ifindex = 1; - req->ifindex = ifindex; -} - -/* - * Add port. - */ -int fou_add(struct ynl_sock *ys, struct fou_add_req *req); - -/* ============== FOU_CMD_DEL ============== */ -/* FOU_CMD_DEL - do */ -struct fou_del_req { - struct { - __u32 af:1; - __u32 ifindex:1; - __u32 port:1; - __u32 peer_port:1; - __u32 local_v4:1; - __u32 peer_v4:1; - __u32 local_v6_len; - __u32 peer_v6_len; - } _present; - - __u8 af; - __s32 ifindex; - __u16 port /* big-endian */; - __u16 peer_port /* big-endian */; - __u32 local_v4; - __u32 peer_v4; - void *local_v6; - void *peer_v6; -}; - -static inline struct fou_del_req *fou_del_req_alloc(void) -{ - return calloc(1, sizeof(struct fou_del_req)); -} -void fou_del_req_free(struct fou_del_req *req); - -static inline void fou_del_req_set_af(struct fou_del_req *req, __u8 af) -{ - req->_present.af = 1; - req->af = af; -} -static inline void -fou_del_req_set_ifindex(struct fou_del_req *req, __s32 ifindex) -{ - req->_present.ifindex = 1; - req->ifindex = ifindex; -} -static inline void -fou_del_req_set_port(struct fou_del_req *req, __u16 port /* big-endian */) -{ - req->_present.port = 1; - req->port = port; -} -static inline void -fou_del_req_set_peer_port(struct fou_del_req *req, - __u16 peer_port /* big-endian */) -{ - req->_present.peer_port = 1; - req->peer_port = peer_port; -} -static inline void -fou_del_req_set_local_v4(struct fou_del_req *req, __u32 local_v4) -{ - req->_present.local_v4 = 1; - req->local_v4 = local_v4; -} -static inline void -fou_del_req_set_peer_v4(struct fou_del_req *req, __u32 peer_v4) -{ - req->_present.peer_v4 = 1; - req->peer_v4 = peer_v4; -} -static inline void -fou_del_req_set_local_v6(struct fou_del_req *req, const void *local_v6, - size_t len) -{ - free(req->local_v6); - req->_present.local_v6_len = len; - req->local_v6 = malloc(req->_present.local_v6_len); - memcpy(req->local_v6, local_v6, req->_present.local_v6_len); -} -static inline void -fou_del_req_set_peer_v6(struct fou_del_req *req, const void *peer_v6, - size_t len) -{ - free(req->peer_v6); - req->_present.peer_v6_len = len; - req->peer_v6 = malloc(req->_present.peer_v6_len); - memcpy(req->peer_v6, peer_v6, req->_present.peer_v6_len); -} - -/* - * Delete port. - */ -int fou_del(struct ynl_sock *ys, struct fou_del_req *req); - -/* ============== FOU_CMD_GET ============== */ -/* FOU_CMD_GET - do */ -struct fou_get_req { - struct { - __u32 af:1; - __u32 ifindex:1; - __u32 port:1; - __u32 peer_port:1; - __u32 local_v4:1; - __u32 peer_v4:1; - __u32 local_v6_len; - __u32 peer_v6_len; - } _present; - - __u8 af; - __s32 ifindex; - __u16 port /* big-endian */; - __u16 peer_port /* big-endian */; - __u32 local_v4; - __u32 peer_v4; - void *local_v6; - void *peer_v6; -}; - -static inline struct fou_get_req *fou_get_req_alloc(void) -{ - return calloc(1, sizeof(struct fou_get_req)); -} -void fou_get_req_free(struct fou_get_req *req); - -static inline void fou_get_req_set_af(struct fou_get_req *req, __u8 af) -{ - req->_present.af = 1; - req->af = af; -} -static inline void -fou_get_req_set_ifindex(struct fou_get_req *req, __s32 ifindex) -{ - req->_present.ifindex = 1; - req->ifindex = ifindex; -} -static inline void -fou_get_req_set_port(struct fou_get_req *req, __u16 port /* big-endian */) -{ - req->_present.port = 1; - req->port = port; -} -static inline void -fou_get_req_set_peer_port(struct fou_get_req *req, - __u16 peer_port /* big-endian */) -{ - req->_present.peer_port = 1; - req->peer_port = peer_port; -} -static inline void -fou_get_req_set_local_v4(struct fou_get_req *req, __u32 local_v4) -{ - req->_present.local_v4 = 1; - req->local_v4 = local_v4; -} -static inline void -fou_get_req_set_peer_v4(struct fou_get_req *req, __u32 peer_v4) -{ - req->_present.peer_v4 = 1; - req->peer_v4 = peer_v4; -} -static inline void -fou_get_req_set_local_v6(struct fou_get_req *req, const void *local_v6, - size_t len) -{ - free(req->local_v6); - req->_present.local_v6_len = len; - req->local_v6 = malloc(req->_present.local_v6_len); - memcpy(req->local_v6, local_v6, req->_present.local_v6_len); -} -static inline void -fou_get_req_set_peer_v6(struct fou_get_req *req, const void *peer_v6, - size_t len) -{ - free(req->peer_v6); - req->_present.peer_v6_len = len; - req->peer_v6 = malloc(req->_present.peer_v6_len); - memcpy(req->peer_v6, peer_v6, req->_present.peer_v6_len); -} - -struct fou_get_rsp { - struct { - __u32 port:1; - __u32 ipproto:1; - __u32 type:1; - __u32 remcsum_nopartial:1; - __u32 local_v4:1; - __u32 peer_v4:1; - __u32 local_v6_len; - __u32 peer_v6_len; - __u32 peer_port:1; - __u32 ifindex:1; - } _present; - - __u16 port /* big-endian */; - __u8 ipproto; - __u8 type; - __u32 local_v4; - __u32 peer_v4; - void *local_v6; - void *peer_v6; - __u16 peer_port /* big-endian */; - __s32 ifindex; -}; - -void fou_get_rsp_free(struct fou_get_rsp *rsp); - -/* - * Get tunnel info. - */ -struct fou_get_rsp *fou_get(struct ynl_sock *ys, struct fou_get_req *req); - -/* FOU_CMD_GET - dump */ -struct fou_get_list { - struct fou_get_list *next; - struct fou_get_rsp obj __attribute__((aligned(8))); -}; - -void fou_get_list_free(struct fou_get_list *rsp); - -struct fou_get_list *fou_get_dump(struct ynl_sock *ys); - -#endif /* _LINUX_FOU_GEN_H */ diff --git a/generated/fou-user.h b/generated/fou-user.h new file mode 120000 index 0000000..501cc9e --- /dev/null +++ b/generated/fou-user.h @@ -0,0 +1 @@ +../include/ynl-c/fou.h \ No newline at end of file diff --git a/generated/handshake-user.h b/generated/handshake-user.h deleted file mode 100644 index bce537d..0000000 --- a/generated/handshake-user.h +++ /dev/null @@ -1,145 +0,0 @@ -/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ -/* Do not edit directly, auto-generated from: */ -/* Documentation/netlink/specs/handshake.yaml */ -/* YNL-GEN user header */ - -#ifndef _LINUX_HANDSHAKE_GEN_H -#define _LINUX_HANDSHAKE_GEN_H - -#include -#include -#include -#include - -struct ynl_sock; - -extern const struct ynl_family ynl_handshake_family; - -/* Enums */ -const char *handshake_op_str(int op); -const char *handshake_handler_class_str(enum handshake_handler_class value); -const char *handshake_msg_type_str(enum handshake_msg_type value); -const char *handshake_auth_str(enum handshake_auth value); - -/* Common nested types */ -struct handshake_x509 { - struct { - __u32 cert:1; - __u32 privkey:1; - } _present; - - __s32 cert; - __s32 privkey; -}; - -/* ============== HANDSHAKE_CMD_ACCEPT ============== */ -/* HANDSHAKE_CMD_ACCEPT - do */ -struct handshake_accept_req { - struct { - __u32 handler_class:1; - } _present; - - enum handshake_handler_class handler_class; -}; - -static inline struct handshake_accept_req *handshake_accept_req_alloc(void) -{ - return calloc(1, sizeof(struct handshake_accept_req)); -} -void handshake_accept_req_free(struct handshake_accept_req *req); - -static inline void -handshake_accept_req_set_handler_class(struct handshake_accept_req *req, - enum handshake_handler_class handler_class) -{ - req->_present.handler_class = 1; - req->handler_class = handler_class; -} - -struct handshake_accept_rsp { - struct { - __u32 sockfd:1; - __u32 message_type:1; - __u32 timeout:1; - __u32 auth_mode:1; - __u32 peername_len; - } _present; - - __s32 sockfd; - enum handshake_msg_type message_type; - __u32 timeout; - enum handshake_auth auth_mode; - unsigned int n_peer_identity; - __u32 *peer_identity; - unsigned int n_certificate; - struct handshake_x509 *certificate; - char *peername; -}; - -void handshake_accept_rsp_free(struct handshake_accept_rsp *rsp); - -/* - * Handler retrieves next queued handshake request - */ -struct handshake_accept_rsp * -handshake_accept(struct ynl_sock *ys, struct handshake_accept_req *req); - -/* HANDSHAKE_CMD_ACCEPT - notify */ -struct handshake_accept_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct handshake_accept_ntf *ntf); - struct handshake_accept_rsp obj __attribute__((aligned(8))); -}; - -void handshake_accept_ntf_free(struct handshake_accept_ntf *rsp); - -/* ============== HANDSHAKE_CMD_DONE ============== */ -/* HANDSHAKE_CMD_DONE - do */ -struct handshake_done_req { - struct { - __u32 status:1; - __u32 sockfd:1; - } _present; - - __u32 status; - __s32 sockfd; - unsigned int n_remote_auth; - __u32 *remote_auth; -}; - -static inline struct handshake_done_req *handshake_done_req_alloc(void) -{ - return calloc(1, sizeof(struct handshake_done_req)); -} -void handshake_done_req_free(struct handshake_done_req *req); - -static inline void -handshake_done_req_set_status(struct handshake_done_req *req, __u32 status) -{ - req->_present.status = 1; - req->status = status; -} -static inline void -handshake_done_req_set_sockfd(struct handshake_done_req *req, __s32 sockfd) -{ - req->_present.sockfd = 1; - req->sockfd = sockfd; -} -static inline void -__handshake_done_req_set_remote_auth(struct handshake_done_req *req, - __u32 *remote_auth, - unsigned int n_remote_auth) -{ - free(req->remote_auth); - req->remote_auth = remote_auth; - req->n_remote_auth = n_remote_auth; -} - -/* - * Handler reports handshake completion - */ -int handshake_done(struct ynl_sock *ys, struct handshake_done_req *req); - -#endif /* _LINUX_HANDSHAKE_GEN_H */ diff --git a/generated/handshake-user.h b/generated/handshake-user.h new file mode 120000 index 0000000..6271775 --- /dev/null +++ b/generated/handshake-user.h @@ -0,0 +1 @@ +../include/ynl-c/handshake.h \ No newline at end of file diff --git a/generated/mptcp_pm-user.h b/generated/mptcp_pm-user.h deleted file mode 100644 index a7b27e6..0000000 --- a/generated/mptcp_pm-user.h +++ /dev/null @@ -1,1048 +0,0 @@ -/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ -/* Do not edit directly, auto-generated from: */ -/* Documentation/netlink/specs/mptcp_pm.yaml */ -/* YNL-GEN user header */ - -#ifndef _LINUX_MPTCP_PM_GEN_H -#define _LINUX_MPTCP_PM_GEN_H - -#include -#include -#include -#include - -struct ynl_sock; - -extern const struct ynl_family ynl_mptcp_pm_family; - -/* Enums */ -const char *mptcp_pm_op_str(int op); -const char *mptcp_pm_event_type_str(enum mptcp_event_type value); - -/* Common nested types */ -struct mptcp_pm_address { - struct { - __u32 family:1; - __u32 id:1; - __u32 addr4:1; - __u32 addr6_len; - __u32 port:1; - __u32 flags:1; - __u32 if_idx:1; - } _present; - - __u16 family; - __u8 id; - __u32 addr4 /* big-endian */; - void *addr6; - __u16 port /* big-endian */; - __u32 flags; - __s32 if_idx; -}; - -/* ============== MPTCP_PM_CMD_ADD_ADDR ============== */ -/* MPTCP_PM_CMD_ADD_ADDR - do */ -struct mptcp_pm_add_addr_req { - struct { - __u32 addr:1; - } _present; - - struct mptcp_pm_address addr; -}; - -static inline struct mptcp_pm_add_addr_req *mptcp_pm_add_addr_req_alloc(void) -{ - return calloc(1, sizeof(struct mptcp_pm_add_addr_req)); -} -void mptcp_pm_add_addr_req_free(struct mptcp_pm_add_addr_req *req); - -static inline void -mptcp_pm_add_addr_req_set_addr_family(struct mptcp_pm_add_addr_req *req, - __u16 family) -{ - req->_present.addr = 1; - req->addr._present.family = 1; - req->addr.family = family; -} -static inline void -mptcp_pm_add_addr_req_set_addr_id(struct mptcp_pm_add_addr_req *req, __u8 id) -{ - req->_present.addr = 1; - req->addr._present.id = 1; - req->addr.id = id; -} -static inline void -mptcp_pm_add_addr_req_set_addr_addr4(struct mptcp_pm_add_addr_req *req, - __u32 addr4 /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.addr4 = 1; - req->addr.addr4 = addr4; -} -static inline void -mptcp_pm_add_addr_req_set_addr_addr6(struct mptcp_pm_add_addr_req *req, - const void *addr6, size_t len) -{ - free(req->addr.addr6); - req->addr._present.addr6_len = len; - req->addr.addr6 = malloc(req->addr._present.addr6_len); - memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); -} -static inline void -mptcp_pm_add_addr_req_set_addr_port(struct mptcp_pm_add_addr_req *req, - __u16 port /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.port = 1; - req->addr.port = port; -} -static inline void -mptcp_pm_add_addr_req_set_addr_flags(struct mptcp_pm_add_addr_req *req, - __u32 flags) -{ - req->_present.addr = 1; - req->addr._present.flags = 1; - req->addr.flags = flags; -} -static inline void -mptcp_pm_add_addr_req_set_addr_if_idx(struct mptcp_pm_add_addr_req *req, - __s32 if_idx) -{ - req->_present.addr = 1; - req->addr._present.if_idx = 1; - req->addr.if_idx = if_idx; -} - -/* - * Add endpoint - */ -int mptcp_pm_add_addr(struct ynl_sock *ys, struct mptcp_pm_add_addr_req *req); - -/* ============== MPTCP_PM_CMD_DEL_ADDR ============== */ -/* MPTCP_PM_CMD_DEL_ADDR - do */ -struct mptcp_pm_del_addr_req { - struct { - __u32 addr:1; - } _present; - - struct mptcp_pm_address addr; -}; - -static inline struct mptcp_pm_del_addr_req *mptcp_pm_del_addr_req_alloc(void) -{ - return calloc(1, sizeof(struct mptcp_pm_del_addr_req)); -} -void mptcp_pm_del_addr_req_free(struct mptcp_pm_del_addr_req *req); - -static inline void -mptcp_pm_del_addr_req_set_addr_family(struct mptcp_pm_del_addr_req *req, - __u16 family) -{ - req->_present.addr = 1; - req->addr._present.family = 1; - req->addr.family = family; -} -static inline void -mptcp_pm_del_addr_req_set_addr_id(struct mptcp_pm_del_addr_req *req, __u8 id) -{ - req->_present.addr = 1; - req->addr._present.id = 1; - req->addr.id = id; -} -static inline void -mptcp_pm_del_addr_req_set_addr_addr4(struct mptcp_pm_del_addr_req *req, - __u32 addr4 /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.addr4 = 1; - req->addr.addr4 = addr4; -} -static inline void -mptcp_pm_del_addr_req_set_addr_addr6(struct mptcp_pm_del_addr_req *req, - const void *addr6, size_t len) -{ - free(req->addr.addr6); - req->addr._present.addr6_len = len; - req->addr.addr6 = malloc(req->addr._present.addr6_len); - memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); -} -static inline void -mptcp_pm_del_addr_req_set_addr_port(struct mptcp_pm_del_addr_req *req, - __u16 port /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.port = 1; - req->addr.port = port; -} -static inline void -mptcp_pm_del_addr_req_set_addr_flags(struct mptcp_pm_del_addr_req *req, - __u32 flags) -{ - req->_present.addr = 1; - req->addr._present.flags = 1; - req->addr.flags = flags; -} -static inline void -mptcp_pm_del_addr_req_set_addr_if_idx(struct mptcp_pm_del_addr_req *req, - __s32 if_idx) -{ - req->_present.addr = 1; - req->addr._present.if_idx = 1; - req->addr.if_idx = if_idx; -} - -/* - * Delete endpoint - */ -int mptcp_pm_del_addr(struct ynl_sock *ys, struct mptcp_pm_del_addr_req *req); - -/* ============== MPTCP_PM_CMD_GET_ADDR ============== */ -/* MPTCP_PM_CMD_GET_ADDR - do */ -struct mptcp_pm_get_addr_req { - struct { - __u32 addr:1; - __u32 token:1; - } _present; - - struct mptcp_pm_address addr; - __u32 token; -}; - -static inline struct mptcp_pm_get_addr_req *mptcp_pm_get_addr_req_alloc(void) -{ - return calloc(1, sizeof(struct mptcp_pm_get_addr_req)); -} -void mptcp_pm_get_addr_req_free(struct mptcp_pm_get_addr_req *req); - -static inline void -mptcp_pm_get_addr_req_set_addr_family(struct mptcp_pm_get_addr_req *req, - __u16 family) -{ - req->_present.addr = 1; - req->addr._present.family = 1; - req->addr.family = family; -} -static inline void -mptcp_pm_get_addr_req_set_addr_id(struct mptcp_pm_get_addr_req *req, __u8 id) -{ - req->_present.addr = 1; - req->addr._present.id = 1; - req->addr.id = id; -} -static inline void -mptcp_pm_get_addr_req_set_addr_addr4(struct mptcp_pm_get_addr_req *req, - __u32 addr4 /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.addr4 = 1; - req->addr.addr4 = addr4; -} -static inline void -mptcp_pm_get_addr_req_set_addr_addr6(struct mptcp_pm_get_addr_req *req, - const void *addr6, size_t len) -{ - free(req->addr.addr6); - req->addr._present.addr6_len = len; - req->addr.addr6 = malloc(req->addr._present.addr6_len); - memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); -} -static inline void -mptcp_pm_get_addr_req_set_addr_port(struct mptcp_pm_get_addr_req *req, - __u16 port /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.port = 1; - req->addr.port = port; -} -static inline void -mptcp_pm_get_addr_req_set_addr_flags(struct mptcp_pm_get_addr_req *req, - __u32 flags) -{ - req->_present.addr = 1; - req->addr._present.flags = 1; - req->addr.flags = flags; -} -static inline void -mptcp_pm_get_addr_req_set_addr_if_idx(struct mptcp_pm_get_addr_req *req, - __s32 if_idx) -{ - req->_present.addr = 1; - req->addr._present.if_idx = 1; - req->addr.if_idx = if_idx; -} -static inline void -mptcp_pm_get_addr_req_set_token(struct mptcp_pm_get_addr_req *req, __u32 token) -{ - req->_present.token = 1; - req->token = token; -} - -struct mptcp_pm_get_addr_rsp { - struct { - __u32 addr:1; - } _present; - - struct mptcp_pm_address addr; -}; - -void mptcp_pm_get_addr_rsp_free(struct mptcp_pm_get_addr_rsp *rsp); - -/* - * Get endpoint information - */ -struct mptcp_pm_get_addr_rsp * -mptcp_pm_get_addr(struct ynl_sock *ys, struct mptcp_pm_get_addr_req *req); - -/* MPTCP_PM_CMD_GET_ADDR - dump */ -struct mptcp_pm_get_addr_list { - struct mptcp_pm_get_addr_list *next; - struct mptcp_pm_get_addr_rsp obj __attribute__((aligned(8))); -}; - -void mptcp_pm_get_addr_list_free(struct mptcp_pm_get_addr_list *rsp); - -struct mptcp_pm_get_addr_list *mptcp_pm_get_addr_dump(struct ynl_sock *ys); - -/* ============== MPTCP_PM_CMD_FLUSH_ADDRS ============== */ -/* MPTCP_PM_CMD_FLUSH_ADDRS - do */ -struct mptcp_pm_flush_addrs_req { - struct { - __u32 addr:1; - } _present; - - struct mptcp_pm_address addr; -}; - -static inline struct mptcp_pm_flush_addrs_req * -mptcp_pm_flush_addrs_req_alloc(void) -{ - return calloc(1, sizeof(struct mptcp_pm_flush_addrs_req)); -} -void mptcp_pm_flush_addrs_req_free(struct mptcp_pm_flush_addrs_req *req); - -static inline void -mptcp_pm_flush_addrs_req_set_addr_family(struct mptcp_pm_flush_addrs_req *req, - __u16 family) -{ - req->_present.addr = 1; - req->addr._present.family = 1; - req->addr.family = family; -} -static inline void -mptcp_pm_flush_addrs_req_set_addr_id(struct mptcp_pm_flush_addrs_req *req, - __u8 id) -{ - req->_present.addr = 1; - req->addr._present.id = 1; - req->addr.id = id; -} -static inline void -mptcp_pm_flush_addrs_req_set_addr_addr4(struct mptcp_pm_flush_addrs_req *req, - __u32 addr4 /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.addr4 = 1; - req->addr.addr4 = addr4; -} -static inline void -mptcp_pm_flush_addrs_req_set_addr_addr6(struct mptcp_pm_flush_addrs_req *req, - const void *addr6, size_t len) -{ - free(req->addr.addr6); - req->addr._present.addr6_len = len; - req->addr.addr6 = malloc(req->addr._present.addr6_len); - memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); -} -static inline void -mptcp_pm_flush_addrs_req_set_addr_port(struct mptcp_pm_flush_addrs_req *req, - __u16 port /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.port = 1; - req->addr.port = port; -} -static inline void -mptcp_pm_flush_addrs_req_set_addr_flags(struct mptcp_pm_flush_addrs_req *req, - __u32 flags) -{ - req->_present.addr = 1; - req->addr._present.flags = 1; - req->addr.flags = flags; -} -static inline void -mptcp_pm_flush_addrs_req_set_addr_if_idx(struct mptcp_pm_flush_addrs_req *req, - __s32 if_idx) -{ - req->_present.addr = 1; - req->addr._present.if_idx = 1; - req->addr.if_idx = if_idx; -} - -/* - * flush addresses - */ -int mptcp_pm_flush_addrs(struct ynl_sock *ys, - struct mptcp_pm_flush_addrs_req *req); - -/* ============== MPTCP_PM_CMD_SET_LIMITS ============== */ -/* MPTCP_PM_CMD_SET_LIMITS - do */ -struct mptcp_pm_set_limits_req { - struct { - __u32 rcv_add_addrs:1; - __u32 subflows:1; - } _present; - - __u32 rcv_add_addrs; - __u32 subflows; -}; - -static inline struct mptcp_pm_set_limits_req * -mptcp_pm_set_limits_req_alloc(void) -{ - return calloc(1, sizeof(struct mptcp_pm_set_limits_req)); -} -void mptcp_pm_set_limits_req_free(struct mptcp_pm_set_limits_req *req); - -static inline void -mptcp_pm_set_limits_req_set_rcv_add_addrs(struct mptcp_pm_set_limits_req *req, - __u32 rcv_add_addrs) -{ - req->_present.rcv_add_addrs = 1; - req->rcv_add_addrs = rcv_add_addrs; -} -static inline void -mptcp_pm_set_limits_req_set_subflows(struct mptcp_pm_set_limits_req *req, - __u32 subflows) -{ - req->_present.subflows = 1; - req->subflows = subflows; -} - -/* - * Set protocol limits - */ -int mptcp_pm_set_limits(struct ynl_sock *ys, - struct mptcp_pm_set_limits_req *req); - -/* ============== MPTCP_PM_CMD_GET_LIMITS ============== */ -/* MPTCP_PM_CMD_GET_LIMITS - do */ -struct mptcp_pm_get_limits_req { - struct { - __u32 rcv_add_addrs:1; - __u32 subflows:1; - } _present; - - __u32 rcv_add_addrs; - __u32 subflows; -}; - -static inline struct mptcp_pm_get_limits_req * -mptcp_pm_get_limits_req_alloc(void) -{ - return calloc(1, sizeof(struct mptcp_pm_get_limits_req)); -} -void mptcp_pm_get_limits_req_free(struct mptcp_pm_get_limits_req *req); - -static inline void -mptcp_pm_get_limits_req_set_rcv_add_addrs(struct mptcp_pm_get_limits_req *req, - __u32 rcv_add_addrs) -{ - req->_present.rcv_add_addrs = 1; - req->rcv_add_addrs = rcv_add_addrs; -} -static inline void -mptcp_pm_get_limits_req_set_subflows(struct mptcp_pm_get_limits_req *req, - __u32 subflows) -{ - req->_present.subflows = 1; - req->subflows = subflows; -} - -struct mptcp_pm_get_limits_rsp { - struct { - __u32 rcv_add_addrs:1; - __u32 subflows:1; - } _present; - - __u32 rcv_add_addrs; - __u32 subflows; -}; - -void mptcp_pm_get_limits_rsp_free(struct mptcp_pm_get_limits_rsp *rsp); - -/* - * Get protocol limits - */ -struct mptcp_pm_get_limits_rsp * -mptcp_pm_get_limits(struct ynl_sock *ys, struct mptcp_pm_get_limits_req *req); - -/* ============== MPTCP_PM_CMD_SET_FLAGS ============== */ -/* MPTCP_PM_CMD_SET_FLAGS - do */ -struct mptcp_pm_set_flags_req { - struct { - __u32 addr:1; - __u32 token:1; - __u32 addr_remote:1; - } _present; - - struct mptcp_pm_address addr; - __u32 token; - struct mptcp_pm_address addr_remote; -}; - -static inline struct mptcp_pm_set_flags_req *mptcp_pm_set_flags_req_alloc(void) -{ - return calloc(1, sizeof(struct mptcp_pm_set_flags_req)); -} -void mptcp_pm_set_flags_req_free(struct mptcp_pm_set_flags_req *req); - -static inline void -mptcp_pm_set_flags_req_set_addr_family(struct mptcp_pm_set_flags_req *req, - __u16 family) -{ - req->_present.addr = 1; - req->addr._present.family = 1; - req->addr.family = family; -} -static inline void -mptcp_pm_set_flags_req_set_addr_id(struct mptcp_pm_set_flags_req *req, __u8 id) -{ - req->_present.addr = 1; - req->addr._present.id = 1; - req->addr.id = id; -} -static inline void -mptcp_pm_set_flags_req_set_addr_addr4(struct mptcp_pm_set_flags_req *req, - __u32 addr4 /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.addr4 = 1; - req->addr.addr4 = addr4; -} -static inline void -mptcp_pm_set_flags_req_set_addr_addr6(struct mptcp_pm_set_flags_req *req, - const void *addr6, size_t len) -{ - free(req->addr.addr6); - req->addr._present.addr6_len = len; - req->addr.addr6 = malloc(req->addr._present.addr6_len); - memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); -} -static inline void -mptcp_pm_set_flags_req_set_addr_port(struct mptcp_pm_set_flags_req *req, - __u16 port /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.port = 1; - req->addr.port = port; -} -static inline void -mptcp_pm_set_flags_req_set_addr_flags(struct mptcp_pm_set_flags_req *req, - __u32 flags) -{ - req->_present.addr = 1; - req->addr._present.flags = 1; - req->addr.flags = flags; -} -static inline void -mptcp_pm_set_flags_req_set_addr_if_idx(struct mptcp_pm_set_flags_req *req, - __s32 if_idx) -{ - req->_present.addr = 1; - req->addr._present.if_idx = 1; - req->addr.if_idx = if_idx; -} -static inline void -mptcp_pm_set_flags_req_set_token(struct mptcp_pm_set_flags_req *req, - __u32 token) -{ - req->_present.token = 1; - req->token = token; -} -static inline void -mptcp_pm_set_flags_req_set_addr_remote_family(struct mptcp_pm_set_flags_req *req, - __u16 family) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.family = 1; - req->addr_remote.family = family; -} -static inline void -mptcp_pm_set_flags_req_set_addr_remote_id(struct mptcp_pm_set_flags_req *req, - __u8 id) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.id = 1; - req->addr_remote.id = id; -} -static inline void -mptcp_pm_set_flags_req_set_addr_remote_addr4(struct mptcp_pm_set_flags_req *req, - __u32 addr4 /* big-endian */) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.addr4 = 1; - req->addr_remote.addr4 = addr4; -} -static inline void -mptcp_pm_set_flags_req_set_addr_remote_addr6(struct mptcp_pm_set_flags_req *req, - const void *addr6, size_t len) -{ - free(req->addr_remote.addr6); - req->addr_remote._present.addr6_len = len; - req->addr_remote.addr6 = malloc(req->addr_remote._present.addr6_len); - memcpy(req->addr_remote.addr6, addr6, req->addr_remote._present.addr6_len); -} -static inline void -mptcp_pm_set_flags_req_set_addr_remote_port(struct mptcp_pm_set_flags_req *req, - __u16 port /* big-endian */) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.port = 1; - req->addr_remote.port = port; -} -static inline void -mptcp_pm_set_flags_req_set_addr_remote_flags(struct mptcp_pm_set_flags_req *req, - __u32 flags) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.flags = 1; - req->addr_remote.flags = flags; -} -static inline void -mptcp_pm_set_flags_req_set_addr_remote_if_idx(struct mptcp_pm_set_flags_req *req, - __s32 if_idx) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.if_idx = 1; - req->addr_remote.if_idx = if_idx; -} - -/* - * Change endpoint flags - */ -int mptcp_pm_set_flags(struct ynl_sock *ys, struct mptcp_pm_set_flags_req *req); - -/* ============== MPTCP_PM_CMD_ANNOUNCE ============== */ -/* MPTCP_PM_CMD_ANNOUNCE - do */ -struct mptcp_pm_announce_req { - struct { - __u32 addr:1; - __u32 token:1; - } _present; - - struct mptcp_pm_address addr; - __u32 token; -}; - -static inline struct mptcp_pm_announce_req *mptcp_pm_announce_req_alloc(void) -{ - return calloc(1, sizeof(struct mptcp_pm_announce_req)); -} -void mptcp_pm_announce_req_free(struct mptcp_pm_announce_req *req); - -static inline void -mptcp_pm_announce_req_set_addr_family(struct mptcp_pm_announce_req *req, - __u16 family) -{ - req->_present.addr = 1; - req->addr._present.family = 1; - req->addr.family = family; -} -static inline void -mptcp_pm_announce_req_set_addr_id(struct mptcp_pm_announce_req *req, __u8 id) -{ - req->_present.addr = 1; - req->addr._present.id = 1; - req->addr.id = id; -} -static inline void -mptcp_pm_announce_req_set_addr_addr4(struct mptcp_pm_announce_req *req, - __u32 addr4 /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.addr4 = 1; - req->addr.addr4 = addr4; -} -static inline void -mptcp_pm_announce_req_set_addr_addr6(struct mptcp_pm_announce_req *req, - const void *addr6, size_t len) -{ - free(req->addr.addr6); - req->addr._present.addr6_len = len; - req->addr.addr6 = malloc(req->addr._present.addr6_len); - memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); -} -static inline void -mptcp_pm_announce_req_set_addr_port(struct mptcp_pm_announce_req *req, - __u16 port /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.port = 1; - req->addr.port = port; -} -static inline void -mptcp_pm_announce_req_set_addr_flags(struct mptcp_pm_announce_req *req, - __u32 flags) -{ - req->_present.addr = 1; - req->addr._present.flags = 1; - req->addr.flags = flags; -} -static inline void -mptcp_pm_announce_req_set_addr_if_idx(struct mptcp_pm_announce_req *req, - __s32 if_idx) -{ - req->_present.addr = 1; - req->addr._present.if_idx = 1; - req->addr.if_idx = if_idx; -} -static inline void -mptcp_pm_announce_req_set_token(struct mptcp_pm_announce_req *req, __u32 token) -{ - req->_present.token = 1; - req->token = token; -} - -/* - * announce new sf - */ -int mptcp_pm_announce(struct ynl_sock *ys, struct mptcp_pm_announce_req *req); - -/* ============== MPTCP_PM_CMD_REMOVE ============== */ -/* MPTCP_PM_CMD_REMOVE - do */ -struct mptcp_pm_remove_req { - struct { - __u32 token:1; - __u32 loc_id:1; - } _present; - - __u32 token; - __u8 loc_id; -}; - -static inline struct mptcp_pm_remove_req *mptcp_pm_remove_req_alloc(void) -{ - return calloc(1, sizeof(struct mptcp_pm_remove_req)); -} -void mptcp_pm_remove_req_free(struct mptcp_pm_remove_req *req); - -static inline void -mptcp_pm_remove_req_set_token(struct mptcp_pm_remove_req *req, __u32 token) -{ - req->_present.token = 1; - req->token = token; -} -static inline void -mptcp_pm_remove_req_set_loc_id(struct mptcp_pm_remove_req *req, __u8 loc_id) -{ - req->_present.loc_id = 1; - req->loc_id = loc_id; -} - -/* - * announce removal - */ -int mptcp_pm_remove(struct ynl_sock *ys, struct mptcp_pm_remove_req *req); - -/* ============== MPTCP_PM_CMD_SUBFLOW_CREATE ============== */ -/* MPTCP_PM_CMD_SUBFLOW_CREATE - do */ -struct mptcp_pm_subflow_create_req { - struct { - __u32 addr:1; - __u32 token:1; - __u32 addr_remote:1; - } _present; - - struct mptcp_pm_address addr; - __u32 token; - struct mptcp_pm_address addr_remote; -}; - -static inline struct mptcp_pm_subflow_create_req * -mptcp_pm_subflow_create_req_alloc(void) -{ - return calloc(1, sizeof(struct mptcp_pm_subflow_create_req)); -} -void mptcp_pm_subflow_create_req_free(struct mptcp_pm_subflow_create_req *req); - -static inline void -mptcp_pm_subflow_create_req_set_addr_family(struct mptcp_pm_subflow_create_req *req, - __u16 family) -{ - req->_present.addr = 1; - req->addr._present.family = 1; - req->addr.family = family; -} -static inline void -mptcp_pm_subflow_create_req_set_addr_id(struct mptcp_pm_subflow_create_req *req, - __u8 id) -{ - req->_present.addr = 1; - req->addr._present.id = 1; - req->addr.id = id; -} -static inline void -mptcp_pm_subflow_create_req_set_addr_addr4(struct mptcp_pm_subflow_create_req *req, - __u32 addr4 /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.addr4 = 1; - req->addr.addr4 = addr4; -} -static inline void -mptcp_pm_subflow_create_req_set_addr_addr6(struct mptcp_pm_subflow_create_req *req, - const void *addr6, size_t len) -{ - free(req->addr.addr6); - req->addr._present.addr6_len = len; - req->addr.addr6 = malloc(req->addr._present.addr6_len); - memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); -} -static inline void -mptcp_pm_subflow_create_req_set_addr_port(struct mptcp_pm_subflow_create_req *req, - __u16 port /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.port = 1; - req->addr.port = port; -} -static inline void -mptcp_pm_subflow_create_req_set_addr_flags(struct mptcp_pm_subflow_create_req *req, - __u32 flags) -{ - req->_present.addr = 1; - req->addr._present.flags = 1; - req->addr.flags = flags; -} -static inline void -mptcp_pm_subflow_create_req_set_addr_if_idx(struct mptcp_pm_subflow_create_req *req, - __s32 if_idx) -{ - req->_present.addr = 1; - req->addr._present.if_idx = 1; - req->addr.if_idx = if_idx; -} -static inline void -mptcp_pm_subflow_create_req_set_token(struct mptcp_pm_subflow_create_req *req, - __u32 token) -{ - req->_present.token = 1; - req->token = token; -} -static inline void -mptcp_pm_subflow_create_req_set_addr_remote_family(struct mptcp_pm_subflow_create_req *req, - __u16 family) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.family = 1; - req->addr_remote.family = family; -} -static inline void -mptcp_pm_subflow_create_req_set_addr_remote_id(struct mptcp_pm_subflow_create_req *req, - __u8 id) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.id = 1; - req->addr_remote.id = id; -} -static inline void -mptcp_pm_subflow_create_req_set_addr_remote_addr4(struct mptcp_pm_subflow_create_req *req, - __u32 addr4 /* big-endian */) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.addr4 = 1; - req->addr_remote.addr4 = addr4; -} -static inline void -mptcp_pm_subflow_create_req_set_addr_remote_addr6(struct mptcp_pm_subflow_create_req *req, - const void *addr6, - size_t len) -{ - free(req->addr_remote.addr6); - req->addr_remote._present.addr6_len = len; - req->addr_remote.addr6 = malloc(req->addr_remote._present.addr6_len); - memcpy(req->addr_remote.addr6, addr6, req->addr_remote._present.addr6_len); -} -static inline void -mptcp_pm_subflow_create_req_set_addr_remote_port(struct mptcp_pm_subflow_create_req *req, - __u16 port /* big-endian */) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.port = 1; - req->addr_remote.port = port; -} -static inline void -mptcp_pm_subflow_create_req_set_addr_remote_flags(struct mptcp_pm_subflow_create_req *req, - __u32 flags) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.flags = 1; - req->addr_remote.flags = flags; -} -static inline void -mptcp_pm_subflow_create_req_set_addr_remote_if_idx(struct mptcp_pm_subflow_create_req *req, - __s32 if_idx) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.if_idx = 1; - req->addr_remote.if_idx = if_idx; -} - -/* - * todo - */ -int mptcp_pm_subflow_create(struct ynl_sock *ys, - struct mptcp_pm_subflow_create_req *req); - -/* ============== MPTCP_PM_CMD_SUBFLOW_DESTROY ============== */ -/* MPTCP_PM_CMD_SUBFLOW_DESTROY - do */ -struct mptcp_pm_subflow_destroy_req { - struct { - __u32 addr:1; - __u32 token:1; - __u32 addr_remote:1; - } _present; - - struct mptcp_pm_address addr; - __u32 token; - struct mptcp_pm_address addr_remote; -}; - -static inline struct mptcp_pm_subflow_destroy_req * -mptcp_pm_subflow_destroy_req_alloc(void) -{ - return calloc(1, sizeof(struct mptcp_pm_subflow_destroy_req)); -} -void -mptcp_pm_subflow_destroy_req_free(struct mptcp_pm_subflow_destroy_req *req); - -static inline void -mptcp_pm_subflow_destroy_req_set_addr_family(struct mptcp_pm_subflow_destroy_req *req, - __u16 family) -{ - req->_present.addr = 1; - req->addr._present.family = 1; - req->addr.family = family; -} -static inline void -mptcp_pm_subflow_destroy_req_set_addr_id(struct mptcp_pm_subflow_destroy_req *req, - __u8 id) -{ - req->_present.addr = 1; - req->addr._present.id = 1; - req->addr.id = id; -} -static inline void -mptcp_pm_subflow_destroy_req_set_addr_addr4(struct mptcp_pm_subflow_destroy_req *req, - __u32 addr4 /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.addr4 = 1; - req->addr.addr4 = addr4; -} -static inline void -mptcp_pm_subflow_destroy_req_set_addr_addr6(struct mptcp_pm_subflow_destroy_req *req, - const void *addr6, size_t len) -{ - free(req->addr.addr6); - req->addr._present.addr6_len = len; - req->addr.addr6 = malloc(req->addr._present.addr6_len); - memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); -} -static inline void -mptcp_pm_subflow_destroy_req_set_addr_port(struct mptcp_pm_subflow_destroy_req *req, - __u16 port /* big-endian */) -{ - req->_present.addr = 1; - req->addr._present.port = 1; - req->addr.port = port; -} -static inline void -mptcp_pm_subflow_destroy_req_set_addr_flags(struct mptcp_pm_subflow_destroy_req *req, - __u32 flags) -{ - req->_present.addr = 1; - req->addr._present.flags = 1; - req->addr.flags = flags; -} -static inline void -mptcp_pm_subflow_destroy_req_set_addr_if_idx(struct mptcp_pm_subflow_destroy_req *req, - __s32 if_idx) -{ - req->_present.addr = 1; - req->addr._present.if_idx = 1; - req->addr.if_idx = if_idx; -} -static inline void -mptcp_pm_subflow_destroy_req_set_token(struct mptcp_pm_subflow_destroy_req *req, - __u32 token) -{ - req->_present.token = 1; - req->token = token; -} -static inline void -mptcp_pm_subflow_destroy_req_set_addr_remote_family(struct mptcp_pm_subflow_destroy_req *req, - __u16 family) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.family = 1; - req->addr_remote.family = family; -} -static inline void -mptcp_pm_subflow_destroy_req_set_addr_remote_id(struct mptcp_pm_subflow_destroy_req *req, - __u8 id) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.id = 1; - req->addr_remote.id = id; -} -static inline void -mptcp_pm_subflow_destroy_req_set_addr_remote_addr4(struct mptcp_pm_subflow_destroy_req *req, - __u32 addr4 /* big-endian */) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.addr4 = 1; - req->addr_remote.addr4 = addr4; -} -static inline void -mptcp_pm_subflow_destroy_req_set_addr_remote_addr6(struct mptcp_pm_subflow_destroy_req *req, - const void *addr6, - size_t len) -{ - free(req->addr_remote.addr6); - req->addr_remote._present.addr6_len = len; - req->addr_remote.addr6 = malloc(req->addr_remote._present.addr6_len); - memcpy(req->addr_remote.addr6, addr6, req->addr_remote._present.addr6_len); -} -static inline void -mptcp_pm_subflow_destroy_req_set_addr_remote_port(struct mptcp_pm_subflow_destroy_req *req, - __u16 port /* big-endian */) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.port = 1; - req->addr_remote.port = port; -} -static inline void -mptcp_pm_subflow_destroy_req_set_addr_remote_flags(struct mptcp_pm_subflow_destroy_req *req, - __u32 flags) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.flags = 1; - req->addr_remote.flags = flags; -} -static inline void -mptcp_pm_subflow_destroy_req_set_addr_remote_if_idx(struct mptcp_pm_subflow_destroy_req *req, - __s32 if_idx) -{ - req->_present.addr_remote = 1; - req->addr_remote._present.if_idx = 1; - req->addr_remote.if_idx = if_idx; -} - -/* - * todo - */ -int mptcp_pm_subflow_destroy(struct ynl_sock *ys, - struct mptcp_pm_subflow_destroy_req *req); - -#endif /* _LINUX_MPTCP_PM_GEN_H */ diff --git a/generated/mptcp_pm-user.h b/generated/mptcp_pm-user.h new file mode 120000 index 0000000..ad0ee12 --- /dev/null +++ b/generated/mptcp_pm-user.h @@ -0,0 +1 @@ +../include/ynl-c/mptcp_pm.h \ No newline at end of file diff --git a/generated/netdev-user.h b/generated/netdev-user.h deleted file mode 100644 index 7b0fdd7..0000000 --- a/generated/netdev-user.h +++ /dev/null @@ -1,499 +0,0 @@ -/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ -/* Do not edit directly, auto-generated from: */ -/* Documentation/netlink/specs/netdev.yaml */ -/* YNL-GEN user header */ - -#ifndef _LINUX_NETDEV_GEN_H -#define _LINUX_NETDEV_GEN_H - -#include -#include -#include -#include - -struct ynl_sock; - -extern const struct ynl_family ynl_netdev_family; - -/* Enums */ -const char *netdev_op_str(int op); -const char *netdev_xdp_act_str(enum netdev_xdp_act value); -const char *netdev_xdp_rx_metadata_str(enum netdev_xdp_rx_metadata value); -const char *netdev_xsk_flags_str(enum netdev_xsk_flags value); -const char *netdev_queue_type_str(enum netdev_queue_type value); -const char *netdev_qstats_scope_str(enum netdev_qstats_scope value); - -/* Common nested types */ -struct netdev_page_pool_info { - struct { - __u32 id:1; - __u32 ifindex:1; - } _present; - - __u64 id; - __u32 ifindex; -}; - -/* ============== NETDEV_CMD_DEV_GET ============== */ -/* NETDEV_CMD_DEV_GET - do */ -struct netdev_dev_get_req { - struct { - __u32 ifindex:1; - } _present; - - __u32 ifindex; -}; - -static inline struct netdev_dev_get_req *netdev_dev_get_req_alloc(void) -{ - return calloc(1, sizeof(struct netdev_dev_get_req)); -} -void netdev_dev_get_req_free(struct netdev_dev_get_req *req); - -static inline void -netdev_dev_get_req_set_ifindex(struct netdev_dev_get_req *req, __u32 ifindex) -{ - req->_present.ifindex = 1; - req->ifindex = ifindex; -} - -struct netdev_dev_get_rsp { - struct { - __u32 ifindex:1; - __u32 xdp_features:1; - __u32 xdp_zc_max_segs:1; - __u32 xdp_rx_metadata_features:1; - __u32 xsk_features:1; - } _present; - - __u32 ifindex; - __u64 xdp_features; - __u32 xdp_zc_max_segs; - __u64 xdp_rx_metadata_features; - __u64 xsk_features; -}; - -void netdev_dev_get_rsp_free(struct netdev_dev_get_rsp *rsp); - -/* - * Get / dump information about a netdev. - */ -struct netdev_dev_get_rsp * -netdev_dev_get(struct ynl_sock *ys, struct netdev_dev_get_req *req); - -/* NETDEV_CMD_DEV_GET - dump */ -struct netdev_dev_get_list { - struct netdev_dev_get_list *next; - struct netdev_dev_get_rsp obj __attribute__((aligned(8))); -}; - -void netdev_dev_get_list_free(struct netdev_dev_get_list *rsp); - -struct netdev_dev_get_list *netdev_dev_get_dump(struct ynl_sock *ys); - -/* NETDEV_CMD_DEV_GET - notify */ -struct netdev_dev_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct netdev_dev_get_ntf *ntf); - struct netdev_dev_get_rsp obj __attribute__((aligned(8))); -}; - -void netdev_dev_get_ntf_free(struct netdev_dev_get_ntf *rsp); - -/* ============== NETDEV_CMD_PAGE_POOL_GET ============== */ -/* NETDEV_CMD_PAGE_POOL_GET - do */ -struct netdev_page_pool_get_req { - struct { - __u32 id:1; - } _present; - - __u64 id; -}; - -static inline struct netdev_page_pool_get_req * -netdev_page_pool_get_req_alloc(void) -{ - return calloc(1, sizeof(struct netdev_page_pool_get_req)); -} -void netdev_page_pool_get_req_free(struct netdev_page_pool_get_req *req); - -static inline void -netdev_page_pool_get_req_set_id(struct netdev_page_pool_get_req *req, __u64 id) -{ - req->_present.id = 1; - req->id = id; -} - -struct netdev_page_pool_get_rsp { - struct { - __u32 id:1; - __u32 ifindex:1; - __u32 napi_id:1; - __u32 inflight:1; - __u32 inflight_mem:1; - __u32 detach_time:1; - } _present; - - __u64 id; - __u32 ifindex; - __u64 napi_id; - __u64 inflight; - __u64 inflight_mem; - __u64 detach_time; -}; - -void netdev_page_pool_get_rsp_free(struct netdev_page_pool_get_rsp *rsp); - -/* - * Get / dump information about Page Pools. -(Only Page Pools associated with a net_device can be listed.) - - */ -struct netdev_page_pool_get_rsp * -netdev_page_pool_get(struct ynl_sock *ys, struct netdev_page_pool_get_req *req); - -/* NETDEV_CMD_PAGE_POOL_GET - dump */ -struct netdev_page_pool_get_list { - struct netdev_page_pool_get_list *next; - struct netdev_page_pool_get_rsp obj __attribute__((aligned(8))); -}; - -void netdev_page_pool_get_list_free(struct netdev_page_pool_get_list *rsp); - -struct netdev_page_pool_get_list * -netdev_page_pool_get_dump(struct ynl_sock *ys); - -/* NETDEV_CMD_PAGE_POOL_GET - notify */ -struct netdev_page_pool_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct netdev_page_pool_get_ntf *ntf); - struct netdev_page_pool_get_rsp obj __attribute__((aligned(8))); -}; - -void netdev_page_pool_get_ntf_free(struct netdev_page_pool_get_ntf *rsp); - -/* ============== NETDEV_CMD_PAGE_POOL_STATS_GET ============== */ -/* NETDEV_CMD_PAGE_POOL_STATS_GET - do */ -struct netdev_page_pool_stats_get_req { - struct { - __u32 info:1; - } _present; - - struct netdev_page_pool_info info; -}; - -static inline struct netdev_page_pool_stats_get_req * -netdev_page_pool_stats_get_req_alloc(void) -{ - return calloc(1, sizeof(struct netdev_page_pool_stats_get_req)); -} -void -netdev_page_pool_stats_get_req_free(struct netdev_page_pool_stats_get_req *req); - -static inline void -netdev_page_pool_stats_get_req_set_info_id(struct netdev_page_pool_stats_get_req *req, - __u64 id) -{ - req->_present.info = 1; - req->info._present.id = 1; - req->info.id = id; -} -static inline void -netdev_page_pool_stats_get_req_set_info_ifindex(struct netdev_page_pool_stats_get_req *req, - __u32 ifindex) -{ - req->_present.info = 1; - req->info._present.ifindex = 1; - req->info.ifindex = ifindex; -} - -struct netdev_page_pool_stats_get_rsp { - struct { - __u32 info:1; - __u32 alloc_fast:1; - __u32 alloc_slow:1; - __u32 alloc_slow_high_order:1; - __u32 alloc_empty:1; - __u32 alloc_refill:1; - __u32 alloc_waive:1; - __u32 recycle_cached:1; - __u32 recycle_cache_full:1; - __u32 recycle_ring:1; - __u32 recycle_ring_full:1; - __u32 recycle_released_refcnt:1; - } _present; - - struct netdev_page_pool_info info; - __u64 alloc_fast; - __u64 alloc_slow; - __u64 alloc_slow_high_order; - __u64 alloc_empty; - __u64 alloc_refill; - __u64 alloc_waive; - __u64 recycle_cached; - __u64 recycle_cache_full; - __u64 recycle_ring; - __u64 recycle_ring_full; - __u64 recycle_released_refcnt; -}; - -void -netdev_page_pool_stats_get_rsp_free(struct netdev_page_pool_stats_get_rsp *rsp); - -/* - * Get page pool statistics. - */ -struct netdev_page_pool_stats_get_rsp * -netdev_page_pool_stats_get(struct ynl_sock *ys, - struct netdev_page_pool_stats_get_req *req); - -/* NETDEV_CMD_PAGE_POOL_STATS_GET - dump */ -struct netdev_page_pool_stats_get_list { - struct netdev_page_pool_stats_get_list *next; - struct netdev_page_pool_stats_get_rsp obj __attribute__((aligned(8))); -}; - -void -netdev_page_pool_stats_get_list_free(struct netdev_page_pool_stats_get_list *rsp); - -struct netdev_page_pool_stats_get_list * -netdev_page_pool_stats_get_dump(struct ynl_sock *ys); - -/* ============== NETDEV_CMD_QUEUE_GET ============== */ -/* NETDEV_CMD_QUEUE_GET - do */ -struct netdev_queue_get_req { - struct { - __u32 ifindex:1; - __u32 type:1; - __u32 id:1; - } _present; - - __u32 ifindex; - enum netdev_queue_type type; - __u32 id; -}; - -static inline struct netdev_queue_get_req *netdev_queue_get_req_alloc(void) -{ - return calloc(1, sizeof(struct netdev_queue_get_req)); -} -void netdev_queue_get_req_free(struct netdev_queue_get_req *req); - -static inline void -netdev_queue_get_req_set_ifindex(struct netdev_queue_get_req *req, - __u32 ifindex) -{ - req->_present.ifindex = 1; - req->ifindex = ifindex; -} -static inline void -netdev_queue_get_req_set_type(struct netdev_queue_get_req *req, - enum netdev_queue_type type) -{ - req->_present.type = 1; - req->type = type; -} -static inline void -netdev_queue_get_req_set_id(struct netdev_queue_get_req *req, __u32 id) -{ - req->_present.id = 1; - req->id = id; -} - -struct netdev_queue_get_rsp { - struct { - __u32 id:1; - __u32 type:1; - __u32 napi_id:1; - __u32 ifindex:1; - } _present; - - __u32 id; - enum netdev_queue_type type; - __u32 napi_id; - __u32 ifindex; -}; - -void netdev_queue_get_rsp_free(struct netdev_queue_get_rsp *rsp); - -/* - * Get queue information from the kernel. Only configured queues will be reported (as opposed to all available hardware queues). - */ -struct netdev_queue_get_rsp * -netdev_queue_get(struct ynl_sock *ys, struct netdev_queue_get_req *req); - -/* NETDEV_CMD_QUEUE_GET - dump */ -struct netdev_queue_get_req_dump { - struct { - __u32 ifindex:1; - } _present; - - __u32 ifindex; -}; - -static inline struct netdev_queue_get_req_dump * -netdev_queue_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct netdev_queue_get_req_dump)); -} -void netdev_queue_get_req_dump_free(struct netdev_queue_get_req_dump *req); - -static inline void -netdev_queue_get_req_dump_set_ifindex(struct netdev_queue_get_req_dump *req, - __u32 ifindex) -{ - req->_present.ifindex = 1; - req->ifindex = ifindex; -} - -struct netdev_queue_get_list { - struct netdev_queue_get_list *next; - struct netdev_queue_get_rsp obj __attribute__((aligned(8))); -}; - -void netdev_queue_get_list_free(struct netdev_queue_get_list *rsp); - -struct netdev_queue_get_list * -netdev_queue_get_dump(struct ynl_sock *ys, - struct netdev_queue_get_req_dump *req); - -/* ============== NETDEV_CMD_NAPI_GET ============== */ -/* NETDEV_CMD_NAPI_GET - do */ -struct netdev_napi_get_req { - struct { - __u32 id:1; - } _present; - - __u32 id; -}; - -static inline struct netdev_napi_get_req *netdev_napi_get_req_alloc(void) -{ - return calloc(1, sizeof(struct netdev_napi_get_req)); -} -void netdev_napi_get_req_free(struct netdev_napi_get_req *req); - -static inline void -netdev_napi_get_req_set_id(struct netdev_napi_get_req *req, __u32 id) -{ - req->_present.id = 1; - req->id = id; -} - -struct netdev_napi_get_rsp { - struct { - __u32 id:1; - __u32 ifindex:1; - __u32 irq:1; - __u32 pid:1; - } _present; - - __u32 id; - __u32 ifindex; - __u32 irq; - __u32 pid; -}; - -void netdev_napi_get_rsp_free(struct netdev_napi_get_rsp *rsp); - -/* - * Get information about NAPI instances configured on the system. - */ -struct netdev_napi_get_rsp * -netdev_napi_get(struct ynl_sock *ys, struct netdev_napi_get_req *req); - -/* NETDEV_CMD_NAPI_GET - dump */ -struct netdev_napi_get_req_dump { - struct { - __u32 ifindex:1; - } _present; - - __u32 ifindex; -}; - -static inline struct netdev_napi_get_req_dump * -netdev_napi_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct netdev_napi_get_req_dump)); -} -void netdev_napi_get_req_dump_free(struct netdev_napi_get_req_dump *req); - -static inline void -netdev_napi_get_req_dump_set_ifindex(struct netdev_napi_get_req_dump *req, - __u32 ifindex) -{ - req->_present.ifindex = 1; - req->ifindex = ifindex; -} - -struct netdev_napi_get_list { - struct netdev_napi_get_list *next; - struct netdev_napi_get_rsp obj __attribute__((aligned(8))); -}; - -void netdev_napi_get_list_free(struct netdev_napi_get_list *rsp); - -struct netdev_napi_get_list * -netdev_napi_get_dump(struct ynl_sock *ys, struct netdev_napi_get_req_dump *req); - -/* ============== NETDEV_CMD_QSTATS_GET ============== */ -/* NETDEV_CMD_QSTATS_GET - dump */ -struct netdev_qstats_get_req_dump { - struct { - __u32 scope:1; - } _present; - - __u64 scope; -}; - -static inline struct netdev_qstats_get_req_dump * -netdev_qstats_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct netdev_qstats_get_req_dump)); -} -void netdev_qstats_get_req_dump_free(struct netdev_qstats_get_req_dump *req); - -static inline void -netdev_qstats_get_req_dump_set_scope(struct netdev_qstats_get_req_dump *req, - __u64 scope) -{ - req->_present.scope = 1; - req->scope = scope; -} - -struct netdev_qstats_get_rsp_dump { - struct { - __u32 ifindex:1; - __u32 queue_type:1; - __u32 queue_id:1; - __u32 rx_packets:1; - __u32 rx_bytes:1; - __u32 tx_packets:1; - __u32 tx_bytes:1; - } _present; - - __u32 ifindex; - enum netdev_queue_type queue_type; - __u32 queue_id; - __u64 rx_packets; - __u64 rx_bytes; - __u64 tx_packets; - __u64 tx_bytes; -}; - -struct netdev_qstats_get_rsp_list { - struct netdev_qstats_get_rsp_list *next; - struct netdev_qstats_get_rsp_dump obj __attribute__((aligned(8))); -}; - -void netdev_qstats_get_rsp_list_free(struct netdev_qstats_get_rsp_list *rsp); - -struct netdev_qstats_get_rsp_list * -netdev_qstats_get_dump(struct ynl_sock *ys, - struct netdev_qstats_get_req_dump *req); - -#endif /* _LINUX_NETDEV_GEN_H */ diff --git a/generated/netdev-user.h b/generated/netdev-user.h new file mode 120000 index 0000000..0336139 --- /dev/null +++ b/generated/netdev-user.h @@ -0,0 +1 @@ +../include/ynl-c/netdev.h \ No newline at end of file diff --git a/generated/nfsd-user.h b/generated/nfsd-user.h deleted file mode 100644 index 989c6e2..0000000 --- a/generated/nfsd-user.h +++ /dev/null @@ -1,67 +0,0 @@ -/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ -/* Do not edit directly, auto-generated from: */ -/* Documentation/netlink/specs/nfsd.yaml */ -/* YNL-GEN user header */ - -#ifndef _LINUX_NFSD_GEN_H -#define _LINUX_NFSD_GEN_H - -#include -#include -#include -#include - -struct ynl_sock; - -extern const struct ynl_family ynl_nfsd_family; - -/* Enums */ -const char *nfsd_op_str(int op); - -/* Common nested types */ -/* ============== NFSD_CMD_RPC_STATUS_GET ============== */ -/* NFSD_CMD_RPC_STATUS_GET - dump */ -struct nfsd_rpc_status_get_rsp_dump { - struct { - __u32 xid:1; - __u32 flags:1; - __u32 prog:1; - __u32 version:1; - __u32 proc:1; - __u32 service_time:1; - __u32 saddr4:1; - __u32 daddr4:1; - __u32 saddr6_len; - __u32 daddr6_len; - __u32 sport:1; - __u32 dport:1; - } _present; - - __u32 xid /* big-endian */; - __u32 flags; - __u32 prog; - __u8 version; - __u32 proc; - __s64 service_time; - __u32 saddr4 /* big-endian */; - __u32 daddr4 /* big-endian */; - void *saddr6; - void *daddr6; - __u16 sport /* big-endian */; - __u16 dport /* big-endian */; - unsigned int n_compound_ops; - __u32 *compound_ops; -}; - -struct nfsd_rpc_status_get_rsp_list { - struct nfsd_rpc_status_get_rsp_list *next; - struct nfsd_rpc_status_get_rsp_dump obj __attribute__((aligned(8))); -}; - -void -nfsd_rpc_status_get_rsp_list_free(struct nfsd_rpc_status_get_rsp_list *rsp); - -struct nfsd_rpc_status_get_rsp_list * -nfsd_rpc_status_get_dump(struct ynl_sock *ys); - -#endif /* _LINUX_NFSD_GEN_H */ diff --git a/generated/nfsd-user.h b/generated/nfsd-user.h new file mode 120000 index 0000000..6e17273 --- /dev/null +++ b/generated/nfsd-user.h @@ -0,0 +1 @@ +../include/ynl-c/nfsd.h \ No newline at end of file diff --git a/generated/nlctrl-user.h b/generated/nlctrl-user.h deleted file mode 100644 index e2f7275..0000000 --- a/generated/nlctrl-user.h +++ /dev/null @@ -1,221 +0,0 @@ -/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ -/* Do not edit directly, auto-generated from: */ -/* Documentation/netlink/specs/nlctrl.yaml */ -/* YNL-GEN user header */ - -#ifndef _LINUX_NLCTRL_GEN_H -#define _LINUX_NLCTRL_GEN_H - -#include -#include -#include -#include - -struct ynl_sock; - -extern const struct ynl_family ynl_nlctrl_family; - -/* Enums */ -const char *nlctrl_op_str(int op); -const char *nlctrl_op_flags_str(int value); -const char *nlctrl_attr_type_str(enum netlink_attribute_type value); - -/* Common nested types */ -struct nlctrl_op_attrs { - struct { - __u32 id:1; - __u32 flags:1; - } _present; - - __u32 idx; - __u32 id; - __u32 flags; -}; - -struct nlctrl_mcast_group_attrs { - struct { - __u32 name_len; - __u32 id:1; - } _present; - - __u32 idx; - char *name; - __u32 id; -}; - -struct nlctrl_policy_attrs { - struct { - __u32 type:1; - __u32 min_value_s:1; - __u32 max_value_s:1; - __u32 min_value_u:1; - __u32 max_value_u:1; - __u32 min_length:1; - __u32 max_length:1; - __u32 policy_idx:1; - __u32 policy_maxtype:1; - __u32 bitfield32_mask:1; - __u32 mask:1; - } _present; - - __u32 attr_id; - __u32 policy_id; - enum netlink_attribute_type type; - __s64 min_value_s; - __s64 max_value_s; - __u64 min_value_u; - __u64 max_value_u; - __u32 min_length; - __u32 max_length; - __u32 policy_idx; - __u32 policy_maxtype; - __u32 bitfield32_mask; - __u64 mask; -}; - -struct nlctrl_op_policy_attrs { - struct { - __u32 do_:1; - __u32 dump:1; - } _present; - - __u32 op_id; - __u32 do_; - __u32 dump; -}; - -/* ============== CTRL_CMD_GETFAMILY ============== */ -/* CTRL_CMD_GETFAMILY - do */ -struct nlctrl_getfamily_req { - struct { - __u32 family_name_len; - } _present; - - char *family_name; -}; - -static inline struct nlctrl_getfamily_req *nlctrl_getfamily_req_alloc(void) -{ - return calloc(1, sizeof(struct nlctrl_getfamily_req)); -} -void nlctrl_getfamily_req_free(struct nlctrl_getfamily_req *req); - -static inline void -nlctrl_getfamily_req_set_family_name(struct nlctrl_getfamily_req *req, - const char *family_name) -{ - free(req->family_name); - req->_present.family_name_len = strlen(family_name); - req->family_name = malloc(req->_present.family_name_len + 1); - memcpy(req->family_name, family_name, req->_present.family_name_len); - req->family_name[req->_present.family_name_len] = 0; -} - -struct nlctrl_getfamily_rsp { - struct { - __u32 family_id:1; - __u32 family_name_len; - __u32 hdrsize:1; - __u32 maxattr:1; - __u32 version:1; - } _present; - - __u16 family_id; - char *family_name; - __u32 hdrsize; - __u32 maxattr; - unsigned int n_mcast_groups; - struct nlctrl_mcast_group_attrs *mcast_groups; - unsigned int n_ops; - struct nlctrl_op_attrs *ops; - __u32 version; -}; - -void nlctrl_getfamily_rsp_free(struct nlctrl_getfamily_rsp *rsp); - -/* - * Get / dump genetlink families - */ -struct nlctrl_getfamily_rsp * -nlctrl_getfamily(struct ynl_sock *ys, struct nlctrl_getfamily_req *req); - -/* CTRL_CMD_GETFAMILY - dump */ -struct nlctrl_getfamily_list { - struct nlctrl_getfamily_list *next; - struct nlctrl_getfamily_rsp obj __attribute__((aligned(8))); -}; - -void nlctrl_getfamily_list_free(struct nlctrl_getfamily_list *rsp); - -struct nlctrl_getfamily_list *nlctrl_getfamily_dump(struct ynl_sock *ys); - -/* ============== CTRL_CMD_GETPOLICY ============== */ -/* CTRL_CMD_GETPOLICY - dump */ -struct nlctrl_getpolicy_req_dump { - struct { - __u32 family_name_len; - __u32 family_id:1; - __u32 op:1; - } _present; - - char *family_name; - __u16 family_id; - __u32 op; -}; - -static inline struct nlctrl_getpolicy_req_dump * -nlctrl_getpolicy_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct nlctrl_getpolicy_req_dump)); -} -void nlctrl_getpolicy_req_dump_free(struct nlctrl_getpolicy_req_dump *req); - -static inline void -nlctrl_getpolicy_req_dump_set_family_name(struct nlctrl_getpolicy_req_dump *req, - const char *family_name) -{ - free(req->family_name); - req->_present.family_name_len = strlen(family_name); - req->family_name = malloc(req->_present.family_name_len + 1); - memcpy(req->family_name, family_name, req->_present.family_name_len); - req->family_name[req->_present.family_name_len] = 0; -} -static inline void -nlctrl_getpolicy_req_dump_set_family_id(struct nlctrl_getpolicy_req_dump *req, - __u16 family_id) -{ - req->_present.family_id = 1; - req->family_id = family_id; -} -static inline void -nlctrl_getpolicy_req_dump_set_op(struct nlctrl_getpolicy_req_dump *req, - __u32 op) -{ - req->_present.op = 1; - req->op = op; -} - -struct nlctrl_getpolicy_rsp_dump { - struct { - __u32 family_id:1; - __u32 op_policy:1; - __u32 policy:1; - } _present; - - __u16 family_id; - struct nlctrl_op_policy_attrs op_policy; - struct nlctrl_policy_attrs policy; -}; - -struct nlctrl_getpolicy_rsp_list { - struct nlctrl_getpolicy_rsp_list *next; - struct nlctrl_getpolicy_rsp_dump obj __attribute__((aligned(8))); -}; - -void nlctrl_getpolicy_rsp_list_free(struct nlctrl_getpolicy_rsp_list *rsp); - -struct nlctrl_getpolicy_rsp_list * -nlctrl_getpolicy_dump(struct ynl_sock *ys, - struct nlctrl_getpolicy_req_dump *req); - -#endif /* _LINUX_NLCTRL_GEN_H */ diff --git a/generated/nlctrl-user.h b/generated/nlctrl-user.h new file mode 120000 index 0000000..a966cfc --- /dev/null +++ b/generated/nlctrl-user.h @@ -0,0 +1 @@ +../include/ynl-c/nlctrl.h \ No newline at end of file diff --git a/generated/ovs_datapath-user.h b/generated/ovs_datapath-user.h deleted file mode 100644 index fcd5b46..0000000 --- a/generated/ovs_datapath-user.h +++ /dev/null @@ -1,208 +0,0 @@ -/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ -/* Do not edit directly, auto-generated from: */ -/* Documentation/netlink/specs/ovs_datapath.yaml */ -/* YNL-GEN user header */ - -#ifndef _LINUX_OVS_DATAPATH_GEN_H -#define _LINUX_OVS_DATAPATH_GEN_H - -#include -#include -#include -#include - -struct ynl_sock; - -extern const struct ynl_family ynl_ovs_datapath_family; - -/* Enums */ -const char *ovs_datapath_op_str(int op); -const char *ovs_datapath_user_features_str(int value); - -/* Common nested types */ -/* ============== OVS_DP_CMD_GET ============== */ -/* OVS_DP_CMD_GET - do */ -struct ovs_datapath_get_req { - struct ovs_header _hdr; - - struct { - __u32 name_len; - } _present; - - char *name; -}; - -static inline struct ovs_datapath_get_req *ovs_datapath_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ovs_datapath_get_req)); -} -void ovs_datapath_get_req_free(struct ovs_datapath_get_req *req); - -static inline void -ovs_datapath_get_req_set_name(struct ovs_datapath_get_req *req, - const char *name) -{ - free(req->name); - req->_present.name_len = strlen(name); - req->name = malloc(req->_present.name_len + 1); - memcpy(req->name, name, req->_present.name_len); - req->name[req->_present.name_len] = 0; -} - -struct ovs_datapath_get_rsp { - struct ovs_header _hdr; - - struct { - __u32 name_len; - __u32 upcall_pid:1; - __u32 stats_len; - __u32 megaflow_stats_len; - __u32 user_features:1; - __u32 masks_cache_size:1; - __u32 per_cpu_pids_len; - } _present; - - char *name; - __u32 upcall_pid; - void *stats; - void *megaflow_stats; - __u32 user_features; - __u32 masks_cache_size; - void *per_cpu_pids; -}; - -void ovs_datapath_get_rsp_free(struct ovs_datapath_get_rsp *rsp); - -/* - * Get / dump OVS data path configuration and state - */ -struct ovs_datapath_get_rsp * -ovs_datapath_get(struct ynl_sock *ys, struct ovs_datapath_get_req *req); - -/* OVS_DP_CMD_GET - dump */ -struct ovs_datapath_get_req_dump { - struct ovs_header _hdr; - - struct { - __u32 name_len; - } _present; - - char *name; -}; - -static inline struct ovs_datapath_get_req_dump * -ovs_datapath_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ovs_datapath_get_req_dump)); -} -void ovs_datapath_get_req_dump_free(struct ovs_datapath_get_req_dump *req); - -static inline void -ovs_datapath_get_req_dump_set_name(struct ovs_datapath_get_req_dump *req, - const char *name) -{ - free(req->name); - req->_present.name_len = strlen(name); - req->name = malloc(req->_present.name_len + 1); - memcpy(req->name, name, req->_present.name_len); - req->name[req->_present.name_len] = 0; -} - -struct ovs_datapath_get_list { - struct ovs_datapath_get_list *next; - struct ovs_datapath_get_rsp obj __attribute__((aligned(8))); -}; - -void ovs_datapath_get_list_free(struct ovs_datapath_get_list *rsp); - -struct ovs_datapath_get_list * -ovs_datapath_get_dump(struct ynl_sock *ys, - struct ovs_datapath_get_req_dump *req); - -/* ============== OVS_DP_CMD_NEW ============== */ -/* OVS_DP_CMD_NEW - do */ -struct ovs_datapath_new_req { - struct ovs_header _hdr; - - struct { - __u32 name_len; - __u32 upcall_pid:1; - __u32 user_features:1; - } _present; - - char *name; - __u32 upcall_pid; - __u32 user_features; -}; - -static inline struct ovs_datapath_new_req *ovs_datapath_new_req_alloc(void) -{ - return calloc(1, sizeof(struct ovs_datapath_new_req)); -} -void ovs_datapath_new_req_free(struct ovs_datapath_new_req *req); - -static inline void -ovs_datapath_new_req_set_name(struct ovs_datapath_new_req *req, - const char *name) -{ - free(req->name); - req->_present.name_len = strlen(name); - req->name = malloc(req->_present.name_len + 1); - memcpy(req->name, name, req->_present.name_len); - req->name[req->_present.name_len] = 0; -} -static inline void -ovs_datapath_new_req_set_upcall_pid(struct ovs_datapath_new_req *req, - __u32 upcall_pid) -{ - req->_present.upcall_pid = 1; - req->upcall_pid = upcall_pid; -} -static inline void -ovs_datapath_new_req_set_user_features(struct ovs_datapath_new_req *req, - __u32 user_features) -{ - req->_present.user_features = 1; - req->user_features = user_features; -} - -/* - * Create new OVS data path - */ -int ovs_datapath_new(struct ynl_sock *ys, struct ovs_datapath_new_req *req); - -/* ============== OVS_DP_CMD_DEL ============== */ -/* OVS_DP_CMD_DEL - do */ -struct ovs_datapath_del_req { - struct ovs_header _hdr; - - struct { - __u32 name_len; - } _present; - - char *name; -}; - -static inline struct ovs_datapath_del_req *ovs_datapath_del_req_alloc(void) -{ - return calloc(1, sizeof(struct ovs_datapath_del_req)); -} -void ovs_datapath_del_req_free(struct ovs_datapath_del_req *req); - -static inline void -ovs_datapath_del_req_set_name(struct ovs_datapath_del_req *req, - const char *name) -{ - free(req->name); - req->_present.name_len = strlen(name); - req->name = malloc(req->_present.name_len + 1); - memcpy(req->name, name, req->_present.name_len); - req->name[req->_present.name_len] = 0; -} - -/* - * Delete existing OVS data path - */ -int ovs_datapath_del(struct ynl_sock *ys, struct ovs_datapath_del_req *req); - -#endif /* _LINUX_OVS_DATAPATH_GEN_H */ diff --git a/generated/ovs_datapath-user.h b/generated/ovs_datapath-user.h new file mode 120000 index 0000000..1736939 --- /dev/null +++ b/generated/ovs_datapath-user.h @@ -0,0 +1 @@ +../include/ynl-c/ovs_datapath.h \ No newline at end of file diff --git a/generated/ovs_flow-user.h b/generated/ovs_flow-user.h deleted file mode 100644 index c5f5c08..0000000 --- a/generated/ovs_flow-user.h +++ /dev/null @@ -1,2449 +0,0 @@ -/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ -/* Do not edit directly, auto-generated from: */ -/* Documentation/netlink/specs/ovs_flow.yaml */ -/* YNL-GEN user header */ - -#ifndef _LINUX_OVS_FLOW_GEN_H -#define _LINUX_OVS_FLOW_GEN_H - -#include -#include -#include -#include - -struct ynl_sock; - -extern const struct ynl_family ynl_ovs_flow_family; - -/* Enums */ -const char *ovs_flow_op_str(int op); -const char *ovs_flow_ovs_frag_type_str(enum ovs_frag_type value); -const char *ovs_flow_ovs_ufid_flags_str(int value); -const char *ovs_flow_ovs_hash_alg_str(enum ovs_hash_alg value); -const char *ovs_flow_ct_state_flags_str(int value); - -/* Common nested types */ -struct ovs_flow_ovs_nsh_key_attrs { - struct { - __u32 base_len; - __u32 md1_len; - __u32 md2_len; - } _present; - - void *base; - void *md1; - void *md2; -}; - -struct ovs_flow_userspace_attrs { - struct { - __u32 pid:1; - __u32 userdata_len; - __u32 egress_tun_port:1; - __u32 actions:1; - } _present; - - __u32 pid; - void *userdata; - __u32 egress_tun_port; -}; - -struct ovs_flow_vxlan_ext_attrs { - struct { - __u32 gbp:1; - } _present; - - __u32 gbp; -}; - -struct ovs_flow_nat_attrs { - struct { - __u32 src:1; - __u32 dst:1; - __u32 ip_min_len; - __u32 ip_max_len; - __u32 proto_min:1; - __u32 proto_max:1; - __u32 persistent:1; - __u32 proto_hash:1; - __u32 proto_random:1; - } _present; - - void *ip_min; - void *ip_max; - __u16 proto_min; - __u16 proto_max; -}; - -struct ovs_flow_tunnel_key_attrs { - struct { - __u32 id:1; - __u32 ipv4_src:1; - __u32 ipv4_dst:1; - __u32 tos:1; - __u32 ttl:1; - __u32 dont_fragment:1; - __u32 csum:1; - __u32 oam:1; - __u32 geneve_opts_len; - __u32 tp_src:1; - __u32 tp_dst:1; - __u32 vxlan_opts:1; - __u32 ipv6_src_len; - __u32 ipv6_dst_len; - __u32 pad_len; - __u32 erspan_opts_len; - __u32 ipv4_info_bridge:1; - } _present; - - __u64 id /* big-endian */; - __u32 ipv4_src /* big-endian */; - __u32 ipv4_dst /* big-endian */; - __u8 tos; - __u8 ttl; - void *geneve_opts; - __u16 tp_src /* big-endian */; - __u16 tp_dst /* big-endian */; - struct ovs_flow_vxlan_ext_attrs vxlan_opts; - void *ipv6_src; - void *ipv6_dst; - void *pad; - void *erspan_opts; -}; - -struct ovs_flow_ct_attrs { - struct { - __u32 commit:1; - __u32 zone:1; - __u32 mark_len; - __u32 labels_len; - __u32 helper_len; - __u32 nat:1; - __u32 force_commit:1; - __u32 eventmask:1; - __u32 timeout_len; - } _present; - - __u16 zone; - void *mark; - void *labels; - char *helper; - struct ovs_flow_nat_attrs nat; - __u32 eventmask; - char *timeout; -}; - -struct ovs_flow_check_pkt_len_attrs { - struct { - __u32 pkt_len:1; - __u32 actions_if_greater:1; - __u32 actions_if_less_equal:1; - } _present; - - __u16 pkt_len; - struct ovs_flow_action_attrs *actions_if_greater; - struct ovs_flow_action_attrs *actions_if_less_equal; -}; - -struct ovs_flow_dec_ttl_attrs { - struct { - __u32 action:1; - } _present; - - struct ovs_flow_action_attrs *action; -}; - -struct ovs_flow_key_attrs { - struct { - __u32 encap:1; - __u32 priority:1; - __u32 in_port:1; - __u32 ethernet_len; - __u32 vlan:1; - __u32 ethertype:1; - __u32 ipv4_len; - __u32 ipv6_len; - __u32 tcp_len; - __u32 udp_len; - __u32 icmp_len; - __u32 icmpv6_len; - __u32 arp_len; - __u32 nd_len; - __u32 skb_mark:1; - __u32 tunnel:1; - __u32 sctp_len; - __u32 tcp_flags:1; - __u32 dp_hash:1; - __u32 recirc_id:1; - __u32 mpls_len; - __u32 ct_state:1; - __u32 ct_zone:1; - __u32 ct_mark:1; - __u32 ct_labels_len; - __u32 ct_orig_tuple_ipv4_len; - __u32 ct_orig_tuple_ipv6_len; - __u32 nsh:1; - __u32 packet_type:1; - __u32 nd_extensions_len; - __u32 tunnel_info_len; - __u32 ipv6_exthdrs_len; - } _present; - - struct ovs_flow_key_attrs *encap; - __u32 priority; - __u32 in_port; - void *ethernet; - __u16 vlan /* big-endian */; - __u16 ethertype /* big-endian */; - void *ipv4; - void *ipv6; - void *tcp; - void *udp; - void *icmp; - void *icmpv6; - void *arp; - void *nd; - __u32 skb_mark; - struct ovs_flow_tunnel_key_attrs tunnel; - void *sctp; - __u16 tcp_flags /* big-endian */; - __u32 dp_hash; - __u32 recirc_id; - void *mpls; - __u32 ct_state; - __u16 ct_zone; - __u32 ct_mark; - void *ct_labels; - void *ct_orig_tuple_ipv4; - void *ct_orig_tuple_ipv6; - struct ovs_flow_ovs_nsh_key_attrs nsh; - __u32 packet_type /* big-endian */; - void *nd_extensions; - void *tunnel_info; - void *ipv6_exthdrs; -}; - -struct ovs_flow_sample_attrs { - struct { - __u32 probability:1; - __u32 actions:1; - } _present; - - __u32 probability; - struct ovs_flow_action_attrs *actions; -}; - -struct ovs_flow_action_attrs { - struct { - __u32 output:1; - __u32 userspace:1; - __u32 set:1; - __u32 push_vlan_len; - __u32 pop_vlan:1; - __u32 sample:1; - __u32 recirc:1; - __u32 hash_len; - __u32 push_mpls_len; - __u32 pop_mpls:1; - __u32 set_masked:1; - __u32 ct:1; - __u32 trunc:1; - __u32 push_eth_len; - __u32 pop_eth:1; - __u32 ct_clear:1; - __u32 push_nsh:1; - __u32 pop_nsh:1; - __u32 meter:1; - __u32 clone:1; - __u32 check_pkt_len:1; - __u32 add_mpls_len; - __u32 dec_ttl:1; - } _present; - - __u32 output; - struct ovs_flow_userspace_attrs userspace; - struct ovs_flow_key_attrs *set; - void *push_vlan; - struct ovs_flow_sample_attrs sample; - __u32 recirc; - void *hash; - void *push_mpls; - __u16 pop_mpls /* big-endian */; - struct ovs_flow_key_attrs *set_masked; - struct ovs_flow_ct_attrs ct; - __u32 trunc; - void *push_eth; - struct ovs_flow_ovs_nsh_key_attrs push_nsh; - __u32 meter; - struct ovs_flow_action_attrs *clone; - struct ovs_flow_check_pkt_len_attrs check_pkt_len; - void *add_mpls; - struct ovs_flow_dec_ttl_attrs dec_ttl; -}; - -/* ============== OVS_FLOW_CMD_GET ============== */ -/* OVS_FLOW_CMD_GET - do */ -struct ovs_flow_get_req { - struct ovs_header _hdr; - - struct { - __u32 key:1; - __u32 ufid_len; - __u32 ufid_flags:1; - } _present; - - struct ovs_flow_key_attrs key; - void *ufid; - __u32 ufid_flags; -}; - -static inline struct ovs_flow_get_req *ovs_flow_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ovs_flow_get_req)); -} -void ovs_flow_get_req_free(struct ovs_flow_get_req *req); - -static inline void -ovs_flow_get_req_set_key_priority(struct ovs_flow_get_req *req, __u32 priority) -{ - req->_present.key = 1; - req->key._present.priority = 1; - req->key.priority = priority; -} -static inline void -ovs_flow_get_req_set_key_in_port(struct ovs_flow_get_req *req, __u32 in_port) -{ - req->_present.key = 1; - req->key._present.in_port = 1; - req->key.in_port = in_port; -} -static inline void -ovs_flow_get_req_set_key_ethernet(struct ovs_flow_get_req *req, - const void *ethernet, size_t len) -{ - free(req->key.ethernet); - req->key._present.ethernet_len = len; - req->key.ethernet = malloc(req->key._present.ethernet_len); - memcpy(req->key.ethernet, ethernet, req->key._present.ethernet_len); -} -static inline void -ovs_flow_get_req_set_key_vlan(struct ovs_flow_get_req *req, - __u16 vlan /* big-endian */) -{ - req->_present.key = 1; - req->key._present.vlan = 1; - req->key.vlan = vlan; -} -static inline void -ovs_flow_get_req_set_key_ethertype(struct ovs_flow_get_req *req, - __u16 ethertype /* big-endian */) -{ - req->_present.key = 1; - req->key._present.ethertype = 1; - req->key.ethertype = ethertype; -} -static inline void -ovs_flow_get_req_set_key_ipv4(struct ovs_flow_get_req *req, const void *ipv4, - size_t len) -{ - free(req->key.ipv4); - req->key._present.ipv4_len = len; - req->key.ipv4 = malloc(req->key._present.ipv4_len); - memcpy(req->key.ipv4, ipv4, req->key._present.ipv4_len); -} -static inline void -ovs_flow_get_req_set_key_ipv6(struct ovs_flow_get_req *req, const void *ipv6, - size_t len) -{ - free(req->key.ipv6); - req->key._present.ipv6_len = len; - req->key.ipv6 = malloc(req->key._present.ipv6_len); - memcpy(req->key.ipv6, ipv6, req->key._present.ipv6_len); -} -static inline void -ovs_flow_get_req_set_key_tcp(struct ovs_flow_get_req *req, const void *tcp, - size_t len) -{ - free(req->key.tcp); - req->key._present.tcp_len = len; - req->key.tcp = malloc(req->key._present.tcp_len); - memcpy(req->key.tcp, tcp, req->key._present.tcp_len); -} -static inline void -ovs_flow_get_req_set_key_udp(struct ovs_flow_get_req *req, const void *udp, - size_t len) -{ - free(req->key.udp); - req->key._present.udp_len = len; - req->key.udp = malloc(req->key._present.udp_len); - memcpy(req->key.udp, udp, req->key._present.udp_len); -} -static inline void -ovs_flow_get_req_set_key_icmp(struct ovs_flow_get_req *req, const void *icmp, - size_t len) -{ - free(req->key.icmp); - req->key._present.icmp_len = len; - req->key.icmp = malloc(req->key._present.icmp_len); - memcpy(req->key.icmp, icmp, req->key._present.icmp_len); -} -static inline void -ovs_flow_get_req_set_key_icmpv6(struct ovs_flow_get_req *req, - const void *icmpv6, size_t len) -{ - free(req->key.icmpv6); - req->key._present.icmpv6_len = len; - req->key.icmpv6 = malloc(req->key._present.icmpv6_len); - memcpy(req->key.icmpv6, icmpv6, req->key._present.icmpv6_len); -} -static inline void -ovs_flow_get_req_set_key_arp(struct ovs_flow_get_req *req, const void *arp, - size_t len) -{ - free(req->key.arp); - req->key._present.arp_len = len; - req->key.arp = malloc(req->key._present.arp_len); - memcpy(req->key.arp, arp, req->key._present.arp_len); -} -static inline void -ovs_flow_get_req_set_key_nd(struct ovs_flow_get_req *req, const void *nd, - size_t len) -{ - free(req->key.nd); - req->key._present.nd_len = len; - req->key.nd = malloc(req->key._present.nd_len); - memcpy(req->key.nd, nd, req->key._present.nd_len); -} -static inline void -ovs_flow_get_req_set_key_skb_mark(struct ovs_flow_get_req *req, __u32 skb_mark) -{ - req->_present.key = 1; - req->key._present.skb_mark = 1; - req->key.skb_mark = skb_mark; -} -static inline void -ovs_flow_get_req_set_key_tunnel_id(struct ovs_flow_get_req *req, - __u64 id /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.id = 1; - req->key.tunnel.id = id; -} -static inline void -ovs_flow_get_req_set_key_tunnel_ipv4_src(struct ovs_flow_get_req *req, - __u32 ipv4_src /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.ipv4_src = 1; - req->key.tunnel.ipv4_src = ipv4_src; -} -static inline void -ovs_flow_get_req_set_key_tunnel_ipv4_dst(struct ovs_flow_get_req *req, - __u32 ipv4_dst /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.ipv4_dst = 1; - req->key.tunnel.ipv4_dst = ipv4_dst; -} -static inline void -ovs_flow_get_req_set_key_tunnel_tos(struct ovs_flow_get_req *req, __u8 tos) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.tos = 1; - req->key.tunnel.tos = tos; -} -static inline void -ovs_flow_get_req_set_key_tunnel_ttl(struct ovs_flow_get_req *req, __u8 ttl) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.ttl = 1; - req->key.tunnel.ttl = ttl; -} -static inline void -ovs_flow_get_req_set_key_tunnel_dont_fragment(struct ovs_flow_get_req *req) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.dont_fragment = 1; -} -static inline void -ovs_flow_get_req_set_key_tunnel_csum(struct ovs_flow_get_req *req) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.csum = 1; -} -static inline void -ovs_flow_get_req_set_key_tunnel_oam(struct ovs_flow_get_req *req) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.oam = 1; -} -static inline void -ovs_flow_get_req_set_key_tunnel_geneve_opts(struct ovs_flow_get_req *req, - const void *geneve_opts, - size_t len) -{ - free(req->key.tunnel.geneve_opts); - req->key.tunnel._present.geneve_opts_len = len; - req->key.tunnel.geneve_opts = malloc(req->key.tunnel._present.geneve_opts_len); - memcpy(req->key.tunnel.geneve_opts, geneve_opts, req->key.tunnel._present.geneve_opts_len); -} -static inline void -ovs_flow_get_req_set_key_tunnel_tp_src(struct ovs_flow_get_req *req, - __u16 tp_src /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.tp_src = 1; - req->key.tunnel.tp_src = tp_src; -} -static inline void -ovs_flow_get_req_set_key_tunnel_tp_dst(struct ovs_flow_get_req *req, - __u16 tp_dst /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.tp_dst = 1; - req->key.tunnel.tp_dst = tp_dst; -} -static inline void -ovs_flow_get_req_set_key_tunnel_vxlan_opts_gbp(struct ovs_flow_get_req *req, - __u32 gbp) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.vxlan_opts = 1; - req->key.tunnel.vxlan_opts._present.gbp = 1; - req->key.tunnel.vxlan_opts.gbp = gbp; -} -static inline void -ovs_flow_get_req_set_key_tunnel_ipv6_src(struct ovs_flow_get_req *req, - const void *ipv6_src, size_t len) -{ - free(req->key.tunnel.ipv6_src); - req->key.tunnel._present.ipv6_src_len = len; - req->key.tunnel.ipv6_src = malloc(req->key.tunnel._present.ipv6_src_len); - memcpy(req->key.tunnel.ipv6_src, ipv6_src, req->key.tunnel._present.ipv6_src_len); -} -static inline void -ovs_flow_get_req_set_key_tunnel_ipv6_dst(struct ovs_flow_get_req *req, - const void *ipv6_dst, size_t len) -{ - free(req->key.tunnel.ipv6_dst); - req->key.tunnel._present.ipv6_dst_len = len; - req->key.tunnel.ipv6_dst = malloc(req->key.tunnel._present.ipv6_dst_len); - memcpy(req->key.tunnel.ipv6_dst, ipv6_dst, req->key.tunnel._present.ipv6_dst_len); -} -static inline void -ovs_flow_get_req_set_key_tunnel_pad(struct ovs_flow_get_req *req, - const void *pad, size_t len) -{ - free(req->key.tunnel.pad); - req->key.tunnel._present.pad_len = len; - req->key.tunnel.pad = malloc(req->key.tunnel._present.pad_len); - memcpy(req->key.tunnel.pad, pad, req->key.tunnel._present.pad_len); -} -static inline void -ovs_flow_get_req_set_key_tunnel_erspan_opts(struct ovs_flow_get_req *req, - const void *erspan_opts, - size_t len) -{ - free(req->key.tunnel.erspan_opts); - req->key.tunnel._present.erspan_opts_len = len; - req->key.tunnel.erspan_opts = malloc(req->key.tunnel._present.erspan_opts_len); - memcpy(req->key.tunnel.erspan_opts, erspan_opts, req->key.tunnel._present.erspan_opts_len); -} -static inline void -ovs_flow_get_req_set_key_tunnel_ipv4_info_bridge(struct ovs_flow_get_req *req) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.ipv4_info_bridge = 1; -} -static inline void -ovs_flow_get_req_set_key_sctp(struct ovs_flow_get_req *req, const void *sctp, - size_t len) -{ - free(req->key.sctp); - req->key._present.sctp_len = len; - req->key.sctp = malloc(req->key._present.sctp_len); - memcpy(req->key.sctp, sctp, req->key._present.sctp_len); -} -static inline void -ovs_flow_get_req_set_key_tcp_flags(struct ovs_flow_get_req *req, - __u16 tcp_flags /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tcp_flags = 1; - req->key.tcp_flags = tcp_flags; -} -static inline void -ovs_flow_get_req_set_key_dp_hash(struct ovs_flow_get_req *req, __u32 dp_hash) -{ - req->_present.key = 1; - req->key._present.dp_hash = 1; - req->key.dp_hash = dp_hash; -} -static inline void -ovs_flow_get_req_set_key_recirc_id(struct ovs_flow_get_req *req, - __u32 recirc_id) -{ - req->_present.key = 1; - req->key._present.recirc_id = 1; - req->key.recirc_id = recirc_id; -} -static inline void -ovs_flow_get_req_set_key_mpls(struct ovs_flow_get_req *req, const void *mpls, - size_t len) -{ - free(req->key.mpls); - req->key._present.mpls_len = len; - req->key.mpls = malloc(req->key._present.mpls_len); - memcpy(req->key.mpls, mpls, req->key._present.mpls_len); -} -static inline void -ovs_flow_get_req_set_key_ct_state(struct ovs_flow_get_req *req, __u32 ct_state) -{ - req->_present.key = 1; - req->key._present.ct_state = 1; - req->key.ct_state = ct_state; -} -static inline void -ovs_flow_get_req_set_key_ct_zone(struct ovs_flow_get_req *req, __u16 ct_zone) -{ - req->_present.key = 1; - req->key._present.ct_zone = 1; - req->key.ct_zone = ct_zone; -} -static inline void -ovs_flow_get_req_set_key_ct_mark(struct ovs_flow_get_req *req, __u32 ct_mark) -{ - req->_present.key = 1; - req->key._present.ct_mark = 1; - req->key.ct_mark = ct_mark; -} -static inline void -ovs_flow_get_req_set_key_ct_labels(struct ovs_flow_get_req *req, - const void *ct_labels, size_t len) -{ - free(req->key.ct_labels); - req->key._present.ct_labels_len = len; - req->key.ct_labels = malloc(req->key._present.ct_labels_len); - memcpy(req->key.ct_labels, ct_labels, req->key._present.ct_labels_len); -} -static inline void -ovs_flow_get_req_set_key_ct_orig_tuple_ipv4(struct ovs_flow_get_req *req, - const void *ct_orig_tuple_ipv4, - size_t len) -{ - free(req->key.ct_orig_tuple_ipv4); - req->key._present.ct_orig_tuple_ipv4_len = len; - req->key.ct_orig_tuple_ipv4 = malloc(req->key._present.ct_orig_tuple_ipv4_len); - memcpy(req->key.ct_orig_tuple_ipv4, ct_orig_tuple_ipv4, req->key._present.ct_orig_tuple_ipv4_len); -} -static inline void -ovs_flow_get_req_set_key_ct_orig_tuple_ipv6(struct ovs_flow_get_req *req, - const void *ct_orig_tuple_ipv6, - size_t len) -{ - free(req->key.ct_orig_tuple_ipv6); - req->key._present.ct_orig_tuple_ipv6_len = len; - req->key.ct_orig_tuple_ipv6 = malloc(req->key._present.ct_orig_tuple_ipv6_len); - memcpy(req->key.ct_orig_tuple_ipv6, ct_orig_tuple_ipv6, req->key._present.ct_orig_tuple_ipv6_len); -} -static inline void -ovs_flow_get_req_set_key_nsh_base(struct ovs_flow_get_req *req, - const void *base, size_t len) -{ - free(req->key.nsh.base); - req->key.nsh._present.base_len = len; - req->key.nsh.base = malloc(req->key.nsh._present.base_len); - memcpy(req->key.nsh.base, base, req->key.nsh._present.base_len); -} -static inline void -ovs_flow_get_req_set_key_nsh_md1(struct ovs_flow_get_req *req, const void *md1, - size_t len) -{ - free(req->key.nsh.md1); - req->key.nsh._present.md1_len = len; - req->key.nsh.md1 = malloc(req->key.nsh._present.md1_len); - memcpy(req->key.nsh.md1, md1, req->key.nsh._present.md1_len); -} -static inline void -ovs_flow_get_req_set_key_nsh_md2(struct ovs_flow_get_req *req, const void *md2, - size_t len) -{ - free(req->key.nsh.md2); - req->key.nsh._present.md2_len = len; - req->key.nsh.md2 = malloc(req->key.nsh._present.md2_len); - memcpy(req->key.nsh.md2, md2, req->key.nsh._present.md2_len); -} -static inline void -ovs_flow_get_req_set_key_packet_type(struct ovs_flow_get_req *req, - __u32 packet_type /* big-endian */) -{ - req->_present.key = 1; - req->key._present.packet_type = 1; - req->key.packet_type = packet_type; -} -static inline void -ovs_flow_get_req_set_key_nd_extensions(struct ovs_flow_get_req *req, - const void *nd_extensions, size_t len) -{ - free(req->key.nd_extensions); - req->key._present.nd_extensions_len = len; - req->key.nd_extensions = malloc(req->key._present.nd_extensions_len); - memcpy(req->key.nd_extensions, nd_extensions, req->key._present.nd_extensions_len); -} -static inline void -ovs_flow_get_req_set_key_tunnel_info(struct ovs_flow_get_req *req, - const void *tunnel_info, size_t len) -{ - free(req->key.tunnel_info); - req->key._present.tunnel_info_len = len; - req->key.tunnel_info = malloc(req->key._present.tunnel_info_len); - memcpy(req->key.tunnel_info, tunnel_info, req->key._present.tunnel_info_len); -} -static inline void -ovs_flow_get_req_set_key_ipv6_exthdrs(struct ovs_flow_get_req *req, - const void *ipv6_exthdrs, size_t len) -{ - free(req->key.ipv6_exthdrs); - req->key._present.ipv6_exthdrs_len = len; - req->key.ipv6_exthdrs = malloc(req->key._present.ipv6_exthdrs_len); - memcpy(req->key.ipv6_exthdrs, ipv6_exthdrs, req->key._present.ipv6_exthdrs_len); -} -static inline void -ovs_flow_get_req_set_ufid(struct ovs_flow_get_req *req, const void *ufid, - size_t len) -{ - free(req->ufid); - req->_present.ufid_len = len; - req->ufid = malloc(req->_present.ufid_len); - memcpy(req->ufid, ufid, req->_present.ufid_len); -} -static inline void -ovs_flow_get_req_set_ufid_flags(struct ovs_flow_get_req *req, __u32 ufid_flags) -{ - req->_present.ufid_flags = 1; - req->ufid_flags = ufid_flags; -} - -struct ovs_flow_get_rsp { - struct ovs_header _hdr; - - struct { - __u32 key:1; - __u32 ufid_len; - __u32 mask:1; - __u32 stats_len; - __u32 actions:1; - } _present; - - struct ovs_flow_key_attrs key; - void *ufid; - struct ovs_flow_key_attrs mask; - void *stats; - struct ovs_flow_action_attrs actions; -}; - -void ovs_flow_get_rsp_free(struct ovs_flow_get_rsp *rsp); - -/* - * Get / dump OVS flow configuration and state - */ -struct ovs_flow_get_rsp * -ovs_flow_get(struct ynl_sock *ys, struct ovs_flow_get_req *req); - -/* OVS_FLOW_CMD_GET - dump */ -struct ovs_flow_get_req_dump { - struct ovs_header _hdr; - - struct { - __u32 key:1; - __u32 ufid_len; - __u32 ufid_flags:1; - } _present; - - struct ovs_flow_key_attrs key; - void *ufid; - __u32 ufid_flags; -}; - -static inline struct ovs_flow_get_req_dump *ovs_flow_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ovs_flow_get_req_dump)); -} -void ovs_flow_get_req_dump_free(struct ovs_flow_get_req_dump *req); - -static inline void -ovs_flow_get_req_dump_set_key_priority(struct ovs_flow_get_req_dump *req, - __u32 priority) -{ - req->_present.key = 1; - req->key._present.priority = 1; - req->key.priority = priority; -} -static inline void -ovs_flow_get_req_dump_set_key_in_port(struct ovs_flow_get_req_dump *req, - __u32 in_port) -{ - req->_present.key = 1; - req->key._present.in_port = 1; - req->key.in_port = in_port; -} -static inline void -ovs_flow_get_req_dump_set_key_ethernet(struct ovs_flow_get_req_dump *req, - const void *ethernet, size_t len) -{ - free(req->key.ethernet); - req->key._present.ethernet_len = len; - req->key.ethernet = malloc(req->key._present.ethernet_len); - memcpy(req->key.ethernet, ethernet, req->key._present.ethernet_len); -} -static inline void -ovs_flow_get_req_dump_set_key_vlan(struct ovs_flow_get_req_dump *req, - __u16 vlan /* big-endian */) -{ - req->_present.key = 1; - req->key._present.vlan = 1; - req->key.vlan = vlan; -} -static inline void -ovs_flow_get_req_dump_set_key_ethertype(struct ovs_flow_get_req_dump *req, - __u16 ethertype /* big-endian */) -{ - req->_present.key = 1; - req->key._present.ethertype = 1; - req->key.ethertype = ethertype; -} -static inline void -ovs_flow_get_req_dump_set_key_ipv4(struct ovs_flow_get_req_dump *req, - const void *ipv4, size_t len) -{ - free(req->key.ipv4); - req->key._present.ipv4_len = len; - req->key.ipv4 = malloc(req->key._present.ipv4_len); - memcpy(req->key.ipv4, ipv4, req->key._present.ipv4_len); -} -static inline void -ovs_flow_get_req_dump_set_key_ipv6(struct ovs_flow_get_req_dump *req, - const void *ipv6, size_t len) -{ - free(req->key.ipv6); - req->key._present.ipv6_len = len; - req->key.ipv6 = malloc(req->key._present.ipv6_len); - memcpy(req->key.ipv6, ipv6, req->key._present.ipv6_len); -} -static inline void -ovs_flow_get_req_dump_set_key_tcp(struct ovs_flow_get_req_dump *req, - const void *tcp, size_t len) -{ - free(req->key.tcp); - req->key._present.tcp_len = len; - req->key.tcp = malloc(req->key._present.tcp_len); - memcpy(req->key.tcp, tcp, req->key._present.tcp_len); -} -static inline void -ovs_flow_get_req_dump_set_key_udp(struct ovs_flow_get_req_dump *req, - const void *udp, size_t len) -{ - free(req->key.udp); - req->key._present.udp_len = len; - req->key.udp = malloc(req->key._present.udp_len); - memcpy(req->key.udp, udp, req->key._present.udp_len); -} -static inline void -ovs_flow_get_req_dump_set_key_icmp(struct ovs_flow_get_req_dump *req, - const void *icmp, size_t len) -{ - free(req->key.icmp); - req->key._present.icmp_len = len; - req->key.icmp = malloc(req->key._present.icmp_len); - memcpy(req->key.icmp, icmp, req->key._present.icmp_len); -} -static inline void -ovs_flow_get_req_dump_set_key_icmpv6(struct ovs_flow_get_req_dump *req, - const void *icmpv6, size_t len) -{ - free(req->key.icmpv6); - req->key._present.icmpv6_len = len; - req->key.icmpv6 = malloc(req->key._present.icmpv6_len); - memcpy(req->key.icmpv6, icmpv6, req->key._present.icmpv6_len); -} -static inline void -ovs_flow_get_req_dump_set_key_arp(struct ovs_flow_get_req_dump *req, - const void *arp, size_t len) -{ - free(req->key.arp); - req->key._present.arp_len = len; - req->key.arp = malloc(req->key._present.arp_len); - memcpy(req->key.arp, arp, req->key._present.arp_len); -} -static inline void -ovs_flow_get_req_dump_set_key_nd(struct ovs_flow_get_req_dump *req, - const void *nd, size_t len) -{ - free(req->key.nd); - req->key._present.nd_len = len; - req->key.nd = malloc(req->key._present.nd_len); - memcpy(req->key.nd, nd, req->key._present.nd_len); -} -static inline void -ovs_flow_get_req_dump_set_key_skb_mark(struct ovs_flow_get_req_dump *req, - __u32 skb_mark) -{ - req->_present.key = 1; - req->key._present.skb_mark = 1; - req->key.skb_mark = skb_mark; -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_id(struct ovs_flow_get_req_dump *req, - __u64 id /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.id = 1; - req->key.tunnel.id = id; -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_ipv4_src(struct ovs_flow_get_req_dump *req, - __u32 ipv4_src /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.ipv4_src = 1; - req->key.tunnel.ipv4_src = ipv4_src; -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_ipv4_dst(struct ovs_flow_get_req_dump *req, - __u32 ipv4_dst /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.ipv4_dst = 1; - req->key.tunnel.ipv4_dst = ipv4_dst; -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_tos(struct ovs_flow_get_req_dump *req, - __u8 tos) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.tos = 1; - req->key.tunnel.tos = tos; -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_ttl(struct ovs_flow_get_req_dump *req, - __u8 ttl) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.ttl = 1; - req->key.tunnel.ttl = ttl; -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_dont_fragment(struct ovs_flow_get_req_dump *req) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.dont_fragment = 1; -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_csum(struct ovs_flow_get_req_dump *req) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.csum = 1; -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_oam(struct ovs_flow_get_req_dump *req) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.oam = 1; -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_geneve_opts(struct ovs_flow_get_req_dump *req, - const void *geneve_opts, - size_t len) -{ - free(req->key.tunnel.geneve_opts); - req->key.tunnel._present.geneve_opts_len = len; - req->key.tunnel.geneve_opts = malloc(req->key.tunnel._present.geneve_opts_len); - memcpy(req->key.tunnel.geneve_opts, geneve_opts, req->key.tunnel._present.geneve_opts_len); -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_tp_src(struct ovs_flow_get_req_dump *req, - __u16 tp_src /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.tp_src = 1; - req->key.tunnel.tp_src = tp_src; -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_tp_dst(struct ovs_flow_get_req_dump *req, - __u16 tp_dst /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.tp_dst = 1; - req->key.tunnel.tp_dst = tp_dst; -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_vxlan_opts_gbp(struct ovs_flow_get_req_dump *req, - __u32 gbp) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.vxlan_opts = 1; - req->key.tunnel.vxlan_opts._present.gbp = 1; - req->key.tunnel.vxlan_opts.gbp = gbp; -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_ipv6_src(struct ovs_flow_get_req_dump *req, - const void *ipv6_src, size_t len) -{ - free(req->key.tunnel.ipv6_src); - req->key.tunnel._present.ipv6_src_len = len; - req->key.tunnel.ipv6_src = malloc(req->key.tunnel._present.ipv6_src_len); - memcpy(req->key.tunnel.ipv6_src, ipv6_src, req->key.tunnel._present.ipv6_src_len); -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_ipv6_dst(struct ovs_flow_get_req_dump *req, - const void *ipv6_dst, size_t len) -{ - free(req->key.tunnel.ipv6_dst); - req->key.tunnel._present.ipv6_dst_len = len; - req->key.tunnel.ipv6_dst = malloc(req->key.tunnel._present.ipv6_dst_len); - memcpy(req->key.tunnel.ipv6_dst, ipv6_dst, req->key.tunnel._present.ipv6_dst_len); -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_pad(struct ovs_flow_get_req_dump *req, - const void *pad, size_t len) -{ - free(req->key.tunnel.pad); - req->key.tunnel._present.pad_len = len; - req->key.tunnel.pad = malloc(req->key.tunnel._present.pad_len); - memcpy(req->key.tunnel.pad, pad, req->key.tunnel._present.pad_len); -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_erspan_opts(struct ovs_flow_get_req_dump *req, - const void *erspan_opts, - size_t len) -{ - free(req->key.tunnel.erspan_opts); - req->key.tunnel._present.erspan_opts_len = len; - req->key.tunnel.erspan_opts = malloc(req->key.tunnel._present.erspan_opts_len); - memcpy(req->key.tunnel.erspan_opts, erspan_opts, req->key.tunnel._present.erspan_opts_len); -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_ipv4_info_bridge(struct ovs_flow_get_req_dump *req) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.ipv4_info_bridge = 1; -} -static inline void -ovs_flow_get_req_dump_set_key_sctp(struct ovs_flow_get_req_dump *req, - const void *sctp, size_t len) -{ - free(req->key.sctp); - req->key._present.sctp_len = len; - req->key.sctp = malloc(req->key._present.sctp_len); - memcpy(req->key.sctp, sctp, req->key._present.sctp_len); -} -static inline void -ovs_flow_get_req_dump_set_key_tcp_flags(struct ovs_flow_get_req_dump *req, - __u16 tcp_flags /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tcp_flags = 1; - req->key.tcp_flags = tcp_flags; -} -static inline void -ovs_flow_get_req_dump_set_key_dp_hash(struct ovs_flow_get_req_dump *req, - __u32 dp_hash) -{ - req->_present.key = 1; - req->key._present.dp_hash = 1; - req->key.dp_hash = dp_hash; -} -static inline void -ovs_flow_get_req_dump_set_key_recirc_id(struct ovs_flow_get_req_dump *req, - __u32 recirc_id) -{ - req->_present.key = 1; - req->key._present.recirc_id = 1; - req->key.recirc_id = recirc_id; -} -static inline void -ovs_flow_get_req_dump_set_key_mpls(struct ovs_flow_get_req_dump *req, - const void *mpls, size_t len) -{ - free(req->key.mpls); - req->key._present.mpls_len = len; - req->key.mpls = malloc(req->key._present.mpls_len); - memcpy(req->key.mpls, mpls, req->key._present.mpls_len); -} -static inline void -ovs_flow_get_req_dump_set_key_ct_state(struct ovs_flow_get_req_dump *req, - __u32 ct_state) -{ - req->_present.key = 1; - req->key._present.ct_state = 1; - req->key.ct_state = ct_state; -} -static inline void -ovs_flow_get_req_dump_set_key_ct_zone(struct ovs_flow_get_req_dump *req, - __u16 ct_zone) -{ - req->_present.key = 1; - req->key._present.ct_zone = 1; - req->key.ct_zone = ct_zone; -} -static inline void -ovs_flow_get_req_dump_set_key_ct_mark(struct ovs_flow_get_req_dump *req, - __u32 ct_mark) -{ - req->_present.key = 1; - req->key._present.ct_mark = 1; - req->key.ct_mark = ct_mark; -} -static inline void -ovs_flow_get_req_dump_set_key_ct_labels(struct ovs_flow_get_req_dump *req, - const void *ct_labels, size_t len) -{ - free(req->key.ct_labels); - req->key._present.ct_labels_len = len; - req->key.ct_labels = malloc(req->key._present.ct_labels_len); - memcpy(req->key.ct_labels, ct_labels, req->key._present.ct_labels_len); -} -static inline void -ovs_flow_get_req_dump_set_key_ct_orig_tuple_ipv4(struct ovs_flow_get_req_dump *req, - const void *ct_orig_tuple_ipv4, - size_t len) -{ - free(req->key.ct_orig_tuple_ipv4); - req->key._present.ct_orig_tuple_ipv4_len = len; - req->key.ct_orig_tuple_ipv4 = malloc(req->key._present.ct_orig_tuple_ipv4_len); - memcpy(req->key.ct_orig_tuple_ipv4, ct_orig_tuple_ipv4, req->key._present.ct_orig_tuple_ipv4_len); -} -static inline void -ovs_flow_get_req_dump_set_key_ct_orig_tuple_ipv6(struct ovs_flow_get_req_dump *req, - const void *ct_orig_tuple_ipv6, - size_t len) -{ - free(req->key.ct_orig_tuple_ipv6); - req->key._present.ct_orig_tuple_ipv6_len = len; - req->key.ct_orig_tuple_ipv6 = malloc(req->key._present.ct_orig_tuple_ipv6_len); - memcpy(req->key.ct_orig_tuple_ipv6, ct_orig_tuple_ipv6, req->key._present.ct_orig_tuple_ipv6_len); -} -static inline void -ovs_flow_get_req_dump_set_key_nsh_base(struct ovs_flow_get_req_dump *req, - const void *base, size_t len) -{ - free(req->key.nsh.base); - req->key.nsh._present.base_len = len; - req->key.nsh.base = malloc(req->key.nsh._present.base_len); - memcpy(req->key.nsh.base, base, req->key.nsh._present.base_len); -} -static inline void -ovs_flow_get_req_dump_set_key_nsh_md1(struct ovs_flow_get_req_dump *req, - const void *md1, size_t len) -{ - free(req->key.nsh.md1); - req->key.nsh._present.md1_len = len; - req->key.nsh.md1 = malloc(req->key.nsh._present.md1_len); - memcpy(req->key.nsh.md1, md1, req->key.nsh._present.md1_len); -} -static inline void -ovs_flow_get_req_dump_set_key_nsh_md2(struct ovs_flow_get_req_dump *req, - const void *md2, size_t len) -{ - free(req->key.nsh.md2); - req->key.nsh._present.md2_len = len; - req->key.nsh.md2 = malloc(req->key.nsh._present.md2_len); - memcpy(req->key.nsh.md2, md2, req->key.nsh._present.md2_len); -} -static inline void -ovs_flow_get_req_dump_set_key_packet_type(struct ovs_flow_get_req_dump *req, - __u32 packet_type /* big-endian */) -{ - req->_present.key = 1; - req->key._present.packet_type = 1; - req->key.packet_type = packet_type; -} -static inline void -ovs_flow_get_req_dump_set_key_nd_extensions(struct ovs_flow_get_req_dump *req, - const void *nd_extensions, - size_t len) -{ - free(req->key.nd_extensions); - req->key._present.nd_extensions_len = len; - req->key.nd_extensions = malloc(req->key._present.nd_extensions_len); - memcpy(req->key.nd_extensions, nd_extensions, req->key._present.nd_extensions_len); -} -static inline void -ovs_flow_get_req_dump_set_key_tunnel_info(struct ovs_flow_get_req_dump *req, - const void *tunnel_info, size_t len) -{ - free(req->key.tunnel_info); - req->key._present.tunnel_info_len = len; - req->key.tunnel_info = malloc(req->key._present.tunnel_info_len); - memcpy(req->key.tunnel_info, tunnel_info, req->key._present.tunnel_info_len); -} -static inline void -ovs_flow_get_req_dump_set_key_ipv6_exthdrs(struct ovs_flow_get_req_dump *req, - const void *ipv6_exthdrs, - size_t len) -{ - free(req->key.ipv6_exthdrs); - req->key._present.ipv6_exthdrs_len = len; - req->key.ipv6_exthdrs = malloc(req->key._present.ipv6_exthdrs_len); - memcpy(req->key.ipv6_exthdrs, ipv6_exthdrs, req->key._present.ipv6_exthdrs_len); -} -static inline void -ovs_flow_get_req_dump_set_ufid(struct ovs_flow_get_req_dump *req, - const void *ufid, size_t len) -{ - free(req->ufid); - req->_present.ufid_len = len; - req->ufid = malloc(req->_present.ufid_len); - memcpy(req->ufid, ufid, req->_present.ufid_len); -} -static inline void -ovs_flow_get_req_dump_set_ufid_flags(struct ovs_flow_get_req_dump *req, - __u32 ufid_flags) -{ - req->_present.ufid_flags = 1; - req->ufid_flags = ufid_flags; -} - -struct ovs_flow_get_list { - struct ovs_flow_get_list *next; - struct ovs_flow_get_rsp obj __attribute__((aligned(8))); -}; - -void ovs_flow_get_list_free(struct ovs_flow_get_list *rsp); - -struct ovs_flow_get_list * -ovs_flow_get_dump(struct ynl_sock *ys, struct ovs_flow_get_req_dump *req); - -/* ============== OVS_FLOW_CMD_NEW ============== */ -/* OVS_FLOW_CMD_NEW - do */ -struct ovs_flow_new_req { - struct ovs_header _hdr; - - struct { - __u32 key:1; - __u32 ufid_len; - __u32 mask:1; - __u32 actions:1; - } _present; - - struct ovs_flow_key_attrs key; - void *ufid; - struct ovs_flow_key_attrs mask; - struct ovs_flow_action_attrs actions; -}; - -static inline struct ovs_flow_new_req *ovs_flow_new_req_alloc(void) -{ - return calloc(1, sizeof(struct ovs_flow_new_req)); -} -void ovs_flow_new_req_free(struct ovs_flow_new_req *req); - -static inline void -ovs_flow_new_req_set_key_priority(struct ovs_flow_new_req *req, __u32 priority) -{ - req->_present.key = 1; - req->key._present.priority = 1; - req->key.priority = priority; -} -static inline void -ovs_flow_new_req_set_key_in_port(struct ovs_flow_new_req *req, __u32 in_port) -{ - req->_present.key = 1; - req->key._present.in_port = 1; - req->key.in_port = in_port; -} -static inline void -ovs_flow_new_req_set_key_ethernet(struct ovs_flow_new_req *req, - const void *ethernet, size_t len) -{ - free(req->key.ethernet); - req->key._present.ethernet_len = len; - req->key.ethernet = malloc(req->key._present.ethernet_len); - memcpy(req->key.ethernet, ethernet, req->key._present.ethernet_len); -} -static inline void -ovs_flow_new_req_set_key_vlan(struct ovs_flow_new_req *req, - __u16 vlan /* big-endian */) -{ - req->_present.key = 1; - req->key._present.vlan = 1; - req->key.vlan = vlan; -} -static inline void -ovs_flow_new_req_set_key_ethertype(struct ovs_flow_new_req *req, - __u16 ethertype /* big-endian */) -{ - req->_present.key = 1; - req->key._present.ethertype = 1; - req->key.ethertype = ethertype; -} -static inline void -ovs_flow_new_req_set_key_ipv4(struct ovs_flow_new_req *req, const void *ipv4, - size_t len) -{ - free(req->key.ipv4); - req->key._present.ipv4_len = len; - req->key.ipv4 = malloc(req->key._present.ipv4_len); - memcpy(req->key.ipv4, ipv4, req->key._present.ipv4_len); -} -static inline void -ovs_flow_new_req_set_key_ipv6(struct ovs_flow_new_req *req, const void *ipv6, - size_t len) -{ - free(req->key.ipv6); - req->key._present.ipv6_len = len; - req->key.ipv6 = malloc(req->key._present.ipv6_len); - memcpy(req->key.ipv6, ipv6, req->key._present.ipv6_len); -} -static inline void -ovs_flow_new_req_set_key_tcp(struct ovs_flow_new_req *req, const void *tcp, - size_t len) -{ - free(req->key.tcp); - req->key._present.tcp_len = len; - req->key.tcp = malloc(req->key._present.tcp_len); - memcpy(req->key.tcp, tcp, req->key._present.tcp_len); -} -static inline void -ovs_flow_new_req_set_key_udp(struct ovs_flow_new_req *req, const void *udp, - size_t len) -{ - free(req->key.udp); - req->key._present.udp_len = len; - req->key.udp = malloc(req->key._present.udp_len); - memcpy(req->key.udp, udp, req->key._present.udp_len); -} -static inline void -ovs_flow_new_req_set_key_icmp(struct ovs_flow_new_req *req, const void *icmp, - size_t len) -{ - free(req->key.icmp); - req->key._present.icmp_len = len; - req->key.icmp = malloc(req->key._present.icmp_len); - memcpy(req->key.icmp, icmp, req->key._present.icmp_len); -} -static inline void -ovs_flow_new_req_set_key_icmpv6(struct ovs_flow_new_req *req, - const void *icmpv6, size_t len) -{ - free(req->key.icmpv6); - req->key._present.icmpv6_len = len; - req->key.icmpv6 = malloc(req->key._present.icmpv6_len); - memcpy(req->key.icmpv6, icmpv6, req->key._present.icmpv6_len); -} -static inline void -ovs_flow_new_req_set_key_arp(struct ovs_flow_new_req *req, const void *arp, - size_t len) -{ - free(req->key.arp); - req->key._present.arp_len = len; - req->key.arp = malloc(req->key._present.arp_len); - memcpy(req->key.arp, arp, req->key._present.arp_len); -} -static inline void -ovs_flow_new_req_set_key_nd(struct ovs_flow_new_req *req, const void *nd, - size_t len) -{ - free(req->key.nd); - req->key._present.nd_len = len; - req->key.nd = malloc(req->key._present.nd_len); - memcpy(req->key.nd, nd, req->key._present.nd_len); -} -static inline void -ovs_flow_new_req_set_key_skb_mark(struct ovs_flow_new_req *req, __u32 skb_mark) -{ - req->_present.key = 1; - req->key._present.skb_mark = 1; - req->key.skb_mark = skb_mark; -} -static inline void -ovs_flow_new_req_set_key_tunnel_id(struct ovs_flow_new_req *req, - __u64 id /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.id = 1; - req->key.tunnel.id = id; -} -static inline void -ovs_flow_new_req_set_key_tunnel_ipv4_src(struct ovs_flow_new_req *req, - __u32 ipv4_src /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.ipv4_src = 1; - req->key.tunnel.ipv4_src = ipv4_src; -} -static inline void -ovs_flow_new_req_set_key_tunnel_ipv4_dst(struct ovs_flow_new_req *req, - __u32 ipv4_dst /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.ipv4_dst = 1; - req->key.tunnel.ipv4_dst = ipv4_dst; -} -static inline void -ovs_flow_new_req_set_key_tunnel_tos(struct ovs_flow_new_req *req, __u8 tos) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.tos = 1; - req->key.tunnel.tos = tos; -} -static inline void -ovs_flow_new_req_set_key_tunnel_ttl(struct ovs_flow_new_req *req, __u8 ttl) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.ttl = 1; - req->key.tunnel.ttl = ttl; -} -static inline void -ovs_flow_new_req_set_key_tunnel_dont_fragment(struct ovs_flow_new_req *req) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.dont_fragment = 1; -} -static inline void -ovs_flow_new_req_set_key_tunnel_csum(struct ovs_flow_new_req *req) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.csum = 1; -} -static inline void -ovs_flow_new_req_set_key_tunnel_oam(struct ovs_flow_new_req *req) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.oam = 1; -} -static inline void -ovs_flow_new_req_set_key_tunnel_geneve_opts(struct ovs_flow_new_req *req, - const void *geneve_opts, - size_t len) -{ - free(req->key.tunnel.geneve_opts); - req->key.tunnel._present.geneve_opts_len = len; - req->key.tunnel.geneve_opts = malloc(req->key.tunnel._present.geneve_opts_len); - memcpy(req->key.tunnel.geneve_opts, geneve_opts, req->key.tunnel._present.geneve_opts_len); -} -static inline void -ovs_flow_new_req_set_key_tunnel_tp_src(struct ovs_flow_new_req *req, - __u16 tp_src /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.tp_src = 1; - req->key.tunnel.tp_src = tp_src; -} -static inline void -ovs_flow_new_req_set_key_tunnel_tp_dst(struct ovs_flow_new_req *req, - __u16 tp_dst /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.tp_dst = 1; - req->key.tunnel.tp_dst = tp_dst; -} -static inline void -ovs_flow_new_req_set_key_tunnel_vxlan_opts_gbp(struct ovs_flow_new_req *req, - __u32 gbp) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.vxlan_opts = 1; - req->key.tunnel.vxlan_opts._present.gbp = 1; - req->key.tunnel.vxlan_opts.gbp = gbp; -} -static inline void -ovs_flow_new_req_set_key_tunnel_ipv6_src(struct ovs_flow_new_req *req, - const void *ipv6_src, size_t len) -{ - free(req->key.tunnel.ipv6_src); - req->key.tunnel._present.ipv6_src_len = len; - req->key.tunnel.ipv6_src = malloc(req->key.tunnel._present.ipv6_src_len); - memcpy(req->key.tunnel.ipv6_src, ipv6_src, req->key.tunnel._present.ipv6_src_len); -} -static inline void -ovs_flow_new_req_set_key_tunnel_ipv6_dst(struct ovs_flow_new_req *req, - const void *ipv6_dst, size_t len) -{ - free(req->key.tunnel.ipv6_dst); - req->key.tunnel._present.ipv6_dst_len = len; - req->key.tunnel.ipv6_dst = malloc(req->key.tunnel._present.ipv6_dst_len); - memcpy(req->key.tunnel.ipv6_dst, ipv6_dst, req->key.tunnel._present.ipv6_dst_len); -} -static inline void -ovs_flow_new_req_set_key_tunnel_pad(struct ovs_flow_new_req *req, - const void *pad, size_t len) -{ - free(req->key.tunnel.pad); - req->key.tunnel._present.pad_len = len; - req->key.tunnel.pad = malloc(req->key.tunnel._present.pad_len); - memcpy(req->key.tunnel.pad, pad, req->key.tunnel._present.pad_len); -} -static inline void -ovs_flow_new_req_set_key_tunnel_erspan_opts(struct ovs_flow_new_req *req, - const void *erspan_opts, - size_t len) -{ - free(req->key.tunnel.erspan_opts); - req->key.tunnel._present.erspan_opts_len = len; - req->key.tunnel.erspan_opts = malloc(req->key.tunnel._present.erspan_opts_len); - memcpy(req->key.tunnel.erspan_opts, erspan_opts, req->key.tunnel._present.erspan_opts_len); -} -static inline void -ovs_flow_new_req_set_key_tunnel_ipv4_info_bridge(struct ovs_flow_new_req *req) -{ - req->_present.key = 1; - req->key._present.tunnel = 1; - req->key.tunnel._present.ipv4_info_bridge = 1; -} -static inline void -ovs_flow_new_req_set_key_sctp(struct ovs_flow_new_req *req, const void *sctp, - size_t len) -{ - free(req->key.sctp); - req->key._present.sctp_len = len; - req->key.sctp = malloc(req->key._present.sctp_len); - memcpy(req->key.sctp, sctp, req->key._present.sctp_len); -} -static inline void -ovs_flow_new_req_set_key_tcp_flags(struct ovs_flow_new_req *req, - __u16 tcp_flags /* big-endian */) -{ - req->_present.key = 1; - req->key._present.tcp_flags = 1; - req->key.tcp_flags = tcp_flags; -} -static inline void -ovs_flow_new_req_set_key_dp_hash(struct ovs_flow_new_req *req, __u32 dp_hash) -{ - req->_present.key = 1; - req->key._present.dp_hash = 1; - req->key.dp_hash = dp_hash; -} -static inline void -ovs_flow_new_req_set_key_recirc_id(struct ovs_flow_new_req *req, - __u32 recirc_id) -{ - req->_present.key = 1; - req->key._present.recirc_id = 1; - req->key.recirc_id = recirc_id; -} -static inline void -ovs_flow_new_req_set_key_mpls(struct ovs_flow_new_req *req, const void *mpls, - size_t len) -{ - free(req->key.mpls); - req->key._present.mpls_len = len; - req->key.mpls = malloc(req->key._present.mpls_len); - memcpy(req->key.mpls, mpls, req->key._present.mpls_len); -} -static inline void -ovs_flow_new_req_set_key_ct_state(struct ovs_flow_new_req *req, __u32 ct_state) -{ - req->_present.key = 1; - req->key._present.ct_state = 1; - req->key.ct_state = ct_state; -} -static inline void -ovs_flow_new_req_set_key_ct_zone(struct ovs_flow_new_req *req, __u16 ct_zone) -{ - req->_present.key = 1; - req->key._present.ct_zone = 1; - req->key.ct_zone = ct_zone; -} -static inline void -ovs_flow_new_req_set_key_ct_mark(struct ovs_flow_new_req *req, __u32 ct_mark) -{ - req->_present.key = 1; - req->key._present.ct_mark = 1; - req->key.ct_mark = ct_mark; -} -static inline void -ovs_flow_new_req_set_key_ct_labels(struct ovs_flow_new_req *req, - const void *ct_labels, size_t len) -{ - free(req->key.ct_labels); - req->key._present.ct_labels_len = len; - req->key.ct_labels = malloc(req->key._present.ct_labels_len); - memcpy(req->key.ct_labels, ct_labels, req->key._present.ct_labels_len); -} -static inline void -ovs_flow_new_req_set_key_ct_orig_tuple_ipv4(struct ovs_flow_new_req *req, - const void *ct_orig_tuple_ipv4, - size_t len) -{ - free(req->key.ct_orig_tuple_ipv4); - req->key._present.ct_orig_tuple_ipv4_len = len; - req->key.ct_orig_tuple_ipv4 = malloc(req->key._present.ct_orig_tuple_ipv4_len); - memcpy(req->key.ct_orig_tuple_ipv4, ct_orig_tuple_ipv4, req->key._present.ct_orig_tuple_ipv4_len); -} -static inline void -ovs_flow_new_req_set_key_ct_orig_tuple_ipv6(struct ovs_flow_new_req *req, - const void *ct_orig_tuple_ipv6, - size_t len) -{ - free(req->key.ct_orig_tuple_ipv6); - req->key._present.ct_orig_tuple_ipv6_len = len; - req->key.ct_orig_tuple_ipv6 = malloc(req->key._present.ct_orig_tuple_ipv6_len); - memcpy(req->key.ct_orig_tuple_ipv6, ct_orig_tuple_ipv6, req->key._present.ct_orig_tuple_ipv6_len); -} -static inline void -ovs_flow_new_req_set_key_nsh_base(struct ovs_flow_new_req *req, - const void *base, size_t len) -{ - free(req->key.nsh.base); - req->key.nsh._present.base_len = len; - req->key.nsh.base = malloc(req->key.nsh._present.base_len); - memcpy(req->key.nsh.base, base, req->key.nsh._present.base_len); -} -static inline void -ovs_flow_new_req_set_key_nsh_md1(struct ovs_flow_new_req *req, const void *md1, - size_t len) -{ - free(req->key.nsh.md1); - req->key.nsh._present.md1_len = len; - req->key.nsh.md1 = malloc(req->key.nsh._present.md1_len); - memcpy(req->key.nsh.md1, md1, req->key.nsh._present.md1_len); -} -static inline void -ovs_flow_new_req_set_key_nsh_md2(struct ovs_flow_new_req *req, const void *md2, - size_t len) -{ - free(req->key.nsh.md2); - req->key.nsh._present.md2_len = len; - req->key.nsh.md2 = malloc(req->key.nsh._present.md2_len); - memcpy(req->key.nsh.md2, md2, req->key.nsh._present.md2_len); -} -static inline void -ovs_flow_new_req_set_key_packet_type(struct ovs_flow_new_req *req, - __u32 packet_type /* big-endian */) -{ - req->_present.key = 1; - req->key._present.packet_type = 1; - req->key.packet_type = packet_type; -} -static inline void -ovs_flow_new_req_set_key_nd_extensions(struct ovs_flow_new_req *req, - const void *nd_extensions, size_t len) -{ - free(req->key.nd_extensions); - req->key._present.nd_extensions_len = len; - req->key.nd_extensions = malloc(req->key._present.nd_extensions_len); - memcpy(req->key.nd_extensions, nd_extensions, req->key._present.nd_extensions_len); -} -static inline void -ovs_flow_new_req_set_key_tunnel_info(struct ovs_flow_new_req *req, - const void *tunnel_info, size_t len) -{ - free(req->key.tunnel_info); - req->key._present.tunnel_info_len = len; - req->key.tunnel_info = malloc(req->key._present.tunnel_info_len); - memcpy(req->key.tunnel_info, tunnel_info, req->key._present.tunnel_info_len); -} -static inline void -ovs_flow_new_req_set_key_ipv6_exthdrs(struct ovs_flow_new_req *req, - const void *ipv6_exthdrs, size_t len) -{ - free(req->key.ipv6_exthdrs); - req->key._present.ipv6_exthdrs_len = len; - req->key.ipv6_exthdrs = malloc(req->key._present.ipv6_exthdrs_len); - memcpy(req->key.ipv6_exthdrs, ipv6_exthdrs, req->key._present.ipv6_exthdrs_len); -} -static inline void -ovs_flow_new_req_set_ufid(struct ovs_flow_new_req *req, const void *ufid, - size_t len) -{ - free(req->ufid); - req->_present.ufid_len = len; - req->ufid = malloc(req->_present.ufid_len); - memcpy(req->ufid, ufid, req->_present.ufid_len); -} -static inline void -ovs_flow_new_req_set_mask_priority(struct ovs_flow_new_req *req, - __u32 priority) -{ - req->_present.mask = 1; - req->mask._present.priority = 1; - req->mask.priority = priority; -} -static inline void -ovs_flow_new_req_set_mask_in_port(struct ovs_flow_new_req *req, __u32 in_port) -{ - req->_present.mask = 1; - req->mask._present.in_port = 1; - req->mask.in_port = in_port; -} -static inline void -ovs_flow_new_req_set_mask_ethernet(struct ovs_flow_new_req *req, - const void *ethernet, size_t len) -{ - free(req->mask.ethernet); - req->mask._present.ethernet_len = len; - req->mask.ethernet = malloc(req->mask._present.ethernet_len); - memcpy(req->mask.ethernet, ethernet, req->mask._present.ethernet_len); -} -static inline void -ovs_flow_new_req_set_mask_vlan(struct ovs_flow_new_req *req, - __u16 vlan /* big-endian */) -{ - req->_present.mask = 1; - req->mask._present.vlan = 1; - req->mask.vlan = vlan; -} -static inline void -ovs_flow_new_req_set_mask_ethertype(struct ovs_flow_new_req *req, - __u16 ethertype /* big-endian */) -{ - req->_present.mask = 1; - req->mask._present.ethertype = 1; - req->mask.ethertype = ethertype; -} -static inline void -ovs_flow_new_req_set_mask_ipv4(struct ovs_flow_new_req *req, const void *ipv4, - size_t len) -{ - free(req->mask.ipv4); - req->mask._present.ipv4_len = len; - req->mask.ipv4 = malloc(req->mask._present.ipv4_len); - memcpy(req->mask.ipv4, ipv4, req->mask._present.ipv4_len); -} -static inline void -ovs_flow_new_req_set_mask_ipv6(struct ovs_flow_new_req *req, const void *ipv6, - size_t len) -{ - free(req->mask.ipv6); - req->mask._present.ipv6_len = len; - req->mask.ipv6 = malloc(req->mask._present.ipv6_len); - memcpy(req->mask.ipv6, ipv6, req->mask._present.ipv6_len); -} -static inline void -ovs_flow_new_req_set_mask_tcp(struct ovs_flow_new_req *req, const void *tcp, - size_t len) -{ - free(req->mask.tcp); - req->mask._present.tcp_len = len; - req->mask.tcp = malloc(req->mask._present.tcp_len); - memcpy(req->mask.tcp, tcp, req->mask._present.tcp_len); -} -static inline void -ovs_flow_new_req_set_mask_udp(struct ovs_flow_new_req *req, const void *udp, - size_t len) -{ - free(req->mask.udp); - req->mask._present.udp_len = len; - req->mask.udp = malloc(req->mask._present.udp_len); - memcpy(req->mask.udp, udp, req->mask._present.udp_len); -} -static inline void -ovs_flow_new_req_set_mask_icmp(struct ovs_flow_new_req *req, const void *icmp, - size_t len) -{ - free(req->mask.icmp); - req->mask._present.icmp_len = len; - req->mask.icmp = malloc(req->mask._present.icmp_len); - memcpy(req->mask.icmp, icmp, req->mask._present.icmp_len); -} -static inline void -ovs_flow_new_req_set_mask_icmpv6(struct ovs_flow_new_req *req, - const void *icmpv6, size_t len) -{ - free(req->mask.icmpv6); - req->mask._present.icmpv6_len = len; - req->mask.icmpv6 = malloc(req->mask._present.icmpv6_len); - memcpy(req->mask.icmpv6, icmpv6, req->mask._present.icmpv6_len); -} -static inline void -ovs_flow_new_req_set_mask_arp(struct ovs_flow_new_req *req, const void *arp, - size_t len) -{ - free(req->mask.arp); - req->mask._present.arp_len = len; - req->mask.arp = malloc(req->mask._present.arp_len); - memcpy(req->mask.arp, arp, req->mask._present.arp_len); -} -static inline void -ovs_flow_new_req_set_mask_nd(struct ovs_flow_new_req *req, const void *nd, - size_t len) -{ - free(req->mask.nd); - req->mask._present.nd_len = len; - req->mask.nd = malloc(req->mask._present.nd_len); - memcpy(req->mask.nd, nd, req->mask._present.nd_len); -} -static inline void -ovs_flow_new_req_set_mask_skb_mark(struct ovs_flow_new_req *req, - __u32 skb_mark) -{ - req->_present.mask = 1; - req->mask._present.skb_mark = 1; - req->mask.skb_mark = skb_mark; -} -static inline void -ovs_flow_new_req_set_mask_tunnel_id(struct ovs_flow_new_req *req, - __u64 id /* big-endian */) -{ - req->_present.mask = 1; - req->mask._present.tunnel = 1; - req->mask.tunnel._present.id = 1; - req->mask.tunnel.id = id; -} -static inline void -ovs_flow_new_req_set_mask_tunnel_ipv4_src(struct ovs_flow_new_req *req, - __u32 ipv4_src /* big-endian */) -{ - req->_present.mask = 1; - req->mask._present.tunnel = 1; - req->mask.tunnel._present.ipv4_src = 1; - req->mask.tunnel.ipv4_src = ipv4_src; -} -static inline void -ovs_flow_new_req_set_mask_tunnel_ipv4_dst(struct ovs_flow_new_req *req, - __u32 ipv4_dst /* big-endian */) -{ - req->_present.mask = 1; - req->mask._present.tunnel = 1; - req->mask.tunnel._present.ipv4_dst = 1; - req->mask.tunnel.ipv4_dst = ipv4_dst; -} -static inline void -ovs_flow_new_req_set_mask_tunnel_tos(struct ovs_flow_new_req *req, __u8 tos) -{ - req->_present.mask = 1; - req->mask._present.tunnel = 1; - req->mask.tunnel._present.tos = 1; - req->mask.tunnel.tos = tos; -} -static inline void -ovs_flow_new_req_set_mask_tunnel_ttl(struct ovs_flow_new_req *req, __u8 ttl) -{ - req->_present.mask = 1; - req->mask._present.tunnel = 1; - req->mask.tunnel._present.ttl = 1; - req->mask.tunnel.ttl = ttl; -} -static inline void -ovs_flow_new_req_set_mask_tunnel_dont_fragment(struct ovs_flow_new_req *req) -{ - req->_present.mask = 1; - req->mask._present.tunnel = 1; - req->mask.tunnel._present.dont_fragment = 1; -} -static inline void -ovs_flow_new_req_set_mask_tunnel_csum(struct ovs_flow_new_req *req) -{ - req->_present.mask = 1; - req->mask._present.tunnel = 1; - req->mask.tunnel._present.csum = 1; -} -static inline void -ovs_flow_new_req_set_mask_tunnel_oam(struct ovs_flow_new_req *req) -{ - req->_present.mask = 1; - req->mask._present.tunnel = 1; - req->mask.tunnel._present.oam = 1; -} -static inline void -ovs_flow_new_req_set_mask_tunnel_geneve_opts(struct ovs_flow_new_req *req, - const void *geneve_opts, - size_t len) -{ - free(req->mask.tunnel.geneve_opts); - req->mask.tunnel._present.geneve_opts_len = len; - req->mask.tunnel.geneve_opts = malloc(req->mask.tunnel._present.geneve_opts_len); - memcpy(req->mask.tunnel.geneve_opts, geneve_opts, req->mask.tunnel._present.geneve_opts_len); -} -static inline void -ovs_flow_new_req_set_mask_tunnel_tp_src(struct ovs_flow_new_req *req, - __u16 tp_src /* big-endian */) -{ - req->_present.mask = 1; - req->mask._present.tunnel = 1; - req->mask.tunnel._present.tp_src = 1; - req->mask.tunnel.tp_src = tp_src; -} -static inline void -ovs_flow_new_req_set_mask_tunnel_tp_dst(struct ovs_flow_new_req *req, - __u16 tp_dst /* big-endian */) -{ - req->_present.mask = 1; - req->mask._present.tunnel = 1; - req->mask.tunnel._present.tp_dst = 1; - req->mask.tunnel.tp_dst = tp_dst; -} -static inline void -ovs_flow_new_req_set_mask_tunnel_vxlan_opts_gbp(struct ovs_flow_new_req *req, - __u32 gbp) -{ - req->_present.mask = 1; - req->mask._present.tunnel = 1; - req->mask.tunnel._present.vxlan_opts = 1; - req->mask.tunnel.vxlan_opts._present.gbp = 1; - req->mask.tunnel.vxlan_opts.gbp = gbp; -} -static inline void -ovs_flow_new_req_set_mask_tunnel_ipv6_src(struct ovs_flow_new_req *req, - const void *ipv6_src, size_t len) -{ - free(req->mask.tunnel.ipv6_src); - req->mask.tunnel._present.ipv6_src_len = len; - req->mask.tunnel.ipv6_src = malloc(req->mask.tunnel._present.ipv6_src_len); - memcpy(req->mask.tunnel.ipv6_src, ipv6_src, req->mask.tunnel._present.ipv6_src_len); -} -static inline void -ovs_flow_new_req_set_mask_tunnel_ipv6_dst(struct ovs_flow_new_req *req, - const void *ipv6_dst, size_t len) -{ - free(req->mask.tunnel.ipv6_dst); - req->mask.tunnel._present.ipv6_dst_len = len; - req->mask.tunnel.ipv6_dst = malloc(req->mask.tunnel._present.ipv6_dst_len); - memcpy(req->mask.tunnel.ipv6_dst, ipv6_dst, req->mask.tunnel._present.ipv6_dst_len); -} -static inline void -ovs_flow_new_req_set_mask_tunnel_pad(struct ovs_flow_new_req *req, - const void *pad, size_t len) -{ - free(req->mask.tunnel.pad); - req->mask.tunnel._present.pad_len = len; - req->mask.tunnel.pad = malloc(req->mask.tunnel._present.pad_len); - memcpy(req->mask.tunnel.pad, pad, req->mask.tunnel._present.pad_len); -} -static inline void -ovs_flow_new_req_set_mask_tunnel_erspan_opts(struct ovs_flow_new_req *req, - const void *erspan_opts, - size_t len) -{ - free(req->mask.tunnel.erspan_opts); - req->mask.tunnel._present.erspan_opts_len = len; - req->mask.tunnel.erspan_opts = malloc(req->mask.tunnel._present.erspan_opts_len); - memcpy(req->mask.tunnel.erspan_opts, erspan_opts, req->mask.tunnel._present.erspan_opts_len); -} -static inline void -ovs_flow_new_req_set_mask_tunnel_ipv4_info_bridge(struct ovs_flow_new_req *req) -{ - req->_present.mask = 1; - req->mask._present.tunnel = 1; - req->mask.tunnel._present.ipv4_info_bridge = 1; -} -static inline void -ovs_flow_new_req_set_mask_sctp(struct ovs_flow_new_req *req, const void *sctp, - size_t len) -{ - free(req->mask.sctp); - req->mask._present.sctp_len = len; - req->mask.sctp = malloc(req->mask._present.sctp_len); - memcpy(req->mask.sctp, sctp, req->mask._present.sctp_len); -} -static inline void -ovs_flow_new_req_set_mask_tcp_flags(struct ovs_flow_new_req *req, - __u16 tcp_flags /* big-endian */) -{ - req->_present.mask = 1; - req->mask._present.tcp_flags = 1; - req->mask.tcp_flags = tcp_flags; -} -static inline void -ovs_flow_new_req_set_mask_dp_hash(struct ovs_flow_new_req *req, __u32 dp_hash) -{ - req->_present.mask = 1; - req->mask._present.dp_hash = 1; - req->mask.dp_hash = dp_hash; -} -static inline void -ovs_flow_new_req_set_mask_recirc_id(struct ovs_flow_new_req *req, - __u32 recirc_id) -{ - req->_present.mask = 1; - req->mask._present.recirc_id = 1; - req->mask.recirc_id = recirc_id; -} -static inline void -ovs_flow_new_req_set_mask_mpls(struct ovs_flow_new_req *req, const void *mpls, - size_t len) -{ - free(req->mask.mpls); - req->mask._present.mpls_len = len; - req->mask.mpls = malloc(req->mask._present.mpls_len); - memcpy(req->mask.mpls, mpls, req->mask._present.mpls_len); -} -static inline void -ovs_flow_new_req_set_mask_ct_state(struct ovs_flow_new_req *req, - __u32 ct_state) -{ - req->_present.mask = 1; - req->mask._present.ct_state = 1; - req->mask.ct_state = ct_state; -} -static inline void -ovs_flow_new_req_set_mask_ct_zone(struct ovs_flow_new_req *req, __u16 ct_zone) -{ - req->_present.mask = 1; - req->mask._present.ct_zone = 1; - req->mask.ct_zone = ct_zone; -} -static inline void -ovs_flow_new_req_set_mask_ct_mark(struct ovs_flow_new_req *req, __u32 ct_mark) -{ - req->_present.mask = 1; - req->mask._present.ct_mark = 1; - req->mask.ct_mark = ct_mark; -} -static inline void -ovs_flow_new_req_set_mask_ct_labels(struct ovs_flow_new_req *req, - const void *ct_labels, size_t len) -{ - free(req->mask.ct_labels); - req->mask._present.ct_labels_len = len; - req->mask.ct_labels = malloc(req->mask._present.ct_labels_len); - memcpy(req->mask.ct_labels, ct_labels, req->mask._present.ct_labels_len); -} -static inline void -ovs_flow_new_req_set_mask_ct_orig_tuple_ipv4(struct ovs_flow_new_req *req, - const void *ct_orig_tuple_ipv4, - size_t len) -{ - free(req->mask.ct_orig_tuple_ipv4); - req->mask._present.ct_orig_tuple_ipv4_len = len; - req->mask.ct_orig_tuple_ipv4 = malloc(req->mask._present.ct_orig_tuple_ipv4_len); - memcpy(req->mask.ct_orig_tuple_ipv4, ct_orig_tuple_ipv4, req->mask._present.ct_orig_tuple_ipv4_len); -} -static inline void -ovs_flow_new_req_set_mask_ct_orig_tuple_ipv6(struct ovs_flow_new_req *req, - const void *ct_orig_tuple_ipv6, - size_t len) -{ - free(req->mask.ct_orig_tuple_ipv6); - req->mask._present.ct_orig_tuple_ipv6_len = len; - req->mask.ct_orig_tuple_ipv6 = malloc(req->mask._present.ct_orig_tuple_ipv6_len); - memcpy(req->mask.ct_orig_tuple_ipv6, ct_orig_tuple_ipv6, req->mask._present.ct_orig_tuple_ipv6_len); -} -static inline void -ovs_flow_new_req_set_mask_nsh_base(struct ovs_flow_new_req *req, - const void *base, size_t len) -{ - free(req->mask.nsh.base); - req->mask.nsh._present.base_len = len; - req->mask.nsh.base = malloc(req->mask.nsh._present.base_len); - memcpy(req->mask.nsh.base, base, req->mask.nsh._present.base_len); -} -static inline void -ovs_flow_new_req_set_mask_nsh_md1(struct ovs_flow_new_req *req, - const void *md1, size_t len) -{ - free(req->mask.nsh.md1); - req->mask.nsh._present.md1_len = len; - req->mask.nsh.md1 = malloc(req->mask.nsh._present.md1_len); - memcpy(req->mask.nsh.md1, md1, req->mask.nsh._present.md1_len); -} -static inline void -ovs_flow_new_req_set_mask_nsh_md2(struct ovs_flow_new_req *req, - const void *md2, size_t len) -{ - free(req->mask.nsh.md2); - req->mask.nsh._present.md2_len = len; - req->mask.nsh.md2 = malloc(req->mask.nsh._present.md2_len); - memcpy(req->mask.nsh.md2, md2, req->mask.nsh._present.md2_len); -} -static inline void -ovs_flow_new_req_set_mask_packet_type(struct ovs_flow_new_req *req, - __u32 packet_type /* big-endian */) -{ - req->_present.mask = 1; - req->mask._present.packet_type = 1; - req->mask.packet_type = packet_type; -} -static inline void -ovs_flow_new_req_set_mask_nd_extensions(struct ovs_flow_new_req *req, - const void *nd_extensions, size_t len) -{ - free(req->mask.nd_extensions); - req->mask._present.nd_extensions_len = len; - req->mask.nd_extensions = malloc(req->mask._present.nd_extensions_len); - memcpy(req->mask.nd_extensions, nd_extensions, req->mask._present.nd_extensions_len); -} -static inline void -ovs_flow_new_req_set_mask_tunnel_info(struct ovs_flow_new_req *req, - const void *tunnel_info, size_t len) -{ - free(req->mask.tunnel_info); - req->mask._present.tunnel_info_len = len; - req->mask.tunnel_info = malloc(req->mask._present.tunnel_info_len); - memcpy(req->mask.tunnel_info, tunnel_info, req->mask._present.tunnel_info_len); -} -static inline void -ovs_flow_new_req_set_mask_ipv6_exthdrs(struct ovs_flow_new_req *req, - const void *ipv6_exthdrs, size_t len) -{ - free(req->mask.ipv6_exthdrs); - req->mask._present.ipv6_exthdrs_len = len; - req->mask.ipv6_exthdrs = malloc(req->mask._present.ipv6_exthdrs_len); - memcpy(req->mask.ipv6_exthdrs, ipv6_exthdrs, req->mask._present.ipv6_exthdrs_len); -} -static inline void -ovs_flow_new_req_set_actions_output(struct ovs_flow_new_req *req, __u32 output) -{ - req->_present.actions = 1; - req->actions._present.output = 1; - req->actions.output = output; -} -static inline void -ovs_flow_new_req_set_actions_userspace_pid(struct ovs_flow_new_req *req, - __u32 pid) -{ - req->_present.actions = 1; - req->actions._present.userspace = 1; - req->actions.userspace._present.pid = 1; - req->actions.userspace.pid = pid; -} -static inline void -ovs_flow_new_req_set_actions_userspace_userdata(struct ovs_flow_new_req *req, - const void *userdata, - size_t len) -{ - free(req->actions.userspace.userdata); - req->actions.userspace._present.userdata_len = len; - req->actions.userspace.userdata = malloc(req->actions.userspace._present.userdata_len); - memcpy(req->actions.userspace.userdata, userdata, req->actions.userspace._present.userdata_len); -} -static inline void -ovs_flow_new_req_set_actions_userspace_egress_tun_port(struct ovs_flow_new_req *req, - __u32 egress_tun_port) -{ - req->_present.actions = 1; - req->actions._present.userspace = 1; - req->actions.userspace._present.egress_tun_port = 1; - req->actions.userspace.egress_tun_port = egress_tun_port; -} -static inline void -ovs_flow_new_req_set_actions_userspace_actions(struct ovs_flow_new_req *req) -{ - req->_present.actions = 1; - req->actions._present.userspace = 1; - req->actions.userspace._present.actions = 1; -} -static inline void -ovs_flow_new_req_set_actions_push_vlan(struct ovs_flow_new_req *req, - const void *push_vlan, size_t len) -{ - free(req->actions.push_vlan); - req->actions._present.push_vlan_len = len; - req->actions.push_vlan = malloc(req->actions._present.push_vlan_len); - memcpy(req->actions.push_vlan, push_vlan, req->actions._present.push_vlan_len); -} -static inline void -ovs_flow_new_req_set_actions_pop_vlan(struct ovs_flow_new_req *req) -{ - req->_present.actions = 1; - req->actions._present.pop_vlan = 1; -} -static inline void -ovs_flow_new_req_set_actions_sample_probability(struct ovs_flow_new_req *req, - __u32 probability) -{ - req->_present.actions = 1; - req->actions._present.sample = 1; - req->actions.sample._present.probability = 1; - req->actions.sample.probability = probability; -} -static inline void -ovs_flow_new_req_set_actions_recirc(struct ovs_flow_new_req *req, __u32 recirc) -{ - req->_present.actions = 1; - req->actions._present.recirc = 1; - req->actions.recirc = recirc; -} -static inline void -ovs_flow_new_req_set_actions_hash(struct ovs_flow_new_req *req, - const void *hash, size_t len) -{ - free(req->actions.hash); - req->actions._present.hash_len = len; - req->actions.hash = malloc(req->actions._present.hash_len); - memcpy(req->actions.hash, hash, req->actions._present.hash_len); -} -static inline void -ovs_flow_new_req_set_actions_push_mpls(struct ovs_flow_new_req *req, - const void *push_mpls, size_t len) -{ - free(req->actions.push_mpls); - req->actions._present.push_mpls_len = len; - req->actions.push_mpls = malloc(req->actions._present.push_mpls_len); - memcpy(req->actions.push_mpls, push_mpls, req->actions._present.push_mpls_len); -} -static inline void -ovs_flow_new_req_set_actions_pop_mpls(struct ovs_flow_new_req *req, - __u16 pop_mpls /* big-endian */) -{ - req->_present.actions = 1; - req->actions._present.pop_mpls = 1; - req->actions.pop_mpls = pop_mpls; -} -static inline void -ovs_flow_new_req_set_actions_ct_commit(struct ovs_flow_new_req *req) -{ - req->_present.actions = 1; - req->actions._present.ct = 1; - req->actions.ct._present.commit = 1; -} -static inline void -ovs_flow_new_req_set_actions_ct_zone(struct ovs_flow_new_req *req, __u16 zone) -{ - req->_present.actions = 1; - req->actions._present.ct = 1; - req->actions.ct._present.zone = 1; - req->actions.ct.zone = zone; -} -static inline void -ovs_flow_new_req_set_actions_ct_mark(struct ovs_flow_new_req *req, - const void *mark, size_t len) -{ - free(req->actions.ct.mark); - req->actions.ct._present.mark_len = len; - req->actions.ct.mark = malloc(req->actions.ct._present.mark_len); - memcpy(req->actions.ct.mark, mark, req->actions.ct._present.mark_len); -} -static inline void -ovs_flow_new_req_set_actions_ct_labels(struct ovs_flow_new_req *req, - const void *labels, size_t len) -{ - free(req->actions.ct.labels); - req->actions.ct._present.labels_len = len; - req->actions.ct.labels = malloc(req->actions.ct._present.labels_len); - memcpy(req->actions.ct.labels, labels, req->actions.ct._present.labels_len); -} -static inline void -ovs_flow_new_req_set_actions_ct_helper(struct ovs_flow_new_req *req, - const char *helper) -{ - free(req->actions.ct.helper); - req->actions.ct._present.helper_len = strlen(helper); - req->actions.ct.helper = malloc(req->actions.ct._present.helper_len + 1); - memcpy(req->actions.ct.helper, helper, req->actions.ct._present.helper_len); - req->actions.ct.helper[req->actions.ct._present.helper_len] = 0; -} -static inline void -ovs_flow_new_req_set_actions_ct_nat_src(struct ovs_flow_new_req *req) -{ - req->_present.actions = 1; - req->actions._present.ct = 1; - req->actions.ct._present.nat = 1; - req->actions.ct.nat._present.src = 1; -} -static inline void -ovs_flow_new_req_set_actions_ct_nat_dst(struct ovs_flow_new_req *req) -{ - req->_present.actions = 1; - req->actions._present.ct = 1; - req->actions.ct._present.nat = 1; - req->actions.ct.nat._present.dst = 1; -} -static inline void -ovs_flow_new_req_set_actions_ct_nat_ip_min(struct ovs_flow_new_req *req, - const void *ip_min, size_t len) -{ - free(req->actions.ct.nat.ip_min); - req->actions.ct.nat._present.ip_min_len = len; - req->actions.ct.nat.ip_min = malloc(req->actions.ct.nat._present.ip_min_len); - memcpy(req->actions.ct.nat.ip_min, ip_min, req->actions.ct.nat._present.ip_min_len); -} -static inline void -ovs_flow_new_req_set_actions_ct_nat_ip_max(struct ovs_flow_new_req *req, - const void *ip_max, size_t len) -{ - free(req->actions.ct.nat.ip_max); - req->actions.ct.nat._present.ip_max_len = len; - req->actions.ct.nat.ip_max = malloc(req->actions.ct.nat._present.ip_max_len); - memcpy(req->actions.ct.nat.ip_max, ip_max, req->actions.ct.nat._present.ip_max_len); -} -static inline void -ovs_flow_new_req_set_actions_ct_nat_proto_min(struct ovs_flow_new_req *req, - __u16 proto_min) -{ - req->_present.actions = 1; - req->actions._present.ct = 1; - req->actions.ct._present.nat = 1; - req->actions.ct.nat._present.proto_min = 1; - req->actions.ct.nat.proto_min = proto_min; -} -static inline void -ovs_flow_new_req_set_actions_ct_nat_proto_max(struct ovs_flow_new_req *req, - __u16 proto_max) -{ - req->_present.actions = 1; - req->actions._present.ct = 1; - req->actions.ct._present.nat = 1; - req->actions.ct.nat._present.proto_max = 1; - req->actions.ct.nat.proto_max = proto_max; -} -static inline void -ovs_flow_new_req_set_actions_ct_nat_persistent(struct ovs_flow_new_req *req) -{ - req->_present.actions = 1; - req->actions._present.ct = 1; - req->actions.ct._present.nat = 1; - req->actions.ct.nat._present.persistent = 1; -} -static inline void -ovs_flow_new_req_set_actions_ct_nat_proto_hash(struct ovs_flow_new_req *req) -{ - req->_present.actions = 1; - req->actions._present.ct = 1; - req->actions.ct._present.nat = 1; - req->actions.ct.nat._present.proto_hash = 1; -} -static inline void -ovs_flow_new_req_set_actions_ct_nat_proto_random(struct ovs_flow_new_req *req) -{ - req->_present.actions = 1; - req->actions._present.ct = 1; - req->actions.ct._present.nat = 1; - req->actions.ct.nat._present.proto_random = 1; -} -static inline void -ovs_flow_new_req_set_actions_ct_force_commit(struct ovs_flow_new_req *req) -{ - req->_present.actions = 1; - req->actions._present.ct = 1; - req->actions.ct._present.force_commit = 1; -} -static inline void -ovs_flow_new_req_set_actions_ct_eventmask(struct ovs_flow_new_req *req, - __u32 eventmask) -{ - req->_present.actions = 1; - req->actions._present.ct = 1; - req->actions.ct._present.eventmask = 1; - req->actions.ct.eventmask = eventmask; -} -static inline void -ovs_flow_new_req_set_actions_ct_timeout(struct ovs_flow_new_req *req, - const char *timeout) -{ - free(req->actions.ct.timeout); - req->actions.ct._present.timeout_len = strlen(timeout); - req->actions.ct.timeout = malloc(req->actions.ct._present.timeout_len + 1); - memcpy(req->actions.ct.timeout, timeout, req->actions.ct._present.timeout_len); - req->actions.ct.timeout[req->actions.ct._present.timeout_len] = 0; -} -static inline void -ovs_flow_new_req_set_actions_trunc(struct ovs_flow_new_req *req, __u32 trunc) -{ - req->_present.actions = 1; - req->actions._present.trunc = 1; - req->actions.trunc = trunc; -} -static inline void -ovs_flow_new_req_set_actions_push_eth(struct ovs_flow_new_req *req, - const void *push_eth, size_t len) -{ - free(req->actions.push_eth); - req->actions._present.push_eth_len = len; - req->actions.push_eth = malloc(req->actions._present.push_eth_len); - memcpy(req->actions.push_eth, push_eth, req->actions._present.push_eth_len); -} -static inline void -ovs_flow_new_req_set_actions_pop_eth(struct ovs_flow_new_req *req) -{ - req->_present.actions = 1; - req->actions._present.pop_eth = 1; -} -static inline void -ovs_flow_new_req_set_actions_ct_clear(struct ovs_flow_new_req *req) -{ - req->_present.actions = 1; - req->actions._present.ct_clear = 1; -} -static inline void -ovs_flow_new_req_set_actions_push_nsh_base(struct ovs_flow_new_req *req, - const void *base, size_t len) -{ - free(req->actions.push_nsh.base); - req->actions.push_nsh._present.base_len = len; - req->actions.push_nsh.base = malloc(req->actions.push_nsh._present.base_len); - memcpy(req->actions.push_nsh.base, base, req->actions.push_nsh._present.base_len); -} -static inline void -ovs_flow_new_req_set_actions_push_nsh_md1(struct ovs_flow_new_req *req, - const void *md1, size_t len) -{ - free(req->actions.push_nsh.md1); - req->actions.push_nsh._present.md1_len = len; - req->actions.push_nsh.md1 = malloc(req->actions.push_nsh._present.md1_len); - memcpy(req->actions.push_nsh.md1, md1, req->actions.push_nsh._present.md1_len); -} -static inline void -ovs_flow_new_req_set_actions_push_nsh_md2(struct ovs_flow_new_req *req, - const void *md2, size_t len) -{ - free(req->actions.push_nsh.md2); - req->actions.push_nsh._present.md2_len = len; - req->actions.push_nsh.md2 = malloc(req->actions.push_nsh._present.md2_len); - memcpy(req->actions.push_nsh.md2, md2, req->actions.push_nsh._present.md2_len); -} -static inline void -ovs_flow_new_req_set_actions_pop_nsh(struct ovs_flow_new_req *req) -{ - req->_present.actions = 1; - req->actions._present.pop_nsh = 1; -} -static inline void -ovs_flow_new_req_set_actions_meter(struct ovs_flow_new_req *req, __u32 meter) -{ - req->_present.actions = 1; - req->actions._present.meter = 1; - req->actions.meter = meter; -} -static inline void -ovs_flow_new_req_set_actions_check_pkt_len_pkt_len(struct ovs_flow_new_req *req, - __u16 pkt_len) -{ - req->_present.actions = 1; - req->actions._present.check_pkt_len = 1; - req->actions.check_pkt_len._present.pkt_len = 1; - req->actions.check_pkt_len.pkt_len = pkt_len; -} -static inline void -ovs_flow_new_req_set_actions_add_mpls(struct ovs_flow_new_req *req, - const void *add_mpls, size_t len) -{ - free(req->actions.add_mpls); - req->actions._present.add_mpls_len = len; - req->actions.add_mpls = malloc(req->actions._present.add_mpls_len); - memcpy(req->actions.add_mpls, add_mpls, req->actions._present.add_mpls_len); -} - -/* - * Create OVS flow configuration in a data path - */ -int ovs_flow_new(struct ynl_sock *ys, struct ovs_flow_new_req *req); - -#endif /* _LINUX_OVS_FLOW_GEN_H */ diff --git a/generated/ovs_flow-user.h b/generated/ovs_flow-user.h new file mode 120000 index 0000000..31bb47d --- /dev/null +++ b/generated/ovs_flow-user.h @@ -0,0 +1 @@ +../include/ynl-c/ovs_flow.h \ No newline at end of file diff --git a/generated/ovs_vport-user.h b/generated/ovs_vport-user.h deleted file mode 100644 index 493a638..0000000 --- a/generated/ovs_vport-user.h +++ /dev/null @@ -1,270 +0,0 @@ -/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ -/* Do not edit directly, auto-generated from: */ -/* Documentation/netlink/specs/ovs_vport.yaml */ -/* YNL-GEN user header */ - -#ifndef _LINUX_OVS_VPORT_GEN_H -#define _LINUX_OVS_VPORT_GEN_H - -#include -#include -#include -#include - -struct ynl_sock; - -extern const struct ynl_family ynl_ovs_vport_family; - -/* Enums */ -const char *ovs_vport_op_str(int op); -const char *ovs_vport_vport_type_str(enum ovs_vport_type value); - -/* Common nested types */ -struct ovs_vport_vport_options { - struct { - __u32 dst_port:1; - __u32 extension:1; - } _present; - - __u32 dst_port; - __u32 extension; -}; - -struct ovs_vport_upcall_stats { - struct { - __u32 success:1; - __u32 fail:1; - } _present; - - __u64 success; - __u64 fail; -}; - -/* ============== OVS_VPORT_CMD_NEW ============== */ -/* OVS_VPORT_CMD_NEW - do */ -struct ovs_vport_new_req { - struct ovs_header _hdr; - - struct { - __u32 name_len; - __u32 type:1; - __u32 upcall_pid_len; - __u32 ifindex:1; - __u32 options:1; - } _present; - - char *name; - enum ovs_vport_type type; - void *upcall_pid; - __u32 ifindex; - struct ovs_vport_vport_options options; -}; - -static inline struct ovs_vport_new_req *ovs_vport_new_req_alloc(void) -{ - return calloc(1, sizeof(struct ovs_vport_new_req)); -} -void ovs_vport_new_req_free(struct ovs_vport_new_req *req); - -static inline void -ovs_vport_new_req_set_name(struct ovs_vport_new_req *req, const char *name) -{ - free(req->name); - req->_present.name_len = strlen(name); - req->name = malloc(req->_present.name_len + 1); - memcpy(req->name, name, req->_present.name_len); - req->name[req->_present.name_len] = 0; -} -static inline void -ovs_vport_new_req_set_type(struct ovs_vport_new_req *req, - enum ovs_vport_type type) -{ - req->_present.type = 1; - req->type = type; -} -static inline void -ovs_vport_new_req_set_upcall_pid(struct ovs_vport_new_req *req, - const void *upcall_pid, size_t len) -{ - free(req->upcall_pid); - req->_present.upcall_pid_len = len; - req->upcall_pid = malloc(req->_present.upcall_pid_len); - memcpy(req->upcall_pid, upcall_pid, req->_present.upcall_pid_len); -} -static inline void -ovs_vport_new_req_set_ifindex(struct ovs_vport_new_req *req, __u32 ifindex) -{ - req->_present.ifindex = 1; - req->ifindex = ifindex; -} -static inline void -ovs_vport_new_req_set_options_dst_port(struct ovs_vport_new_req *req, - __u32 dst_port) -{ - req->_present.options = 1; - req->options._present.dst_port = 1; - req->options.dst_port = dst_port; -} -static inline void -ovs_vport_new_req_set_options_extension(struct ovs_vport_new_req *req, - __u32 extension) -{ - req->_present.options = 1; - req->options._present.extension = 1; - req->options.extension = extension; -} - -/* - * Create a new OVS vport - */ -int ovs_vport_new(struct ynl_sock *ys, struct ovs_vport_new_req *req); - -/* ============== OVS_VPORT_CMD_DEL ============== */ -/* OVS_VPORT_CMD_DEL - do */ -struct ovs_vport_del_req { - struct ovs_header _hdr; - - struct { - __u32 port_no:1; - __u32 type:1; - __u32 name_len; - } _present; - - __u32 port_no; - enum ovs_vport_type type; - char *name; -}; - -static inline struct ovs_vport_del_req *ovs_vport_del_req_alloc(void) -{ - return calloc(1, sizeof(struct ovs_vport_del_req)); -} -void ovs_vport_del_req_free(struct ovs_vport_del_req *req); - -static inline void -ovs_vport_del_req_set_port_no(struct ovs_vport_del_req *req, __u32 port_no) -{ - req->_present.port_no = 1; - req->port_no = port_no; -} -static inline void -ovs_vport_del_req_set_type(struct ovs_vport_del_req *req, - enum ovs_vport_type type) -{ - req->_present.type = 1; - req->type = type; -} -static inline void -ovs_vport_del_req_set_name(struct ovs_vport_del_req *req, const char *name) -{ - free(req->name); - req->_present.name_len = strlen(name); - req->name = malloc(req->_present.name_len + 1); - memcpy(req->name, name, req->_present.name_len); - req->name[req->_present.name_len] = 0; -} - -/* - * Delete existing OVS vport from a data path - */ -int ovs_vport_del(struct ynl_sock *ys, struct ovs_vport_del_req *req); - -/* ============== OVS_VPORT_CMD_GET ============== */ -/* OVS_VPORT_CMD_GET - do */ -struct ovs_vport_get_req { - struct ovs_header _hdr; - - struct { - __u32 name_len; - } _present; - - char *name; -}; - -static inline struct ovs_vport_get_req *ovs_vport_get_req_alloc(void) -{ - return calloc(1, sizeof(struct ovs_vport_get_req)); -} -void ovs_vport_get_req_free(struct ovs_vport_get_req *req); - -static inline void -ovs_vport_get_req_set_name(struct ovs_vport_get_req *req, const char *name) -{ - free(req->name); - req->_present.name_len = strlen(name); - req->name = malloc(req->_present.name_len + 1); - memcpy(req->name, name, req->_present.name_len); - req->name[req->_present.name_len] = 0; -} - -struct ovs_vport_get_rsp { - struct ovs_header _hdr; - - struct { - __u32 port_no:1; - __u32 type:1; - __u32 name_len; - __u32 upcall_pid_len; - __u32 stats_len; - __u32 ifindex:1; - __u32 netnsid:1; - __u32 upcall_stats:1; - } _present; - - __u32 port_no; - enum ovs_vport_type type; - char *name; - void *upcall_pid; - void *stats; - __u32 ifindex; - __u32 netnsid; - struct ovs_vport_upcall_stats upcall_stats; -}; - -void ovs_vport_get_rsp_free(struct ovs_vport_get_rsp *rsp); - -/* - * Get / dump OVS vport configuration and state - */ -struct ovs_vport_get_rsp * -ovs_vport_get(struct ynl_sock *ys, struct ovs_vport_get_req *req); - -/* OVS_VPORT_CMD_GET - dump */ -struct ovs_vport_get_req_dump { - struct ovs_header _hdr; - - struct { - __u32 name_len; - } _present; - - char *name; -}; - -static inline struct ovs_vport_get_req_dump *ovs_vport_get_req_dump_alloc(void) -{ - return calloc(1, sizeof(struct ovs_vport_get_req_dump)); -} -void ovs_vport_get_req_dump_free(struct ovs_vport_get_req_dump *req); - -static inline void -ovs_vport_get_req_dump_set_name(struct ovs_vport_get_req_dump *req, - const char *name) -{ - free(req->name); - req->_present.name_len = strlen(name); - req->name = malloc(req->_present.name_len + 1); - memcpy(req->name, name, req->_present.name_len); - req->name[req->_present.name_len] = 0; -} - -struct ovs_vport_get_list { - struct ovs_vport_get_list *next; - struct ovs_vport_get_rsp obj __attribute__((aligned(8))); -}; - -void ovs_vport_get_list_free(struct ovs_vport_get_list *rsp); - -struct ovs_vport_get_list * -ovs_vport_get_dump(struct ynl_sock *ys, struct ovs_vport_get_req_dump *req); - -#endif /* _LINUX_OVS_VPORT_GEN_H */ diff --git a/generated/ovs_vport-user.h b/generated/ovs_vport-user.h new file mode 120000 index 0000000..89f04ba --- /dev/null +++ b/generated/ovs_vport-user.h @@ -0,0 +1 @@ +../include/ynl-c/ovs_vport.h \ No newline at end of file diff --git a/generated/psp-user.h b/generated/psp-user.h deleted file mode 100644 index e9b4c1a..0000000 --- a/generated/psp-user.h +++ /dev/null @@ -1,368 +0,0 @@ -/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ -/* Do not edit directly, auto-generated from: */ -/* Documentation/netlink/specs/psp.yaml */ -/* YNL-GEN user header */ - -#ifndef _LINUX_PSP_GEN_H -#define _LINUX_PSP_GEN_H - -#include -#include -#include -#include - -struct ynl_sock; - -extern const struct ynl_family ynl_psp_family; - -/* Enums */ -const char *psp_op_str(int op); -const char *psp_version_str(enum psp_version value); - -/* Common nested types */ -struct psp_keys { - struct { - __u32 key_len; - __u32 spi:1; - } _present; - - void *key; - __u32 spi; -}; - -/* ============== PSP_CMD_DEV_GET ============== */ -/* PSP_CMD_DEV_GET - do */ -struct psp_dev_get_req { - struct { - __u32 id:1; - } _present; - - __u32 id; -}; - -static inline struct psp_dev_get_req *psp_dev_get_req_alloc(void) -{ - return calloc(1, sizeof(struct psp_dev_get_req)); -} -void psp_dev_get_req_free(struct psp_dev_get_req *req); - -static inline void -psp_dev_get_req_set_id(struct psp_dev_get_req *req, __u32 id) -{ - req->_present.id = 1; - req->id = id; -} - -struct psp_dev_get_rsp { - struct { - __u32 id:1; - __u32 ifindex:1; - __u32 psp_versions_cap:1; - __u32 psp_versions_ena:1; - } _present; - - __u32 id; - __u32 ifindex; - __u32 psp_versions_cap; - __u32 psp_versions_ena; -}; - -void psp_dev_get_rsp_free(struct psp_dev_get_rsp *rsp); - -/* - * Get / dump information about PSP capable devices on the system. - */ -struct psp_dev_get_rsp * -psp_dev_get(struct ynl_sock *ys, struct psp_dev_get_req *req); - -/* PSP_CMD_DEV_GET - dump */ -struct psp_dev_get_list { - struct psp_dev_get_list *next; - struct psp_dev_get_rsp obj __attribute__((aligned(8))); -}; - -void psp_dev_get_list_free(struct psp_dev_get_list *rsp); - -struct psp_dev_get_list *psp_dev_get_dump(struct ynl_sock *ys); - -/* PSP_CMD_DEV_GET - notify */ -struct psp_dev_get_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct psp_dev_get_ntf *ntf); - struct psp_dev_get_rsp obj __attribute__((aligned(8))); -}; - -void psp_dev_get_ntf_free(struct psp_dev_get_ntf *rsp); - -/* ============== PSP_CMD_DEV_SET ============== */ -/* PSP_CMD_DEV_SET - do */ -struct psp_dev_set_req { - struct { - __u32 id:1; - __u32 psp_versions_ena:1; - } _present; - - __u32 id; - __u32 psp_versions_ena; -}; - -static inline struct psp_dev_set_req *psp_dev_set_req_alloc(void) -{ - return calloc(1, sizeof(struct psp_dev_set_req)); -} -void psp_dev_set_req_free(struct psp_dev_set_req *req); - -static inline void -psp_dev_set_req_set_id(struct psp_dev_set_req *req, __u32 id) -{ - req->_present.id = 1; - req->id = id; -} -static inline void -psp_dev_set_req_set_psp_versions_ena(struct psp_dev_set_req *req, - __u32 psp_versions_ena) -{ - req->_present.psp_versions_ena = 1; - req->psp_versions_ena = psp_versions_ena; -} - -/* - * Set the configuration of a PSP device. - */ -int psp_dev_set(struct ynl_sock *ys, struct psp_dev_set_req *req); - -/* ============== PSP_CMD_KEY_ROTATE ============== */ -/* PSP_CMD_KEY_ROTATE - do */ -struct psp_key_rotate_req { - struct { - __u32 id:1; - } _present; - - __u32 id; -}; - -static inline struct psp_key_rotate_req *psp_key_rotate_req_alloc(void) -{ - return calloc(1, sizeof(struct psp_key_rotate_req)); -} -void psp_key_rotate_req_free(struct psp_key_rotate_req *req); - -static inline void -psp_key_rotate_req_set_id(struct psp_key_rotate_req *req, __u32 id) -{ - req->_present.id = 1; - req->id = id; -} - -struct psp_key_rotate_rsp { - struct { - __u32 id:1; - } _present; - - __u32 id; -}; - -void psp_key_rotate_rsp_free(struct psp_key_rotate_rsp *rsp); - -/* - * Rotate the main key. - */ -struct psp_key_rotate_rsp * -psp_key_rotate(struct ynl_sock *ys, struct psp_key_rotate_req *req); - -/* PSP_CMD_KEY_ROTATE - notify */ -struct psp_key_rotate_ntf { - __u16 family; - __u8 cmd; - struct ynl_ntf_base_type *next; - void (*free)(struct psp_key_rotate_ntf *ntf); - struct psp_key_rotate_rsp obj __attribute__((aligned(8))); -}; - -void psp_key_rotate_ntf_free(struct psp_key_rotate_ntf *rsp); - -/* ============== PSP_CMD_RX_ASSOC ============== */ -/* PSP_CMD_RX_ASSOC - do */ -struct psp_rx_assoc_req { - struct { - __u32 dev_id:1; - __u32 version:1; - __u32 sock_fd:1; - } _present; - - __u32 dev_id; - enum psp_version version; - __u32 sock_fd; -}; - -static inline struct psp_rx_assoc_req *psp_rx_assoc_req_alloc(void) -{ - return calloc(1, sizeof(struct psp_rx_assoc_req)); -} -void psp_rx_assoc_req_free(struct psp_rx_assoc_req *req); - -static inline void -psp_rx_assoc_req_set_dev_id(struct psp_rx_assoc_req *req, __u32 dev_id) -{ - req->_present.dev_id = 1; - req->dev_id = dev_id; -} -static inline void -psp_rx_assoc_req_set_version(struct psp_rx_assoc_req *req, - enum psp_version version) -{ - req->_present.version = 1; - req->version = version; -} -static inline void -psp_rx_assoc_req_set_sock_fd(struct psp_rx_assoc_req *req, __u32 sock_fd) -{ - req->_present.sock_fd = 1; - req->sock_fd = sock_fd; -} - -struct psp_rx_assoc_rsp { - struct { - __u32 dev_id:1; - __u32 version:1; - __u32 rx_key:1; - } _present; - - __u32 dev_id; - enum psp_version version; - struct psp_keys rx_key; -}; - -void psp_rx_assoc_rsp_free(struct psp_rx_assoc_rsp *rsp); - -/* - * Allocate a new Rx key + SPI pair, associate it with a socket. - */ -struct psp_rx_assoc_rsp * -psp_rx_assoc(struct ynl_sock *ys, struct psp_rx_assoc_req *req); - -/* ============== PSP_CMD_TX_ASSOC ============== */ -/* PSP_CMD_TX_ASSOC - do */ -struct psp_tx_assoc_req { - struct { - __u32 dev_id:1; - __u32 version:1; - __u32 tx_key:1; - __u32 sock_fd:1; - } _present; - - __u32 dev_id; - enum psp_version version; - struct psp_keys tx_key; - __u32 sock_fd; -}; - -static inline struct psp_tx_assoc_req *psp_tx_assoc_req_alloc(void) -{ - return calloc(1, sizeof(struct psp_tx_assoc_req)); -} -void psp_tx_assoc_req_free(struct psp_tx_assoc_req *req); - -static inline void -psp_tx_assoc_req_set_dev_id(struct psp_tx_assoc_req *req, __u32 dev_id) -{ - req->_present.dev_id = 1; - req->dev_id = dev_id; -} -static inline void -psp_tx_assoc_req_set_version(struct psp_tx_assoc_req *req, - enum psp_version version) -{ - req->_present.version = 1; - req->version = version; -} -static inline void -psp_tx_assoc_req_set_tx_key_key(struct psp_tx_assoc_req *req, const void *key, - size_t len) -{ - free(req->tx_key.key); - req->tx_key._present.key_len = len; - req->tx_key.key = malloc(req->tx_key._present.key_len); - memcpy(req->tx_key.key, key, req->tx_key._present.key_len); -} -static inline void -psp_tx_assoc_req_set_tx_key_spi(struct psp_tx_assoc_req *req, __u32 spi) -{ - req->_present.tx_key = 1; - req->tx_key._present.spi = 1; - req->tx_key.spi = spi; -} -static inline void -psp_tx_assoc_req_set_sock_fd(struct psp_tx_assoc_req *req, __u32 sock_fd) -{ - req->_present.sock_fd = 1; - req->sock_fd = sock_fd; -} - -struct psp_tx_assoc_rsp { -}; - -void psp_tx_assoc_rsp_free(struct psp_tx_assoc_rsp *rsp); - -/* - * Add a PSP Tx association. - */ -struct psp_tx_assoc_rsp * -psp_tx_assoc(struct ynl_sock *ys, struct psp_tx_assoc_req *req); - -/* ============== PSP_CMD_GET_STATS ============== */ -/* PSP_CMD_GET_STATS - do */ -struct psp_get_stats_req { - struct { - __u32 dev_id:1; - } _present; - - __u32 dev_id; -}; - -static inline struct psp_get_stats_req *psp_get_stats_req_alloc(void) -{ - return calloc(1, sizeof(struct psp_get_stats_req)); -} -void psp_get_stats_req_free(struct psp_get_stats_req *req); - -static inline void -psp_get_stats_req_set_dev_id(struct psp_get_stats_req *req, __u32 dev_id) -{ - req->_present.dev_id = 1; - req->dev_id = dev_id; -} - -struct psp_get_stats_rsp { - struct { - __u32 dev_id:1; - __u32 key_rotations:1; - __u32 stale_events:1; - } _present; - - __u32 dev_id; - __u64 key_rotations; - __u64 stale_events; -}; - -void psp_get_stats_rsp_free(struct psp_get_stats_rsp *rsp); - -/* - * Get device statistics. - */ -struct psp_get_stats_rsp * -psp_get_stats(struct ynl_sock *ys, struct psp_get_stats_req *req); - -/* PSP_CMD_GET_STATS - dump */ -struct psp_get_stats_list { - struct psp_get_stats_list *next; - struct psp_get_stats_rsp obj __attribute__((aligned(8))); -}; - -void psp_get_stats_list_free(struct psp_get_stats_list *rsp); - -struct psp_get_stats_list *psp_get_stats_dump(struct ynl_sock *ys); - -#endif /* _LINUX_PSP_GEN_H */ diff --git a/generated/psp-user.h b/generated/psp-user.h new file mode 120000 index 0000000..4dc7801 --- /dev/null +++ b/generated/psp-user.h @@ -0,0 +1 @@ +../include/ynl-c/psp.h \ No newline at end of file diff --git a/include/ynl-c/devlink.h b/include/ynl-c/devlink.h new file mode 100644 index 0000000..b54ee40 --- /dev/null +++ b/include/ynl-c/devlink.h @@ -0,0 +1,5410 @@ +/* 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 header */ + +#ifndef _LINUX_DEVLINK_GEN_H +#define _LINUX_DEVLINK_GEN_H + +#include +#include +#include +#include +#include + +struct ynl_sock; + +extern const struct ynl_family ynl_devlink_family; + +/* Enums */ +const char *devlink_op_str(int op); +const char *devlink_sb_pool_type_str(enum devlink_sb_pool_type value); +const char *devlink_port_type_str(enum devlink_port_type value); +const char *devlink_port_flavour_str(enum devlink_port_flavour value); +const char *devlink_port_fn_state_str(enum devlink_port_fn_state value); +const char *devlink_port_fn_opstate_str(enum devlink_port_fn_opstate value); +const char *devlink_port_fn_attr_cap_str(enum devlink_port_fn_attr_cap value); +const char *devlink_rate_type_str(enum devlink_rate_type value); +const char * +devlink_sb_threshold_type_str(enum devlink_sb_threshold_type value); +const char *devlink_eswitch_mode_str(enum devlink_eswitch_mode value); +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_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 * +devlink_dpipe_action_type_str(enum devlink_dpipe_action_type value); +const char * +devlink_dpipe_field_mapping_type_str(enum devlink_dpipe_field_mapping_type value); +const char *devlink_resource_unit_str(enum devlink_resource_unit value); +const char *devlink_reload_action_str(enum devlink_reload_action value); +const char *devlink_param_cmode_str(enum devlink_param_cmode value); +const char *devlink_flash_overwrite_str(enum devlink_flash_overwrite value); +const char *devlink_trap_action_str(enum devlink_trap_action value); +const char *devlink_trap_type_str(enum devlink_trap_type value); + +/* Common nested types */ +struct devlink_dl_dpipe_match { + struct { + __u32 dpipe_match_type:1; + __u32 dpipe_header_id:1; + __u32 dpipe_header_global:1; + __u32 dpipe_header_index:1; + __u32 dpipe_field_id:1; + } _present; + + enum devlink_dpipe_match_type dpipe_match_type; + enum devlink_dpipe_header_id dpipe_header_id; + __u8 dpipe_header_global; + __u32 dpipe_header_index; + __u32 dpipe_field_id; +}; + +struct devlink_dl_dpipe_match_value { + struct { + __u32 dpipe_value_len; + __u32 dpipe_value_mask_len; + __u32 dpipe_value_mapping:1; + } _present; + + unsigned int n_dpipe_match; + struct devlink_dl_dpipe_match *dpipe_match; + void *dpipe_value; + void *dpipe_value_mask; + __u32 dpipe_value_mapping; +}; + +struct devlink_dl_dpipe_action { + struct { + __u32 dpipe_action_type:1; + __u32 dpipe_header_id:1; + __u32 dpipe_header_global:1; + __u32 dpipe_header_index:1; + __u32 dpipe_field_id:1; + } _present; + + enum devlink_dpipe_action_type dpipe_action_type; + enum devlink_dpipe_header_id dpipe_header_id; + __u8 dpipe_header_global; + __u32 dpipe_header_index; + __u32 dpipe_field_id; +}; + +struct devlink_dl_dpipe_action_value { + struct { + __u32 dpipe_value_len; + __u32 dpipe_value_mask_len; + __u32 dpipe_value_mapping:1; + } _present; + + unsigned int n_dpipe_action; + struct devlink_dl_dpipe_action *dpipe_action; + void *dpipe_value; + void *dpipe_value_mask; + __u32 dpipe_value_mapping; +}; + +struct devlink_dl_dpipe_field { + struct { + __u32 dpipe_field_name_len; + __u32 dpipe_field_id:1; + __u32 dpipe_field_bitwidth:1; + __u32 dpipe_field_mapping_type:1; + } _present; + + char *dpipe_field_name; + __u32 dpipe_field_id; + __u32 dpipe_field_bitwidth; + enum devlink_dpipe_field_mapping_type dpipe_field_mapping_type; +}; + +struct devlink_dl_resource { + struct { + __u32 resource_name_len; + __u32 resource_id:1; + __u32 resource_size:1; + __u32 resource_size_new:1; + __u32 resource_size_valid:1; + __u32 resource_size_min:1; + __u32 resource_size_max:1; + __u32 resource_size_gran:1; + __u32 resource_unit:1; + __u32 resource_occ:1; + } _present; + + char *resource_name; + __u64 resource_id; + __u64 resource_size; + __u64 resource_size_new; + __u8 resource_size_valid; + __u64 resource_size_min; + __u64 resource_size_max; + __u64 resource_size_gran; + enum devlink_resource_unit resource_unit; + __u64 resource_occ; +}; + +struct devlink_dl_param { + struct { + __u32 param_name_len; + __u32 param_generic:1; + __u32 param_type:1; + } _present; + + char *param_name; + __u8 param_type; +}; + +struct devlink_dl_region_snapshot { + struct { + __u32 region_snapshot_id:1; + } _present; + + __u32 region_snapshot_id; +}; + +struct devlink_dl_region_chunk { + struct { + __u32 region_chunk_data_len; + __u32 region_chunk_addr:1; + } _present; + + void *region_chunk_data; + __u64 region_chunk_addr; +}; + +struct devlink_dl_info_version { + struct { + __u32 info_version_name_len; + __u32 info_version_value_len; + } _present; + + char *info_version_name; + char *info_version_value; +}; + +struct devlink_dl_fmsg { + struct { + __u32 fmsg_obj_nest_start:1; + __u32 fmsg_pair_nest_start:1; + __u32 fmsg_arr_nest_start:1; + __u32 fmsg_nest_end:1; + __u32 fmsg_obj_name_len; + } _present; + + char *fmsg_obj_name; +}; + +struct devlink_dl_health_reporter { + struct { + __u32 health_reporter_name_len; + __u32 health_reporter_state:1; + __u32 health_reporter_err_count:1; + __u32 health_reporter_recover_count:1; + __u32 health_reporter_graceful_period:1; + __u32 health_reporter_auto_recover:1; + __u32 health_reporter_dump_ts:1; + __u32 health_reporter_dump_ts_ns:1; + __u32 health_reporter_auto_dump:1; + } _present; + + char *health_reporter_name; + __u8 health_reporter_state; + __u64 health_reporter_err_count; + __u64 health_reporter_recover_count; + __u64 health_reporter_graceful_period; + __u8 health_reporter_auto_recover; + __u64 health_reporter_dump_ts; + __u64 health_reporter_dump_ts_ns; + __u8 health_reporter_auto_dump; +}; + +struct devlink_dl_attr_stats { + struct { + __u32 stats_rx_packets:1; + __u32 stats_rx_bytes:1; + __u32 stats_rx_dropped:1; + } _present; + + __u64 stats_rx_packets; + __u64 stats_rx_bytes; + __u64 stats_rx_dropped; +}; + +struct devlink_dl_trap_metadata { + struct { + __u32 trap_metadata_type_in_port:1; + __u32 trap_metadata_type_fa_cookie:1; + } _present; +}; + +struct devlink_dl_port_function { + struct { + __u32 hw_addr_len; + __u32 state:1; + __u32 opstate:1; + __u32 caps:1; + } _present; + + void *hw_addr; + enum devlink_port_fn_state state; + enum devlink_port_fn_opstate opstate; + struct nla_bitfield32 caps; +}; + +struct devlink_dl_reload_stats_entry { + struct { + __u32 reload_stats_limit:1; + __u32 reload_stats_value:1; + } _present; + + __u8 reload_stats_limit; + __u32 reload_stats_value; +}; + +struct devlink_dl_reload_act_stats { + unsigned int n_reload_stats_entry; + struct devlink_dl_reload_stats_entry *reload_stats_entry; +}; + +struct devlink_dl_linecard_supported_types { + struct { + __u32 linecard_type_len; + } _present; + + char *linecard_type; +}; + +struct devlink_dl_selftest_id { + struct { + __u32 flash:1; + } _present; +}; + +struct devlink_dl_dpipe_table_matches { + unsigned int n_dpipe_match; + struct devlink_dl_dpipe_match *dpipe_match; +}; + +struct devlink_dl_dpipe_table_actions { + unsigned int n_dpipe_action; + struct devlink_dl_dpipe_action *dpipe_action; +}; + +struct devlink_dl_dpipe_entry_match_values { + unsigned int n_dpipe_match_value; + struct devlink_dl_dpipe_match_value *dpipe_match_value; +}; + +struct devlink_dl_dpipe_entry_action_values { + unsigned int n_dpipe_action_value; + struct devlink_dl_dpipe_action_value *dpipe_action_value; +}; + +struct devlink_dl_dpipe_header_fields { + unsigned int n_dpipe_field; + struct devlink_dl_dpipe_field *dpipe_field; +}; + +struct devlink_dl_resource_list { + unsigned int n_resource; + struct devlink_dl_resource *resource; +}; + +struct devlink_dl_region_snapshots { + struct { + __u32 region_snapshot:1; + } _present; + + struct devlink_dl_region_snapshot region_snapshot; +}; + +struct devlink_dl_region_chunks { + struct { + __u32 region_chunk:1; + } _present; + + struct devlink_dl_region_chunk region_chunk; +}; + +struct devlink_dl_reload_act_info { + struct { + __u32 reload_action:1; + } _present; + + enum devlink_reload_action reload_action; + unsigned int n_reload_action_stats; + struct devlink_dl_reload_act_stats *reload_action_stats; +}; + +struct devlink_dl_dpipe_table { + struct { + __u32 dpipe_table_name_len; + __u32 dpipe_table_size:1; + __u32 dpipe_table_matches:1; + __u32 dpipe_table_actions:1; + __u32 dpipe_table_counters_enabled:1; + __u32 dpipe_table_resource_id:1; + __u32 dpipe_table_resource_units:1; + } _present; + + char *dpipe_table_name; + __u64 dpipe_table_size; + struct devlink_dl_dpipe_table_matches dpipe_table_matches; + struct devlink_dl_dpipe_table_actions dpipe_table_actions; + __u8 dpipe_table_counters_enabled; + __u64 dpipe_table_resource_id; + __u64 dpipe_table_resource_units; +}; + +struct devlink_dl_dpipe_entry { + struct { + __u32 dpipe_entry_index:1; + __u32 dpipe_entry_match_values:1; + __u32 dpipe_entry_action_values:1; + __u32 dpipe_entry_counter:1; + } _present; + + __u64 dpipe_entry_index; + struct devlink_dl_dpipe_entry_match_values dpipe_entry_match_values; + struct devlink_dl_dpipe_entry_action_values dpipe_entry_action_values; + __u64 dpipe_entry_counter; +}; + +struct devlink_dl_dpipe_header { + struct { + __u32 dpipe_header_name_len; + __u32 dpipe_header_id:1; + __u32 dpipe_header_global:1; + __u32 dpipe_header_fields:1; + } _present; + + char *dpipe_header_name; + enum devlink_dpipe_header_id dpipe_header_id; + __u8 dpipe_header_global; + struct devlink_dl_dpipe_header_fields dpipe_header_fields; +}; + +struct devlink_dl_reload_stats { + unsigned int n_reload_action_info; + struct devlink_dl_reload_act_info *reload_action_info; +}; + +struct devlink_dl_dpipe_tables { + unsigned int n_dpipe_table; + struct devlink_dl_dpipe_table *dpipe_table; +}; + +struct devlink_dl_dpipe_entries { + unsigned int n_dpipe_entry; + struct devlink_dl_dpipe_entry *dpipe_entry; +}; + +struct devlink_dl_dpipe_headers { + unsigned int n_dpipe_header; + struct devlink_dl_dpipe_header *dpipe_header; +}; + +struct devlink_dl_dev_stats { + struct { + __u32 reload_stats:1; + __u32 remote_reload_stats:1; + } _present; + + struct devlink_dl_reload_stats reload_stats; + struct devlink_dl_reload_stats remote_reload_stats; +}; + +/* ============== DEVLINK_CMD_GET ============== */ +/* DEVLINK_CMD_GET - do */ +struct devlink_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_get_req *devlink_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_get_req)); +} +void devlink_get_req_free(struct devlink_get_req *req); + +static inline void +devlink_get_req_set_bus_name(struct devlink_get_req *req, const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_get_req_set_dev_name(struct devlink_get_req *req, const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 reload_failed:1; + __u32 dev_stats:1; + } _present; + + char *bus_name; + char *dev_name; + __u8 reload_failed; + struct devlink_dl_dev_stats dev_stats; +}; + +void devlink_get_rsp_free(struct devlink_get_rsp *rsp); + +/* + * Get devlink instances. + */ +struct devlink_get_rsp * +devlink_get(struct ynl_sock *ys, struct devlink_get_req *req); + +/* DEVLINK_CMD_GET - dump */ +struct devlink_get_list { + struct devlink_get_list *next; + struct devlink_get_rsp obj __attribute__((aligned(8))); +}; + +void devlink_get_list_free(struct devlink_get_list *rsp); + +struct devlink_get_list *devlink_get_dump(struct ynl_sock *ys); + +/* ============== DEVLINK_CMD_PORT_GET ============== */ +/* DEVLINK_CMD_PORT_GET - do */ +struct devlink_port_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; +}; + +static inline struct devlink_port_get_req *devlink_port_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_port_get_req)); +} +void devlink_port_get_req_free(struct devlink_port_get_req *req); + +static inline void +devlink_port_get_req_set_bus_name(struct devlink_port_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_port_get_req_set_dev_name(struct devlink_port_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_port_get_req_set_port_index(struct devlink_port_get_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} + +struct devlink_port_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; +}; + +void devlink_port_get_rsp_free(struct devlink_port_get_rsp *rsp); + +/* + * Get devlink port instances. + */ +struct devlink_port_get_rsp * +devlink_port_get(struct ynl_sock *ys, struct devlink_port_get_req *req); + +/* DEVLINK_CMD_PORT_GET - dump */ +struct devlink_port_get_req_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_port_get_req_dump * +devlink_port_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct devlink_port_get_req_dump)); +} +void devlink_port_get_req_dump_free(struct devlink_port_get_req_dump *req); + +static inline void +devlink_port_get_req_dump_set_bus_name(struct devlink_port_get_req_dump *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_port_get_req_dump_set_dev_name(struct devlink_port_get_req_dump *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_port_get_rsp_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; +}; + +struct devlink_port_get_rsp_list { + struct devlink_port_get_rsp_list *next; + struct devlink_port_get_rsp_dump obj __attribute__((aligned(8))); +}; + +void devlink_port_get_rsp_list_free(struct devlink_port_get_rsp_list *rsp); + +struct devlink_port_get_rsp_list * +devlink_port_get_dump(struct ynl_sock *ys, + struct devlink_port_get_req_dump *req); + +/* ============== DEVLINK_CMD_PORT_SET ============== */ +/* DEVLINK_CMD_PORT_SET - do */ +struct devlink_port_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 port_type:1; + __u32 port_function:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + enum devlink_port_type port_type; + struct devlink_dl_port_function port_function; +}; + +static inline struct devlink_port_set_req *devlink_port_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_port_set_req)); +} +void devlink_port_set_req_free(struct devlink_port_set_req *req); + +static inline void +devlink_port_set_req_set_bus_name(struct devlink_port_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_port_set_req_set_dev_name(struct devlink_port_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_port_set_req_set_port_index(struct devlink_port_set_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_port_set_req_set_port_type(struct devlink_port_set_req *req, + enum devlink_port_type port_type) +{ + req->_present.port_type = 1; + req->port_type = port_type; +} +static inline void +devlink_port_set_req_set_port_function_hw_addr(struct devlink_port_set_req *req, + const void *hw_addr, size_t len) +{ + free(req->port_function.hw_addr); + req->port_function._present.hw_addr_len = len; + req->port_function.hw_addr = malloc(req->port_function._present.hw_addr_len); + memcpy(req->port_function.hw_addr, hw_addr, req->port_function._present.hw_addr_len); +} +static inline void +devlink_port_set_req_set_port_function_state(struct devlink_port_set_req *req, + enum devlink_port_fn_state state) +{ + req->_present.port_function = 1; + req->port_function._present.state = 1; + req->port_function.state = state; +} +static inline void +devlink_port_set_req_set_port_function_opstate(struct devlink_port_set_req *req, + enum devlink_port_fn_opstate opstate) +{ + req->_present.port_function = 1; + req->port_function._present.opstate = 1; + req->port_function.opstate = opstate; +} +static inline void +devlink_port_set_req_set_port_function_caps(struct devlink_port_set_req *req, + struct nla_bitfield32 *caps) +{ + req->_present.port_function = 1; + req->port_function._present.caps = 1; + memcpy(&req->port_function.caps, caps, sizeof(struct nla_bitfield32)); +} + +/* + * Set devlink port instances. + */ +int devlink_port_set(struct ynl_sock *ys, struct devlink_port_set_req *req); + +/* ============== DEVLINK_CMD_PORT_NEW ============== */ +/* DEVLINK_CMD_PORT_NEW - do */ +struct devlink_port_new_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 port_flavour:1; + __u32 port_pci_pf_number:1; + __u32 port_pci_sf_number:1; + __u32 port_controller_number:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + enum devlink_port_flavour port_flavour; + __u16 port_pci_pf_number; + __u32 port_pci_sf_number; + __u32 port_controller_number; +}; + +static inline struct devlink_port_new_req *devlink_port_new_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_port_new_req)); +} +void devlink_port_new_req_free(struct devlink_port_new_req *req); + +static inline void +devlink_port_new_req_set_bus_name(struct devlink_port_new_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_port_new_req_set_dev_name(struct devlink_port_new_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_port_new_req_set_port_index(struct devlink_port_new_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_port_new_req_set_port_flavour(struct devlink_port_new_req *req, + enum devlink_port_flavour port_flavour) +{ + req->_present.port_flavour = 1; + req->port_flavour = port_flavour; +} +static inline void +devlink_port_new_req_set_port_pci_pf_number(struct devlink_port_new_req *req, + __u16 port_pci_pf_number) +{ + req->_present.port_pci_pf_number = 1; + req->port_pci_pf_number = port_pci_pf_number; +} +static inline void +devlink_port_new_req_set_port_pci_sf_number(struct devlink_port_new_req *req, + __u32 port_pci_sf_number) +{ + req->_present.port_pci_sf_number = 1; + req->port_pci_sf_number = port_pci_sf_number; +} +static inline void +devlink_port_new_req_set_port_controller_number(struct devlink_port_new_req *req, + __u32 port_controller_number) +{ + req->_present.port_controller_number = 1; + req->port_controller_number = port_controller_number; +} + +struct devlink_port_new_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; +}; + +void devlink_port_new_rsp_free(struct devlink_port_new_rsp *rsp); + +/* + * Create devlink port instances. + */ +struct devlink_port_new_rsp * +devlink_port_new(struct ynl_sock *ys, struct devlink_port_new_req *req); + +/* ============== DEVLINK_CMD_PORT_DEL ============== */ +/* DEVLINK_CMD_PORT_DEL - do */ +struct devlink_port_del_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; +}; + +static inline struct devlink_port_del_req *devlink_port_del_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_port_del_req)); +} +void devlink_port_del_req_free(struct devlink_port_del_req *req); + +static inline void +devlink_port_del_req_set_bus_name(struct devlink_port_del_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_port_del_req_set_dev_name(struct devlink_port_del_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_port_del_req_set_port_index(struct devlink_port_del_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} + +/* + * Delete devlink port instances. + */ +int devlink_port_del(struct ynl_sock *ys, struct devlink_port_del_req *req); + +/* ============== DEVLINK_CMD_PORT_SPLIT ============== */ +/* DEVLINK_CMD_PORT_SPLIT - do */ +struct devlink_port_split_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 port_split_count:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + __u32 port_split_count; +}; + +static inline struct devlink_port_split_req *devlink_port_split_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_port_split_req)); +} +void devlink_port_split_req_free(struct devlink_port_split_req *req); + +static inline void +devlink_port_split_req_set_bus_name(struct devlink_port_split_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_port_split_req_set_dev_name(struct devlink_port_split_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_port_split_req_set_port_index(struct devlink_port_split_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_port_split_req_set_port_split_count(struct devlink_port_split_req *req, + __u32 port_split_count) +{ + req->_present.port_split_count = 1; + req->port_split_count = port_split_count; +} + +/* + * Split devlink port instances. + */ +int devlink_port_split(struct ynl_sock *ys, struct devlink_port_split_req *req); + +/* ============== DEVLINK_CMD_PORT_UNSPLIT ============== */ +/* DEVLINK_CMD_PORT_UNSPLIT - do */ +struct devlink_port_unsplit_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; +}; + +static inline struct devlink_port_unsplit_req * +devlink_port_unsplit_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_port_unsplit_req)); +} +void devlink_port_unsplit_req_free(struct devlink_port_unsplit_req *req); + +static inline void +devlink_port_unsplit_req_set_bus_name(struct devlink_port_unsplit_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_port_unsplit_req_set_dev_name(struct devlink_port_unsplit_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_port_unsplit_req_set_port_index(struct devlink_port_unsplit_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} + +/* + * Unplit devlink port instances. + */ +int devlink_port_unsplit(struct ynl_sock *ys, + struct devlink_port_unsplit_req *req); + +/* ============== DEVLINK_CMD_SB_GET ============== */ +/* DEVLINK_CMD_SB_GET - do */ +struct devlink_sb_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 sb_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 sb_index; +}; + +static inline struct devlink_sb_get_req *devlink_sb_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_sb_get_req)); +} +void devlink_sb_get_req_free(struct devlink_sb_get_req *req); + +static inline void +devlink_sb_get_req_set_bus_name(struct devlink_sb_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_sb_get_req_set_dev_name(struct devlink_sb_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_sb_get_req_set_sb_index(struct devlink_sb_get_req *req, __u32 sb_index) +{ + req->_present.sb_index = 1; + req->sb_index = sb_index; +} + +struct devlink_sb_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 sb_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 sb_index; +}; + +void devlink_sb_get_rsp_free(struct devlink_sb_get_rsp *rsp); + +/* + * Get shared buffer instances. + */ +struct devlink_sb_get_rsp * +devlink_sb_get(struct ynl_sock *ys, struct devlink_sb_get_req *req); + +/* DEVLINK_CMD_SB_GET - dump */ +struct devlink_sb_get_req_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_sb_get_req_dump * +devlink_sb_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct devlink_sb_get_req_dump)); +} +void devlink_sb_get_req_dump_free(struct devlink_sb_get_req_dump *req); + +static inline void +devlink_sb_get_req_dump_set_bus_name(struct devlink_sb_get_req_dump *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_sb_get_req_dump_set_dev_name(struct devlink_sb_get_req_dump *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_sb_get_list { + struct devlink_sb_get_list *next; + struct devlink_sb_get_rsp obj __attribute__((aligned(8))); +}; + +void devlink_sb_get_list_free(struct devlink_sb_get_list *rsp); + +struct devlink_sb_get_list * +devlink_sb_get_dump(struct ynl_sock *ys, struct devlink_sb_get_req_dump *req); + +/* ============== DEVLINK_CMD_SB_POOL_GET ============== */ +/* DEVLINK_CMD_SB_POOL_GET - do */ +struct devlink_sb_pool_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 sb_index:1; + __u32 sb_pool_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 sb_index; + __u16 sb_pool_index; +}; + +static inline struct devlink_sb_pool_get_req * +devlink_sb_pool_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_sb_pool_get_req)); +} +void devlink_sb_pool_get_req_free(struct devlink_sb_pool_get_req *req); + +static inline void +devlink_sb_pool_get_req_set_bus_name(struct devlink_sb_pool_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_sb_pool_get_req_set_dev_name(struct devlink_sb_pool_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_sb_pool_get_req_set_sb_index(struct devlink_sb_pool_get_req *req, + __u32 sb_index) +{ + req->_present.sb_index = 1; + req->sb_index = sb_index; +} +static inline void +devlink_sb_pool_get_req_set_sb_pool_index(struct devlink_sb_pool_get_req *req, + __u16 sb_pool_index) +{ + req->_present.sb_pool_index = 1; + req->sb_pool_index = sb_pool_index; +} + +struct devlink_sb_pool_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 sb_index:1; + __u32 sb_pool_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 sb_index; + __u16 sb_pool_index; +}; + +void devlink_sb_pool_get_rsp_free(struct devlink_sb_pool_get_rsp *rsp); + +/* + * Get shared buffer pool instances. + */ +struct devlink_sb_pool_get_rsp * +devlink_sb_pool_get(struct ynl_sock *ys, struct devlink_sb_pool_get_req *req); + +/* DEVLINK_CMD_SB_POOL_GET - dump */ +struct devlink_sb_pool_get_req_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_sb_pool_get_req_dump * +devlink_sb_pool_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct devlink_sb_pool_get_req_dump)); +} +void +devlink_sb_pool_get_req_dump_free(struct devlink_sb_pool_get_req_dump *req); + +static inline void +devlink_sb_pool_get_req_dump_set_bus_name(struct devlink_sb_pool_get_req_dump *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_sb_pool_get_req_dump_set_dev_name(struct devlink_sb_pool_get_req_dump *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_sb_pool_get_list { + struct devlink_sb_pool_get_list *next; + struct devlink_sb_pool_get_rsp obj __attribute__((aligned(8))); +}; + +void devlink_sb_pool_get_list_free(struct devlink_sb_pool_get_list *rsp); + +struct devlink_sb_pool_get_list * +devlink_sb_pool_get_dump(struct ynl_sock *ys, + struct devlink_sb_pool_get_req_dump *req); + +/* ============== DEVLINK_CMD_SB_POOL_SET ============== */ +/* DEVLINK_CMD_SB_POOL_SET - do */ +struct devlink_sb_pool_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 sb_index:1; + __u32 sb_pool_index:1; + __u32 sb_pool_threshold_type:1; + __u32 sb_pool_size:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 sb_index; + __u16 sb_pool_index; + enum devlink_sb_threshold_type sb_pool_threshold_type; + __u32 sb_pool_size; +}; + +static inline struct devlink_sb_pool_set_req * +devlink_sb_pool_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_sb_pool_set_req)); +} +void devlink_sb_pool_set_req_free(struct devlink_sb_pool_set_req *req); + +static inline void +devlink_sb_pool_set_req_set_bus_name(struct devlink_sb_pool_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_sb_pool_set_req_set_dev_name(struct devlink_sb_pool_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_sb_pool_set_req_set_sb_index(struct devlink_sb_pool_set_req *req, + __u32 sb_index) +{ + req->_present.sb_index = 1; + req->sb_index = sb_index; +} +static inline void +devlink_sb_pool_set_req_set_sb_pool_index(struct devlink_sb_pool_set_req *req, + __u16 sb_pool_index) +{ + req->_present.sb_pool_index = 1; + req->sb_pool_index = sb_pool_index; +} +static inline void +devlink_sb_pool_set_req_set_sb_pool_threshold_type(struct devlink_sb_pool_set_req *req, + enum devlink_sb_threshold_type sb_pool_threshold_type) +{ + req->_present.sb_pool_threshold_type = 1; + req->sb_pool_threshold_type = sb_pool_threshold_type; +} +static inline void +devlink_sb_pool_set_req_set_sb_pool_size(struct devlink_sb_pool_set_req *req, + __u32 sb_pool_size) +{ + req->_present.sb_pool_size = 1; + req->sb_pool_size = sb_pool_size; +} + +/* + * Set shared buffer pool instances. + */ +int devlink_sb_pool_set(struct ynl_sock *ys, + struct devlink_sb_pool_set_req *req); + +/* ============== DEVLINK_CMD_SB_PORT_POOL_GET ============== */ +/* DEVLINK_CMD_SB_PORT_POOL_GET - do */ +struct devlink_sb_port_pool_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 sb_index:1; + __u32 sb_pool_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + __u32 sb_index; + __u16 sb_pool_index; +}; + +static inline struct devlink_sb_port_pool_get_req * +devlink_sb_port_pool_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_sb_port_pool_get_req)); +} +void +devlink_sb_port_pool_get_req_free(struct devlink_sb_port_pool_get_req *req); + +static inline void +devlink_sb_port_pool_get_req_set_bus_name(struct devlink_sb_port_pool_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_sb_port_pool_get_req_set_dev_name(struct devlink_sb_port_pool_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_sb_port_pool_get_req_set_port_index(struct devlink_sb_port_pool_get_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_sb_port_pool_get_req_set_sb_index(struct devlink_sb_port_pool_get_req *req, + __u32 sb_index) +{ + req->_present.sb_index = 1; + req->sb_index = sb_index; +} +static inline void +devlink_sb_port_pool_get_req_set_sb_pool_index(struct devlink_sb_port_pool_get_req *req, + __u16 sb_pool_index) +{ + req->_present.sb_pool_index = 1; + req->sb_pool_index = sb_pool_index; +} + +struct devlink_sb_port_pool_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 sb_index:1; + __u32 sb_pool_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + __u32 sb_index; + __u16 sb_pool_index; +}; + +void +devlink_sb_port_pool_get_rsp_free(struct devlink_sb_port_pool_get_rsp *rsp); + +/* + * Get shared buffer port-pool combinations and threshold. + */ +struct devlink_sb_port_pool_get_rsp * +devlink_sb_port_pool_get(struct ynl_sock *ys, + struct devlink_sb_port_pool_get_req *req); + +/* DEVLINK_CMD_SB_PORT_POOL_GET - dump */ +struct devlink_sb_port_pool_get_req_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_sb_port_pool_get_req_dump * +devlink_sb_port_pool_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct devlink_sb_port_pool_get_req_dump)); +} +void +devlink_sb_port_pool_get_req_dump_free(struct devlink_sb_port_pool_get_req_dump *req); + +static inline void +devlink_sb_port_pool_get_req_dump_set_bus_name(struct devlink_sb_port_pool_get_req_dump *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_sb_port_pool_get_req_dump_set_dev_name(struct devlink_sb_port_pool_get_req_dump *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_sb_port_pool_get_list { + struct devlink_sb_port_pool_get_list *next; + struct devlink_sb_port_pool_get_rsp obj __attribute__((aligned(8))); +}; + +void +devlink_sb_port_pool_get_list_free(struct devlink_sb_port_pool_get_list *rsp); + +struct devlink_sb_port_pool_get_list * +devlink_sb_port_pool_get_dump(struct ynl_sock *ys, + struct devlink_sb_port_pool_get_req_dump *req); + +/* ============== DEVLINK_CMD_SB_PORT_POOL_SET ============== */ +/* DEVLINK_CMD_SB_PORT_POOL_SET - do */ +struct devlink_sb_port_pool_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 sb_index:1; + __u32 sb_pool_index:1; + __u32 sb_threshold:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + __u32 sb_index; + __u16 sb_pool_index; + __u32 sb_threshold; +}; + +static inline struct devlink_sb_port_pool_set_req * +devlink_sb_port_pool_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_sb_port_pool_set_req)); +} +void +devlink_sb_port_pool_set_req_free(struct devlink_sb_port_pool_set_req *req); + +static inline void +devlink_sb_port_pool_set_req_set_bus_name(struct devlink_sb_port_pool_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_sb_port_pool_set_req_set_dev_name(struct devlink_sb_port_pool_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_sb_port_pool_set_req_set_port_index(struct devlink_sb_port_pool_set_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_sb_port_pool_set_req_set_sb_index(struct devlink_sb_port_pool_set_req *req, + __u32 sb_index) +{ + req->_present.sb_index = 1; + req->sb_index = sb_index; +} +static inline void +devlink_sb_port_pool_set_req_set_sb_pool_index(struct devlink_sb_port_pool_set_req *req, + __u16 sb_pool_index) +{ + req->_present.sb_pool_index = 1; + req->sb_pool_index = sb_pool_index; +} +static inline void +devlink_sb_port_pool_set_req_set_sb_threshold(struct devlink_sb_port_pool_set_req *req, + __u32 sb_threshold) +{ + req->_present.sb_threshold = 1; + req->sb_threshold = sb_threshold; +} + +/* + * Set shared buffer port-pool combinations and threshold. + */ +int devlink_sb_port_pool_set(struct ynl_sock *ys, + struct devlink_sb_port_pool_set_req *req); + +/* ============== DEVLINK_CMD_SB_TC_POOL_BIND_GET ============== */ +/* DEVLINK_CMD_SB_TC_POOL_BIND_GET - do */ +struct devlink_sb_tc_pool_bind_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 sb_index:1; + __u32 sb_pool_type:1; + __u32 sb_tc_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + __u32 sb_index; + enum devlink_sb_pool_type sb_pool_type; + __u16 sb_tc_index; +}; + +static inline struct devlink_sb_tc_pool_bind_get_req * +devlink_sb_tc_pool_bind_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_sb_tc_pool_bind_get_req)); +} +void +devlink_sb_tc_pool_bind_get_req_free(struct devlink_sb_tc_pool_bind_get_req *req); + +static inline void +devlink_sb_tc_pool_bind_get_req_set_bus_name(struct devlink_sb_tc_pool_bind_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_sb_tc_pool_bind_get_req_set_dev_name(struct devlink_sb_tc_pool_bind_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_sb_tc_pool_bind_get_req_set_port_index(struct devlink_sb_tc_pool_bind_get_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_sb_tc_pool_bind_get_req_set_sb_index(struct devlink_sb_tc_pool_bind_get_req *req, + __u32 sb_index) +{ + req->_present.sb_index = 1; + req->sb_index = sb_index; +} +static inline void +devlink_sb_tc_pool_bind_get_req_set_sb_pool_type(struct devlink_sb_tc_pool_bind_get_req *req, + enum devlink_sb_pool_type sb_pool_type) +{ + req->_present.sb_pool_type = 1; + req->sb_pool_type = sb_pool_type; +} +static inline void +devlink_sb_tc_pool_bind_get_req_set_sb_tc_index(struct devlink_sb_tc_pool_bind_get_req *req, + __u16 sb_tc_index) +{ + req->_present.sb_tc_index = 1; + req->sb_tc_index = sb_tc_index; +} + +struct devlink_sb_tc_pool_bind_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 sb_index:1; + __u32 sb_pool_type:1; + __u32 sb_tc_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + __u32 sb_index; + enum devlink_sb_pool_type sb_pool_type; + __u16 sb_tc_index; +}; + +void +devlink_sb_tc_pool_bind_get_rsp_free(struct devlink_sb_tc_pool_bind_get_rsp *rsp); + +/* + * Get shared buffer port-TC to pool bindings and threshold. + */ +struct devlink_sb_tc_pool_bind_get_rsp * +devlink_sb_tc_pool_bind_get(struct ynl_sock *ys, + struct devlink_sb_tc_pool_bind_get_req *req); + +/* DEVLINK_CMD_SB_TC_POOL_BIND_GET - dump */ +struct devlink_sb_tc_pool_bind_get_req_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_sb_tc_pool_bind_get_req_dump * +devlink_sb_tc_pool_bind_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct devlink_sb_tc_pool_bind_get_req_dump)); +} +void +devlink_sb_tc_pool_bind_get_req_dump_free(struct devlink_sb_tc_pool_bind_get_req_dump *req); + +static inline void +devlink_sb_tc_pool_bind_get_req_dump_set_bus_name(struct devlink_sb_tc_pool_bind_get_req_dump *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_sb_tc_pool_bind_get_req_dump_set_dev_name(struct devlink_sb_tc_pool_bind_get_req_dump *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_sb_tc_pool_bind_get_list { + struct devlink_sb_tc_pool_bind_get_list *next; + struct devlink_sb_tc_pool_bind_get_rsp obj __attribute__((aligned(8))); +}; + +void +devlink_sb_tc_pool_bind_get_list_free(struct devlink_sb_tc_pool_bind_get_list *rsp); + +struct devlink_sb_tc_pool_bind_get_list * +devlink_sb_tc_pool_bind_get_dump(struct ynl_sock *ys, + struct devlink_sb_tc_pool_bind_get_req_dump *req); + +/* ============== DEVLINK_CMD_SB_TC_POOL_BIND_SET ============== */ +/* DEVLINK_CMD_SB_TC_POOL_BIND_SET - do */ +struct devlink_sb_tc_pool_bind_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 sb_index:1; + __u32 sb_pool_index:1; + __u32 sb_pool_type:1; + __u32 sb_tc_index:1; + __u32 sb_threshold:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + __u32 sb_index; + __u16 sb_pool_index; + enum devlink_sb_pool_type sb_pool_type; + __u16 sb_tc_index; + __u32 sb_threshold; +}; + +static inline struct devlink_sb_tc_pool_bind_set_req * +devlink_sb_tc_pool_bind_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_sb_tc_pool_bind_set_req)); +} +void +devlink_sb_tc_pool_bind_set_req_free(struct devlink_sb_tc_pool_bind_set_req *req); + +static inline void +devlink_sb_tc_pool_bind_set_req_set_bus_name(struct devlink_sb_tc_pool_bind_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_sb_tc_pool_bind_set_req_set_dev_name(struct devlink_sb_tc_pool_bind_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_sb_tc_pool_bind_set_req_set_port_index(struct devlink_sb_tc_pool_bind_set_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_sb_tc_pool_bind_set_req_set_sb_index(struct devlink_sb_tc_pool_bind_set_req *req, + __u32 sb_index) +{ + req->_present.sb_index = 1; + req->sb_index = sb_index; +} +static inline void +devlink_sb_tc_pool_bind_set_req_set_sb_pool_index(struct devlink_sb_tc_pool_bind_set_req *req, + __u16 sb_pool_index) +{ + req->_present.sb_pool_index = 1; + req->sb_pool_index = sb_pool_index; +} +static inline void +devlink_sb_tc_pool_bind_set_req_set_sb_pool_type(struct devlink_sb_tc_pool_bind_set_req *req, + enum devlink_sb_pool_type sb_pool_type) +{ + req->_present.sb_pool_type = 1; + req->sb_pool_type = sb_pool_type; +} +static inline void +devlink_sb_tc_pool_bind_set_req_set_sb_tc_index(struct devlink_sb_tc_pool_bind_set_req *req, + __u16 sb_tc_index) +{ + req->_present.sb_tc_index = 1; + req->sb_tc_index = sb_tc_index; +} +static inline void +devlink_sb_tc_pool_bind_set_req_set_sb_threshold(struct devlink_sb_tc_pool_bind_set_req *req, + __u32 sb_threshold) +{ + req->_present.sb_threshold = 1; + req->sb_threshold = sb_threshold; +} + +/* + * Set shared buffer port-TC to pool bindings and threshold. + */ +int devlink_sb_tc_pool_bind_set(struct ynl_sock *ys, + struct devlink_sb_tc_pool_bind_set_req *req); + +/* ============== DEVLINK_CMD_SB_OCC_SNAPSHOT ============== */ +/* DEVLINK_CMD_SB_OCC_SNAPSHOT - do */ +struct devlink_sb_occ_snapshot_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 sb_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 sb_index; +}; + +static inline struct devlink_sb_occ_snapshot_req * +devlink_sb_occ_snapshot_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_sb_occ_snapshot_req)); +} +void devlink_sb_occ_snapshot_req_free(struct devlink_sb_occ_snapshot_req *req); + +static inline void +devlink_sb_occ_snapshot_req_set_bus_name(struct devlink_sb_occ_snapshot_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_sb_occ_snapshot_req_set_dev_name(struct devlink_sb_occ_snapshot_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_sb_occ_snapshot_req_set_sb_index(struct devlink_sb_occ_snapshot_req *req, + __u32 sb_index) +{ + req->_present.sb_index = 1; + req->sb_index = sb_index; +} + +/* + * Take occupancy snapshot of shared buffer. + */ +int devlink_sb_occ_snapshot(struct ynl_sock *ys, + struct devlink_sb_occ_snapshot_req *req); + +/* ============== DEVLINK_CMD_SB_OCC_MAX_CLEAR ============== */ +/* DEVLINK_CMD_SB_OCC_MAX_CLEAR - do */ +struct devlink_sb_occ_max_clear_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 sb_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 sb_index; +}; + +static inline struct devlink_sb_occ_max_clear_req * +devlink_sb_occ_max_clear_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_sb_occ_max_clear_req)); +} +void +devlink_sb_occ_max_clear_req_free(struct devlink_sb_occ_max_clear_req *req); + +static inline void +devlink_sb_occ_max_clear_req_set_bus_name(struct devlink_sb_occ_max_clear_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_sb_occ_max_clear_req_set_dev_name(struct devlink_sb_occ_max_clear_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_sb_occ_max_clear_req_set_sb_index(struct devlink_sb_occ_max_clear_req *req, + __u32 sb_index) +{ + req->_present.sb_index = 1; + req->sb_index = sb_index; +} + +/* + * Clear occupancy watermarks of shared buffer. + */ +int devlink_sb_occ_max_clear(struct ynl_sock *ys, + struct devlink_sb_occ_max_clear_req *req); + +/* ============== DEVLINK_CMD_ESWITCH_GET ============== */ +/* DEVLINK_CMD_ESWITCH_GET - do */ +struct devlink_eswitch_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_eswitch_get_req * +devlink_eswitch_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_eswitch_get_req)); +} +void devlink_eswitch_get_req_free(struct devlink_eswitch_get_req *req); + +static inline void +devlink_eswitch_get_req_set_bus_name(struct devlink_eswitch_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_eswitch_get_req_set_dev_name(struct devlink_eswitch_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_eswitch_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 eswitch_mode:1; + __u32 eswitch_inline_mode:1; + __u32 eswitch_encap_mode:1; + } _present; + + char *bus_name; + char *dev_name; + enum devlink_eswitch_mode eswitch_mode; + enum devlink_eswitch_inline_mode eswitch_inline_mode; + enum devlink_eswitch_encap_mode eswitch_encap_mode; +}; + +void devlink_eswitch_get_rsp_free(struct devlink_eswitch_get_rsp *rsp); + +/* + * Get eswitch attributes. + */ +struct devlink_eswitch_get_rsp * +devlink_eswitch_get(struct ynl_sock *ys, struct devlink_eswitch_get_req *req); + +/* ============== DEVLINK_CMD_ESWITCH_SET ============== */ +/* DEVLINK_CMD_ESWITCH_SET - do */ +struct devlink_eswitch_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 eswitch_mode:1; + __u32 eswitch_inline_mode:1; + __u32 eswitch_encap_mode:1; + } _present; + + char *bus_name; + char *dev_name; + enum devlink_eswitch_mode eswitch_mode; + enum devlink_eswitch_inline_mode eswitch_inline_mode; + enum devlink_eswitch_encap_mode eswitch_encap_mode; +}; + +static inline struct devlink_eswitch_set_req * +devlink_eswitch_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_eswitch_set_req)); +} +void devlink_eswitch_set_req_free(struct devlink_eswitch_set_req *req); + +static inline void +devlink_eswitch_set_req_set_bus_name(struct devlink_eswitch_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_eswitch_set_req_set_dev_name(struct devlink_eswitch_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_eswitch_set_req_set_eswitch_mode(struct devlink_eswitch_set_req *req, + enum devlink_eswitch_mode eswitch_mode) +{ + req->_present.eswitch_mode = 1; + req->eswitch_mode = eswitch_mode; +} +static inline void +devlink_eswitch_set_req_set_eswitch_inline_mode(struct devlink_eswitch_set_req *req, + enum devlink_eswitch_inline_mode eswitch_inline_mode) +{ + req->_present.eswitch_inline_mode = 1; + req->eswitch_inline_mode = eswitch_inline_mode; +} +static inline void +devlink_eswitch_set_req_set_eswitch_encap_mode(struct devlink_eswitch_set_req *req, + enum devlink_eswitch_encap_mode eswitch_encap_mode) +{ + req->_present.eswitch_encap_mode = 1; + req->eswitch_encap_mode = eswitch_encap_mode; +} + +/* + * Set eswitch attributes. + */ +int devlink_eswitch_set(struct ynl_sock *ys, + struct devlink_eswitch_set_req *req); + +/* ============== DEVLINK_CMD_DPIPE_TABLE_GET ============== */ +/* DEVLINK_CMD_DPIPE_TABLE_GET - do */ +struct devlink_dpipe_table_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 dpipe_table_name_len; + } _present; + + char *bus_name; + char *dev_name; + char *dpipe_table_name; +}; + +static inline struct devlink_dpipe_table_get_req * +devlink_dpipe_table_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_dpipe_table_get_req)); +} +void devlink_dpipe_table_get_req_free(struct devlink_dpipe_table_get_req *req); + +static inline void +devlink_dpipe_table_get_req_set_bus_name(struct devlink_dpipe_table_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_dpipe_table_get_req_set_dev_name(struct devlink_dpipe_table_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_dpipe_table_get_req_set_dpipe_table_name(struct devlink_dpipe_table_get_req *req, + const char *dpipe_table_name) +{ + free(req->dpipe_table_name); + req->_present.dpipe_table_name_len = strlen(dpipe_table_name); + req->dpipe_table_name = malloc(req->_present.dpipe_table_name_len + 1); + memcpy(req->dpipe_table_name, dpipe_table_name, req->_present.dpipe_table_name_len); + req->dpipe_table_name[req->_present.dpipe_table_name_len] = 0; +} + +struct devlink_dpipe_table_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 dpipe_tables:1; + } _present; + + char *bus_name; + char *dev_name; + struct devlink_dl_dpipe_tables dpipe_tables; +}; + +void devlink_dpipe_table_get_rsp_free(struct devlink_dpipe_table_get_rsp *rsp); + +/* + * Get dpipe table attributes. + */ +struct devlink_dpipe_table_get_rsp * +devlink_dpipe_table_get(struct ynl_sock *ys, + struct devlink_dpipe_table_get_req *req); + +/* ============== DEVLINK_CMD_DPIPE_ENTRIES_GET ============== */ +/* DEVLINK_CMD_DPIPE_ENTRIES_GET - do */ +struct devlink_dpipe_entries_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 dpipe_table_name_len; + } _present; + + char *bus_name; + char *dev_name; + char *dpipe_table_name; +}; + +static inline struct devlink_dpipe_entries_get_req * +devlink_dpipe_entries_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_dpipe_entries_get_req)); +} +void +devlink_dpipe_entries_get_req_free(struct devlink_dpipe_entries_get_req *req); + +static inline void +devlink_dpipe_entries_get_req_set_bus_name(struct devlink_dpipe_entries_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_dpipe_entries_get_req_set_dev_name(struct devlink_dpipe_entries_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_dpipe_entries_get_req_set_dpipe_table_name(struct devlink_dpipe_entries_get_req *req, + const char *dpipe_table_name) +{ + free(req->dpipe_table_name); + req->_present.dpipe_table_name_len = strlen(dpipe_table_name); + req->dpipe_table_name = malloc(req->_present.dpipe_table_name_len + 1); + memcpy(req->dpipe_table_name, dpipe_table_name, req->_present.dpipe_table_name_len); + req->dpipe_table_name[req->_present.dpipe_table_name_len] = 0; +} + +struct devlink_dpipe_entries_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 dpipe_entries:1; + } _present; + + char *bus_name; + char *dev_name; + struct devlink_dl_dpipe_entries dpipe_entries; +}; + +void +devlink_dpipe_entries_get_rsp_free(struct devlink_dpipe_entries_get_rsp *rsp); + +/* + * Get dpipe entries attributes. + */ +struct devlink_dpipe_entries_get_rsp * +devlink_dpipe_entries_get(struct ynl_sock *ys, + struct devlink_dpipe_entries_get_req *req); + +/* ============== DEVLINK_CMD_DPIPE_HEADERS_GET ============== */ +/* DEVLINK_CMD_DPIPE_HEADERS_GET - do */ +struct devlink_dpipe_headers_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_dpipe_headers_get_req * +devlink_dpipe_headers_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_dpipe_headers_get_req)); +} +void +devlink_dpipe_headers_get_req_free(struct devlink_dpipe_headers_get_req *req); + +static inline void +devlink_dpipe_headers_get_req_set_bus_name(struct devlink_dpipe_headers_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_dpipe_headers_get_req_set_dev_name(struct devlink_dpipe_headers_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_dpipe_headers_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 dpipe_headers:1; + } _present; + + char *bus_name; + char *dev_name; + struct devlink_dl_dpipe_headers dpipe_headers; +}; + +void +devlink_dpipe_headers_get_rsp_free(struct devlink_dpipe_headers_get_rsp *rsp); + +/* + * Get dpipe headers attributes. + */ +struct devlink_dpipe_headers_get_rsp * +devlink_dpipe_headers_get(struct ynl_sock *ys, + struct devlink_dpipe_headers_get_req *req); + +/* ============== DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET ============== */ +/* DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET - do */ +struct devlink_dpipe_table_counters_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 dpipe_table_name_len; + __u32 dpipe_table_counters_enabled:1; + } _present; + + char *bus_name; + char *dev_name; + char *dpipe_table_name; + __u8 dpipe_table_counters_enabled; +}; + +static inline struct devlink_dpipe_table_counters_set_req * +devlink_dpipe_table_counters_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_dpipe_table_counters_set_req)); +} +void +devlink_dpipe_table_counters_set_req_free(struct devlink_dpipe_table_counters_set_req *req); + +static inline void +devlink_dpipe_table_counters_set_req_set_bus_name(struct devlink_dpipe_table_counters_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_dpipe_table_counters_set_req_set_dev_name(struct devlink_dpipe_table_counters_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_dpipe_table_counters_set_req_set_dpipe_table_name(struct devlink_dpipe_table_counters_set_req *req, + const char *dpipe_table_name) +{ + free(req->dpipe_table_name); + req->_present.dpipe_table_name_len = strlen(dpipe_table_name); + req->dpipe_table_name = malloc(req->_present.dpipe_table_name_len + 1); + memcpy(req->dpipe_table_name, dpipe_table_name, req->_present.dpipe_table_name_len); + req->dpipe_table_name[req->_present.dpipe_table_name_len] = 0; +} +static inline void +devlink_dpipe_table_counters_set_req_set_dpipe_table_counters_enabled(struct devlink_dpipe_table_counters_set_req *req, + __u8 dpipe_table_counters_enabled) +{ + req->_present.dpipe_table_counters_enabled = 1; + req->dpipe_table_counters_enabled = dpipe_table_counters_enabled; +} + +/* + * Set dpipe counter attributes. + */ +int devlink_dpipe_table_counters_set(struct ynl_sock *ys, + struct devlink_dpipe_table_counters_set_req *req); + +/* ============== DEVLINK_CMD_RESOURCE_SET ============== */ +/* DEVLINK_CMD_RESOURCE_SET - do */ +struct devlink_resource_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 resource_id:1; + __u32 resource_size:1; + } _present; + + char *bus_name; + char *dev_name; + __u64 resource_id; + __u64 resource_size; +}; + +static inline struct devlink_resource_set_req * +devlink_resource_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_resource_set_req)); +} +void devlink_resource_set_req_free(struct devlink_resource_set_req *req); + +static inline void +devlink_resource_set_req_set_bus_name(struct devlink_resource_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_resource_set_req_set_dev_name(struct devlink_resource_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_resource_set_req_set_resource_id(struct devlink_resource_set_req *req, + __u64 resource_id) +{ + req->_present.resource_id = 1; + req->resource_id = resource_id; +} +static inline void +devlink_resource_set_req_set_resource_size(struct devlink_resource_set_req *req, + __u64 resource_size) +{ + req->_present.resource_size = 1; + req->resource_size = resource_size; +} + +/* + * Set resource attributes. + */ +int devlink_resource_set(struct ynl_sock *ys, + struct devlink_resource_set_req *req); + +/* ============== DEVLINK_CMD_RESOURCE_DUMP ============== */ +/* DEVLINK_CMD_RESOURCE_DUMP - do */ +struct devlink_resource_dump_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_resource_dump_req * +devlink_resource_dump_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_resource_dump_req)); +} +void devlink_resource_dump_req_free(struct devlink_resource_dump_req *req); + +static inline void +devlink_resource_dump_req_set_bus_name(struct devlink_resource_dump_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_resource_dump_req_set_dev_name(struct devlink_resource_dump_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_resource_dump_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 resource_list:1; + } _present; + + char *bus_name; + char *dev_name; + struct devlink_dl_resource_list resource_list; +}; + +void devlink_resource_dump_rsp_free(struct devlink_resource_dump_rsp *rsp); + +/* + * Get resource attributes. + */ +struct devlink_resource_dump_rsp * +devlink_resource_dump(struct ynl_sock *ys, + struct devlink_resource_dump_req *req); + +/* ============== DEVLINK_CMD_RELOAD ============== */ +/* DEVLINK_CMD_RELOAD - do */ +struct devlink_reload_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 reload_action:1; + __u32 reload_limits:1; + __u32 netns_pid:1; + __u32 netns_fd:1; + __u32 netns_id:1; + } _present; + + char *bus_name; + char *dev_name; + enum devlink_reload_action reload_action; + struct nla_bitfield32 reload_limits; + __u32 netns_pid; + __u32 netns_fd; + __u32 netns_id; +}; + +static inline struct devlink_reload_req *devlink_reload_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_reload_req)); +} +void devlink_reload_req_free(struct devlink_reload_req *req); + +static inline void +devlink_reload_req_set_bus_name(struct devlink_reload_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_reload_req_set_dev_name(struct devlink_reload_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_reload_req_set_reload_action(struct devlink_reload_req *req, + enum devlink_reload_action reload_action) +{ + req->_present.reload_action = 1; + req->reload_action = reload_action; +} +static inline void +devlink_reload_req_set_reload_limits(struct devlink_reload_req *req, + struct nla_bitfield32 *reload_limits) +{ + req->_present.reload_limits = 1; + memcpy(&req->reload_limits, reload_limits, sizeof(struct nla_bitfield32)); +} +static inline void +devlink_reload_req_set_netns_pid(struct devlink_reload_req *req, + __u32 netns_pid) +{ + req->_present.netns_pid = 1; + req->netns_pid = netns_pid; +} +static inline void +devlink_reload_req_set_netns_fd(struct devlink_reload_req *req, __u32 netns_fd) +{ + req->_present.netns_fd = 1; + req->netns_fd = netns_fd; +} +static inline void +devlink_reload_req_set_netns_id(struct devlink_reload_req *req, __u32 netns_id) +{ + req->_present.netns_id = 1; + req->netns_id = netns_id; +} + +struct devlink_reload_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 reload_actions_performed:1; + } _present; + + char *bus_name; + char *dev_name; + struct nla_bitfield32 reload_actions_performed; +}; + +void devlink_reload_rsp_free(struct devlink_reload_rsp *rsp); + +/* + * Reload devlink. + */ +struct devlink_reload_rsp * +devlink_reload(struct ynl_sock *ys, struct devlink_reload_req *req); + +/* ============== DEVLINK_CMD_PARAM_GET ============== */ +/* DEVLINK_CMD_PARAM_GET - do */ +struct devlink_param_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 param_name_len; + } _present; + + char *bus_name; + char *dev_name; + char *param_name; +}; + +static inline struct devlink_param_get_req *devlink_param_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_param_get_req)); +} +void devlink_param_get_req_free(struct devlink_param_get_req *req); + +static inline void +devlink_param_get_req_set_bus_name(struct devlink_param_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_param_get_req_set_dev_name(struct devlink_param_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_param_get_req_set_param_name(struct devlink_param_get_req *req, + const char *param_name) +{ + free(req->param_name); + req->_present.param_name_len = strlen(param_name); + req->param_name = malloc(req->_present.param_name_len + 1); + memcpy(req->param_name, param_name, req->_present.param_name_len); + req->param_name[req->_present.param_name_len] = 0; +} + +struct devlink_param_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 param_name_len; + } _present; + + char *bus_name; + char *dev_name; + char *param_name; +}; + +void devlink_param_get_rsp_free(struct devlink_param_get_rsp *rsp); + +/* + * Get param instances. + */ +struct devlink_param_get_rsp * +devlink_param_get(struct ynl_sock *ys, struct devlink_param_get_req *req); + +/* DEVLINK_CMD_PARAM_GET - dump */ +struct devlink_param_get_req_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_param_get_req_dump * +devlink_param_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct devlink_param_get_req_dump)); +} +void devlink_param_get_req_dump_free(struct devlink_param_get_req_dump *req); + +static inline void +devlink_param_get_req_dump_set_bus_name(struct devlink_param_get_req_dump *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_param_get_req_dump_set_dev_name(struct devlink_param_get_req_dump *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_param_get_list { + struct devlink_param_get_list *next; + struct devlink_param_get_rsp obj __attribute__((aligned(8))); +}; + +void devlink_param_get_list_free(struct devlink_param_get_list *rsp); + +struct devlink_param_get_list * +devlink_param_get_dump(struct ynl_sock *ys, + struct devlink_param_get_req_dump *req); + +/* ============== DEVLINK_CMD_PARAM_SET ============== */ +/* DEVLINK_CMD_PARAM_SET - do */ +struct devlink_param_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 param_name_len; + __u32 param_type:1; + __u32 param_value_cmode:1; + } _present; + + char *bus_name; + char *dev_name; + char *param_name; + __u8 param_type; + enum devlink_param_cmode param_value_cmode; +}; + +static inline struct devlink_param_set_req *devlink_param_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_param_set_req)); +} +void devlink_param_set_req_free(struct devlink_param_set_req *req); + +static inline void +devlink_param_set_req_set_bus_name(struct devlink_param_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_param_set_req_set_dev_name(struct devlink_param_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_param_set_req_set_param_name(struct devlink_param_set_req *req, + const char *param_name) +{ + free(req->param_name); + req->_present.param_name_len = strlen(param_name); + req->param_name = malloc(req->_present.param_name_len + 1); + memcpy(req->param_name, param_name, req->_present.param_name_len); + req->param_name[req->_present.param_name_len] = 0; +} +static inline void +devlink_param_set_req_set_param_type(struct devlink_param_set_req *req, + __u8 param_type) +{ + req->_present.param_type = 1; + req->param_type = param_type; +} +static inline void +devlink_param_set_req_set_param_value_cmode(struct devlink_param_set_req *req, + enum devlink_param_cmode param_value_cmode) +{ + req->_present.param_value_cmode = 1; + req->param_value_cmode = param_value_cmode; +} + +/* + * Set param instances. + */ +int devlink_param_set(struct ynl_sock *ys, struct devlink_param_set_req *req); + +/* ============== DEVLINK_CMD_REGION_GET ============== */ +/* DEVLINK_CMD_REGION_GET - do */ +struct devlink_region_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 region_name_len; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *region_name; +}; + +static inline struct devlink_region_get_req *devlink_region_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_region_get_req)); +} +void devlink_region_get_req_free(struct devlink_region_get_req *req); + +static inline void +devlink_region_get_req_set_bus_name(struct devlink_region_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_region_get_req_set_dev_name(struct devlink_region_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_region_get_req_set_port_index(struct devlink_region_get_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_region_get_req_set_region_name(struct devlink_region_get_req *req, + const char *region_name) +{ + free(req->region_name); + req->_present.region_name_len = strlen(region_name); + req->region_name = malloc(req->_present.region_name_len + 1); + memcpy(req->region_name, region_name, req->_present.region_name_len); + req->region_name[req->_present.region_name_len] = 0; +} + +struct devlink_region_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 region_name_len; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *region_name; +}; + +void devlink_region_get_rsp_free(struct devlink_region_get_rsp *rsp); + +/* + * Get region instances. + */ +struct devlink_region_get_rsp * +devlink_region_get(struct ynl_sock *ys, struct devlink_region_get_req *req); + +/* DEVLINK_CMD_REGION_GET - dump */ +struct devlink_region_get_req_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_region_get_req_dump * +devlink_region_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct devlink_region_get_req_dump)); +} +void devlink_region_get_req_dump_free(struct devlink_region_get_req_dump *req); + +static inline void +devlink_region_get_req_dump_set_bus_name(struct devlink_region_get_req_dump *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_region_get_req_dump_set_dev_name(struct devlink_region_get_req_dump *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_region_get_list { + struct devlink_region_get_list *next; + struct devlink_region_get_rsp obj __attribute__((aligned(8))); +}; + +void devlink_region_get_list_free(struct devlink_region_get_list *rsp); + +struct devlink_region_get_list * +devlink_region_get_dump(struct ynl_sock *ys, + struct devlink_region_get_req_dump *req); + +/* ============== DEVLINK_CMD_REGION_NEW ============== */ +/* DEVLINK_CMD_REGION_NEW - do */ +struct devlink_region_new_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 region_name_len; + __u32 region_snapshot_id:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *region_name; + __u32 region_snapshot_id; +}; + +static inline struct devlink_region_new_req *devlink_region_new_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_region_new_req)); +} +void devlink_region_new_req_free(struct devlink_region_new_req *req); + +static inline void +devlink_region_new_req_set_bus_name(struct devlink_region_new_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_region_new_req_set_dev_name(struct devlink_region_new_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_region_new_req_set_port_index(struct devlink_region_new_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_region_new_req_set_region_name(struct devlink_region_new_req *req, + const char *region_name) +{ + free(req->region_name); + req->_present.region_name_len = strlen(region_name); + req->region_name = malloc(req->_present.region_name_len + 1); + memcpy(req->region_name, region_name, req->_present.region_name_len); + req->region_name[req->_present.region_name_len] = 0; +} +static inline void +devlink_region_new_req_set_region_snapshot_id(struct devlink_region_new_req *req, + __u32 region_snapshot_id) +{ + req->_present.region_snapshot_id = 1; + req->region_snapshot_id = region_snapshot_id; +} + +struct devlink_region_new_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 region_name_len; + __u32 region_snapshot_id:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *region_name; + __u32 region_snapshot_id; +}; + +void devlink_region_new_rsp_free(struct devlink_region_new_rsp *rsp); + +/* + * Create region snapshot. + */ +struct devlink_region_new_rsp * +devlink_region_new(struct ynl_sock *ys, struct devlink_region_new_req *req); + +/* ============== DEVLINK_CMD_REGION_DEL ============== */ +/* DEVLINK_CMD_REGION_DEL - do */ +struct devlink_region_del_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 region_name_len; + __u32 region_snapshot_id:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *region_name; + __u32 region_snapshot_id; +}; + +static inline struct devlink_region_del_req *devlink_region_del_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_region_del_req)); +} +void devlink_region_del_req_free(struct devlink_region_del_req *req); + +static inline void +devlink_region_del_req_set_bus_name(struct devlink_region_del_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_region_del_req_set_dev_name(struct devlink_region_del_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_region_del_req_set_port_index(struct devlink_region_del_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_region_del_req_set_region_name(struct devlink_region_del_req *req, + const char *region_name) +{ + free(req->region_name); + req->_present.region_name_len = strlen(region_name); + req->region_name = malloc(req->_present.region_name_len + 1); + memcpy(req->region_name, region_name, req->_present.region_name_len); + req->region_name[req->_present.region_name_len] = 0; +} +static inline void +devlink_region_del_req_set_region_snapshot_id(struct devlink_region_del_req *req, + __u32 region_snapshot_id) +{ + req->_present.region_snapshot_id = 1; + req->region_snapshot_id = region_snapshot_id; +} + +/* + * Delete region snapshot. + */ +int devlink_region_del(struct ynl_sock *ys, struct devlink_region_del_req *req); + +/* ============== DEVLINK_CMD_REGION_READ ============== */ +/* DEVLINK_CMD_REGION_READ - dump */ +struct devlink_region_read_req_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 region_name_len; + __u32 region_snapshot_id:1; + __u32 region_direct:1; + __u32 region_chunk_addr:1; + __u32 region_chunk_len:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *region_name; + __u32 region_snapshot_id; + __u64 region_chunk_addr; + __u64 region_chunk_len; +}; + +static inline struct devlink_region_read_req_dump * +devlink_region_read_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct devlink_region_read_req_dump)); +} +void +devlink_region_read_req_dump_free(struct devlink_region_read_req_dump *req); + +static inline void +devlink_region_read_req_dump_set_bus_name(struct devlink_region_read_req_dump *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_region_read_req_dump_set_dev_name(struct devlink_region_read_req_dump *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_region_read_req_dump_set_port_index(struct devlink_region_read_req_dump *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_region_read_req_dump_set_region_name(struct devlink_region_read_req_dump *req, + const char *region_name) +{ + free(req->region_name); + req->_present.region_name_len = strlen(region_name); + req->region_name = malloc(req->_present.region_name_len + 1); + memcpy(req->region_name, region_name, req->_present.region_name_len); + req->region_name[req->_present.region_name_len] = 0; +} +static inline void +devlink_region_read_req_dump_set_region_snapshot_id(struct devlink_region_read_req_dump *req, + __u32 region_snapshot_id) +{ + req->_present.region_snapshot_id = 1; + req->region_snapshot_id = region_snapshot_id; +} +static inline void +devlink_region_read_req_dump_set_region_direct(struct devlink_region_read_req_dump *req) +{ + req->_present.region_direct = 1; +} +static inline void +devlink_region_read_req_dump_set_region_chunk_addr(struct devlink_region_read_req_dump *req, + __u64 region_chunk_addr) +{ + req->_present.region_chunk_addr = 1; + req->region_chunk_addr = region_chunk_addr; +} +static inline void +devlink_region_read_req_dump_set_region_chunk_len(struct devlink_region_read_req_dump *req, + __u64 region_chunk_len) +{ + req->_present.region_chunk_len = 1; + req->region_chunk_len = region_chunk_len; +} + +struct devlink_region_read_rsp_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 region_name_len; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *region_name; +}; + +struct devlink_region_read_rsp_list { + struct devlink_region_read_rsp_list *next; + struct devlink_region_read_rsp_dump obj __attribute__((aligned(8))); +}; + +void +devlink_region_read_rsp_list_free(struct devlink_region_read_rsp_list *rsp); + +struct devlink_region_read_rsp_list * +devlink_region_read_dump(struct ynl_sock *ys, + struct devlink_region_read_req_dump *req); + +/* ============== DEVLINK_CMD_PORT_PARAM_GET ============== */ +/* DEVLINK_CMD_PORT_PARAM_GET - do */ +struct devlink_port_param_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; +}; + +static inline struct devlink_port_param_get_req * +devlink_port_param_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_port_param_get_req)); +} +void devlink_port_param_get_req_free(struct devlink_port_param_get_req *req); + +static inline void +devlink_port_param_get_req_set_bus_name(struct devlink_port_param_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_port_param_get_req_set_dev_name(struct devlink_port_param_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_port_param_get_req_set_port_index(struct devlink_port_param_get_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} + +struct devlink_port_param_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; +}; + +void devlink_port_param_get_rsp_free(struct devlink_port_param_get_rsp *rsp); + +/* + * Get port param instances. + */ +struct devlink_port_param_get_rsp * +devlink_port_param_get(struct ynl_sock *ys, + struct devlink_port_param_get_req *req); + +/* DEVLINK_CMD_PORT_PARAM_GET - dump */ +struct devlink_port_param_get_list { + struct devlink_port_param_get_list *next; + struct devlink_port_param_get_rsp obj __attribute__((aligned(8))); +}; + +void devlink_port_param_get_list_free(struct devlink_port_param_get_list *rsp); + +struct devlink_port_param_get_list * +devlink_port_param_get_dump(struct ynl_sock *ys); + +/* ============== DEVLINK_CMD_PORT_PARAM_SET ============== */ +/* DEVLINK_CMD_PORT_PARAM_SET - do */ +struct devlink_port_param_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; +}; + +static inline struct devlink_port_param_set_req * +devlink_port_param_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_port_param_set_req)); +} +void devlink_port_param_set_req_free(struct devlink_port_param_set_req *req); + +static inline void +devlink_port_param_set_req_set_bus_name(struct devlink_port_param_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_port_param_set_req_set_dev_name(struct devlink_port_param_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_port_param_set_req_set_port_index(struct devlink_port_param_set_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} + +/* + * Set port param instances. + */ +int devlink_port_param_set(struct ynl_sock *ys, + struct devlink_port_param_set_req *req); + +/* ============== DEVLINK_CMD_INFO_GET ============== */ +/* DEVLINK_CMD_INFO_GET - do */ +struct devlink_info_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_info_get_req *devlink_info_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_info_get_req)); +} +void devlink_info_get_req_free(struct devlink_info_get_req *req); + +static inline void +devlink_info_get_req_set_bus_name(struct devlink_info_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_info_get_req_set_dev_name(struct devlink_info_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_info_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 info_driver_name_len; + __u32 info_serial_number_len; + } _present; + + char *bus_name; + char *dev_name; + char *info_driver_name; + char *info_serial_number; + unsigned int n_info_version_fixed; + struct devlink_dl_info_version *info_version_fixed; + unsigned int n_info_version_running; + struct devlink_dl_info_version *info_version_running; + unsigned int n_info_version_stored; + struct devlink_dl_info_version *info_version_stored; +}; + +void devlink_info_get_rsp_free(struct devlink_info_get_rsp *rsp); + +/* + * Get device information, like driver name, hardware and firmware versions etc. + */ +struct devlink_info_get_rsp * +devlink_info_get(struct ynl_sock *ys, struct devlink_info_get_req *req); + +/* DEVLINK_CMD_INFO_GET - dump */ +struct devlink_info_get_list { + struct devlink_info_get_list *next; + struct devlink_info_get_rsp obj __attribute__((aligned(8))); +}; + +void devlink_info_get_list_free(struct devlink_info_get_list *rsp); + +struct devlink_info_get_list *devlink_info_get_dump(struct ynl_sock *ys); + +/* ============== DEVLINK_CMD_HEALTH_REPORTER_GET ============== */ +/* DEVLINK_CMD_HEALTH_REPORTER_GET - do */ +struct devlink_health_reporter_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 health_reporter_name_len; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *health_reporter_name; +}; + +static inline struct devlink_health_reporter_get_req * +devlink_health_reporter_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_health_reporter_get_req)); +} +void +devlink_health_reporter_get_req_free(struct devlink_health_reporter_get_req *req); + +static inline void +devlink_health_reporter_get_req_set_bus_name(struct devlink_health_reporter_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_health_reporter_get_req_set_dev_name(struct devlink_health_reporter_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_health_reporter_get_req_set_port_index(struct devlink_health_reporter_get_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_health_reporter_get_req_set_health_reporter_name(struct devlink_health_reporter_get_req *req, + const char *health_reporter_name) +{ + free(req->health_reporter_name); + req->_present.health_reporter_name_len = strlen(health_reporter_name); + req->health_reporter_name = malloc(req->_present.health_reporter_name_len + 1); + memcpy(req->health_reporter_name, health_reporter_name, req->_present.health_reporter_name_len); + req->health_reporter_name[req->_present.health_reporter_name_len] = 0; +} + +struct devlink_health_reporter_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 health_reporter_name_len; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *health_reporter_name; +}; + +void +devlink_health_reporter_get_rsp_free(struct devlink_health_reporter_get_rsp *rsp); + +/* + * Get health reporter instances. + */ +struct devlink_health_reporter_get_rsp * +devlink_health_reporter_get(struct ynl_sock *ys, + struct devlink_health_reporter_get_req *req); + +/* DEVLINK_CMD_HEALTH_REPORTER_GET - dump */ +struct devlink_health_reporter_get_req_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; +}; + +static inline struct devlink_health_reporter_get_req_dump * +devlink_health_reporter_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct devlink_health_reporter_get_req_dump)); +} +void +devlink_health_reporter_get_req_dump_free(struct devlink_health_reporter_get_req_dump *req); + +static inline void +devlink_health_reporter_get_req_dump_set_bus_name(struct devlink_health_reporter_get_req_dump *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_health_reporter_get_req_dump_set_dev_name(struct devlink_health_reporter_get_req_dump *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_health_reporter_get_req_dump_set_port_index(struct devlink_health_reporter_get_req_dump *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} + +struct devlink_health_reporter_get_list { + struct devlink_health_reporter_get_list *next; + struct devlink_health_reporter_get_rsp obj __attribute__((aligned(8))); +}; + +void +devlink_health_reporter_get_list_free(struct devlink_health_reporter_get_list *rsp); + +struct devlink_health_reporter_get_list * +devlink_health_reporter_get_dump(struct ynl_sock *ys, + struct devlink_health_reporter_get_req_dump *req); + +/* ============== DEVLINK_CMD_HEALTH_REPORTER_SET ============== */ +/* DEVLINK_CMD_HEALTH_REPORTER_SET - do */ +struct devlink_health_reporter_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 health_reporter_name_len; + __u32 health_reporter_graceful_period:1; + __u32 health_reporter_auto_recover:1; + __u32 health_reporter_auto_dump:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *health_reporter_name; + __u64 health_reporter_graceful_period; + __u8 health_reporter_auto_recover; + __u8 health_reporter_auto_dump; +}; + +static inline struct devlink_health_reporter_set_req * +devlink_health_reporter_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_health_reporter_set_req)); +} +void +devlink_health_reporter_set_req_free(struct devlink_health_reporter_set_req *req); + +static inline void +devlink_health_reporter_set_req_set_bus_name(struct devlink_health_reporter_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_health_reporter_set_req_set_dev_name(struct devlink_health_reporter_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_health_reporter_set_req_set_port_index(struct devlink_health_reporter_set_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_health_reporter_set_req_set_health_reporter_name(struct devlink_health_reporter_set_req *req, + const char *health_reporter_name) +{ + free(req->health_reporter_name); + req->_present.health_reporter_name_len = strlen(health_reporter_name); + req->health_reporter_name = malloc(req->_present.health_reporter_name_len + 1); + memcpy(req->health_reporter_name, health_reporter_name, req->_present.health_reporter_name_len); + req->health_reporter_name[req->_present.health_reporter_name_len] = 0; +} +static inline void +devlink_health_reporter_set_req_set_health_reporter_graceful_period(struct devlink_health_reporter_set_req *req, + __u64 health_reporter_graceful_period) +{ + req->_present.health_reporter_graceful_period = 1; + req->health_reporter_graceful_period = health_reporter_graceful_period; +} +static inline void +devlink_health_reporter_set_req_set_health_reporter_auto_recover(struct devlink_health_reporter_set_req *req, + __u8 health_reporter_auto_recover) +{ + req->_present.health_reporter_auto_recover = 1; + req->health_reporter_auto_recover = health_reporter_auto_recover; +} +static inline void +devlink_health_reporter_set_req_set_health_reporter_auto_dump(struct devlink_health_reporter_set_req *req, + __u8 health_reporter_auto_dump) +{ + req->_present.health_reporter_auto_dump = 1; + req->health_reporter_auto_dump = health_reporter_auto_dump; +} + +/* + * Set health reporter instances. + */ +int devlink_health_reporter_set(struct ynl_sock *ys, + struct devlink_health_reporter_set_req *req); + +/* ============== DEVLINK_CMD_HEALTH_REPORTER_RECOVER ============== */ +/* DEVLINK_CMD_HEALTH_REPORTER_RECOVER - do */ +struct devlink_health_reporter_recover_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 health_reporter_name_len; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *health_reporter_name; +}; + +static inline struct devlink_health_reporter_recover_req * +devlink_health_reporter_recover_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_health_reporter_recover_req)); +} +void +devlink_health_reporter_recover_req_free(struct devlink_health_reporter_recover_req *req); + +static inline void +devlink_health_reporter_recover_req_set_bus_name(struct devlink_health_reporter_recover_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_health_reporter_recover_req_set_dev_name(struct devlink_health_reporter_recover_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_health_reporter_recover_req_set_port_index(struct devlink_health_reporter_recover_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_health_reporter_recover_req_set_health_reporter_name(struct devlink_health_reporter_recover_req *req, + const char *health_reporter_name) +{ + free(req->health_reporter_name); + req->_present.health_reporter_name_len = strlen(health_reporter_name); + req->health_reporter_name = malloc(req->_present.health_reporter_name_len + 1); + memcpy(req->health_reporter_name, health_reporter_name, req->_present.health_reporter_name_len); + req->health_reporter_name[req->_present.health_reporter_name_len] = 0; +} + +/* + * Recover health reporter instances. + */ +int devlink_health_reporter_recover(struct ynl_sock *ys, + struct devlink_health_reporter_recover_req *req); + +/* ============== DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE ============== */ +/* DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE - do */ +struct devlink_health_reporter_diagnose_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 health_reporter_name_len; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *health_reporter_name; +}; + +static inline struct devlink_health_reporter_diagnose_req * +devlink_health_reporter_diagnose_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_health_reporter_diagnose_req)); +} +void +devlink_health_reporter_diagnose_req_free(struct devlink_health_reporter_diagnose_req *req); + +static inline void +devlink_health_reporter_diagnose_req_set_bus_name(struct devlink_health_reporter_diagnose_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_health_reporter_diagnose_req_set_dev_name(struct devlink_health_reporter_diagnose_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_health_reporter_diagnose_req_set_port_index(struct devlink_health_reporter_diagnose_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_health_reporter_diagnose_req_set_health_reporter_name(struct devlink_health_reporter_diagnose_req *req, + const char *health_reporter_name) +{ + free(req->health_reporter_name); + req->_present.health_reporter_name_len = strlen(health_reporter_name); + req->health_reporter_name = malloc(req->_present.health_reporter_name_len + 1); + memcpy(req->health_reporter_name, health_reporter_name, req->_present.health_reporter_name_len); + req->health_reporter_name[req->_present.health_reporter_name_len] = 0; +} + +/* + * Diagnose health reporter instances. + */ +int devlink_health_reporter_diagnose(struct ynl_sock *ys, + struct devlink_health_reporter_diagnose_req *req); + +/* ============== DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET ============== */ +/* DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET - dump */ +struct devlink_health_reporter_dump_get_req_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 health_reporter_name_len; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *health_reporter_name; +}; + +static inline struct devlink_health_reporter_dump_get_req_dump * +devlink_health_reporter_dump_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct devlink_health_reporter_dump_get_req_dump)); +} +void +devlink_health_reporter_dump_get_req_dump_free(struct devlink_health_reporter_dump_get_req_dump *req); + +static inline void +devlink_health_reporter_dump_get_req_dump_set_bus_name(struct devlink_health_reporter_dump_get_req_dump *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_health_reporter_dump_get_req_dump_set_dev_name(struct devlink_health_reporter_dump_get_req_dump *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_health_reporter_dump_get_req_dump_set_port_index(struct devlink_health_reporter_dump_get_req_dump *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_health_reporter_dump_get_req_dump_set_health_reporter_name(struct devlink_health_reporter_dump_get_req_dump *req, + const char *health_reporter_name) +{ + free(req->health_reporter_name); + req->_present.health_reporter_name_len = strlen(health_reporter_name); + req->health_reporter_name = malloc(req->_present.health_reporter_name_len + 1); + memcpy(req->health_reporter_name, health_reporter_name, req->_present.health_reporter_name_len); + req->health_reporter_name[req->_present.health_reporter_name_len] = 0; +} + +struct devlink_health_reporter_dump_get_rsp_dump { + struct { + __u32 fmsg:1; + } _present; + + struct devlink_dl_fmsg fmsg; +}; + +struct devlink_health_reporter_dump_get_rsp_list { + struct devlink_health_reporter_dump_get_rsp_list *next; + struct devlink_health_reporter_dump_get_rsp_dump obj __attribute__((aligned(8))); +}; + +void +devlink_health_reporter_dump_get_rsp_list_free(struct devlink_health_reporter_dump_get_rsp_list *rsp); + +struct devlink_health_reporter_dump_get_rsp_list * +devlink_health_reporter_dump_get_dump(struct ynl_sock *ys, + struct devlink_health_reporter_dump_get_req_dump *req); + +/* ============== DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR ============== */ +/* DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR - do */ +struct devlink_health_reporter_dump_clear_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 health_reporter_name_len; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *health_reporter_name; +}; + +static inline struct devlink_health_reporter_dump_clear_req * +devlink_health_reporter_dump_clear_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_health_reporter_dump_clear_req)); +} +void +devlink_health_reporter_dump_clear_req_free(struct devlink_health_reporter_dump_clear_req *req); + +static inline void +devlink_health_reporter_dump_clear_req_set_bus_name(struct devlink_health_reporter_dump_clear_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_health_reporter_dump_clear_req_set_dev_name(struct devlink_health_reporter_dump_clear_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_health_reporter_dump_clear_req_set_port_index(struct devlink_health_reporter_dump_clear_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_health_reporter_dump_clear_req_set_health_reporter_name(struct devlink_health_reporter_dump_clear_req *req, + const char *health_reporter_name) +{ + free(req->health_reporter_name); + req->_present.health_reporter_name_len = strlen(health_reporter_name); + req->health_reporter_name = malloc(req->_present.health_reporter_name_len + 1); + memcpy(req->health_reporter_name, health_reporter_name, req->_present.health_reporter_name_len); + req->health_reporter_name[req->_present.health_reporter_name_len] = 0; +} + +/* + * Clear dump of health reporter instances. + */ +int devlink_health_reporter_dump_clear(struct ynl_sock *ys, + struct devlink_health_reporter_dump_clear_req *req); + +/* ============== DEVLINK_CMD_FLASH_UPDATE ============== */ +/* DEVLINK_CMD_FLASH_UPDATE - do */ +struct devlink_flash_update_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 flash_update_file_name_len; + __u32 flash_update_component_len; + __u32 flash_update_overwrite_mask:1; + } _present; + + char *bus_name; + char *dev_name; + char *flash_update_file_name; + char *flash_update_component; + struct nla_bitfield32 flash_update_overwrite_mask; +}; + +static inline struct devlink_flash_update_req * +devlink_flash_update_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_flash_update_req)); +} +void devlink_flash_update_req_free(struct devlink_flash_update_req *req); + +static inline void +devlink_flash_update_req_set_bus_name(struct devlink_flash_update_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_flash_update_req_set_dev_name(struct devlink_flash_update_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_flash_update_req_set_flash_update_file_name(struct devlink_flash_update_req *req, + const char *flash_update_file_name) +{ + free(req->flash_update_file_name); + req->_present.flash_update_file_name_len = strlen(flash_update_file_name); + req->flash_update_file_name = malloc(req->_present.flash_update_file_name_len + 1); + memcpy(req->flash_update_file_name, flash_update_file_name, req->_present.flash_update_file_name_len); + req->flash_update_file_name[req->_present.flash_update_file_name_len] = 0; +} +static inline void +devlink_flash_update_req_set_flash_update_component(struct devlink_flash_update_req *req, + const char *flash_update_component) +{ + free(req->flash_update_component); + req->_present.flash_update_component_len = strlen(flash_update_component); + req->flash_update_component = malloc(req->_present.flash_update_component_len + 1); + memcpy(req->flash_update_component, flash_update_component, req->_present.flash_update_component_len); + req->flash_update_component[req->_present.flash_update_component_len] = 0; +} +static inline void +devlink_flash_update_req_set_flash_update_overwrite_mask(struct devlink_flash_update_req *req, + struct nla_bitfield32 *flash_update_overwrite_mask) +{ + req->_present.flash_update_overwrite_mask = 1; + memcpy(&req->flash_update_overwrite_mask, flash_update_overwrite_mask, sizeof(struct nla_bitfield32)); +} + +/* + * Flash update devlink instances. + */ +int devlink_flash_update(struct ynl_sock *ys, + struct devlink_flash_update_req *req); + +/* ============== DEVLINK_CMD_TRAP_GET ============== */ +/* DEVLINK_CMD_TRAP_GET - do */ +struct devlink_trap_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 trap_name_len; + } _present; + + char *bus_name; + char *dev_name; + char *trap_name; +}; + +static inline struct devlink_trap_get_req *devlink_trap_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_trap_get_req)); +} +void devlink_trap_get_req_free(struct devlink_trap_get_req *req); + +static inline void +devlink_trap_get_req_set_bus_name(struct devlink_trap_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_trap_get_req_set_dev_name(struct devlink_trap_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_trap_get_req_set_trap_name(struct devlink_trap_get_req *req, + const char *trap_name) +{ + free(req->trap_name); + req->_present.trap_name_len = strlen(trap_name); + req->trap_name = malloc(req->_present.trap_name_len + 1); + memcpy(req->trap_name, trap_name, req->_present.trap_name_len); + req->trap_name[req->_present.trap_name_len] = 0; +} + +struct devlink_trap_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 trap_name_len; + } _present; + + char *bus_name; + char *dev_name; + char *trap_name; +}; + +void devlink_trap_get_rsp_free(struct devlink_trap_get_rsp *rsp); + +/* + * Get trap instances. + */ +struct devlink_trap_get_rsp * +devlink_trap_get(struct ynl_sock *ys, struct devlink_trap_get_req *req); + +/* DEVLINK_CMD_TRAP_GET - dump */ +struct devlink_trap_get_req_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_trap_get_req_dump * +devlink_trap_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct devlink_trap_get_req_dump)); +} +void devlink_trap_get_req_dump_free(struct devlink_trap_get_req_dump *req); + +static inline void +devlink_trap_get_req_dump_set_bus_name(struct devlink_trap_get_req_dump *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_trap_get_req_dump_set_dev_name(struct devlink_trap_get_req_dump *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_trap_get_list { + struct devlink_trap_get_list *next; + struct devlink_trap_get_rsp obj __attribute__((aligned(8))); +}; + +void devlink_trap_get_list_free(struct devlink_trap_get_list *rsp); + +struct devlink_trap_get_list * +devlink_trap_get_dump(struct ynl_sock *ys, + struct devlink_trap_get_req_dump *req); + +/* ============== DEVLINK_CMD_TRAP_SET ============== */ +/* DEVLINK_CMD_TRAP_SET - do */ +struct devlink_trap_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 trap_name_len; + __u32 trap_action:1; + } _present; + + char *bus_name; + char *dev_name; + char *trap_name; + enum devlink_trap_action trap_action; +}; + +static inline struct devlink_trap_set_req *devlink_trap_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_trap_set_req)); +} +void devlink_trap_set_req_free(struct devlink_trap_set_req *req); + +static inline void +devlink_trap_set_req_set_bus_name(struct devlink_trap_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_trap_set_req_set_dev_name(struct devlink_trap_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_trap_set_req_set_trap_name(struct devlink_trap_set_req *req, + const char *trap_name) +{ + free(req->trap_name); + req->_present.trap_name_len = strlen(trap_name); + req->trap_name = malloc(req->_present.trap_name_len + 1); + memcpy(req->trap_name, trap_name, req->_present.trap_name_len); + req->trap_name[req->_present.trap_name_len] = 0; +} +static inline void +devlink_trap_set_req_set_trap_action(struct devlink_trap_set_req *req, + enum devlink_trap_action trap_action) +{ + req->_present.trap_action = 1; + req->trap_action = trap_action; +} + +/* + * Set trap instances. + */ +int devlink_trap_set(struct ynl_sock *ys, struct devlink_trap_set_req *req); + +/* ============== DEVLINK_CMD_TRAP_GROUP_GET ============== */ +/* DEVLINK_CMD_TRAP_GROUP_GET - do */ +struct devlink_trap_group_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 trap_group_name_len; + } _present; + + char *bus_name; + char *dev_name; + char *trap_group_name; +}; + +static inline struct devlink_trap_group_get_req * +devlink_trap_group_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_trap_group_get_req)); +} +void devlink_trap_group_get_req_free(struct devlink_trap_group_get_req *req); + +static inline void +devlink_trap_group_get_req_set_bus_name(struct devlink_trap_group_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_trap_group_get_req_set_dev_name(struct devlink_trap_group_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_trap_group_get_req_set_trap_group_name(struct devlink_trap_group_get_req *req, + const char *trap_group_name) +{ + free(req->trap_group_name); + req->_present.trap_group_name_len = strlen(trap_group_name); + req->trap_group_name = malloc(req->_present.trap_group_name_len + 1); + memcpy(req->trap_group_name, trap_group_name, req->_present.trap_group_name_len); + req->trap_group_name[req->_present.trap_group_name_len] = 0; +} + +struct devlink_trap_group_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 trap_group_name_len; + } _present; + + char *bus_name; + char *dev_name; + char *trap_group_name; +}; + +void devlink_trap_group_get_rsp_free(struct devlink_trap_group_get_rsp *rsp); + +/* + * Get trap group instances. + */ +struct devlink_trap_group_get_rsp * +devlink_trap_group_get(struct ynl_sock *ys, + struct devlink_trap_group_get_req *req); + +/* DEVLINK_CMD_TRAP_GROUP_GET - dump */ +struct devlink_trap_group_get_req_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_trap_group_get_req_dump * +devlink_trap_group_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct devlink_trap_group_get_req_dump)); +} +void +devlink_trap_group_get_req_dump_free(struct devlink_trap_group_get_req_dump *req); + +static inline void +devlink_trap_group_get_req_dump_set_bus_name(struct devlink_trap_group_get_req_dump *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_trap_group_get_req_dump_set_dev_name(struct devlink_trap_group_get_req_dump *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_trap_group_get_list { + struct devlink_trap_group_get_list *next; + struct devlink_trap_group_get_rsp obj __attribute__((aligned(8))); +}; + +void devlink_trap_group_get_list_free(struct devlink_trap_group_get_list *rsp); + +struct devlink_trap_group_get_list * +devlink_trap_group_get_dump(struct ynl_sock *ys, + struct devlink_trap_group_get_req_dump *req); + +/* ============== DEVLINK_CMD_TRAP_GROUP_SET ============== */ +/* DEVLINK_CMD_TRAP_GROUP_SET - do */ +struct devlink_trap_group_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 trap_group_name_len; + __u32 trap_action:1; + __u32 trap_policer_id:1; + } _present; + + char *bus_name; + char *dev_name; + char *trap_group_name; + enum devlink_trap_action trap_action; + __u32 trap_policer_id; +}; + +static inline struct devlink_trap_group_set_req * +devlink_trap_group_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_trap_group_set_req)); +} +void devlink_trap_group_set_req_free(struct devlink_trap_group_set_req *req); + +static inline void +devlink_trap_group_set_req_set_bus_name(struct devlink_trap_group_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_trap_group_set_req_set_dev_name(struct devlink_trap_group_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_trap_group_set_req_set_trap_group_name(struct devlink_trap_group_set_req *req, + const char *trap_group_name) +{ + free(req->trap_group_name); + req->_present.trap_group_name_len = strlen(trap_group_name); + req->trap_group_name = malloc(req->_present.trap_group_name_len + 1); + memcpy(req->trap_group_name, trap_group_name, req->_present.trap_group_name_len); + req->trap_group_name[req->_present.trap_group_name_len] = 0; +} +static inline void +devlink_trap_group_set_req_set_trap_action(struct devlink_trap_group_set_req *req, + enum devlink_trap_action trap_action) +{ + req->_present.trap_action = 1; + req->trap_action = trap_action; +} +static inline void +devlink_trap_group_set_req_set_trap_policer_id(struct devlink_trap_group_set_req *req, + __u32 trap_policer_id) +{ + req->_present.trap_policer_id = 1; + req->trap_policer_id = trap_policer_id; +} + +/* + * Set trap group instances. + */ +int devlink_trap_group_set(struct ynl_sock *ys, + struct devlink_trap_group_set_req *req); + +/* ============== DEVLINK_CMD_TRAP_POLICER_GET ============== */ +/* DEVLINK_CMD_TRAP_POLICER_GET - do */ +struct devlink_trap_policer_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 trap_policer_id:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 trap_policer_id; +}; + +static inline struct devlink_trap_policer_get_req * +devlink_trap_policer_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_trap_policer_get_req)); +} +void +devlink_trap_policer_get_req_free(struct devlink_trap_policer_get_req *req); + +static inline void +devlink_trap_policer_get_req_set_bus_name(struct devlink_trap_policer_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_trap_policer_get_req_set_dev_name(struct devlink_trap_policer_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_trap_policer_get_req_set_trap_policer_id(struct devlink_trap_policer_get_req *req, + __u32 trap_policer_id) +{ + req->_present.trap_policer_id = 1; + req->trap_policer_id = trap_policer_id; +} + +struct devlink_trap_policer_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 trap_policer_id:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 trap_policer_id; +}; + +void +devlink_trap_policer_get_rsp_free(struct devlink_trap_policer_get_rsp *rsp); + +/* + * Get trap policer instances. + */ +struct devlink_trap_policer_get_rsp * +devlink_trap_policer_get(struct ynl_sock *ys, + struct devlink_trap_policer_get_req *req); + +/* DEVLINK_CMD_TRAP_POLICER_GET - dump */ +struct devlink_trap_policer_get_req_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_trap_policer_get_req_dump * +devlink_trap_policer_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct devlink_trap_policer_get_req_dump)); +} +void +devlink_trap_policer_get_req_dump_free(struct devlink_trap_policer_get_req_dump *req); + +static inline void +devlink_trap_policer_get_req_dump_set_bus_name(struct devlink_trap_policer_get_req_dump *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_trap_policer_get_req_dump_set_dev_name(struct devlink_trap_policer_get_req_dump *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_trap_policer_get_list { + struct devlink_trap_policer_get_list *next; + struct devlink_trap_policer_get_rsp obj __attribute__((aligned(8))); +}; + +void +devlink_trap_policer_get_list_free(struct devlink_trap_policer_get_list *rsp); + +struct devlink_trap_policer_get_list * +devlink_trap_policer_get_dump(struct ynl_sock *ys, + struct devlink_trap_policer_get_req_dump *req); + +/* ============== DEVLINK_CMD_TRAP_POLICER_SET ============== */ +/* DEVLINK_CMD_TRAP_POLICER_SET - do */ +struct devlink_trap_policer_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 trap_policer_id:1; + __u32 trap_policer_rate:1; + __u32 trap_policer_burst:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 trap_policer_id; + __u64 trap_policer_rate; + __u64 trap_policer_burst; +}; + +static inline struct devlink_trap_policer_set_req * +devlink_trap_policer_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_trap_policer_set_req)); +} +void +devlink_trap_policer_set_req_free(struct devlink_trap_policer_set_req *req); + +static inline void +devlink_trap_policer_set_req_set_bus_name(struct devlink_trap_policer_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_trap_policer_set_req_set_dev_name(struct devlink_trap_policer_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_trap_policer_set_req_set_trap_policer_id(struct devlink_trap_policer_set_req *req, + __u32 trap_policer_id) +{ + req->_present.trap_policer_id = 1; + req->trap_policer_id = trap_policer_id; +} +static inline void +devlink_trap_policer_set_req_set_trap_policer_rate(struct devlink_trap_policer_set_req *req, + __u64 trap_policer_rate) +{ + req->_present.trap_policer_rate = 1; + req->trap_policer_rate = trap_policer_rate; +} +static inline void +devlink_trap_policer_set_req_set_trap_policer_burst(struct devlink_trap_policer_set_req *req, + __u64 trap_policer_burst) +{ + req->_present.trap_policer_burst = 1; + req->trap_policer_burst = trap_policer_burst; +} + +/* + * Get trap policer instances. + */ +int devlink_trap_policer_set(struct ynl_sock *ys, + struct devlink_trap_policer_set_req *req); + +/* ============== DEVLINK_CMD_HEALTH_REPORTER_TEST ============== */ +/* DEVLINK_CMD_HEALTH_REPORTER_TEST - do */ +struct devlink_health_reporter_test_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 health_reporter_name_len; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *health_reporter_name; +}; + +static inline struct devlink_health_reporter_test_req * +devlink_health_reporter_test_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_health_reporter_test_req)); +} +void +devlink_health_reporter_test_req_free(struct devlink_health_reporter_test_req *req); + +static inline void +devlink_health_reporter_test_req_set_bus_name(struct devlink_health_reporter_test_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_health_reporter_test_req_set_dev_name(struct devlink_health_reporter_test_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_health_reporter_test_req_set_port_index(struct devlink_health_reporter_test_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_health_reporter_test_req_set_health_reporter_name(struct devlink_health_reporter_test_req *req, + const char *health_reporter_name) +{ + free(req->health_reporter_name); + req->_present.health_reporter_name_len = strlen(health_reporter_name); + req->health_reporter_name = malloc(req->_present.health_reporter_name_len + 1); + memcpy(req->health_reporter_name, health_reporter_name, req->_present.health_reporter_name_len); + req->health_reporter_name[req->_present.health_reporter_name_len] = 0; +} + +/* + * Test health reporter instances. + */ +int devlink_health_reporter_test(struct ynl_sock *ys, + struct devlink_health_reporter_test_req *req); + +/* ============== DEVLINK_CMD_RATE_GET ============== */ +/* DEVLINK_CMD_RATE_GET - do */ +struct devlink_rate_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 rate_node_name_len; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *rate_node_name; +}; + +static inline struct devlink_rate_get_req *devlink_rate_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_rate_get_req)); +} +void devlink_rate_get_req_free(struct devlink_rate_get_req *req); + +static inline void +devlink_rate_get_req_set_bus_name(struct devlink_rate_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_rate_get_req_set_dev_name(struct devlink_rate_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_rate_get_req_set_port_index(struct devlink_rate_get_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} +static inline void +devlink_rate_get_req_set_rate_node_name(struct devlink_rate_get_req *req, + const char *rate_node_name) +{ + free(req->rate_node_name); + req->_present.rate_node_name_len = strlen(rate_node_name); + req->rate_node_name = malloc(req->_present.rate_node_name_len + 1); + memcpy(req->rate_node_name, rate_node_name, req->_present.rate_node_name_len); + req->rate_node_name[req->_present.rate_node_name_len] = 0; +} + +struct devlink_rate_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + __u32 rate_node_name_len; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; + char *rate_node_name; +}; + +void devlink_rate_get_rsp_free(struct devlink_rate_get_rsp *rsp); + +/* + * Get rate instances. + */ +struct devlink_rate_get_rsp * +devlink_rate_get(struct ynl_sock *ys, struct devlink_rate_get_req *req); + +/* DEVLINK_CMD_RATE_GET - dump */ +struct devlink_rate_get_req_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_rate_get_req_dump * +devlink_rate_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct devlink_rate_get_req_dump)); +} +void devlink_rate_get_req_dump_free(struct devlink_rate_get_req_dump *req); + +static inline void +devlink_rate_get_req_dump_set_bus_name(struct devlink_rate_get_req_dump *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_rate_get_req_dump_set_dev_name(struct devlink_rate_get_req_dump *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_rate_get_list { + struct devlink_rate_get_list *next; + struct devlink_rate_get_rsp obj __attribute__((aligned(8))); +}; + +void devlink_rate_get_list_free(struct devlink_rate_get_list *rsp); + +struct devlink_rate_get_list * +devlink_rate_get_dump(struct ynl_sock *ys, + struct devlink_rate_get_req_dump *req); + +/* ============== DEVLINK_CMD_RATE_SET ============== */ +/* DEVLINK_CMD_RATE_SET - do */ +struct devlink_rate_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 rate_node_name_len; + __u32 rate_tx_share:1; + __u32 rate_tx_max:1; + __u32 rate_tx_priority:1; + __u32 rate_tx_weight:1; + __u32 rate_parent_node_name_len; + } _present; + + char *bus_name; + char *dev_name; + char *rate_node_name; + __u64 rate_tx_share; + __u64 rate_tx_max; + __u32 rate_tx_priority; + __u32 rate_tx_weight; + char *rate_parent_node_name; +}; + +static inline struct devlink_rate_set_req *devlink_rate_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_rate_set_req)); +} +void devlink_rate_set_req_free(struct devlink_rate_set_req *req); + +static inline void +devlink_rate_set_req_set_bus_name(struct devlink_rate_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_rate_set_req_set_dev_name(struct devlink_rate_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_rate_set_req_set_rate_node_name(struct devlink_rate_set_req *req, + const char *rate_node_name) +{ + free(req->rate_node_name); + req->_present.rate_node_name_len = strlen(rate_node_name); + req->rate_node_name = malloc(req->_present.rate_node_name_len + 1); + memcpy(req->rate_node_name, rate_node_name, req->_present.rate_node_name_len); + req->rate_node_name[req->_present.rate_node_name_len] = 0; +} +static inline void +devlink_rate_set_req_set_rate_tx_share(struct devlink_rate_set_req *req, + __u64 rate_tx_share) +{ + req->_present.rate_tx_share = 1; + req->rate_tx_share = rate_tx_share; +} +static inline void +devlink_rate_set_req_set_rate_tx_max(struct devlink_rate_set_req *req, + __u64 rate_tx_max) +{ + req->_present.rate_tx_max = 1; + req->rate_tx_max = rate_tx_max; +} +static inline void +devlink_rate_set_req_set_rate_tx_priority(struct devlink_rate_set_req *req, + __u32 rate_tx_priority) +{ + req->_present.rate_tx_priority = 1; + req->rate_tx_priority = rate_tx_priority; +} +static inline void +devlink_rate_set_req_set_rate_tx_weight(struct devlink_rate_set_req *req, + __u32 rate_tx_weight) +{ + req->_present.rate_tx_weight = 1; + req->rate_tx_weight = rate_tx_weight; +} +static inline void +devlink_rate_set_req_set_rate_parent_node_name(struct devlink_rate_set_req *req, + const char *rate_parent_node_name) +{ + free(req->rate_parent_node_name); + req->_present.rate_parent_node_name_len = strlen(rate_parent_node_name); + req->rate_parent_node_name = malloc(req->_present.rate_parent_node_name_len + 1); + 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; +} + +/* + * Set rate instances. + */ +int devlink_rate_set(struct ynl_sock *ys, struct devlink_rate_set_req *req); + +/* ============== DEVLINK_CMD_RATE_NEW ============== */ +/* DEVLINK_CMD_RATE_NEW - do */ +struct devlink_rate_new_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 rate_node_name_len; + __u32 rate_tx_share:1; + __u32 rate_tx_max:1; + __u32 rate_tx_priority:1; + __u32 rate_tx_weight:1; + __u32 rate_parent_node_name_len; + } _present; + + char *bus_name; + char *dev_name; + char *rate_node_name; + __u64 rate_tx_share; + __u64 rate_tx_max; + __u32 rate_tx_priority; + __u32 rate_tx_weight; + char *rate_parent_node_name; +}; + +static inline struct devlink_rate_new_req *devlink_rate_new_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_rate_new_req)); +} +void devlink_rate_new_req_free(struct devlink_rate_new_req *req); + +static inline void +devlink_rate_new_req_set_bus_name(struct devlink_rate_new_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_rate_new_req_set_dev_name(struct devlink_rate_new_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_rate_new_req_set_rate_node_name(struct devlink_rate_new_req *req, + const char *rate_node_name) +{ + free(req->rate_node_name); + req->_present.rate_node_name_len = strlen(rate_node_name); + req->rate_node_name = malloc(req->_present.rate_node_name_len + 1); + memcpy(req->rate_node_name, rate_node_name, req->_present.rate_node_name_len); + req->rate_node_name[req->_present.rate_node_name_len] = 0; +} +static inline void +devlink_rate_new_req_set_rate_tx_share(struct devlink_rate_new_req *req, + __u64 rate_tx_share) +{ + req->_present.rate_tx_share = 1; + req->rate_tx_share = rate_tx_share; +} +static inline void +devlink_rate_new_req_set_rate_tx_max(struct devlink_rate_new_req *req, + __u64 rate_tx_max) +{ + req->_present.rate_tx_max = 1; + req->rate_tx_max = rate_tx_max; +} +static inline void +devlink_rate_new_req_set_rate_tx_priority(struct devlink_rate_new_req *req, + __u32 rate_tx_priority) +{ + req->_present.rate_tx_priority = 1; + req->rate_tx_priority = rate_tx_priority; +} +static inline void +devlink_rate_new_req_set_rate_tx_weight(struct devlink_rate_new_req *req, + __u32 rate_tx_weight) +{ + req->_present.rate_tx_weight = 1; + req->rate_tx_weight = rate_tx_weight; +} +static inline void +devlink_rate_new_req_set_rate_parent_node_name(struct devlink_rate_new_req *req, + const char *rate_parent_node_name) +{ + free(req->rate_parent_node_name); + req->_present.rate_parent_node_name_len = strlen(rate_parent_node_name); + req->rate_parent_node_name = malloc(req->_present.rate_parent_node_name_len + 1); + 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; +} + +/* + * Create rate instances. + */ +int devlink_rate_new(struct ynl_sock *ys, struct devlink_rate_new_req *req); + +/* ============== DEVLINK_CMD_RATE_DEL ============== */ +/* DEVLINK_CMD_RATE_DEL - do */ +struct devlink_rate_del_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 rate_node_name_len; + } _present; + + char *bus_name; + char *dev_name; + char *rate_node_name; +}; + +static inline struct devlink_rate_del_req *devlink_rate_del_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_rate_del_req)); +} +void devlink_rate_del_req_free(struct devlink_rate_del_req *req); + +static inline void +devlink_rate_del_req_set_bus_name(struct devlink_rate_del_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_rate_del_req_set_dev_name(struct devlink_rate_del_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_rate_del_req_set_rate_node_name(struct devlink_rate_del_req *req, + const char *rate_node_name) +{ + free(req->rate_node_name); + req->_present.rate_node_name_len = strlen(rate_node_name); + req->rate_node_name = malloc(req->_present.rate_node_name_len + 1); + memcpy(req->rate_node_name, rate_node_name, req->_present.rate_node_name_len); + req->rate_node_name[req->_present.rate_node_name_len] = 0; +} + +/* + * Delete rate instances. + */ +int devlink_rate_del(struct ynl_sock *ys, struct devlink_rate_del_req *req); + +/* ============== DEVLINK_CMD_LINECARD_GET ============== */ +/* DEVLINK_CMD_LINECARD_GET - do */ +struct devlink_linecard_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 linecard_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 linecard_index; +}; + +static inline struct devlink_linecard_get_req * +devlink_linecard_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_linecard_get_req)); +} +void devlink_linecard_get_req_free(struct devlink_linecard_get_req *req); + +static inline void +devlink_linecard_get_req_set_bus_name(struct devlink_linecard_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_linecard_get_req_set_dev_name(struct devlink_linecard_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_linecard_get_req_set_linecard_index(struct devlink_linecard_get_req *req, + __u32 linecard_index) +{ + req->_present.linecard_index = 1; + req->linecard_index = linecard_index; +} + +struct devlink_linecard_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 linecard_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 linecard_index; +}; + +void devlink_linecard_get_rsp_free(struct devlink_linecard_get_rsp *rsp); + +/* + * Get line card instances. + */ +struct devlink_linecard_get_rsp * +devlink_linecard_get(struct ynl_sock *ys, struct devlink_linecard_get_req *req); + +/* DEVLINK_CMD_LINECARD_GET - dump */ +struct devlink_linecard_get_req_dump { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_linecard_get_req_dump * +devlink_linecard_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct devlink_linecard_get_req_dump)); +} +void +devlink_linecard_get_req_dump_free(struct devlink_linecard_get_req_dump *req); + +static inline void +devlink_linecard_get_req_dump_set_bus_name(struct devlink_linecard_get_req_dump *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_linecard_get_req_dump_set_dev_name(struct devlink_linecard_get_req_dump *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_linecard_get_list { + struct devlink_linecard_get_list *next; + struct devlink_linecard_get_rsp obj __attribute__((aligned(8))); +}; + +void devlink_linecard_get_list_free(struct devlink_linecard_get_list *rsp); + +struct devlink_linecard_get_list * +devlink_linecard_get_dump(struct ynl_sock *ys, + struct devlink_linecard_get_req_dump *req); + +/* ============== DEVLINK_CMD_LINECARD_SET ============== */ +/* DEVLINK_CMD_LINECARD_SET - do */ +struct devlink_linecard_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 linecard_index:1; + __u32 linecard_type_len; + } _present; + + char *bus_name; + char *dev_name; + __u32 linecard_index; + char *linecard_type; +}; + +static inline struct devlink_linecard_set_req * +devlink_linecard_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_linecard_set_req)); +} +void devlink_linecard_set_req_free(struct devlink_linecard_set_req *req); + +static inline void +devlink_linecard_set_req_set_bus_name(struct devlink_linecard_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_linecard_set_req_set_dev_name(struct devlink_linecard_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_linecard_set_req_set_linecard_index(struct devlink_linecard_set_req *req, + __u32 linecard_index) +{ + req->_present.linecard_index = 1; + req->linecard_index = linecard_index; +} +static inline void +devlink_linecard_set_req_set_linecard_type(struct devlink_linecard_set_req *req, + const char *linecard_type) +{ + free(req->linecard_type); + req->_present.linecard_type_len = strlen(linecard_type); + req->linecard_type = malloc(req->_present.linecard_type_len + 1); + memcpy(req->linecard_type, linecard_type, req->_present.linecard_type_len); + req->linecard_type[req->_present.linecard_type_len] = 0; +} + +/* + * Set line card instances. + */ +int devlink_linecard_set(struct ynl_sock *ys, + struct devlink_linecard_set_req *req); + +/* ============== DEVLINK_CMD_SELFTESTS_GET ============== */ +/* DEVLINK_CMD_SELFTESTS_GET - do */ +struct devlink_selftests_get_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +static inline struct devlink_selftests_get_req * +devlink_selftests_get_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_selftests_get_req)); +} +void devlink_selftests_get_req_free(struct devlink_selftests_get_req *req); + +static inline void +devlink_selftests_get_req_set_bus_name(struct devlink_selftests_get_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_selftests_get_req_set_dev_name(struct devlink_selftests_get_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} + +struct devlink_selftests_get_rsp { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + } _present; + + char *bus_name; + char *dev_name; +}; + +void devlink_selftests_get_rsp_free(struct devlink_selftests_get_rsp *rsp); + +/* + * Get device selftest instances. + */ +struct devlink_selftests_get_rsp * +devlink_selftests_get(struct ynl_sock *ys, + struct devlink_selftests_get_req *req); + +/* DEVLINK_CMD_SELFTESTS_GET - dump */ +struct devlink_selftests_get_list { + struct devlink_selftests_get_list *next; + struct devlink_selftests_get_rsp obj __attribute__((aligned(8))); +}; + +void devlink_selftests_get_list_free(struct devlink_selftests_get_list *rsp); + +struct devlink_selftests_get_list * +devlink_selftests_get_dump(struct ynl_sock *ys); + +/* ============== DEVLINK_CMD_SELFTESTS_RUN ============== */ +/* DEVLINK_CMD_SELFTESTS_RUN - do */ +struct devlink_selftests_run_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 selftests:1; + } _present; + + char *bus_name; + char *dev_name; + struct devlink_dl_selftest_id selftests; +}; + +static inline struct devlink_selftests_run_req * +devlink_selftests_run_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_selftests_run_req)); +} +void devlink_selftests_run_req_free(struct devlink_selftests_run_req *req); + +static inline void +devlink_selftests_run_req_set_bus_name(struct devlink_selftests_run_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_selftests_run_req_set_dev_name(struct devlink_selftests_run_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_selftests_run_req_set_selftests_flash(struct devlink_selftests_run_req *req) +{ + req->_present.selftests = 1; + req->selftests._present.flash = 1; +} + +/* + * Run device selftest instances. + */ +int devlink_selftests_run(struct ynl_sock *ys, + struct devlink_selftests_run_req *req); + +/* ============== DEVLINK_CMD_NOTIFY_FILTER_SET ============== */ +/* DEVLINK_CMD_NOTIFY_FILTER_SET - do */ +struct devlink_notify_filter_set_req { + struct { + __u32 bus_name_len; + __u32 dev_name_len; + __u32 port_index:1; + } _present; + + char *bus_name; + char *dev_name; + __u32 port_index; +}; + +static inline struct devlink_notify_filter_set_req * +devlink_notify_filter_set_req_alloc(void) +{ + return calloc(1, sizeof(struct devlink_notify_filter_set_req)); +} +void +devlink_notify_filter_set_req_free(struct devlink_notify_filter_set_req *req); + +static inline void +devlink_notify_filter_set_req_set_bus_name(struct devlink_notify_filter_set_req *req, + const char *bus_name) +{ + free(req->bus_name); + req->_present.bus_name_len = strlen(bus_name); + req->bus_name = malloc(req->_present.bus_name_len + 1); + memcpy(req->bus_name, bus_name, req->_present.bus_name_len); + req->bus_name[req->_present.bus_name_len] = 0; +} +static inline void +devlink_notify_filter_set_req_set_dev_name(struct devlink_notify_filter_set_req *req, + const char *dev_name) +{ + free(req->dev_name); + req->_present.dev_name_len = strlen(dev_name); + req->dev_name = malloc(req->_present.dev_name_len + 1); + memcpy(req->dev_name, dev_name, req->_present.dev_name_len); + req->dev_name[req->_present.dev_name_len] = 0; +} +static inline void +devlink_notify_filter_set_req_set_port_index(struct devlink_notify_filter_set_req *req, + __u32 port_index) +{ + req->_present.port_index = 1; + req->port_index = port_index; +} + +/* + * Set notification messages socket filter. + */ +int devlink_notify_filter_set(struct ynl_sock *ys, + struct devlink_notify_filter_set_req *req); + +#endif /* _LINUX_DEVLINK_GEN_H */ diff --git a/include/ynl-c/dpll.h b/include/ynl-c/dpll.h new file mode 100644 index 0000000..9055d42 --- /dev/null +++ b/include/ynl-c/dpll.h @@ -0,0 +1,538 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/dpll.yaml */ +/* YNL-GEN user header */ + +#ifndef _LINUX_DPLL_GEN_H +#define _LINUX_DPLL_GEN_H + +#include +#include +#include +#include + +struct ynl_sock; + +extern const struct ynl_family ynl_dpll_family; + +/* Enums */ +const char *dpll_op_str(int op); +const char *dpll_mode_str(enum dpll_mode value); +const char *dpll_lock_status_str(enum dpll_lock_status value); +const char *dpll_lock_status_error_str(enum dpll_lock_status_error value); +const char *dpll_type_str(enum dpll_type value); +const char *dpll_pin_type_str(enum dpll_pin_type value); +const char *dpll_pin_direction_str(enum dpll_pin_direction value); +const char *dpll_pin_state_str(enum dpll_pin_state value); +const char *dpll_pin_capabilities_str(enum dpll_pin_capabilities value); + +/* Common nested types */ +struct dpll_frequency_range { + struct { + __u32 frequency_min:1; + __u32 frequency_max:1; + } _present; + + __u64 frequency_min; + __u64 frequency_max; +}; + +struct dpll_pin_parent_device { + struct { + __u32 parent_id:1; + __u32 direction:1; + __u32 prio:1; + __u32 state:1; + __u32 phase_offset:1; + } _present; + + __u32 parent_id; + enum dpll_pin_direction direction; + __u32 prio; + enum dpll_pin_state state; + __s64 phase_offset; +}; + +struct dpll_pin_parent_pin { + struct { + __u32 parent_id:1; + __u32 state:1; + } _present; + + __u32 parent_id; + enum dpll_pin_state state; +}; + +/* ============== DPLL_CMD_DEVICE_ID_GET ============== */ +/* DPLL_CMD_DEVICE_ID_GET - do */ +struct dpll_device_id_get_req { + struct { + __u32 module_name_len; + __u32 clock_id:1; + __u32 type:1; + } _present; + + char *module_name; + __u64 clock_id; + enum dpll_type type; +}; + +static inline struct dpll_device_id_get_req *dpll_device_id_get_req_alloc(void) +{ + return calloc(1, sizeof(struct dpll_device_id_get_req)); +} +void dpll_device_id_get_req_free(struct dpll_device_id_get_req *req); + +static inline void +dpll_device_id_get_req_set_module_name(struct dpll_device_id_get_req *req, + const char *module_name) +{ + free(req->module_name); + req->_present.module_name_len = strlen(module_name); + req->module_name = malloc(req->_present.module_name_len + 1); + memcpy(req->module_name, module_name, req->_present.module_name_len); + req->module_name[req->_present.module_name_len] = 0; +} +static inline void +dpll_device_id_get_req_set_clock_id(struct dpll_device_id_get_req *req, + __u64 clock_id) +{ + req->_present.clock_id = 1; + req->clock_id = clock_id; +} +static inline void +dpll_device_id_get_req_set_type(struct dpll_device_id_get_req *req, + enum dpll_type type) +{ + req->_present.type = 1; + req->type = type; +} + +struct dpll_device_id_get_rsp { + struct { + __u32 id:1; + } _present; + + __u32 id; +}; + +void dpll_device_id_get_rsp_free(struct dpll_device_id_get_rsp *rsp); + +/* + * Get id of dpll device that matches given attributes + + */ +struct dpll_device_id_get_rsp * +dpll_device_id_get(struct ynl_sock *ys, struct dpll_device_id_get_req *req); + +/* ============== DPLL_CMD_DEVICE_GET ============== */ +/* DPLL_CMD_DEVICE_GET - do */ +struct dpll_device_get_req { + struct { + __u32 id:1; + } _present; + + __u32 id; +}; + +static inline struct dpll_device_get_req *dpll_device_get_req_alloc(void) +{ + return calloc(1, sizeof(struct dpll_device_get_req)); +} +void dpll_device_get_req_free(struct dpll_device_get_req *req); + +static inline void +dpll_device_get_req_set_id(struct dpll_device_get_req *req, __u32 id) +{ + req->_present.id = 1; + req->id = id; +} + +struct dpll_device_get_rsp { + struct { + __u32 id:1; + __u32 module_name_len; + __u32 mode:1; + __u32 lock_status:1; + __u32 lock_status_error:1; + __u32 temp:1; + __u32 clock_id:1; + __u32 type:1; + } _present; + + __u32 id; + char *module_name; + enum dpll_mode mode; + unsigned int n_mode_supported; + __u32 *mode_supported; + enum dpll_lock_status lock_status; + enum dpll_lock_status_error lock_status_error; + __s32 temp; + __u64 clock_id; + enum dpll_type type; +}; + +void dpll_device_get_rsp_free(struct dpll_device_get_rsp *rsp); + +/* + * Get list of DPLL devices (dump) or attributes of a single dpll device + + */ +struct dpll_device_get_rsp * +dpll_device_get(struct ynl_sock *ys, struct dpll_device_get_req *req); + +/* DPLL_CMD_DEVICE_GET - dump */ +struct dpll_device_get_list { + struct dpll_device_get_list *next; + struct dpll_device_get_rsp obj __attribute__((aligned(8))); +}; + +void dpll_device_get_list_free(struct dpll_device_get_list *rsp); + +struct dpll_device_get_list *dpll_device_get_dump(struct ynl_sock *ys); + +/* DPLL_CMD_DEVICE_GET - notify */ +struct dpll_device_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct dpll_device_get_ntf *ntf); + struct dpll_device_get_rsp obj __attribute__((aligned(8))); +}; + +void dpll_device_get_ntf_free(struct dpll_device_get_ntf *rsp); + +/* ============== DPLL_CMD_DEVICE_SET ============== */ +/* DPLL_CMD_DEVICE_SET - do */ +struct dpll_device_set_req { + struct { + __u32 id:1; + } _present; + + __u32 id; +}; + +static inline struct dpll_device_set_req *dpll_device_set_req_alloc(void) +{ + return calloc(1, sizeof(struct dpll_device_set_req)); +} +void dpll_device_set_req_free(struct dpll_device_set_req *req); + +static inline void +dpll_device_set_req_set_id(struct dpll_device_set_req *req, __u32 id) +{ + req->_present.id = 1; + req->id = id; +} + +/* + * Set attributes for a DPLL device + */ +int dpll_device_set(struct ynl_sock *ys, struct dpll_device_set_req *req); + +/* ============== DPLL_CMD_PIN_ID_GET ============== */ +/* DPLL_CMD_PIN_ID_GET - do */ +struct dpll_pin_id_get_req { + struct { + __u32 module_name_len; + __u32 clock_id:1; + __u32 board_label_len; + __u32 panel_label_len; + __u32 package_label_len; + __u32 type:1; + } _present; + + char *module_name; + __u64 clock_id; + char *board_label; + char *panel_label; + char *package_label; + enum dpll_pin_type type; +}; + +static inline struct dpll_pin_id_get_req *dpll_pin_id_get_req_alloc(void) +{ + return calloc(1, sizeof(struct dpll_pin_id_get_req)); +} +void dpll_pin_id_get_req_free(struct dpll_pin_id_get_req *req); + +static inline void +dpll_pin_id_get_req_set_module_name(struct dpll_pin_id_get_req *req, + const char *module_name) +{ + free(req->module_name); + req->_present.module_name_len = strlen(module_name); + req->module_name = malloc(req->_present.module_name_len + 1); + memcpy(req->module_name, module_name, req->_present.module_name_len); + req->module_name[req->_present.module_name_len] = 0; +} +static inline void +dpll_pin_id_get_req_set_clock_id(struct dpll_pin_id_get_req *req, + __u64 clock_id) +{ + req->_present.clock_id = 1; + req->clock_id = clock_id; +} +static inline void +dpll_pin_id_get_req_set_board_label(struct dpll_pin_id_get_req *req, + const char *board_label) +{ + free(req->board_label); + req->_present.board_label_len = strlen(board_label); + req->board_label = malloc(req->_present.board_label_len + 1); + memcpy(req->board_label, board_label, req->_present.board_label_len); + req->board_label[req->_present.board_label_len] = 0; +} +static inline void +dpll_pin_id_get_req_set_panel_label(struct dpll_pin_id_get_req *req, + const char *panel_label) +{ + free(req->panel_label); + req->_present.panel_label_len = strlen(panel_label); + req->panel_label = malloc(req->_present.panel_label_len + 1); + memcpy(req->panel_label, panel_label, req->_present.panel_label_len); + req->panel_label[req->_present.panel_label_len] = 0; +} +static inline void +dpll_pin_id_get_req_set_package_label(struct dpll_pin_id_get_req *req, + const char *package_label) +{ + free(req->package_label); + req->_present.package_label_len = strlen(package_label); + req->package_label = malloc(req->_present.package_label_len + 1); + memcpy(req->package_label, package_label, req->_present.package_label_len); + req->package_label[req->_present.package_label_len] = 0; +} +static inline void +dpll_pin_id_get_req_set_type(struct dpll_pin_id_get_req *req, + enum dpll_pin_type type) +{ + req->_present.type = 1; + req->type = type; +} + +struct dpll_pin_id_get_rsp { + struct { + __u32 id:1; + } _present; + + __u32 id; +}; + +void dpll_pin_id_get_rsp_free(struct dpll_pin_id_get_rsp *rsp); + +/* + * Get id of a pin that matches given attributes + + */ +struct dpll_pin_id_get_rsp * +dpll_pin_id_get(struct ynl_sock *ys, struct dpll_pin_id_get_req *req); + +/* ============== DPLL_CMD_PIN_GET ============== */ +/* DPLL_CMD_PIN_GET - do */ +struct dpll_pin_get_req { + struct { + __u32 id:1; + } _present; + + __u32 id; +}; + +static inline struct dpll_pin_get_req *dpll_pin_get_req_alloc(void) +{ + return calloc(1, sizeof(struct dpll_pin_get_req)); +} +void dpll_pin_get_req_free(struct dpll_pin_get_req *req); + +static inline void +dpll_pin_get_req_set_id(struct dpll_pin_get_req *req, __u32 id) +{ + req->_present.id = 1; + req->id = id; +} + +struct dpll_pin_get_rsp { + struct { + __u32 id:1; + __u32 board_label_len; + __u32 panel_label_len; + __u32 package_label_len; + __u32 type:1; + __u32 frequency:1; + __u32 capabilities:1; + __u32 phase_adjust_min:1; + __u32 phase_adjust_max:1; + __u32 phase_adjust:1; + __u32 fractional_frequency_offset:1; + } _present; + + __u32 id; + char *board_label; + char *panel_label; + char *package_label; + enum dpll_pin_type type; + __u64 frequency; + unsigned int n_frequency_supported; + struct dpll_frequency_range *frequency_supported; + __u32 capabilities; + unsigned int n_parent_device; + struct dpll_pin_parent_device *parent_device; + unsigned int n_parent_pin; + struct dpll_pin_parent_pin *parent_pin; + __s32 phase_adjust_min; + __s32 phase_adjust_max; + __s32 phase_adjust; + __s64 fractional_frequency_offset; +}; + +void dpll_pin_get_rsp_free(struct dpll_pin_get_rsp *rsp); + +/* + * Get list of pins and its attributes. +- dump request without any attributes given - list all the pins in the + system +- dump request with target dpll - list all the pins registered with + a given dpll device +- do request with target dpll and target pin - single pin attributes + + */ +struct dpll_pin_get_rsp * +dpll_pin_get(struct ynl_sock *ys, struct dpll_pin_get_req *req); + +/* DPLL_CMD_PIN_GET - dump */ +struct dpll_pin_get_req_dump { + struct { + __u32 id:1; + } _present; + + __u32 id; +}; + +static inline struct dpll_pin_get_req_dump *dpll_pin_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct dpll_pin_get_req_dump)); +} +void dpll_pin_get_req_dump_free(struct dpll_pin_get_req_dump *req); + +static inline void +dpll_pin_get_req_dump_set_id(struct dpll_pin_get_req_dump *req, __u32 id) +{ + req->_present.id = 1; + req->id = id; +} + +struct dpll_pin_get_list { + struct dpll_pin_get_list *next; + struct dpll_pin_get_rsp obj __attribute__((aligned(8))); +}; + +void dpll_pin_get_list_free(struct dpll_pin_get_list *rsp); + +struct dpll_pin_get_list * +dpll_pin_get_dump(struct ynl_sock *ys, struct dpll_pin_get_req_dump *req); + +/* DPLL_CMD_PIN_GET - notify */ +struct dpll_pin_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct dpll_pin_get_ntf *ntf); + struct dpll_pin_get_rsp obj __attribute__((aligned(8))); +}; + +void dpll_pin_get_ntf_free(struct dpll_pin_get_ntf *rsp); + +/* ============== DPLL_CMD_PIN_SET ============== */ +/* DPLL_CMD_PIN_SET - do */ +struct dpll_pin_set_req { + struct { + __u32 id:1; + __u32 frequency:1; + __u32 direction:1; + __u32 prio:1; + __u32 state:1; + __u32 phase_adjust:1; + } _present; + + __u32 id; + __u64 frequency; + enum dpll_pin_direction direction; + __u32 prio; + enum dpll_pin_state state; + unsigned int n_parent_device; + struct dpll_pin_parent_device *parent_device; + unsigned int n_parent_pin; + struct dpll_pin_parent_pin *parent_pin; + __s32 phase_adjust; +}; + +static inline struct dpll_pin_set_req *dpll_pin_set_req_alloc(void) +{ + return calloc(1, sizeof(struct dpll_pin_set_req)); +} +void dpll_pin_set_req_free(struct dpll_pin_set_req *req); + +static inline void +dpll_pin_set_req_set_id(struct dpll_pin_set_req *req, __u32 id) +{ + req->_present.id = 1; + req->id = id; +} +static inline void +dpll_pin_set_req_set_frequency(struct dpll_pin_set_req *req, __u64 frequency) +{ + req->_present.frequency = 1; + req->frequency = frequency; +} +static inline void +dpll_pin_set_req_set_direction(struct dpll_pin_set_req *req, + enum dpll_pin_direction direction) +{ + req->_present.direction = 1; + req->direction = direction; +} +static inline void +dpll_pin_set_req_set_prio(struct dpll_pin_set_req *req, __u32 prio) +{ + req->_present.prio = 1; + req->prio = prio; +} +static inline void +dpll_pin_set_req_set_state(struct dpll_pin_set_req *req, + enum dpll_pin_state state) +{ + req->_present.state = 1; + req->state = state; +} +static inline void +__dpll_pin_set_req_set_parent_device(struct dpll_pin_set_req *req, + struct dpll_pin_parent_device *parent_device, + unsigned int n_parent_device) +{ + free(req->parent_device); + req->parent_device = parent_device; + req->n_parent_device = n_parent_device; +} +static inline void +__dpll_pin_set_req_set_parent_pin(struct dpll_pin_set_req *req, + struct dpll_pin_parent_pin *parent_pin, + unsigned int n_parent_pin) +{ + free(req->parent_pin); + req->parent_pin = parent_pin; + req->n_parent_pin = n_parent_pin; +} +static inline void +dpll_pin_set_req_set_phase_adjust(struct dpll_pin_set_req *req, + __s32 phase_adjust) +{ + req->_present.phase_adjust = 1; + req->phase_adjust = phase_adjust; +} + +/* + * Set attributes of a target pin + */ +int dpll_pin_set(struct ynl_sock *ys, struct dpll_pin_set_req *req); + +#endif /* _LINUX_DPLL_GEN_H */ diff --git a/include/ynl-c/ethtool.h b/include/ynl-c/ethtool.h new file mode 100644 index 0000000..ebaf14f --- /dev/null +++ b/include/ynl-c/ethtool.h @@ -0,0 +1,5537 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/ethtool.yaml */ +/* YNL-GEN user header */ +/* YNL-ARG --user-header linux/ethtool_netlink.h --exclude-op stats-get */ + +#ifndef _LINUX_ETHTOOL_GEN_H +#define _LINUX_ETHTOOL_GEN_H + +#include +#include +#include +#include + +struct ynl_sock; + +extern const struct ynl_family ynl_ethtool_family; + +/* Enums */ +const char *ethtool_op_str(int op); +const char *ethtool_udp_tunnel_type_str(int value); +const char *ethtool_stringset_str(enum ethtool_stringset value); + +/* Common nested types */ +struct ethtool_header { + struct { + __u32 dev_index:1; + __u32 dev_name_len; + __u32 flags:1; + } _present; + + __u32 dev_index; + char *dev_name; + __u32 flags; +}; + +struct ethtool_pause_stat { + struct { + __u32 tx_frames:1; + __u32 rx_frames:1; + } _present; + + __u64 tx_frames; + __u64 rx_frames; +}; + +struct ethtool_cable_test_tdr_cfg { + struct { + __u32 first:1; + __u32 last:1; + __u32 step:1; + __u32 pair:1; + } _present; + + __u32 first; + __u32 last; + __u32 step; + __u8 pair; +}; + +struct ethtool_fec_stat { + struct { + __u32 corrected_len; + __u32 uncorr_len; + __u32 corr_bits_len; + } _present; + + void *corrected; + void *uncorr; + void *corr_bits; +}; + +struct ethtool_mm_stat { + struct { + __u32 reassembly_errors:1; + __u32 smd_errors:1; + __u32 reassembly_ok:1; + __u32 rx_frag_count:1; + __u32 tx_frag_count:1; + __u32 hold_count:1; + } _present; + + __u64 reassembly_errors; + __u64 smd_errors; + __u64 reassembly_ok; + __u64 rx_frag_count; + __u64 tx_frag_count; + __u64 hold_count; +}; + +struct ethtool_cable_result { + struct { + __u32 pair:1; + __u32 code:1; + } _present; + + __u8 pair; + __u8 code; +}; + +struct ethtool_cable_fault_length { + struct { + __u32 pair:1; + __u32 cm:1; + } _present; + + __u8 pair; + __u32 cm; +}; + +struct ethtool_bitset_bit { + struct { + __u32 index:1; + __u32 name_len; + __u32 value:1; + } _present; + + __u32 index; + char *name; +}; + +struct ethtool_tunnel_udp_entry { + struct { + __u32 port:1; + __u32 type:1; + } _present; + + __u16 port /* big-endian */; + int type; +}; + +struct ethtool_string { + struct { + __u32 index:1; + __u32 value_len; + } _present; + + __u32 index; + char *value; +}; + +struct ethtool_cable_nest { + struct { + __u32 result:1; + __u32 fault_length:1; + } _present; + + struct ethtool_cable_result result; + struct ethtool_cable_fault_length fault_length; +}; + +struct ethtool_bitset_bits { + unsigned int n_bit; + struct ethtool_bitset_bit *bit; +}; + +struct ethtool_strings { + unsigned int n_string; + struct ethtool_string *string; +}; + +struct ethtool_bitset { + struct { + __u32 nomask:1; + __u32 size:1; + __u32 bits:1; + } _present; + + __u32 size; + struct ethtool_bitset_bits bits; +}; + +struct ethtool_stringset_ { + struct { + __u32 id:1; + __u32 count:1; + } _present; + + __u32 id; + __u32 count; + unsigned int n_strings; + struct ethtool_strings *strings; +}; + +struct ethtool_tunnel_udp_table { + struct { + __u32 size:1; + __u32 types:1; + } _present; + + __u32 size; + struct ethtool_bitset types; + unsigned int n_entry; + struct ethtool_tunnel_udp_entry *entry; +}; + +struct ethtool_stringsets { + unsigned int n_stringset; + struct ethtool_stringset_ *stringset; +}; + +struct ethtool_tunnel_udp { + struct { + __u32 table:1; + } _present; + + struct ethtool_tunnel_udp_table table; +}; + +/* ============== ETHTOOL_MSG_STRSET_GET ============== */ +/* ETHTOOL_MSG_STRSET_GET - do */ +struct ethtool_strset_get_req { + struct { + __u32 header:1; + __u32 stringsets:1; + __u32 counts_only:1; + } _present; + + struct ethtool_header header; + struct ethtool_stringsets stringsets; +}; + +static inline struct ethtool_strset_get_req *ethtool_strset_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_strset_get_req)); +} +void ethtool_strset_get_req_free(struct ethtool_strset_get_req *req); + +static inline void +ethtool_strset_get_req_set_header_dev_index(struct ethtool_strset_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_strset_get_req_set_header_dev_name(struct ethtool_strset_get_req *req, + const char *dev_name) +{ + 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_strset_get_req_set_header_flags(struct ethtool_strset_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +__ethtool_strset_get_req_set_stringsets_stringset(struct ethtool_strset_get_req *req, + struct ethtool_stringset_ *stringset, + unsigned int n_stringset) +{ + free(req->stringsets.stringset); + req->stringsets.stringset = stringset; + req->stringsets.n_stringset = n_stringset; +} +static inline void +ethtool_strset_get_req_set_counts_only(struct ethtool_strset_get_req *req) +{ + req->_present.counts_only = 1; +} + +struct ethtool_strset_get_rsp { + struct { + __u32 header:1; + __u32 stringsets:1; + } _present; + + struct ethtool_header header; + struct ethtool_stringsets stringsets; +}; + +void ethtool_strset_get_rsp_free(struct ethtool_strset_get_rsp *rsp); + +/* + * Get string set from the kernel. + */ +struct ethtool_strset_get_rsp * +ethtool_strset_get(struct ynl_sock *ys, struct ethtool_strset_get_req *req); + +/* ETHTOOL_MSG_STRSET_GET - dump */ +struct ethtool_strset_get_req_dump { + struct { + __u32 header:1; + __u32 stringsets:1; + __u32 counts_only:1; + } _present; + + struct ethtool_header header; + struct ethtool_stringsets stringsets; +}; + +static inline struct ethtool_strset_get_req_dump * +ethtool_strset_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_strset_get_req_dump)); +} +void ethtool_strset_get_req_dump_free(struct ethtool_strset_get_req_dump *req); + +static inline void +ethtool_strset_get_req_dump_set_header_dev_index(struct ethtool_strset_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_strset_get_req_dump_set_header_dev_name(struct ethtool_strset_get_req_dump *req, + const char *dev_name) +{ + 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_strset_get_req_dump_set_header_flags(struct ethtool_strset_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +__ethtool_strset_get_req_dump_set_stringsets_stringset(struct ethtool_strset_get_req_dump *req, + struct ethtool_stringset_ *stringset, + unsigned int n_stringset) +{ + free(req->stringsets.stringset); + req->stringsets.stringset = stringset; + req->stringsets.n_stringset = n_stringset; +} +static inline void +ethtool_strset_get_req_dump_set_counts_only(struct ethtool_strset_get_req_dump *req) +{ + req->_present.counts_only = 1; +} + +struct ethtool_strset_get_list { + struct ethtool_strset_get_list *next; + struct ethtool_strset_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_strset_get_list_free(struct ethtool_strset_get_list *rsp); + +struct ethtool_strset_get_list * +ethtool_strset_get_dump(struct ynl_sock *ys, + struct ethtool_strset_get_req_dump *req); + +/* ============== ETHTOOL_MSG_LINKINFO_GET ============== */ +/* ETHTOOL_MSG_LINKINFO_GET - do */ +struct ethtool_linkinfo_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_linkinfo_get_req * +ethtool_linkinfo_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_linkinfo_get_req)); +} +void ethtool_linkinfo_get_req_free(struct ethtool_linkinfo_get_req *req); + +static inline void +ethtool_linkinfo_get_req_set_header_dev_index(struct ethtool_linkinfo_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_linkinfo_get_req_set_header_dev_name(struct ethtool_linkinfo_get_req *req, + const char *dev_name) +{ + 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_linkinfo_get_req_set_header_flags(struct ethtool_linkinfo_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_linkinfo_get_rsp { + struct { + __u32 header:1; + __u32 port:1; + __u32 phyaddr:1; + __u32 tp_mdix:1; + __u32 tp_mdix_ctrl:1; + __u32 transceiver:1; + } _present; + + struct ethtool_header header; + __u8 port; + __u8 phyaddr; + __u8 tp_mdix; + __u8 tp_mdix_ctrl; + __u8 transceiver; +}; + +void ethtool_linkinfo_get_rsp_free(struct ethtool_linkinfo_get_rsp *rsp); + +/* + * Get link info. + */ +struct ethtool_linkinfo_get_rsp * +ethtool_linkinfo_get(struct ynl_sock *ys, struct ethtool_linkinfo_get_req *req); + +/* ETHTOOL_MSG_LINKINFO_GET - dump */ +struct ethtool_linkinfo_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_linkinfo_get_req_dump * +ethtool_linkinfo_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_linkinfo_get_req_dump)); +} +void +ethtool_linkinfo_get_req_dump_free(struct ethtool_linkinfo_get_req_dump *req); + +static inline void +ethtool_linkinfo_get_req_dump_set_header_dev_index(struct ethtool_linkinfo_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_linkinfo_get_req_dump_set_header_dev_name(struct ethtool_linkinfo_get_req_dump *req, + const char *dev_name) +{ + 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_linkinfo_get_req_dump_set_header_flags(struct ethtool_linkinfo_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_linkinfo_get_list { + struct ethtool_linkinfo_get_list *next; + struct ethtool_linkinfo_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_linkinfo_get_list_free(struct ethtool_linkinfo_get_list *rsp); + +struct ethtool_linkinfo_get_list * +ethtool_linkinfo_get_dump(struct ynl_sock *ys, + struct ethtool_linkinfo_get_req_dump *req); + +/* ETHTOOL_MSG_LINKINFO_GET - notify */ +struct ethtool_linkinfo_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_linkinfo_get_ntf *ntf); + struct ethtool_linkinfo_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_linkinfo_get_ntf_free(struct ethtool_linkinfo_get_ntf *rsp); + +/* ============== ETHTOOL_MSG_LINKINFO_SET ============== */ +/* ETHTOOL_MSG_LINKINFO_SET - do */ +struct ethtool_linkinfo_set_req { + struct { + __u32 header:1; + __u32 port:1; + __u32 phyaddr:1; + __u32 tp_mdix:1; + __u32 tp_mdix_ctrl:1; + __u32 transceiver:1; + } _present; + + struct ethtool_header header; + __u8 port; + __u8 phyaddr; + __u8 tp_mdix; + __u8 tp_mdix_ctrl; + __u8 transceiver; +}; + +static inline struct ethtool_linkinfo_set_req * +ethtool_linkinfo_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_linkinfo_set_req)); +} +void ethtool_linkinfo_set_req_free(struct ethtool_linkinfo_set_req *req); + +static inline void +ethtool_linkinfo_set_req_set_header_dev_index(struct ethtool_linkinfo_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_linkinfo_set_req_set_header_dev_name(struct ethtool_linkinfo_set_req *req, + const char *dev_name) +{ + 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_linkinfo_set_req_set_header_flags(struct ethtool_linkinfo_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_linkinfo_set_req_set_port(struct ethtool_linkinfo_set_req *req, + __u8 port) +{ + req->_present.port = 1; + req->port = port; +} +static inline void +ethtool_linkinfo_set_req_set_phyaddr(struct ethtool_linkinfo_set_req *req, + __u8 phyaddr) +{ + req->_present.phyaddr = 1; + req->phyaddr = phyaddr; +} +static inline void +ethtool_linkinfo_set_req_set_tp_mdix(struct ethtool_linkinfo_set_req *req, + __u8 tp_mdix) +{ + req->_present.tp_mdix = 1; + req->tp_mdix = tp_mdix; +} +static inline void +ethtool_linkinfo_set_req_set_tp_mdix_ctrl(struct ethtool_linkinfo_set_req *req, + __u8 tp_mdix_ctrl) +{ + req->_present.tp_mdix_ctrl = 1; + req->tp_mdix_ctrl = tp_mdix_ctrl; +} +static inline void +ethtool_linkinfo_set_req_set_transceiver(struct ethtool_linkinfo_set_req *req, + __u8 transceiver) +{ + req->_present.transceiver = 1; + req->transceiver = transceiver; +} + +/* + * Set link info. + */ +int ethtool_linkinfo_set(struct ynl_sock *ys, + struct ethtool_linkinfo_set_req *req); + +/* ============== ETHTOOL_MSG_LINKMODES_GET ============== */ +/* ETHTOOL_MSG_LINKMODES_GET - do */ +struct ethtool_linkmodes_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_linkmodes_get_req * +ethtool_linkmodes_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_linkmodes_get_req)); +} +void ethtool_linkmodes_get_req_free(struct ethtool_linkmodes_get_req *req); + +static inline void +ethtool_linkmodes_get_req_set_header_dev_index(struct ethtool_linkmodes_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_linkmodes_get_req_set_header_dev_name(struct ethtool_linkmodes_get_req *req, + const char *dev_name) +{ + 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_linkmodes_get_req_set_header_flags(struct ethtool_linkmodes_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_linkmodes_get_rsp { + struct { + __u32 header:1; + __u32 autoneg:1; + __u32 ours:1; + __u32 peer:1; + __u32 speed:1; + __u32 duplex:1; + __u32 master_slave_cfg:1; + __u32 master_slave_state:1; + __u32 lanes:1; + __u32 rate_matching:1; + } _present; + + struct ethtool_header header; + __u8 autoneg; + struct ethtool_bitset ours; + struct ethtool_bitset peer; + __u32 speed; + __u8 duplex; + __u8 master_slave_cfg; + __u8 master_slave_state; + __u32 lanes; + __u8 rate_matching; +}; + +void ethtool_linkmodes_get_rsp_free(struct ethtool_linkmodes_get_rsp *rsp); + +/* + * Get link modes. + */ +struct ethtool_linkmodes_get_rsp * +ethtool_linkmodes_get(struct ynl_sock *ys, + struct ethtool_linkmodes_get_req *req); + +/* ETHTOOL_MSG_LINKMODES_GET - dump */ +struct ethtool_linkmodes_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_linkmodes_get_req_dump * +ethtool_linkmodes_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_linkmodes_get_req_dump)); +} +void +ethtool_linkmodes_get_req_dump_free(struct ethtool_linkmodes_get_req_dump *req); + +static inline void +ethtool_linkmodes_get_req_dump_set_header_dev_index(struct ethtool_linkmodes_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_linkmodes_get_req_dump_set_header_dev_name(struct ethtool_linkmodes_get_req_dump *req, + const char *dev_name) +{ + 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_linkmodes_get_req_dump_set_header_flags(struct ethtool_linkmodes_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_linkmodes_get_list { + struct ethtool_linkmodes_get_list *next; + struct ethtool_linkmodes_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_linkmodes_get_list_free(struct ethtool_linkmodes_get_list *rsp); + +struct ethtool_linkmodes_get_list * +ethtool_linkmodes_get_dump(struct ynl_sock *ys, + struct ethtool_linkmodes_get_req_dump *req); + +/* ETHTOOL_MSG_LINKMODES_GET - notify */ +struct ethtool_linkmodes_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_linkmodes_get_ntf *ntf); + struct ethtool_linkmodes_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_linkmodes_get_ntf_free(struct ethtool_linkmodes_get_ntf *rsp); + +/* ============== ETHTOOL_MSG_LINKMODES_SET ============== */ +/* ETHTOOL_MSG_LINKMODES_SET - do */ +struct ethtool_linkmodes_set_req { + struct { + __u32 header:1; + __u32 autoneg:1; + __u32 ours:1; + __u32 peer:1; + __u32 speed:1; + __u32 duplex:1; + __u32 master_slave_cfg:1; + __u32 master_slave_state:1; + __u32 lanes:1; + __u32 rate_matching:1; + } _present; + + struct ethtool_header header; + __u8 autoneg; + struct ethtool_bitset ours; + struct ethtool_bitset peer; + __u32 speed; + __u8 duplex; + __u8 master_slave_cfg; + __u8 master_slave_state; + __u32 lanes; + __u8 rate_matching; +}; + +static inline struct ethtool_linkmodes_set_req * +ethtool_linkmodes_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_linkmodes_set_req)); +} +void ethtool_linkmodes_set_req_free(struct ethtool_linkmodes_set_req *req); + +static inline void +ethtool_linkmodes_set_req_set_header_dev_index(struct ethtool_linkmodes_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_linkmodes_set_req_set_header_dev_name(struct ethtool_linkmodes_set_req *req, + const char *dev_name) +{ + 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_linkmodes_set_req_set_header_flags(struct ethtool_linkmodes_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_linkmodes_set_req_set_autoneg(struct ethtool_linkmodes_set_req *req, + __u8 autoneg) +{ + req->_present.autoneg = 1; + req->autoneg = autoneg; +} +static inline void +ethtool_linkmodes_set_req_set_ours_nomask(struct ethtool_linkmodes_set_req *req) +{ + req->_present.ours = 1; + req->ours._present.nomask = 1; +} +static inline void +ethtool_linkmodes_set_req_set_ours_size(struct ethtool_linkmodes_set_req *req, + __u32 size) +{ + req->_present.ours = 1; + req->ours._present.size = 1; + req->ours.size = size; +} +static inline void +__ethtool_linkmodes_set_req_set_ours_bits_bit(struct ethtool_linkmodes_set_req *req, + struct ethtool_bitset_bit *bit, + unsigned int n_bit) +{ + free(req->ours.bits.bit); + req->ours.bits.bit = bit; + req->ours.bits.n_bit = n_bit; +} +static inline void +ethtool_linkmodes_set_req_set_peer_nomask(struct ethtool_linkmodes_set_req *req) +{ + req->_present.peer = 1; + req->peer._present.nomask = 1; +} +static inline void +ethtool_linkmodes_set_req_set_peer_size(struct ethtool_linkmodes_set_req *req, + __u32 size) +{ + req->_present.peer = 1; + req->peer._present.size = 1; + req->peer.size = size; +} +static inline void +__ethtool_linkmodes_set_req_set_peer_bits_bit(struct ethtool_linkmodes_set_req *req, + struct ethtool_bitset_bit *bit, + unsigned int n_bit) +{ + free(req->peer.bits.bit); + req->peer.bits.bit = bit; + req->peer.bits.n_bit = n_bit; +} +static inline void +ethtool_linkmodes_set_req_set_speed(struct ethtool_linkmodes_set_req *req, + __u32 speed) +{ + req->_present.speed = 1; + req->speed = speed; +} +static inline void +ethtool_linkmodes_set_req_set_duplex(struct ethtool_linkmodes_set_req *req, + __u8 duplex) +{ + req->_present.duplex = 1; + req->duplex = duplex; +} +static inline void +ethtool_linkmodes_set_req_set_master_slave_cfg(struct ethtool_linkmodes_set_req *req, + __u8 master_slave_cfg) +{ + req->_present.master_slave_cfg = 1; + req->master_slave_cfg = master_slave_cfg; +} +static inline void +ethtool_linkmodes_set_req_set_master_slave_state(struct ethtool_linkmodes_set_req *req, + __u8 master_slave_state) +{ + req->_present.master_slave_state = 1; + req->master_slave_state = master_slave_state; +} +static inline void +ethtool_linkmodes_set_req_set_lanes(struct ethtool_linkmodes_set_req *req, + __u32 lanes) +{ + req->_present.lanes = 1; + req->lanes = lanes; +} +static inline void +ethtool_linkmodes_set_req_set_rate_matching(struct ethtool_linkmodes_set_req *req, + __u8 rate_matching) +{ + req->_present.rate_matching = 1; + req->rate_matching = rate_matching; +} + +/* + * Set link modes. + */ +int ethtool_linkmodes_set(struct ynl_sock *ys, + struct ethtool_linkmodes_set_req *req); + +/* ============== ETHTOOL_MSG_LINKSTATE_GET ============== */ +/* ETHTOOL_MSG_LINKSTATE_GET - do */ +struct ethtool_linkstate_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_linkstate_get_req * +ethtool_linkstate_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_linkstate_get_req)); +} +void ethtool_linkstate_get_req_free(struct ethtool_linkstate_get_req *req); + +static inline void +ethtool_linkstate_get_req_set_header_dev_index(struct ethtool_linkstate_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_linkstate_get_req_set_header_dev_name(struct ethtool_linkstate_get_req *req, + const char *dev_name) +{ + 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_linkstate_get_req_set_header_flags(struct ethtool_linkstate_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_linkstate_get_rsp { + struct { + __u32 header:1; + __u32 link:1; + __u32 sqi:1; + __u32 sqi_max:1; + __u32 ext_state:1; + __u32 ext_substate:1; + __u32 ext_down_cnt:1; + } _present; + + struct ethtool_header header; + __u8 link; + __u32 sqi; + __u32 sqi_max; + __u8 ext_state; + __u8 ext_substate; + __u32 ext_down_cnt; +}; + +void ethtool_linkstate_get_rsp_free(struct ethtool_linkstate_get_rsp *rsp); + +/* + * Get link state. + */ +struct ethtool_linkstate_get_rsp * +ethtool_linkstate_get(struct ynl_sock *ys, + struct ethtool_linkstate_get_req *req); + +/* ETHTOOL_MSG_LINKSTATE_GET - dump */ +struct ethtool_linkstate_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_linkstate_get_req_dump * +ethtool_linkstate_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_linkstate_get_req_dump)); +} +void +ethtool_linkstate_get_req_dump_free(struct ethtool_linkstate_get_req_dump *req); + +static inline void +ethtool_linkstate_get_req_dump_set_header_dev_index(struct ethtool_linkstate_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_linkstate_get_req_dump_set_header_dev_name(struct ethtool_linkstate_get_req_dump *req, + const char *dev_name) +{ + 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_linkstate_get_req_dump_set_header_flags(struct ethtool_linkstate_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_linkstate_get_list { + struct ethtool_linkstate_get_list *next; + struct ethtool_linkstate_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_linkstate_get_list_free(struct ethtool_linkstate_get_list *rsp); + +struct ethtool_linkstate_get_list * +ethtool_linkstate_get_dump(struct ynl_sock *ys, + struct ethtool_linkstate_get_req_dump *req); + +/* ============== ETHTOOL_MSG_DEBUG_GET ============== */ +/* ETHTOOL_MSG_DEBUG_GET - do */ +struct ethtool_debug_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_debug_get_req *ethtool_debug_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_debug_get_req)); +} +void ethtool_debug_get_req_free(struct ethtool_debug_get_req *req); + +static inline void +ethtool_debug_get_req_set_header_dev_index(struct ethtool_debug_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_debug_get_req_set_header_dev_name(struct ethtool_debug_get_req *req, + const char *dev_name) +{ + 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_debug_get_req_set_header_flags(struct ethtool_debug_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_debug_get_rsp { + struct { + __u32 header:1; + __u32 msgmask:1; + } _present; + + struct ethtool_header header; + struct ethtool_bitset msgmask; +}; + +void ethtool_debug_get_rsp_free(struct ethtool_debug_get_rsp *rsp); + +/* + * Get debug message mask. + */ +struct ethtool_debug_get_rsp * +ethtool_debug_get(struct ynl_sock *ys, struct ethtool_debug_get_req *req); + +/* ETHTOOL_MSG_DEBUG_GET - dump */ +struct ethtool_debug_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_debug_get_req_dump * +ethtool_debug_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_debug_get_req_dump)); +} +void ethtool_debug_get_req_dump_free(struct ethtool_debug_get_req_dump *req); + +static inline void +ethtool_debug_get_req_dump_set_header_dev_index(struct ethtool_debug_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_debug_get_req_dump_set_header_dev_name(struct ethtool_debug_get_req_dump *req, + const char *dev_name) +{ + 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_debug_get_req_dump_set_header_flags(struct ethtool_debug_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_debug_get_list { + struct ethtool_debug_get_list *next; + struct ethtool_debug_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_debug_get_list_free(struct ethtool_debug_get_list *rsp); + +struct ethtool_debug_get_list * +ethtool_debug_get_dump(struct ynl_sock *ys, + struct ethtool_debug_get_req_dump *req); + +/* ETHTOOL_MSG_DEBUG_GET - notify */ +struct ethtool_debug_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_debug_get_ntf *ntf); + struct ethtool_debug_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_debug_get_ntf_free(struct ethtool_debug_get_ntf *rsp); + +/* ============== ETHTOOL_MSG_DEBUG_SET ============== */ +/* ETHTOOL_MSG_DEBUG_SET - do */ +struct ethtool_debug_set_req { + struct { + __u32 header:1; + __u32 msgmask:1; + } _present; + + struct ethtool_header header; + struct ethtool_bitset msgmask; +}; + +static inline struct ethtool_debug_set_req *ethtool_debug_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_debug_set_req)); +} +void ethtool_debug_set_req_free(struct ethtool_debug_set_req *req); + +static inline void +ethtool_debug_set_req_set_header_dev_index(struct ethtool_debug_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_debug_set_req_set_header_dev_name(struct ethtool_debug_set_req *req, + const char *dev_name) +{ + 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_debug_set_req_set_header_flags(struct ethtool_debug_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_debug_set_req_set_msgmask_nomask(struct ethtool_debug_set_req *req) +{ + req->_present.msgmask = 1; + req->msgmask._present.nomask = 1; +} +static inline void +ethtool_debug_set_req_set_msgmask_size(struct ethtool_debug_set_req *req, + __u32 size) +{ + req->_present.msgmask = 1; + req->msgmask._present.size = 1; + req->msgmask.size = size; +} +static inline void +__ethtool_debug_set_req_set_msgmask_bits_bit(struct ethtool_debug_set_req *req, + struct ethtool_bitset_bit *bit, + unsigned int n_bit) +{ + free(req->msgmask.bits.bit); + req->msgmask.bits.bit = bit; + req->msgmask.bits.n_bit = n_bit; +} + +/* + * Set debug message mask. + */ +int ethtool_debug_set(struct ynl_sock *ys, struct ethtool_debug_set_req *req); + +/* ============== ETHTOOL_MSG_WOL_GET ============== */ +/* ETHTOOL_MSG_WOL_GET - do */ +struct ethtool_wol_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_wol_get_req *ethtool_wol_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_wol_get_req)); +} +void ethtool_wol_get_req_free(struct ethtool_wol_get_req *req); + +static inline void +ethtool_wol_get_req_set_header_dev_index(struct ethtool_wol_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_wol_get_req_set_header_dev_name(struct ethtool_wol_get_req *req, + const char *dev_name) +{ + 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_wol_get_req_set_header_flags(struct ethtool_wol_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_wol_get_rsp { + struct { + __u32 header:1; + __u32 modes:1; + __u32 sopass_len; + } _present; + + struct ethtool_header header; + struct ethtool_bitset modes; + void *sopass; +}; + +void ethtool_wol_get_rsp_free(struct ethtool_wol_get_rsp *rsp); + +/* + * Get WOL params. + */ +struct ethtool_wol_get_rsp * +ethtool_wol_get(struct ynl_sock *ys, struct ethtool_wol_get_req *req); + +/* ETHTOOL_MSG_WOL_GET - dump */ +struct ethtool_wol_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_wol_get_req_dump * +ethtool_wol_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_wol_get_req_dump)); +} +void ethtool_wol_get_req_dump_free(struct ethtool_wol_get_req_dump *req); + +static inline void +ethtool_wol_get_req_dump_set_header_dev_index(struct ethtool_wol_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_wol_get_req_dump_set_header_dev_name(struct ethtool_wol_get_req_dump *req, + const char *dev_name) +{ + 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_wol_get_req_dump_set_header_flags(struct ethtool_wol_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_wol_get_list { + struct ethtool_wol_get_list *next; + struct ethtool_wol_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_wol_get_list_free(struct ethtool_wol_get_list *rsp); + +struct ethtool_wol_get_list * +ethtool_wol_get_dump(struct ynl_sock *ys, struct ethtool_wol_get_req_dump *req); + +/* ETHTOOL_MSG_WOL_GET - notify */ +struct ethtool_wol_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_wol_get_ntf *ntf); + struct ethtool_wol_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_wol_get_ntf_free(struct ethtool_wol_get_ntf *rsp); + +/* ============== ETHTOOL_MSG_WOL_SET ============== */ +/* ETHTOOL_MSG_WOL_SET - do */ +struct ethtool_wol_set_req { + struct { + __u32 header:1; + __u32 modes:1; + __u32 sopass_len; + } _present; + + struct ethtool_header header; + struct ethtool_bitset modes; + void *sopass; +}; + +static inline struct ethtool_wol_set_req *ethtool_wol_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_wol_set_req)); +} +void ethtool_wol_set_req_free(struct ethtool_wol_set_req *req); + +static inline void +ethtool_wol_set_req_set_header_dev_index(struct ethtool_wol_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_wol_set_req_set_header_dev_name(struct ethtool_wol_set_req *req, + const char *dev_name) +{ + 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_wol_set_req_set_header_flags(struct ethtool_wol_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_wol_set_req_set_modes_nomask(struct ethtool_wol_set_req *req) +{ + req->_present.modes = 1; + req->modes._present.nomask = 1; +} +static inline void +ethtool_wol_set_req_set_modes_size(struct ethtool_wol_set_req *req, __u32 size) +{ + req->_present.modes = 1; + req->modes._present.size = 1; + req->modes.size = size; +} +static inline void +__ethtool_wol_set_req_set_modes_bits_bit(struct ethtool_wol_set_req *req, + struct ethtool_bitset_bit *bit, + unsigned int n_bit) +{ + free(req->modes.bits.bit); + req->modes.bits.bit = bit; + req->modes.bits.n_bit = n_bit; +} +static inline void +ethtool_wol_set_req_set_sopass(struct ethtool_wol_set_req *req, + const void *sopass, size_t len) +{ + free(req->sopass); + req->_present.sopass_len = len; + req->sopass = malloc(req->_present.sopass_len); + memcpy(req->sopass, sopass, req->_present.sopass_len); +} + +/* + * Set WOL params. + */ +int ethtool_wol_set(struct ynl_sock *ys, struct ethtool_wol_set_req *req); + +/* ============== ETHTOOL_MSG_FEATURES_GET ============== */ +/* ETHTOOL_MSG_FEATURES_GET - do */ +struct ethtool_features_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_features_get_req * +ethtool_features_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_features_get_req)); +} +void ethtool_features_get_req_free(struct ethtool_features_get_req *req); + +static inline void +ethtool_features_get_req_set_header_dev_index(struct ethtool_features_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_features_get_req_set_header_dev_name(struct ethtool_features_get_req *req, + const char *dev_name) +{ + 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_features_get_req_set_header_flags(struct ethtool_features_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_features_get_rsp { + struct { + __u32 header:1; + __u32 hw:1; + __u32 wanted:1; + __u32 active:1; + __u32 nochange:1; + } _present; + + struct ethtool_header header; + struct ethtool_bitset hw; + struct ethtool_bitset wanted; + struct ethtool_bitset active; + struct ethtool_bitset nochange; +}; + +void ethtool_features_get_rsp_free(struct ethtool_features_get_rsp *rsp); + +/* + * Get features. + */ +struct ethtool_features_get_rsp * +ethtool_features_get(struct ynl_sock *ys, struct ethtool_features_get_req *req); + +/* ETHTOOL_MSG_FEATURES_GET - dump */ +struct ethtool_features_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_features_get_req_dump * +ethtool_features_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_features_get_req_dump)); +} +void +ethtool_features_get_req_dump_free(struct ethtool_features_get_req_dump *req); + +static inline void +ethtool_features_get_req_dump_set_header_dev_index(struct ethtool_features_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_features_get_req_dump_set_header_dev_name(struct ethtool_features_get_req_dump *req, + const char *dev_name) +{ + 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_features_get_req_dump_set_header_flags(struct ethtool_features_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_features_get_list { + struct ethtool_features_get_list *next; + struct ethtool_features_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_features_get_list_free(struct ethtool_features_get_list *rsp); + +struct ethtool_features_get_list * +ethtool_features_get_dump(struct ynl_sock *ys, + struct ethtool_features_get_req_dump *req); + +/* ETHTOOL_MSG_FEATURES_GET - notify */ +struct ethtool_features_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_features_get_ntf *ntf); + struct ethtool_features_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_features_get_ntf_free(struct ethtool_features_get_ntf *rsp); + +/* ============== ETHTOOL_MSG_FEATURES_SET ============== */ +/* ETHTOOL_MSG_FEATURES_SET - do */ +struct ethtool_features_set_req { + struct { + __u32 header:1; + __u32 hw:1; + __u32 wanted:1; + __u32 active:1; + __u32 nochange:1; + } _present; + + struct ethtool_header header; + struct ethtool_bitset hw; + struct ethtool_bitset wanted; + struct ethtool_bitset active; + struct ethtool_bitset nochange; +}; + +static inline struct ethtool_features_set_req * +ethtool_features_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_features_set_req)); +} +void ethtool_features_set_req_free(struct ethtool_features_set_req *req); + +static inline void +ethtool_features_set_req_set_header_dev_index(struct ethtool_features_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_features_set_req_set_header_dev_name(struct ethtool_features_set_req *req, + const char *dev_name) +{ + 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_features_set_req_set_header_flags(struct ethtool_features_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_features_set_req_set_hw_nomask(struct ethtool_features_set_req *req) +{ + req->_present.hw = 1; + req->hw._present.nomask = 1; +} +static inline void +ethtool_features_set_req_set_hw_size(struct ethtool_features_set_req *req, + __u32 size) +{ + req->_present.hw = 1; + req->hw._present.size = 1; + req->hw.size = size; +} +static inline void +__ethtool_features_set_req_set_hw_bits_bit(struct ethtool_features_set_req *req, + struct ethtool_bitset_bit *bit, + unsigned int n_bit) +{ + free(req->hw.bits.bit); + req->hw.bits.bit = bit; + req->hw.bits.n_bit = n_bit; +} +static inline void +ethtool_features_set_req_set_wanted_nomask(struct ethtool_features_set_req *req) +{ + req->_present.wanted = 1; + req->wanted._present.nomask = 1; +} +static inline void +ethtool_features_set_req_set_wanted_size(struct ethtool_features_set_req *req, + __u32 size) +{ + req->_present.wanted = 1; + req->wanted._present.size = 1; + req->wanted.size = size; +} +static inline void +__ethtool_features_set_req_set_wanted_bits_bit(struct ethtool_features_set_req *req, + struct ethtool_bitset_bit *bit, + unsigned int n_bit) +{ + free(req->wanted.bits.bit); + req->wanted.bits.bit = bit; + req->wanted.bits.n_bit = n_bit; +} +static inline void +ethtool_features_set_req_set_active_nomask(struct ethtool_features_set_req *req) +{ + req->_present.active = 1; + req->active._present.nomask = 1; +} +static inline void +ethtool_features_set_req_set_active_size(struct ethtool_features_set_req *req, + __u32 size) +{ + req->_present.active = 1; + req->active._present.size = 1; + req->active.size = size; +} +static inline void +__ethtool_features_set_req_set_active_bits_bit(struct ethtool_features_set_req *req, + struct ethtool_bitset_bit *bit, + unsigned int n_bit) +{ + free(req->active.bits.bit); + req->active.bits.bit = bit; + req->active.bits.n_bit = n_bit; +} +static inline void +ethtool_features_set_req_set_nochange_nomask(struct ethtool_features_set_req *req) +{ + req->_present.nochange = 1; + req->nochange._present.nomask = 1; +} +static inline void +ethtool_features_set_req_set_nochange_size(struct ethtool_features_set_req *req, + __u32 size) +{ + req->_present.nochange = 1; + req->nochange._present.size = 1; + req->nochange.size = size; +} +static inline void +__ethtool_features_set_req_set_nochange_bits_bit(struct ethtool_features_set_req *req, + struct ethtool_bitset_bit *bit, + unsigned int n_bit) +{ + free(req->nochange.bits.bit); + req->nochange.bits.bit = bit; + req->nochange.bits.n_bit = n_bit; +} + +struct ethtool_features_set_rsp { + struct { + __u32 header:1; + __u32 hw:1; + __u32 wanted:1; + __u32 active:1; + __u32 nochange:1; + } _present; + + struct ethtool_header header; + struct ethtool_bitset hw; + struct ethtool_bitset wanted; + struct ethtool_bitset active; + struct ethtool_bitset nochange; +}; + +void ethtool_features_set_rsp_free(struct ethtool_features_set_rsp *rsp); + +/* + * Set features. + */ +struct ethtool_features_set_rsp * +ethtool_features_set(struct ynl_sock *ys, struct ethtool_features_set_req *req); + +/* ============== ETHTOOL_MSG_PRIVFLAGS_GET ============== */ +/* ETHTOOL_MSG_PRIVFLAGS_GET - do */ +struct ethtool_privflags_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_privflags_get_req * +ethtool_privflags_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_privflags_get_req)); +} +void ethtool_privflags_get_req_free(struct ethtool_privflags_get_req *req); + +static inline void +ethtool_privflags_get_req_set_header_dev_index(struct ethtool_privflags_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_privflags_get_req_set_header_dev_name(struct ethtool_privflags_get_req *req, + const char *dev_name) +{ + 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_privflags_get_req_set_header_flags(struct ethtool_privflags_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_privflags_get_rsp { + struct { + __u32 header:1; + __u32 flags:1; + } _present; + + struct ethtool_header header; + struct ethtool_bitset flags; +}; + +void ethtool_privflags_get_rsp_free(struct ethtool_privflags_get_rsp *rsp); + +/* + * Get device private flags. + */ +struct ethtool_privflags_get_rsp * +ethtool_privflags_get(struct ynl_sock *ys, + struct ethtool_privflags_get_req *req); + +/* ETHTOOL_MSG_PRIVFLAGS_GET - dump */ +struct ethtool_privflags_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_privflags_get_req_dump * +ethtool_privflags_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_privflags_get_req_dump)); +} +void +ethtool_privflags_get_req_dump_free(struct ethtool_privflags_get_req_dump *req); + +static inline void +ethtool_privflags_get_req_dump_set_header_dev_index(struct ethtool_privflags_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_privflags_get_req_dump_set_header_dev_name(struct ethtool_privflags_get_req_dump *req, + const char *dev_name) +{ + 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_privflags_get_req_dump_set_header_flags(struct ethtool_privflags_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_privflags_get_list { + struct ethtool_privflags_get_list *next; + struct ethtool_privflags_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_privflags_get_list_free(struct ethtool_privflags_get_list *rsp); + +struct ethtool_privflags_get_list * +ethtool_privflags_get_dump(struct ynl_sock *ys, + struct ethtool_privflags_get_req_dump *req); + +/* ETHTOOL_MSG_PRIVFLAGS_GET - notify */ +struct ethtool_privflags_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_privflags_get_ntf *ntf); + struct ethtool_privflags_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_privflags_get_ntf_free(struct ethtool_privflags_get_ntf *rsp); + +/* ============== ETHTOOL_MSG_PRIVFLAGS_SET ============== */ +/* ETHTOOL_MSG_PRIVFLAGS_SET - do */ +struct ethtool_privflags_set_req { + struct { + __u32 header:1; + __u32 flags:1; + } _present; + + struct ethtool_header header; + struct ethtool_bitset flags; +}; + +static inline struct ethtool_privflags_set_req * +ethtool_privflags_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_privflags_set_req)); +} +void ethtool_privflags_set_req_free(struct ethtool_privflags_set_req *req); + +static inline void +ethtool_privflags_set_req_set_header_dev_index(struct ethtool_privflags_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_privflags_set_req_set_header_dev_name(struct ethtool_privflags_set_req *req, + const char *dev_name) +{ + 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_privflags_set_req_set_header_flags(struct ethtool_privflags_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_privflags_set_req_set_flags_nomask(struct ethtool_privflags_set_req *req) +{ + req->_present.flags = 1; + req->flags._present.nomask = 1; +} +static inline void +ethtool_privflags_set_req_set_flags_size(struct ethtool_privflags_set_req *req, + __u32 size) +{ + req->_present.flags = 1; + req->flags._present.size = 1; + req->flags.size = size; +} +static inline void +__ethtool_privflags_set_req_set_flags_bits_bit(struct ethtool_privflags_set_req *req, + struct ethtool_bitset_bit *bit, + unsigned int n_bit) +{ + free(req->flags.bits.bit); + req->flags.bits.bit = bit; + req->flags.bits.n_bit = n_bit; +} + +/* + * Set device private flags. + */ +int ethtool_privflags_set(struct ynl_sock *ys, + struct ethtool_privflags_set_req *req); + +/* ============== ETHTOOL_MSG_RINGS_GET ============== */ +/* ETHTOOL_MSG_RINGS_GET - do */ +struct ethtool_rings_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_rings_get_req *ethtool_rings_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_rings_get_req)); +} +void ethtool_rings_get_req_free(struct ethtool_rings_get_req *req); + +static inline void +ethtool_rings_get_req_set_header_dev_index(struct ethtool_rings_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_rings_get_req_set_header_dev_name(struct ethtool_rings_get_req *req, + const char *dev_name) +{ + 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_rings_get_req_set_header_flags(struct ethtool_rings_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_rings_get_rsp { + struct { + __u32 header:1; + __u32 rx_max:1; + __u32 rx_mini_max:1; + __u32 rx_jumbo_max:1; + __u32 tx_max:1; + __u32 rx:1; + __u32 rx_mini:1; + __u32 rx_jumbo:1; + __u32 tx:1; + __u32 rx_buf_len:1; + __u32 tcp_data_split:1; + __u32 cqe_size:1; + __u32 tx_push:1; + __u32 rx_push:1; + __u32 tx_push_buf_len:1; + __u32 tx_push_buf_len_max:1; + } _present; + + struct ethtool_header header; + __u32 rx_max; + __u32 rx_mini_max; + __u32 rx_jumbo_max; + __u32 tx_max; + __u32 rx; + __u32 rx_mini; + __u32 rx_jumbo; + __u32 tx; + __u32 rx_buf_len; + __u8 tcp_data_split; + __u32 cqe_size; + __u8 tx_push; + __u8 rx_push; + __u32 tx_push_buf_len; + __u32 tx_push_buf_len_max; +}; + +void ethtool_rings_get_rsp_free(struct ethtool_rings_get_rsp *rsp); + +/* + * Get ring params. + */ +struct ethtool_rings_get_rsp * +ethtool_rings_get(struct ynl_sock *ys, struct ethtool_rings_get_req *req); + +/* ETHTOOL_MSG_RINGS_GET - dump */ +struct ethtool_rings_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_rings_get_req_dump * +ethtool_rings_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_rings_get_req_dump)); +} +void ethtool_rings_get_req_dump_free(struct ethtool_rings_get_req_dump *req); + +static inline void +ethtool_rings_get_req_dump_set_header_dev_index(struct ethtool_rings_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_rings_get_req_dump_set_header_dev_name(struct ethtool_rings_get_req_dump *req, + const char *dev_name) +{ + 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_rings_get_req_dump_set_header_flags(struct ethtool_rings_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_rings_get_list { + struct ethtool_rings_get_list *next; + struct ethtool_rings_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_rings_get_list_free(struct ethtool_rings_get_list *rsp); + +struct ethtool_rings_get_list * +ethtool_rings_get_dump(struct ynl_sock *ys, + struct ethtool_rings_get_req_dump *req); + +/* ETHTOOL_MSG_RINGS_GET - notify */ +struct ethtool_rings_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_rings_get_ntf *ntf); + struct ethtool_rings_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_rings_get_ntf_free(struct ethtool_rings_get_ntf *rsp); + +/* ============== ETHTOOL_MSG_RINGS_SET ============== */ +/* ETHTOOL_MSG_RINGS_SET - do */ +struct ethtool_rings_set_req { + struct { + __u32 header:1; + __u32 rx_max:1; + __u32 rx_mini_max:1; + __u32 rx_jumbo_max:1; + __u32 tx_max:1; + __u32 rx:1; + __u32 rx_mini:1; + __u32 rx_jumbo:1; + __u32 tx:1; + __u32 rx_buf_len:1; + __u32 tcp_data_split:1; + __u32 cqe_size:1; + __u32 tx_push:1; + __u32 rx_push:1; + __u32 tx_push_buf_len:1; + __u32 tx_push_buf_len_max:1; + } _present; + + struct ethtool_header header; + __u32 rx_max; + __u32 rx_mini_max; + __u32 rx_jumbo_max; + __u32 tx_max; + __u32 rx; + __u32 rx_mini; + __u32 rx_jumbo; + __u32 tx; + __u32 rx_buf_len; + __u8 tcp_data_split; + __u32 cqe_size; + __u8 tx_push; + __u8 rx_push; + __u32 tx_push_buf_len; + __u32 tx_push_buf_len_max; +}; + +static inline struct ethtool_rings_set_req *ethtool_rings_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_rings_set_req)); +} +void ethtool_rings_set_req_free(struct ethtool_rings_set_req *req); + +static inline void +ethtool_rings_set_req_set_header_dev_index(struct ethtool_rings_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_rings_set_req_set_header_dev_name(struct ethtool_rings_set_req *req, + const char *dev_name) +{ + 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_rings_set_req_set_header_flags(struct ethtool_rings_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_rings_set_req_set_rx_max(struct ethtool_rings_set_req *req, + __u32 rx_max) +{ + req->_present.rx_max = 1; + req->rx_max = rx_max; +} +static inline void +ethtool_rings_set_req_set_rx_mini_max(struct ethtool_rings_set_req *req, + __u32 rx_mini_max) +{ + req->_present.rx_mini_max = 1; + req->rx_mini_max = rx_mini_max; +} +static inline void +ethtool_rings_set_req_set_rx_jumbo_max(struct ethtool_rings_set_req *req, + __u32 rx_jumbo_max) +{ + req->_present.rx_jumbo_max = 1; + req->rx_jumbo_max = rx_jumbo_max; +} +static inline void +ethtool_rings_set_req_set_tx_max(struct ethtool_rings_set_req *req, + __u32 tx_max) +{ + req->_present.tx_max = 1; + req->tx_max = tx_max; +} +static inline void +ethtool_rings_set_req_set_rx(struct ethtool_rings_set_req *req, __u32 rx) +{ + req->_present.rx = 1; + req->rx = rx; +} +static inline void +ethtool_rings_set_req_set_rx_mini(struct ethtool_rings_set_req *req, + __u32 rx_mini) +{ + req->_present.rx_mini = 1; + req->rx_mini = rx_mini; +} +static inline void +ethtool_rings_set_req_set_rx_jumbo(struct ethtool_rings_set_req *req, + __u32 rx_jumbo) +{ + req->_present.rx_jumbo = 1; + req->rx_jumbo = rx_jumbo; +} +static inline void +ethtool_rings_set_req_set_tx(struct ethtool_rings_set_req *req, __u32 tx) +{ + req->_present.tx = 1; + req->tx = tx; +} +static inline void +ethtool_rings_set_req_set_rx_buf_len(struct ethtool_rings_set_req *req, + __u32 rx_buf_len) +{ + req->_present.rx_buf_len = 1; + req->rx_buf_len = rx_buf_len; +} +static inline void +ethtool_rings_set_req_set_tcp_data_split(struct ethtool_rings_set_req *req, + __u8 tcp_data_split) +{ + req->_present.tcp_data_split = 1; + req->tcp_data_split = tcp_data_split; +} +static inline void +ethtool_rings_set_req_set_cqe_size(struct ethtool_rings_set_req *req, + __u32 cqe_size) +{ + req->_present.cqe_size = 1; + req->cqe_size = cqe_size; +} +static inline void +ethtool_rings_set_req_set_tx_push(struct ethtool_rings_set_req *req, + __u8 tx_push) +{ + req->_present.tx_push = 1; + req->tx_push = tx_push; +} +static inline void +ethtool_rings_set_req_set_rx_push(struct ethtool_rings_set_req *req, + __u8 rx_push) +{ + req->_present.rx_push = 1; + req->rx_push = rx_push; +} +static inline void +ethtool_rings_set_req_set_tx_push_buf_len(struct ethtool_rings_set_req *req, + __u32 tx_push_buf_len) +{ + req->_present.tx_push_buf_len = 1; + req->tx_push_buf_len = tx_push_buf_len; +} +static inline void +ethtool_rings_set_req_set_tx_push_buf_len_max(struct ethtool_rings_set_req *req, + __u32 tx_push_buf_len_max) +{ + req->_present.tx_push_buf_len_max = 1; + req->tx_push_buf_len_max = tx_push_buf_len_max; +} + +/* + * Set ring params. + */ +int ethtool_rings_set(struct ynl_sock *ys, struct ethtool_rings_set_req *req); + +/* ============== ETHTOOL_MSG_CHANNELS_GET ============== */ +/* ETHTOOL_MSG_CHANNELS_GET - do */ +struct ethtool_channels_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_channels_get_req * +ethtool_channels_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_channels_get_req)); +} +void ethtool_channels_get_req_free(struct ethtool_channels_get_req *req); + +static inline void +ethtool_channels_get_req_set_header_dev_index(struct ethtool_channels_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_channels_get_req_set_header_dev_name(struct ethtool_channels_get_req *req, + const char *dev_name) +{ + 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_channels_get_req_set_header_flags(struct ethtool_channels_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_channels_get_rsp { + struct { + __u32 header:1; + __u32 rx_max:1; + __u32 tx_max:1; + __u32 other_max:1; + __u32 combined_max:1; + __u32 rx_count:1; + __u32 tx_count:1; + __u32 other_count:1; + __u32 combined_count:1; + } _present; + + struct ethtool_header header; + __u32 rx_max; + __u32 tx_max; + __u32 other_max; + __u32 combined_max; + __u32 rx_count; + __u32 tx_count; + __u32 other_count; + __u32 combined_count; +}; + +void ethtool_channels_get_rsp_free(struct ethtool_channels_get_rsp *rsp); + +/* + * Get channel params. + */ +struct ethtool_channels_get_rsp * +ethtool_channels_get(struct ynl_sock *ys, struct ethtool_channels_get_req *req); + +/* ETHTOOL_MSG_CHANNELS_GET - dump */ +struct ethtool_channels_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_channels_get_req_dump * +ethtool_channels_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_channels_get_req_dump)); +} +void +ethtool_channels_get_req_dump_free(struct ethtool_channels_get_req_dump *req); + +static inline void +ethtool_channels_get_req_dump_set_header_dev_index(struct ethtool_channels_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_channels_get_req_dump_set_header_dev_name(struct ethtool_channels_get_req_dump *req, + const char *dev_name) +{ + 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_channels_get_req_dump_set_header_flags(struct ethtool_channels_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_channels_get_list { + struct ethtool_channels_get_list *next; + struct ethtool_channels_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_channels_get_list_free(struct ethtool_channels_get_list *rsp); + +struct ethtool_channels_get_list * +ethtool_channels_get_dump(struct ynl_sock *ys, + struct ethtool_channels_get_req_dump *req); + +/* ETHTOOL_MSG_CHANNELS_GET - notify */ +struct ethtool_channels_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_channels_get_ntf *ntf); + struct ethtool_channels_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_channels_get_ntf_free(struct ethtool_channels_get_ntf *rsp); + +/* ============== ETHTOOL_MSG_CHANNELS_SET ============== */ +/* ETHTOOL_MSG_CHANNELS_SET - do */ +struct ethtool_channels_set_req { + struct { + __u32 header:1; + __u32 rx_max:1; + __u32 tx_max:1; + __u32 other_max:1; + __u32 combined_max:1; + __u32 rx_count:1; + __u32 tx_count:1; + __u32 other_count:1; + __u32 combined_count:1; + } _present; + + struct ethtool_header header; + __u32 rx_max; + __u32 tx_max; + __u32 other_max; + __u32 combined_max; + __u32 rx_count; + __u32 tx_count; + __u32 other_count; + __u32 combined_count; +}; + +static inline struct ethtool_channels_set_req * +ethtool_channels_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_channels_set_req)); +} +void ethtool_channels_set_req_free(struct ethtool_channels_set_req *req); + +static inline void +ethtool_channels_set_req_set_header_dev_index(struct ethtool_channels_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_channels_set_req_set_header_dev_name(struct ethtool_channels_set_req *req, + const char *dev_name) +{ + 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_channels_set_req_set_header_flags(struct ethtool_channels_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_channels_set_req_set_rx_max(struct ethtool_channels_set_req *req, + __u32 rx_max) +{ + req->_present.rx_max = 1; + req->rx_max = rx_max; +} +static inline void +ethtool_channels_set_req_set_tx_max(struct ethtool_channels_set_req *req, + __u32 tx_max) +{ + req->_present.tx_max = 1; + req->tx_max = tx_max; +} +static inline void +ethtool_channels_set_req_set_other_max(struct ethtool_channels_set_req *req, + __u32 other_max) +{ + req->_present.other_max = 1; + req->other_max = other_max; +} +static inline void +ethtool_channels_set_req_set_combined_max(struct ethtool_channels_set_req *req, + __u32 combined_max) +{ + req->_present.combined_max = 1; + req->combined_max = combined_max; +} +static inline void +ethtool_channels_set_req_set_rx_count(struct ethtool_channels_set_req *req, + __u32 rx_count) +{ + req->_present.rx_count = 1; + req->rx_count = rx_count; +} +static inline void +ethtool_channels_set_req_set_tx_count(struct ethtool_channels_set_req *req, + __u32 tx_count) +{ + req->_present.tx_count = 1; + req->tx_count = tx_count; +} +static inline void +ethtool_channels_set_req_set_other_count(struct ethtool_channels_set_req *req, + __u32 other_count) +{ + req->_present.other_count = 1; + req->other_count = other_count; +} +static inline void +ethtool_channels_set_req_set_combined_count(struct ethtool_channels_set_req *req, + __u32 combined_count) +{ + req->_present.combined_count = 1; + req->combined_count = combined_count; +} + +/* + * Set channel params. + */ +int ethtool_channels_set(struct ynl_sock *ys, + struct ethtool_channels_set_req *req); + +/* ============== ETHTOOL_MSG_COALESCE_GET ============== */ +/* ETHTOOL_MSG_COALESCE_GET - do */ +struct ethtool_coalesce_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_coalesce_get_req * +ethtool_coalesce_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_coalesce_get_req)); +} +void ethtool_coalesce_get_req_free(struct ethtool_coalesce_get_req *req); + +static inline void +ethtool_coalesce_get_req_set_header_dev_index(struct ethtool_coalesce_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_coalesce_get_req_set_header_dev_name(struct ethtool_coalesce_get_req *req, + const char *dev_name) +{ + 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_coalesce_get_req_set_header_flags(struct ethtool_coalesce_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_coalesce_get_rsp { + struct { + __u32 header:1; + __u32 rx_usecs:1; + __u32 rx_max_frames:1; + __u32 rx_usecs_irq:1; + __u32 rx_max_frames_irq:1; + __u32 tx_usecs:1; + __u32 tx_max_frames:1; + __u32 tx_usecs_irq:1; + __u32 tx_max_frames_irq:1; + __u32 stats_block_usecs:1; + __u32 use_adaptive_rx:1; + __u32 use_adaptive_tx:1; + __u32 pkt_rate_low:1; + __u32 rx_usecs_low:1; + __u32 rx_max_frames_low:1; + __u32 tx_usecs_low:1; + __u32 tx_max_frames_low:1; + __u32 pkt_rate_high:1; + __u32 rx_usecs_high:1; + __u32 rx_max_frames_high:1; + __u32 tx_usecs_high:1; + __u32 tx_max_frames_high:1; + __u32 rate_sample_interval:1; + __u32 use_cqe_mode_tx:1; + __u32 use_cqe_mode_rx:1; + __u32 tx_aggr_max_bytes:1; + __u32 tx_aggr_max_frames:1; + __u32 tx_aggr_time_usecs:1; + } _present; + + struct ethtool_header header; + __u32 rx_usecs; + __u32 rx_max_frames; + __u32 rx_usecs_irq; + __u32 rx_max_frames_irq; + __u32 tx_usecs; + __u32 tx_max_frames; + __u32 tx_usecs_irq; + __u32 tx_max_frames_irq; + __u32 stats_block_usecs; + __u8 use_adaptive_rx; + __u8 use_adaptive_tx; + __u32 pkt_rate_low; + __u32 rx_usecs_low; + __u32 rx_max_frames_low; + __u32 tx_usecs_low; + __u32 tx_max_frames_low; + __u32 pkt_rate_high; + __u32 rx_usecs_high; + __u32 rx_max_frames_high; + __u32 tx_usecs_high; + __u32 tx_max_frames_high; + __u32 rate_sample_interval; + __u8 use_cqe_mode_tx; + __u8 use_cqe_mode_rx; + __u32 tx_aggr_max_bytes; + __u32 tx_aggr_max_frames; + __u32 tx_aggr_time_usecs; +}; + +void ethtool_coalesce_get_rsp_free(struct ethtool_coalesce_get_rsp *rsp); + +/* + * Get coalesce params. + */ +struct ethtool_coalesce_get_rsp * +ethtool_coalesce_get(struct ynl_sock *ys, struct ethtool_coalesce_get_req *req); + +/* ETHTOOL_MSG_COALESCE_GET - dump */ +struct ethtool_coalesce_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_coalesce_get_req_dump * +ethtool_coalesce_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_coalesce_get_req_dump)); +} +void +ethtool_coalesce_get_req_dump_free(struct ethtool_coalesce_get_req_dump *req); + +static inline void +ethtool_coalesce_get_req_dump_set_header_dev_index(struct ethtool_coalesce_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_coalesce_get_req_dump_set_header_dev_name(struct ethtool_coalesce_get_req_dump *req, + const char *dev_name) +{ + 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_coalesce_get_req_dump_set_header_flags(struct ethtool_coalesce_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_coalesce_get_list { + struct ethtool_coalesce_get_list *next; + struct ethtool_coalesce_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_coalesce_get_list_free(struct ethtool_coalesce_get_list *rsp); + +struct ethtool_coalesce_get_list * +ethtool_coalesce_get_dump(struct ynl_sock *ys, + struct ethtool_coalesce_get_req_dump *req); + +/* ETHTOOL_MSG_COALESCE_GET - notify */ +struct ethtool_coalesce_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_coalesce_get_ntf *ntf); + struct ethtool_coalesce_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_coalesce_get_ntf_free(struct ethtool_coalesce_get_ntf *rsp); + +/* ============== ETHTOOL_MSG_COALESCE_SET ============== */ +/* ETHTOOL_MSG_COALESCE_SET - do */ +struct ethtool_coalesce_set_req { + struct { + __u32 header:1; + __u32 rx_usecs:1; + __u32 rx_max_frames:1; + __u32 rx_usecs_irq:1; + __u32 rx_max_frames_irq:1; + __u32 tx_usecs:1; + __u32 tx_max_frames:1; + __u32 tx_usecs_irq:1; + __u32 tx_max_frames_irq:1; + __u32 stats_block_usecs:1; + __u32 use_adaptive_rx:1; + __u32 use_adaptive_tx:1; + __u32 pkt_rate_low:1; + __u32 rx_usecs_low:1; + __u32 rx_max_frames_low:1; + __u32 tx_usecs_low:1; + __u32 tx_max_frames_low:1; + __u32 pkt_rate_high:1; + __u32 rx_usecs_high:1; + __u32 rx_max_frames_high:1; + __u32 tx_usecs_high:1; + __u32 tx_max_frames_high:1; + __u32 rate_sample_interval:1; + __u32 use_cqe_mode_tx:1; + __u32 use_cqe_mode_rx:1; + __u32 tx_aggr_max_bytes:1; + __u32 tx_aggr_max_frames:1; + __u32 tx_aggr_time_usecs:1; + } _present; + + struct ethtool_header header; + __u32 rx_usecs; + __u32 rx_max_frames; + __u32 rx_usecs_irq; + __u32 rx_max_frames_irq; + __u32 tx_usecs; + __u32 tx_max_frames; + __u32 tx_usecs_irq; + __u32 tx_max_frames_irq; + __u32 stats_block_usecs; + __u8 use_adaptive_rx; + __u8 use_adaptive_tx; + __u32 pkt_rate_low; + __u32 rx_usecs_low; + __u32 rx_max_frames_low; + __u32 tx_usecs_low; + __u32 tx_max_frames_low; + __u32 pkt_rate_high; + __u32 rx_usecs_high; + __u32 rx_max_frames_high; + __u32 tx_usecs_high; + __u32 tx_max_frames_high; + __u32 rate_sample_interval; + __u8 use_cqe_mode_tx; + __u8 use_cqe_mode_rx; + __u32 tx_aggr_max_bytes; + __u32 tx_aggr_max_frames; + __u32 tx_aggr_time_usecs; +}; + +static inline struct ethtool_coalesce_set_req * +ethtool_coalesce_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_coalesce_set_req)); +} +void ethtool_coalesce_set_req_free(struct ethtool_coalesce_set_req *req); + +static inline void +ethtool_coalesce_set_req_set_header_dev_index(struct ethtool_coalesce_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_coalesce_set_req_set_header_dev_name(struct ethtool_coalesce_set_req *req, + const char *dev_name) +{ + 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_coalesce_set_req_set_header_flags(struct ethtool_coalesce_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_coalesce_set_req_set_rx_usecs(struct ethtool_coalesce_set_req *req, + __u32 rx_usecs) +{ + req->_present.rx_usecs = 1; + req->rx_usecs = rx_usecs; +} +static inline void +ethtool_coalesce_set_req_set_rx_max_frames(struct ethtool_coalesce_set_req *req, + __u32 rx_max_frames) +{ + req->_present.rx_max_frames = 1; + req->rx_max_frames = rx_max_frames; +} +static inline void +ethtool_coalesce_set_req_set_rx_usecs_irq(struct ethtool_coalesce_set_req *req, + __u32 rx_usecs_irq) +{ + req->_present.rx_usecs_irq = 1; + req->rx_usecs_irq = rx_usecs_irq; +} +static inline void +ethtool_coalesce_set_req_set_rx_max_frames_irq(struct ethtool_coalesce_set_req *req, + __u32 rx_max_frames_irq) +{ + req->_present.rx_max_frames_irq = 1; + req->rx_max_frames_irq = rx_max_frames_irq; +} +static inline void +ethtool_coalesce_set_req_set_tx_usecs(struct ethtool_coalesce_set_req *req, + __u32 tx_usecs) +{ + req->_present.tx_usecs = 1; + req->tx_usecs = tx_usecs; +} +static inline void +ethtool_coalesce_set_req_set_tx_max_frames(struct ethtool_coalesce_set_req *req, + __u32 tx_max_frames) +{ + req->_present.tx_max_frames = 1; + req->tx_max_frames = tx_max_frames; +} +static inline void +ethtool_coalesce_set_req_set_tx_usecs_irq(struct ethtool_coalesce_set_req *req, + __u32 tx_usecs_irq) +{ + req->_present.tx_usecs_irq = 1; + req->tx_usecs_irq = tx_usecs_irq; +} +static inline void +ethtool_coalesce_set_req_set_tx_max_frames_irq(struct ethtool_coalesce_set_req *req, + __u32 tx_max_frames_irq) +{ + req->_present.tx_max_frames_irq = 1; + req->tx_max_frames_irq = tx_max_frames_irq; +} +static inline void +ethtool_coalesce_set_req_set_stats_block_usecs(struct ethtool_coalesce_set_req *req, + __u32 stats_block_usecs) +{ + req->_present.stats_block_usecs = 1; + req->stats_block_usecs = stats_block_usecs; +} +static inline void +ethtool_coalesce_set_req_set_use_adaptive_rx(struct ethtool_coalesce_set_req *req, + __u8 use_adaptive_rx) +{ + req->_present.use_adaptive_rx = 1; + req->use_adaptive_rx = use_adaptive_rx; +} +static inline void +ethtool_coalesce_set_req_set_use_adaptive_tx(struct ethtool_coalesce_set_req *req, + __u8 use_adaptive_tx) +{ + req->_present.use_adaptive_tx = 1; + req->use_adaptive_tx = use_adaptive_tx; +} +static inline void +ethtool_coalesce_set_req_set_pkt_rate_low(struct ethtool_coalesce_set_req *req, + __u32 pkt_rate_low) +{ + req->_present.pkt_rate_low = 1; + req->pkt_rate_low = pkt_rate_low; +} +static inline void +ethtool_coalesce_set_req_set_rx_usecs_low(struct ethtool_coalesce_set_req *req, + __u32 rx_usecs_low) +{ + req->_present.rx_usecs_low = 1; + req->rx_usecs_low = rx_usecs_low; +} +static inline void +ethtool_coalesce_set_req_set_rx_max_frames_low(struct ethtool_coalesce_set_req *req, + __u32 rx_max_frames_low) +{ + req->_present.rx_max_frames_low = 1; + req->rx_max_frames_low = rx_max_frames_low; +} +static inline void +ethtool_coalesce_set_req_set_tx_usecs_low(struct ethtool_coalesce_set_req *req, + __u32 tx_usecs_low) +{ + req->_present.tx_usecs_low = 1; + req->tx_usecs_low = tx_usecs_low; +} +static inline void +ethtool_coalesce_set_req_set_tx_max_frames_low(struct ethtool_coalesce_set_req *req, + __u32 tx_max_frames_low) +{ + req->_present.tx_max_frames_low = 1; + req->tx_max_frames_low = tx_max_frames_low; +} +static inline void +ethtool_coalesce_set_req_set_pkt_rate_high(struct ethtool_coalesce_set_req *req, + __u32 pkt_rate_high) +{ + req->_present.pkt_rate_high = 1; + req->pkt_rate_high = pkt_rate_high; +} +static inline void +ethtool_coalesce_set_req_set_rx_usecs_high(struct ethtool_coalesce_set_req *req, + __u32 rx_usecs_high) +{ + req->_present.rx_usecs_high = 1; + req->rx_usecs_high = rx_usecs_high; +} +static inline void +ethtool_coalesce_set_req_set_rx_max_frames_high(struct ethtool_coalesce_set_req *req, + __u32 rx_max_frames_high) +{ + req->_present.rx_max_frames_high = 1; + req->rx_max_frames_high = rx_max_frames_high; +} +static inline void +ethtool_coalesce_set_req_set_tx_usecs_high(struct ethtool_coalesce_set_req *req, + __u32 tx_usecs_high) +{ + req->_present.tx_usecs_high = 1; + req->tx_usecs_high = tx_usecs_high; +} +static inline void +ethtool_coalesce_set_req_set_tx_max_frames_high(struct ethtool_coalesce_set_req *req, + __u32 tx_max_frames_high) +{ + req->_present.tx_max_frames_high = 1; + req->tx_max_frames_high = tx_max_frames_high; +} +static inline void +ethtool_coalesce_set_req_set_rate_sample_interval(struct ethtool_coalesce_set_req *req, + __u32 rate_sample_interval) +{ + req->_present.rate_sample_interval = 1; + req->rate_sample_interval = rate_sample_interval; +} +static inline void +ethtool_coalesce_set_req_set_use_cqe_mode_tx(struct ethtool_coalesce_set_req *req, + __u8 use_cqe_mode_tx) +{ + req->_present.use_cqe_mode_tx = 1; + req->use_cqe_mode_tx = use_cqe_mode_tx; +} +static inline void +ethtool_coalesce_set_req_set_use_cqe_mode_rx(struct ethtool_coalesce_set_req *req, + __u8 use_cqe_mode_rx) +{ + req->_present.use_cqe_mode_rx = 1; + req->use_cqe_mode_rx = use_cqe_mode_rx; +} +static inline void +ethtool_coalesce_set_req_set_tx_aggr_max_bytes(struct ethtool_coalesce_set_req *req, + __u32 tx_aggr_max_bytes) +{ + req->_present.tx_aggr_max_bytes = 1; + req->tx_aggr_max_bytes = tx_aggr_max_bytes; +} +static inline void +ethtool_coalesce_set_req_set_tx_aggr_max_frames(struct ethtool_coalesce_set_req *req, + __u32 tx_aggr_max_frames) +{ + req->_present.tx_aggr_max_frames = 1; + req->tx_aggr_max_frames = tx_aggr_max_frames; +} +static inline void +ethtool_coalesce_set_req_set_tx_aggr_time_usecs(struct ethtool_coalesce_set_req *req, + __u32 tx_aggr_time_usecs) +{ + req->_present.tx_aggr_time_usecs = 1; + req->tx_aggr_time_usecs = tx_aggr_time_usecs; +} + +/* + * Set coalesce params. + */ +int ethtool_coalesce_set(struct ynl_sock *ys, + struct ethtool_coalesce_set_req *req); + +/* ============== ETHTOOL_MSG_PAUSE_GET ============== */ +/* ETHTOOL_MSG_PAUSE_GET - do */ +struct ethtool_pause_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_pause_get_req *ethtool_pause_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_pause_get_req)); +} +void ethtool_pause_get_req_free(struct ethtool_pause_get_req *req); + +static inline void +ethtool_pause_get_req_set_header_dev_index(struct ethtool_pause_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_pause_get_req_set_header_dev_name(struct ethtool_pause_get_req *req, + const char *dev_name) +{ + 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_pause_get_req_set_header_flags(struct ethtool_pause_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_pause_get_rsp { + struct { + __u32 header:1; + __u32 autoneg:1; + __u32 rx:1; + __u32 tx:1; + __u32 stats:1; + __u32 stats_src:1; + } _present; + + struct ethtool_header header; + __u8 autoneg; + __u8 rx; + __u8 tx; + struct ethtool_pause_stat stats; + __u32 stats_src; +}; + +void ethtool_pause_get_rsp_free(struct ethtool_pause_get_rsp *rsp); + +/* + * Get pause params. + */ +struct ethtool_pause_get_rsp * +ethtool_pause_get(struct ynl_sock *ys, struct ethtool_pause_get_req *req); + +/* ETHTOOL_MSG_PAUSE_GET - dump */ +struct ethtool_pause_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_pause_get_req_dump * +ethtool_pause_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_pause_get_req_dump)); +} +void ethtool_pause_get_req_dump_free(struct ethtool_pause_get_req_dump *req); + +static inline void +ethtool_pause_get_req_dump_set_header_dev_index(struct ethtool_pause_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_pause_get_req_dump_set_header_dev_name(struct ethtool_pause_get_req_dump *req, + const char *dev_name) +{ + 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_pause_get_req_dump_set_header_flags(struct ethtool_pause_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_pause_get_list { + struct ethtool_pause_get_list *next; + struct ethtool_pause_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_pause_get_list_free(struct ethtool_pause_get_list *rsp); + +struct ethtool_pause_get_list * +ethtool_pause_get_dump(struct ynl_sock *ys, + struct ethtool_pause_get_req_dump *req); + +/* ETHTOOL_MSG_PAUSE_GET - notify */ +struct ethtool_pause_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_pause_get_ntf *ntf); + struct ethtool_pause_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_pause_get_ntf_free(struct ethtool_pause_get_ntf *rsp); + +/* ============== ETHTOOL_MSG_PAUSE_SET ============== */ +/* ETHTOOL_MSG_PAUSE_SET - do */ +struct ethtool_pause_set_req { + struct { + __u32 header:1; + __u32 autoneg:1; + __u32 rx:1; + __u32 tx:1; + __u32 stats:1; + __u32 stats_src:1; + } _present; + + struct ethtool_header header; + __u8 autoneg; + __u8 rx; + __u8 tx; + struct ethtool_pause_stat stats; + __u32 stats_src; +}; + +static inline struct ethtool_pause_set_req *ethtool_pause_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_pause_set_req)); +} +void ethtool_pause_set_req_free(struct ethtool_pause_set_req *req); + +static inline void +ethtool_pause_set_req_set_header_dev_index(struct ethtool_pause_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_pause_set_req_set_header_dev_name(struct ethtool_pause_set_req *req, + const char *dev_name) +{ + 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_pause_set_req_set_header_flags(struct ethtool_pause_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_pause_set_req_set_autoneg(struct ethtool_pause_set_req *req, + __u8 autoneg) +{ + req->_present.autoneg = 1; + req->autoneg = autoneg; +} +static inline void +ethtool_pause_set_req_set_rx(struct ethtool_pause_set_req *req, __u8 rx) +{ + req->_present.rx = 1; + req->rx = rx; +} +static inline void +ethtool_pause_set_req_set_tx(struct ethtool_pause_set_req *req, __u8 tx) +{ + req->_present.tx = 1; + req->tx = tx; +} +static inline void +ethtool_pause_set_req_set_stats_tx_frames(struct ethtool_pause_set_req *req, + __u64 tx_frames) +{ + req->_present.stats = 1; + req->stats._present.tx_frames = 1; + req->stats.tx_frames = tx_frames; +} +static inline void +ethtool_pause_set_req_set_stats_rx_frames(struct ethtool_pause_set_req *req, + __u64 rx_frames) +{ + req->_present.stats = 1; + req->stats._present.rx_frames = 1; + req->stats.rx_frames = rx_frames; +} +static inline void +ethtool_pause_set_req_set_stats_src(struct ethtool_pause_set_req *req, + __u32 stats_src) +{ + req->_present.stats_src = 1; + req->stats_src = stats_src; +} + +/* + * Set pause params. + */ +int ethtool_pause_set(struct ynl_sock *ys, struct ethtool_pause_set_req *req); + +/* ============== ETHTOOL_MSG_EEE_GET ============== */ +/* ETHTOOL_MSG_EEE_GET - do */ +struct ethtool_eee_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_eee_get_req *ethtool_eee_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_eee_get_req)); +} +void ethtool_eee_get_req_free(struct ethtool_eee_get_req *req); + +static inline void +ethtool_eee_get_req_set_header_dev_index(struct ethtool_eee_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_eee_get_req_set_header_dev_name(struct ethtool_eee_get_req *req, + const char *dev_name) +{ + 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_eee_get_req_set_header_flags(struct ethtool_eee_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_eee_get_rsp { + struct { + __u32 header:1; + __u32 modes_ours:1; + __u32 modes_peer:1; + __u32 active:1; + __u32 enabled:1; + __u32 tx_lpi_enabled:1; + __u32 tx_lpi_timer:1; + } _present; + + struct ethtool_header header; + struct ethtool_bitset modes_ours; + struct ethtool_bitset modes_peer; + __u8 active; + __u8 enabled; + __u8 tx_lpi_enabled; + __u32 tx_lpi_timer; +}; + +void ethtool_eee_get_rsp_free(struct ethtool_eee_get_rsp *rsp); + +/* + * Get eee params. + */ +struct ethtool_eee_get_rsp * +ethtool_eee_get(struct ynl_sock *ys, struct ethtool_eee_get_req *req); + +/* ETHTOOL_MSG_EEE_GET - dump */ +struct ethtool_eee_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_eee_get_req_dump * +ethtool_eee_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_eee_get_req_dump)); +} +void ethtool_eee_get_req_dump_free(struct ethtool_eee_get_req_dump *req); + +static inline void +ethtool_eee_get_req_dump_set_header_dev_index(struct ethtool_eee_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_eee_get_req_dump_set_header_dev_name(struct ethtool_eee_get_req_dump *req, + const char *dev_name) +{ + 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_eee_get_req_dump_set_header_flags(struct ethtool_eee_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_eee_get_list { + struct ethtool_eee_get_list *next; + struct ethtool_eee_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_eee_get_list_free(struct ethtool_eee_get_list *rsp); + +struct ethtool_eee_get_list * +ethtool_eee_get_dump(struct ynl_sock *ys, struct ethtool_eee_get_req_dump *req); + +/* ETHTOOL_MSG_EEE_GET - notify */ +struct ethtool_eee_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_eee_get_ntf *ntf); + struct ethtool_eee_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_eee_get_ntf_free(struct ethtool_eee_get_ntf *rsp); + +/* ============== ETHTOOL_MSG_EEE_SET ============== */ +/* ETHTOOL_MSG_EEE_SET - do */ +struct ethtool_eee_set_req { + struct { + __u32 header:1; + __u32 modes_ours:1; + __u32 modes_peer:1; + __u32 active:1; + __u32 enabled:1; + __u32 tx_lpi_enabled:1; + __u32 tx_lpi_timer:1; + } _present; + + struct ethtool_header header; + struct ethtool_bitset modes_ours; + struct ethtool_bitset modes_peer; + __u8 active; + __u8 enabled; + __u8 tx_lpi_enabled; + __u32 tx_lpi_timer; +}; + +static inline struct ethtool_eee_set_req *ethtool_eee_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_eee_set_req)); +} +void ethtool_eee_set_req_free(struct ethtool_eee_set_req *req); + +static inline void +ethtool_eee_set_req_set_header_dev_index(struct ethtool_eee_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_eee_set_req_set_header_dev_name(struct ethtool_eee_set_req *req, + const char *dev_name) +{ + 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_eee_set_req_set_header_flags(struct ethtool_eee_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_eee_set_req_set_modes_ours_nomask(struct ethtool_eee_set_req *req) +{ + req->_present.modes_ours = 1; + req->modes_ours._present.nomask = 1; +} +static inline void +ethtool_eee_set_req_set_modes_ours_size(struct ethtool_eee_set_req *req, + __u32 size) +{ + req->_present.modes_ours = 1; + req->modes_ours._present.size = 1; + req->modes_ours.size = size; +} +static inline void +__ethtool_eee_set_req_set_modes_ours_bits_bit(struct ethtool_eee_set_req *req, + struct ethtool_bitset_bit *bit, + unsigned int n_bit) +{ + free(req->modes_ours.bits.bit); + req->modes_ours.bits.bit = bit; + req->modes_ours.bits.n_bit = n_bit; +} +static inline void +ethtool_eee_set_req_set_modes_peer_nomask(struct ethtool_eee_set_req *req) +{ + req->_present.modes_peer = 1; + req->modes_peer._present.nomask = 1; +} +static inline void +ethtool_eee_set_req_set_modes_peer_size(struct ethtool_eee_set_req *req, + __u32 size) +{ + req->_present.modes_peer = 1; + req->modes_peer._present.size = 1; + req->modes_peer.size = size; +} +static inline void +__ethtool_eee_set_req_set_modes_peer_bits_bit(struct ethtool_eee_set_req *req, + struct ethtool_bitset_bit *bit, + unsigned int n_bit) +{ + free(req->modes_peer.bits.bit); + req->modes_peer.bits.bit = bit; + req->modes_peer.bits.n_bit = n_bit; +} +static inline void +ethtool_eee_set_req_set_active(struct ethtool_eee_set_req *req, __u8 active) +{ + req->_present.active = 1; + req->active = active; +} +static inline void +ethtool_eee_set_req_set_enabled(struct ethtool_eee_set_req *req, __u8 enabled) +{ + req->_present.enabled = 1; + req->enabled = enabled; +} +static inline void +ethtool_eee_set_req_set_tx_lpi_enabled(struct ethtool_eee_set_req *req, + __u8 tx_lpi_enabled) +{ + req->_present.tx_lpi_enabled = 1; + req->tx_lpi_enabled = tx_lpi_enabled; +} +static inline void +ethtool_eee_set_req_set_tx_lpi_timer(struct ethtool_eee_set_req *req, + __u32 tx_lpi_timer) +{ + req->_present.tx_lpi_timer = 1; + req->tx_lpi_timer = tx_lpi_timer; +} + +/* + * Set eee params. + */ +int ethtool_eee_set(struct ynl_sock *ys, struct ethtool_eee_set_req *req); + +/* ============== ETHTOOL_MSG_TSINFO_GET ============== */ +/* ETHTOOL_MSG_TSINFO_GET - do */ +struct ethtool_tsinfo_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_tsinfo_get_req *ethtool_tsinfo_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_tsinfo_get_req)); +} +void ethtool_tsinfo_get_req_free(struct ethtool_tsinfo_get_req *req); + +static inline void +ethtool_tsinfo_get_req_set_header_dev_index(struct ethtool_tsinfo_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_tsinfo_get_req_set_header_dev_name(struct ethtool_tsinfo_get_req *req, + const char *dev_name) +{ + 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_tsinfo_get_req_set_header_flags(struct ethtool_tsinfo_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_tsinfo_get_rsp { + struct { + __u32 header:1; + __u32 timestamping:1; + __u32 tx_types:1; + __u32 rx_filters:1; + __u32 phc_index:1; + } _present; + + struct ethtool_header header; + struct ethtool_bitset timestamping; + struct ethtool_bitset tx_types; + struct ethtool_bitset rx_filters; + __u32 phc_index; +}; + +void ethtool_tsinfo_get_rsp_free(struct ethtool_tsinfo_get_rsp *rsp); + +/* + * Get tsinfo params. + */ +struct ethtool_tsinfo_get_rsp * +ethtool_tsinfo_get(struct ynl_sock *ys, struct ethtool_tsinfo_get_req *req); + +/* ETHTOOL_MSG_TSINFO_GET - dump */ +struct ethtool_tsinfo_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_tsinfo_get_req_dump * +ethtool_tsinfo_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_tsinfo_get_req_dump)); +} +void ethtool_tsinfo_get_req_dump_free(struct ethtool_tsinfo_get_req_dump *req); + +static inline void +ethtool_tsinfo_get_req_dump_set_header_dev_index(struct ethtool_tsinfo_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_tsinfo_get_req_dump_set_header_dev_name(struct ethtool_tsinfo_get_req_dump *req, + const char *dev_name) +{ + 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_tsinfo_get_req_dump_set_header_flags(struct ethtool_tsinfo_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_tsinfo_get_list { + struct ethtool_tsinfo_get_list *next; + struct ethtool_tsinfo_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_tsinfo_get_list_free(struct ethtool_tsinfo_get_list *rsp); + +struct ethtool_tsinfo_get_list * +ethtool_tsinfo_get_dump(struct ynl_sock *ys, + struct ethtool_tsinfo_get_req_dump *req); + +/* ============== ETHTOOL_MSG_CABLE_TEST_ACT ============== */ +/* ETHTOOL_MSG_CABLE_TEST_ACT - do */ +struct ethtool_cable_test_act_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_cable_test_act_req * +ethtool_cable_test_act_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_cable_test_act_req)); +} +void ethtool_cable_test_act_req_free(struct ethtool_cable_test_act_req *req); + +static inline void +ethtool_cable_test_act_req_set_header_dev_index(struct ethtool_cable_test_act_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_cable_test_act_req_set_header_dev_name(struct ethtool_cable_test_act_req *req, + const char *dev_name) +{ + 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_cable_test_act_req_set_header_flags(struct ethtool_cable_test_act_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +/* + * Cable test. + */ +int ethtool_cable_test_act(struct ynl_sock *ys, + struct ethtool_cable_test_act_req *req); + +/* ============== ETHTOOL_MSG_CABLE_TEST_TDR_ACT ============== */ +/* ETHTOOL_MSG_CABLE_TEST_TDR_ACT - do */ +struct ethtool_cable_test_tdr_act_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_cable_test_tdr_act_req * +ethtool_cable_test_tdr_act_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_cable_test_tdr_act_req)); +} +void +ethtool_cable_test_tdr_act_req_free(struct ethtool_cable_test_tdr_act_req *req); + +static inline void +ethtool_cable_test_tdr_act_req_set_header_dev_index(struct ethtool_cable_test_tdr_act_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_cable_test_tdr_act_req_set_header_dev_name(struct ethtool_cable_test_tdr_act_req *req, + const char *dev_name) +{ + 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_cable_test_tdr_act_req_set_header_flags(struct ethtool_cable_test_tdr_act_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +/* + * Cable test TDR. + */ +int ethtool_cable_test_tdr_act(struct ynl_sock *ys, + struct ethtool_cable_test_tdr_act_req *req); + +/* ============== ETHTOOL_MSG_TUNNEL_INFO_GET ============== */ +/* ETHTOOL_MSG_TUNNEL_INFO_GET - do */ +struct ethtool_tunnel_info_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_tunnel_info_get_req * +ethtool_tunnel_info_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_tunnel_info_get_req)); +} +void ethtool_tunnel_info_get_req_free(struct ethtool_tunnel_info_get_req *req); + +static inline void +ethtool_tunnel_info_get_req_set_header_dev_index(struct ethtool_tunnel_info_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_tunnel_info_get_req_set_header_dev_name(struct ethtool_tunnel_info_get_req *req, + const char *dev_name) +{ + 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_tunnel_info_get_req_set_header_flags(struct ethtool_tunnel_info_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_tunnel_info_get_rsp { + struct { + __u32 header:1; + __u32 udp_ports:1; + } _present; + + struct ethtool_header header; + struct ethtool_tunnel_udp udp_ports; +}; + +void ethtool_tunnel_info_get_rsp_free(struct ethtool_tunnel_info_get_rsp *rsp); + +/* + * Get tsinfo params. + */ +struct ethtool_tunnel_info_get_rsp * +ethtool_tunnel_info_get(struct ynl_sock *ys, + struct ethtool_tunnel_info_get_req *req); + +/* ETHTOOL_MSG_TUNNEL_INFO_GET - dump */ +struct ethtool_tunnel_info_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_tunnel_info_get_req_dump * +ethtool_tunnel_info_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_tunnel_info_get_req_dump)); +} +void +ethtool_tunnel_info_get_req_dump_free(struct ethtool_tunnel_info_get_req_dump *req); + +static inline void +ethtool_tunnel_info_get_req_dump_set_header_dev_index(struct ethtool_tunnel_info_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_tunnel_info_get_req_dump_set_header_dev_name(struct ethtool_tunnel_info_get_req_dump *req, + const char *dev_name) +{ + 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_tunnel_info_get_req_dump_set_header_flags(struct ethtool_tunnel_info_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_tunnel_info_get_list { + struct ethtool_tunnel_info_get_list *next; + struct ethtool_tunnel_info_get_rsp obj __attribute__((aligned(8))); +}; + +void +ethtool_tunnel_info_get_list_free(struct ethtool_tunnel_info_get_list *rsp); + +struct ethtool_tunnel_info_get_list * +ethtool_tunnel_info_get_dump(struct ynl_sock *ys, + struct ethtool_tunnel_info_get_req_dump *req); + +/* ============== ETHTOOL_MSG_FEC_GET ============== */ +/* ETHTOOL_MSG_FEC_GET - do */ +struct ethtool_fec_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_fec_get_req *ethtool_fec_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_fec_get_req)); +} +void ethtool_fec_get_req_free(struct ethtool_fec_get_req *req); + +static inline void +ethtool_fec_get_req_set_header_dev_index(struct ethtool_fec_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_fec_get_req_set_header_dev_name(struct ethtool_fec_get_req *req, + const char *dev_name) +{ + 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_fec_get_req_set_header_flags(struct ethtool_fec_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_fec_get_rsp { + struct { + __u32 header:1; + __u32 modes:1; + __u32 auto_:1; + __u32 active:1; + __u32 stats:1; + } _present; + + struct ethtool_header header; + struct ethtool_bitset modes; + __u8 auto_; + __u32 active; + struct ethtool_fec_stat stats; +}; + +void ethtool_fec_get_rsp_free(struct ethtool_fec_get_rsp *rsp); + +/* + * Get FEC params. + */ +struct ethtool_fec_get_rsp * +ethtool_fec_get(struct ynl_sock *ys, struct ethtool_fec_get_req *req); + +/* ETHTOOL_MSG_FEC_GET - dump */ +struct ethtool_fec_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_fec_get_req_dump * +ethtool_fec_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_fec_get_req_dump)); +} +void ethtool_fec_get_req_dump_free(struct ethtool_fec_get_req_dump *req); + +static inline void +ethtool_fec_get_req_dump_set_header_dev_index(struct ethtool_fec_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_fec_get_req_dump_set_header_dev_name(struct ethtool_fec_get_req_dump *req, + const char *dev_name) +{ + 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_fec_get_req_dump_set_header_flags(struct ethtool_fec_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_fec_get_list { + struct ethtool_fec_get_list *next; + struct ethtool_fec_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_fec_get_list_free(struct ethtool_fec_get_list *rsp); + +struct ethtool_fec_get_list * +ethtool_fec_get_dump(struct ynl_sock *ys, struct ethtool_fec_get_req_dump *req); + +/* ETHTOOL_MSG_FEC_GET - notify */ +struct ethtool_fec_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_fec_get_ntf *ntf); + struct ethtool_fec_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_fec_get_ntf_free(struct ethtool_fec_get_ntf *rsp); + +/* ============== ETHTOOL_MSG_FEC_SET ============== */ +/* ETHTOOL_MSG_FEC_SET - do */ +struct ethtool_fec_set_req { + struct { + __u32 header:1; + __u32 modes:1; + __u32 auto_:1; + __u32 active:1; + __u32 stats:1; + } _present; + + struct ethtool_header header; + struct ethtool_bitset modes; + __u8 auto_; + __u32 active; + struct ethtool_fec_stat stats; +}; + +static inline struct ethtool_fec_set_req *ethtool_fec_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_fec_set_req)); +} +void ethtool_fec_set_req_free(struct ethtool_fec_set_req *req); + +static inline void +ethtool_fec_set_req_set_header_dev_index(struct ethtool_fec_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_fec_set_req_set_header_dev_name(struct ethtool_fec_set_req *req, + const char *dev_name) +{ + 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_fec_set_req_set_header_flags(struct ethtool_fec_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_fec_set_req_set_modes_nomask(struct ethtool_fec_set_req *req) +{ + req->_present.modes = 1; + req->modes._present.nomask = 1; +} +static inline void +ethtool_fec_set_req_set_modes_size(struct ethtool_fec_set_req *req, __u32 size) +{ + req->_present.modes = 1; + req->modes._present.size = 1; + req->modes.size = size; +} +static inline void +__ethtool_fec_set_req_set_modes_bits_bit(struct ethtool_fec_set_req *req, + struct ethtool_bitset_bit *bit, + unsigned int n_bit) +{ + free(req->modes.bits.bit); + req->modes.bits.bit = bit; + req->modes.bits.n_bit = n_bit; +} +static inline void +ethtool_fec_set_req_set_auto_(struct ethtool_fec_set_req *req, __u8 auto_) +{ + req->_present.auto_ = 1; + req->auto_ = auto_; +} +static inline void +ethtool_fec_set_req_set_active(struct ethtool_fec_set_req *req, __u32 active) +{ + req->_present.active = 1; + req->active = active; +} +static inline void +ethtool_fec_set_req_set_stats_corrected(struct ethtool_fec_set_req *req, + const void *corrected, size_t len) +{ + free(req->stats.corrected); + req->stats._present.corrected_len = len; + req->stats.corrected = malloc(req->stats._present.corrected_len); + memcpy(req->stats.corrected, corrected, req->stats._present.corrected_len); +} +static inline void +ethtool_fec_set_req_set_stats_uncorr(struct ethtool_fec_set_req *req, + const void *uncorr, size_t len) +{ + free(req->stats.uncorr); + req->stats._present.uncorr_len = len; + req->stats.uncorr = malloc(req->stats._present.uncorr_len); + memcpy(req->stats.uncorr, uncorr, req->stats._present.uncorr_len); +} +static inline void +ethtool_fec_set_req_set_stats_corr_bits(struct ethtool_fec_set_req *req, + const void *corr_bits, size_t len) +{ + free(req->stats.corr_bits); + req->stats._present.corr_bits_len = len; + req->stats.corr_bits = malloc(req->stats._present.corr_bits_len); + memcpy(req->stats.corr_bits, corr_bits, req->stats._present.corr_bits_len); +} + +/* + * Set FEC params. + */ +int ethtool_fec_set(struct ynl_sock *ys, struct ethtool_fec_set_req *req); + +/* ============== ETHTOOL_MSG_MODULE_EEPROM_GET ============== */ +/* ETHTOOL_MSG_MODULE_EEPROM_GET - do */ +struct ethtool_module_eeprom_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_module_eeprom_get_req * +ethtool_module_eeprom_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_module_eeprom_get_req)); +} +void +ethtool_module_eeprom_get_req_free(struct ethtool_module_eeprom_get_req *req); + +static inline void +ethtool_module_eeprom_get_req_set_header_dev_index(struct ethtool_module_eeprom_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_module_eeprom_get_req_set_header_dev_name(struct ethtool_module_eeprom_get_req *req, + const char *dev_name) +{ + 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_module_eeprom_get_req_set_header_flags(struct ethtool_module_eeprom_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_module_eeprom_get_rsp { + struct { + __u32 header:1; + __u32 offset:1; + __u32 length:1; + __u32 page:1; + __u32 bank:1; + __u32 i2c_address:1; + __u32 data_len; + } _present; + + struct ethtool_header header; + __u32 offset; + __u32 length; + __u8 page; + __u8 bank; + __u8 i2c_address; + void *data; +}; + +void +ethtool_module_eeprom_get_rsp_free(struct ethtool_module_eeprom_get_rsp *rsp); + +/* + * Get module EEPROM params. + */ +struct ethtool_module_eeprom_get_rsp * +ethtool_module_eeprom_get(struct ynl_sock *ys, + struct ethtool_module_eeprom_get_req *req); + +/* ETHTOOL_MSG_MODULE_EEPROM_GET - dump */ +struct ethtool_module_eeprom_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_module_eeprom_get_req_dump * +ethtool_module_eeprom_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_module_eeprom_get_req_dump)); +} +void +ethtool_module_eeprom_get_req_dump_free(struct ethtool_module_eeprom_get_req_dump *req); + +static inline void +ethtool_module_eeprom_get_req_dump_set_header_dev_index(struct ethtool_module_eeprom_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_module_eeprom_get_req_dump_set_header_dev_name(struct ethtool_module_eeprom_get_req_dump *req, + const char *dev_name) +{ + 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_module_eeprom_get_req_dump_set_header_flags(struct ethtool_module_eeprom_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_module_eeprom_get_list { + struct ethtool_module_eeprom_get_list *next; + struct ethtool_module_eeprom_get_rsp obj __attribute__((aligned(8))); +}; + +void +ethtool_module_eeprom_get_list_free(struct ethtool_module_eeprom_get_list *rsp); + +struct ethtool_module_eeprom_get_list * +ethtool_module_eeprom_get_dump(struct ynl_sock *ys, + struct ethtool_module_eeprom_get_req_dump *req); + +/* ============== ETHTOOL_MSG_PHC_VCLOCKS_GET ============== */ +/* ETHTOOL_MSG_PHC_VCLOCKS_GET - do */ +struct ethtool_phc_vclocks_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_phc_vclocks_get_req * +ethtool_phc_vclocks_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_phc_vclocks_get_req)); +} +void ethtool_phc_vclocks_get_req_free(struct ethtool_phc_vclocks_get_req *req); + +static inline void +ethtool_phc_vclocks_get_req_set_header_dev_index(struct ethtool_phc_vclocks_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_phc_vclocks_get_req_set_header_dev_name(struct ethtool_phc_vclocks_get_req *req, + const char *dev_name) +{ + 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_phc_vclocks_get_req_set_header_flags(struct ethtool_phc_vclocks_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_phc_vclocks_get_rsp { + struct { + __u32 header:1; + __u32 num:1; + } _present; + + struct ethtool_header header; + __u32 num; +}; + +void ethtool_phc_vclocks_get_rsp_free(struct ethtool_phc_vclocks_get_rsp *rsp); + +/* + * Get PHC VCLOCKs. + */ +struct ethtool_phc_vclocks_get_rsp * +ethtool_phc_vclocks_get(struct ynl_sock *ys, + struct ethtool_phc_vclocks_get_req *req); + +/* ETHTOOL_MSG_PHC_VCLOCKS_GET - dump */ +struct ethtool_phc_vclocks_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_phc_vclocks_get_req_dump * +ethtool_phc_vclocks_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_phc_vclocks_get_req_dump)); +} +void +ethtool_phc_vclocks_get_req_dump_free(struct ethtool_phc_vclocks_get_req_dump *req); + +static inline void +ethtool_phc_vclocks_get_req_dump_set_header_dev_index(struct ethtool_phc_vclocks_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_phc_vclocks_get_req_dump_set_header_dev_name(struct ethtool_phc_vclocks_get_req_dump *req, + const char *dev_name) +{ + 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_phc_vclocks_get_req_dump_set_header_flags(struct ethtool_phc_vclocks_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_phc_vclocks_get_list { + struct ethtool_phc_vclocks_get_list *next; + struct ethtool_phc_vclocks_get_rsp obj __attribute__((aligned(8))); +}; + +void +ethtool_phc_vclocks_get_list_free(struct ethtool_phc_vclocks_get_list *rsp); + +struct ethtool_phc_vclocks_get_list * +ethtool_phc_vclocks_get_dump(struct ynl_sock *ys, + struct ethtool_phc_vclocks_get_req_dump *req); + +/* ============== ETHTOOL_MSG_MODULE_GET ============== */ +/* ETHTOOL_MSG_MODULE_GET - do */ +struct ethtool_module_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_module_get_req *ethtool_module_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_module_get_req)); +} +void ethtool_module_get_req_free(struct ethtool_module_get_req *req); + +static inline void +ethtool_module_get_req_set_header_dev_index(struct ethtool_module_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_module_get_req_set_header_dev_name(struct ethtool_module_get_req *req, + const char *dev_name) +{ + 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_module_get_req_set_header_flags(struct ethtool_module_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_module_get_rsp { + struct { + __u32 header:1; + __u32 power_mode_policy:1; + __u32 power_mode:1; + } _present; + + struct ethtool_header header; + __u8 power_mode_policy; + __u8 power_mode; +}; + +void ethtool_module_get_rsp_free(struct ethtool_module_get_rsp *rsp); + +/* + * Get module params. + */ +struct ethtool_module_get_rsp * +ethtool_module_get(struct ynl_sock *ys, struct ethtool_module_get_req *req); + +/* ETHTOOL_MSG_MODULE_GET - dump */ +struct ethtool_module_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_module_get_req_dump * +ethtool_module_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_module_get_req_dump)); +} +void ethtool_module_get_req_dump_free(struct ethtool_module_get_req_dump *req); + +static inline void +ethtool_module_get_req_dump_set_header_dev_index(struct ethtool_module_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_module_get_req_dump_set_header_dev_name(struct ethtool_module_get_req_dump *req, + const char *dev_name) +{ + 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_module_get_req_dump_set_header_flags(struct ethtool_module_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_module_get_list { + struct ethtool_module_get_list *next; + struct ethtool_module_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_module_get_list_free(struct ethtool_module_get_list *rsp); + +struct ethtool_module_get_list * +ethtool_module_get_dump(struct ynl_sock *ys, + struct ethtool_module_get_req_dump *req); + +/* ETHTOOL_MSG_MODULE_GET - notify */ +struct ethtool_module_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_module_get_ntf *ntf); + struct ethtool_module_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_module_get_ntf_free(struct ethtool_module_get_ntf *rsp); + +/* ============== ETHTOOL_MSG_MODULE_SET ============== */ +/* ETHTOOL_MSG_MODULE_SET - do */ +struct ethtool_module_set_req { + struct { + __u32 header:1; + __u32 power_mode_policy:1; + __u32 power_mode:1; + } _present; + + struct ethtool_header header; + __u8 power_mode_policy; + __u8 power_mode; +}; + +static inline struct ethtool_module_set_req *ethtool_module_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_module_set_req)); +} +void ethtool_module_set_req_free(struct ethtool_module_set_req *req); + +static inline void +ethtool_module_set_req_set_header_dev_index(struct ethtool_module_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_module_set_req_set_header_dev_name(struct ethtool_module_set_req *req, + const char *dev_name) +{ + 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_module_set_req_set_header_flags(struct ethtool_module_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_module_set_req_set_power_mode_policy(struct ethtool_module_set_req *req, + __u8 power_mode_policy) +{ + req->_present.power_mode_policy = 1; + req->power_mode_policy = power_mode_policy; +} +static inline void +ethtool_module_set_req_set_power_mode(struct ethtool_module_set_req *req, + __u8 power_mode) +{ + req->_present.power_mode = 1; + req->power_mode = power_mode; +} + +/* + * Set module params. + */ +int ethtool_module_set(struct ynl_sock *ys, struct ethtool_module_set_req *req); + +/* ============== ETHTOOL_MSG_PSE_GET ============== */ +/* ETHTOOL_MSG_PSE_GET - do */ +struct ethtool_pse_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_pse_get_req *ethtool_pse_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_pse_get_req)); +} +void ethtool_pse_get_req_free(struct ethtool_pse_get_req *req); + +static inline void +ethtool_pse_get_req_set_header_dev_index(struct ethtool_pse_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_pse_get_req_set_header_dev_name(struct ethtool_pse_get_req *req, + const char *dev_name) +{ + 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_pse_get_req_set_header_flags(struct ethtool_pse_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_pse_get_rsp { + struct { + __u32 header:1; + __u32 admin_state:1; + __u32 admin_control:1; + __u32 pw_d_status:1; + } _present; + + struct ethtool_header header; + __u32 admin_state; + __u32 admin_control; + __u32 pw_d_status; +}; + +void ethtool_pse_get_rsp_free(struct ethtool_pse_get_rsp *rsp); + +/* + * Get Power Sourcing Equipment params. + */ +struct ethtool_pse_get_rsp * +ethtool_pse_get(struct ynl_sock *ys, struct ethtool_pse_get_req *req); + +/* ETHTOOL_MSG_PSE_GET - dump */ +struct ethtool_pse_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_pse_get_req_dump * +ethtool_pse_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_pse_get_req_dump)); +} +void ethtool_pse_get_req_dump_free(struct ethtool_pse_get_req_dump *req); + +static inline void +ethtool_pse_get_req_dump_set_header_dev_index(struct ethtool_pse_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_pse_get_req_dump_set_header_dev_name(struct ethtool_pse_get_req_dump *req, + const char *dev_name) +{ + 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_pse_get_req_dump_set_header_flags(struct ethtool_pse_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_pse_get_list { + struct ethtool_pse_get_list *next; + struct ethtool_pse_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_pse_get_list_free(struct ethtool_pse_get_list *rsp); + +struct ethtool_pse_get_list * +ethtool_pse_get_dump(struct ynl_sock *ys, struct ethtool_pse_get_req_dump *req); + +/* ============== ETHTOOL_MSG_PSE_SET ============== */ +/* ETHTOOL_MSG_PSE_SET - do */ +struct ethtool_pse_set_req { + struct { + __u32 header:1; + __u32 admin_state:1; + __u32 admin_control:1; + __u32 pw_d_status:1; + } _present; + + struct ethtool_header header; + __u32 admin_state; + __u32 admin_control; + __u32 pw_d_status; +}; + +static inline struct ethtool_pse_set_req *ethtool_pse_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_pse_set_req)); +} +void ethtool_pse_set_req_free(struct ethtool_pse_set_req *req); + +static inline void +ethtool_pse_set_req_set_header_dev_index(struct ethtool_pse_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_pse_set_req_set_header_dev_name(struct ethtool_pse_set_req *req, + const char *dev_name) +{ + 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_pse_set_req_set_header_flags(struct ethtool_pse_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_pse_set_req_set_admin_state(struct ethtool_pse_set_req *req, + __u32 admin_state) +{ + req->_present.admin_state = 1; + req->admin_state = admin_state; +} +static inline void +ethtool_pse_set_req_set_admin_control(struct ethtool_pse_set_req *req, + __u32 admin_control) +{ + req->_present.admin_control = 1; + req->admin_control = admin_control; +} +static inline void +ethtool_pse_set_req_set_pw_d_status(struct ethtool_pse_set_req *req, + __u32 pw_d_status) +{ + req->_present.pw_d_status = 1; + req->pw_d_status = pw_d_status; +} + +/* + * Set Power Sourcing Equipment params. + */ +int ethtool_pse_set(struct ynl_sock *ys, struct ethtool_pse_set_req *req); + +/* ============== ETHTOOL_MSG_RSS_GET ============== */ +/* ETHTOOL_MSG_RSS_GET - do */ +struct ethtool_rss_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_rss_get_req *ethtool_rss_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_rss_get_req)); +} +void ethtool_rss_get_req_free(struct ethtool_rss_get_req *req); + +static inline void +ethtool_rss_get_req_set_header_dev_index(struct ethtool_rss_get_req *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_set_header_dev_name(struct ethtool_rss_get_req *req, + const char *dev_name) +{ + 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_set_header_flags(struct ethtool_rss_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_rss_get_rsp { + struct { + __u32 header:1; + __u32 context:1; + __u32 hfunc:1; + __u32 indir_len; + __u32 hkey_len; + __u32 input_xfrm:1; + } _present; + + struct ethtool_header header; + __u32 context; + __u32 hfunc; + void *indir; + void *hkey; + __u32 input_xfrm; +}; + +void ethtool_rss_get_rsp_free(struct ethtool_rss_get_rsp *rsp); + +/* + * Get RSS params. + */ +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; + } _present; + + struct ethtool_header header; +}; + +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) +{ + 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; +} + +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 { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_plca_get_cfg_req * +ethtool_plca_get_cfg_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_plca_get_cfg_req)); +} +void ethtool_plca_get_cfg_req_free(struct ethtool_plca_get_cfg_req *req); + +static inline void +ethtool_plca_get_cfg_req_set_header_dev_index(struct ethtool_plca_get_cfg_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_plca_get_cfg_req_set_header_dev_name(struct ethtool_plca_get_cfg_req *req, + const char *dev_name) +{ + 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_plca_get_cfg_req_set_header_flags(struct ethtool_plca_get_cfg_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_plca_get_cfg_rsp { + struct { + __u32 header:1; + __u32 version:1; + __u32 enabled:1; + __u32 status:1; + __u32 node_cnt:1; + __u32 node_id:1; + __u32 to_tmr:1; + __u32 burst_cnt:1; + __u32 burst_tmr:1; + } _present; + + struct ethtool_header header; + __u16 version; + __u8 enabled; + __u8 status; + __u32 node_cnt; + __u32 node_id; + __u32 to_tmr; + __u32 burst_cnt; + __u32 burst_tmr; +}; + +void ethtool_plca_get_cfg_rsp_free(struct ethtool_plca_get_cfg_rsp *rsp); + +/* + * Get PLCA params. + */ +struct ethtool_plca_get_cfg_rsp * +ethtool_plca_get_cfg(struct ynl_sock *ys, struct ethtool_plca_get_cfg_req *req); + +/* ETHTOOL_MSG_PLCA_GET_CFG - dump */ +struct ethtool_plca_get_cfg_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_plca_get_cfg_req_dump * +ethtool_plca_get_cfg_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_plca_get_cfg_req_dump)); +} +void +ethtool_plca_get_cfg_req_dump_free(struct ethtool_plca_get_cfg_req_dump *req); + +static inline void +ethtool_plca_get_cfg_req_dump_set_header_dev_index(struct ethtool_plca_get_cfg_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_plca_get_cfg_req_dump_set_header_dev_name(struct ethtool_plca_get_cfg_req_dump *req, + const char *dev_name) +{ + 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_plca_get_cfg_req_dump_set_header_flags(struct ethtool_plca_get_cfg_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_plca_get_cfg_list { + struct ethtool_plca_get_cfg_list *next; + struct ethtool_plca_get_cfg_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_plca_get_cfg_list_free(struct ethtool_plca_get_cfg_list *rsp); + +struct ethtool_plca_get_cfg_list * +ethtool_plca_get_cfg_dump(struct ynl_sock *ys, + struct ethtool_plca_get_cfg_req_dump *req); + +/* ETHTOOL_MSG_PLCA_GET_CFG - notify */ +struct ethtool_plca_get_cfg_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_plca_get_cfg_ntf *ntf); + struct ethtool_plca_get_cfg_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_plca_get_cfg_ntf_free(struct ethtool_plca_get_cfg_ntf *rsp); + +/* ============== ETHTOOL_MSG_PLCA_SET_CFG ============== */ +/* ETHTOOL_MSG_PLCA_SET_CFG - do */ +struct ethtool_plca_set_cfg_req { + struct { + __u32 header:1; + __u32 version:1; + __u32 enabled:1; + __u32 status:1; + __u32 node_cnt:1; + __u32 node_id:1; + __u32 to_tmr:1; + __u32 burst_cnt:1; + __u32 burst_tmr:1; + } _present; + + struct ethtool_header header; + __u16 version; + __u8 enabled; + __u8 status; + __u32 node_cnt; + __u32 node_id; + __u32 to_tmr; + __u32 burst_cnt; + __u32 burst_tmr; +}; + +static inline struct ethtool_plca_set_cfg_req * +ethtool_plca_set_cfg_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_plca_set_cfg_req)); +} +void ethtool_plca_set_cfg_req_free(struct ethtool_plca_set_cfg_req *req); + +static inline void +ethtool_plca_set_cfg_req_set_header_dev_index(struct ethtool_plca_set_cfg_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_plca_set_cfg_req_set_header_dev_name(struct ethtool_plca_set_cfg_req *req, + const char *dev_name) +{ + 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_plca_set_cfg_req_set_header_flags(struct ethtool_plca_set_cfg_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_plca_set_cfg_req_set_version(struct ethtool_plca_set_cfg_req *req, + __u16 version) +{ + req->_present.version = 1; + req->version = version; +} +static inline void +ethtool_plca_set_cfg_req_set_enabled(struct ethtool_plca_set_cfg_req *req, + __u8 enabled) +{ + req->_present.enabled = 1; + req->enabled = enabled; +} +static inline void +ethtool_plca_set_cfg_req_set_status(struct ethtool_plca_set_cfg_req *req, + __u8 status) +{ + req->_present.status = 1; + req->status = status; +} +static inline void +ethtool_plca_set_cfg_req_set_node_cnt(struct ethtool_plca_set_cfg_req *req, + __u32 node_cnt) +{ + req->_present.node_cnt = 1; + req->node_cnt = node_cnt; +} +static inline void +ethtool_plca_set_cfg_req_set_node_id(struct ethtool_plca_set_cfg_req *req, + __u32 node_id) +{ + req->_present.node_id = 1; + req->node_id = node_id; +} +static inline void +ethtool_plca_set_cfg_req_set_to_tmr(struct ethtool_plca_set_cfg_req *req, + __u32 to_tmr) +{ + req->_present.to_tmr = 1; + req->to_tmr = to_tmr; +} +static inline void +ethtool_plca_set_cfg_req_set_burst_cnt(struct ethtool_plca_set_cfg_req *req, + __u32 burst_cnt) +{ + req->_present.burst_cnt = 1; + req->burst_cnt = burst_cnt; +} +static inline void +ethtool_plca_set_cfg_req_set_burst_tmr(struct ethtool_plca_set_cfg_req *req, + __u32 burst_tmr) +{ + req->_present.burst_tmr = 1; + req->burst_tmr = burst_tmr; +} + +/* + * Set PLCA params. + */ +int ethtool_plca_set_cfg(struct ynl_sock *ys, + struct ethtool_plca_set_cfg_req *req); + +/* ============== ETHTOOL_MSG_PLCA_GET_STATUS ============== */ +/* ETHTOOL_MSG_PLCA_GET_STATUS - do */ +struct ethtool_plca_get_status_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_plca_get_status_req * +ethtool_plca_get_status_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_plca_get_status_req)); +} +void ethtool_plca_get_status_req_free(struct ethtool_plca_get_status_req *req); + +static inline void +ethtool_plca_get_status_req_set_header_dev_index(struct ethtool_plca_get_status_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_plca_get_status_req_set_header_dev_name(struct ethtool_plca_get_status_req *req, + const char *dev_name) +{ + 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_plca_get_status_req_set_header_flags(struct ethtool_plca_get_status_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_plca_get_status_rsp { + struct { + __u32 header:1; + __u32 version:1; + __u32 enabled:1; + __u32 status:1; + __u32 node_cnt:1; + __u32 node_id:1; + __u32 to_tmr:1; + __u32 burst_cnt:1; + __u32 burst_tmr:1; + } _present; + + struct ethtool_header header; + __u16 version; + __u8 enabled; + __u8 status; + __u32 node_cnt; + __u32 node_id; + __u32 to_tmr; + __u32 burst_cnt; + __u32 burst_tmr; +}; + +void ethtool_plca_get_status_rsp_free(struct ethtool_plca_get_status_rsp *rsp); + +/* + * Get PLCA status params. + */ +struct ethtool_plca_get_status_rsp * +ethtool_plca_get_status(struct ynl_sock *ys, + struct ethtool_plca_get_status_req *req); + +/* ETHTOOL_MSG_PLCA_GET_STATUS - dump */ +struct ethtool_plca_get_status_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_plca_get_status_req_dump * +ethtool_plca_get_status_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_plca_get_status_req_dump)); +} +void +ethtool_plca_get_status_req_dump_free(struct ethtool_plca_get_status_req_dump *req); + +static inline void +ethtool_plca_get_status_req_dump_set_header_dev_index(struct ethtool_plca_get_status_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_plca_get_status_req_dump_set_header_dev_name(struct ethtool_plca_get_status_req_dump *req, + const char *dev_name) +{ + 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_plca_get_status_req_dump_set_header_flags(struct ethtool_plca_get_status_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_plca_get_status_list { + struct ethtool_plca_get_status_list *next; + struct ethtool_plca_get_status_rsp obj __attribute__((aligned(8))); +}; + +void +ethtool_plca_get_status_list_free(struct ethtool_plca_get_status_list *rsp); + +struct ethtool_plca_get_status_list * +ethtool_plca_get_status_dump(struct ynl_sock *ys, + struct ethtool_plca_get_status_req_dump *req); + +/* ============== ETHTOOL_MSG_MM_GET ============== */ +/* ETHTOOL_MSG_MM_GET - do */ +struct ethtool_mm_get_req { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_mm_get_req *ethtool_mm_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_mm_get_req)); +} +void ethtool_mm_get_req_free(struct ethtool_mm_get_req *req); + +static inline void +ethtool_mm_get_req_set_header_dev_index(struct ethtool_mm_get_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_mm_get_req_set_header_dev_name(struct ethtool_mm_get_req *req, + const char *dev_name) +{ + 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_mm_get_req_set_header_flags(struct ethtool_mm_get_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_mm_get_rsp { + struct { + __u32 header:1; + __u32 pmac_enabled:1; + __u32 tx_enabled:1; + __u32 tx_active:1; + __u32 tx_min_frag_size:1; + __u32 rx_min_frag_size:1; + __u32 verify_enabled:1; + __u32 verify_time:1; + __u32 max_verify_time:1; + __u32 stats:1; + } _present; + + struct ethtool_header header; + __u8 pmac_enabled; + __u8 tx_enabled; + __u8 tx_active; + __u32 tx_min_frag_size; + __u32 rx_min_frag_size; + __u8 verify_enabled; + __u32 verify_time; + __u32 max_verify_time; + struct ethtool_mm_stat stats; +}; + +void ethtool_mm_get_rsp_free(struct ethtool_mm_get_rsp *rsp); + +/* + * Get MAC Merge configuration and state + */ +struct ethtool_mm_get_rsp * +ethtool_mm_get(struct ynl_sock *ys, struct ethtool_mm_get_req *req); + +/* ETHTOOL_MSG_MM_GET - dump */ +struct ethtool_mm_get_req_dump { + struct { + __u32 header:1; + } _present; + + struct ethtool_header header; +}; + +static inline struct ethtool_mm_get_req_dump * +ethtool_mm_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_mm_get_req_dump)); +} +void ethtool_mm_get_req_dump_free(struct ethtool_mm_get_req_dump *req); + +static inline void +ethtool_mm_get_req_dump_set_header_dev_index(struct ethtool_mm_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_mm_get_req_dump_set_header_dev_name(struct ethtool_mm_get_req_dump *req, + const char *dev_name) +{ + 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_mm_get_req_dump_set_header_flags(struct ethtool_mm_get_req_dump *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} + +struct ethtool_mm_get_list { + struct ethtool_mm_get_list *next; + struct ethtool_mm_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_mm_get_list_free(struct ethtool_mm_get_list *rsp); + +struct ethtool_mm_get_list * +ethtool_mm_get_dump(struct ynl_sock *ys, struct ethtool_mm_get_req_dump *req); + +/* ETHTOOL_MSG_MM_GET - notify */ +struct ethtool_mm_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_mm_get_ntf *ntf); + struct ethtool_mm_get_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_mm_get_ntf_free(struct ethtool_mm_get_ntf *rsp); + +/* ============== ETHTOOL_MSG_MM_SET ============== */ +/* ETHTOOL_MSG_MM_SET - do */ +struct ethtool_mm_set_req { + struct { + __u32 header:1; + __u32 verify_enabled:1; + __u32 verify_time:1; + __u32 tx_enabled:1; + __u32 pmac_enabled:1; + __u32 tx_min_frag_size:1; + } _present; + + struct ethtool_header header; + __u8 verify_enabled; + __u32 verify_time; + __u8 tx_enabled; + __u8 pmac_enabled; + __u32 tx_min_frag_size; +}; + +static inline struct ethtool_mm_set_req *ethtool_mm_set_req_alloc(void) +{ + return calloc(1, sizeof(struct ethtool_mm_set_req)); +} +void ethtool_mm_set_req_free(struct ethtool_mm_set_req *req); + +static inline void +ethtool_mm_set_req_set_header_dev_index(struct ethtool_mm_set_req *req, + __u32 dev_index) +{ + req->_present.header = 1; + req->header._present.dev_index = 1; + req->header.dev_index = dev_index; +} +static inline void +ethtool_mm_set_req_set_header_dev_name(struct ethtool_mm_set_req *req, + const char *dev_name) +{ + 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_mm_set_req_set_header_flags(struct ethtool_mm_set_req *req, + __u32 flags) +{ + req->_present.header = 1; + req->header._present.flags = 1; + req->header.flags = flags; +} +static inline void +ethtool_mm_set_req_set_verify_enabled(struct ethtool_mm_set_req *req, + __u8 verify_enabled) +{ + req->_present.verify_enabled = 1; + req->verify_enabled = verify_enabled; +} +static inline void +ethtool_mm_set_req_set_verify_time(struct ethtool_mm_set_req *req, + __u32 verify_time) +{ + req->_present.verify_time = 1; + req->verify_time = verify_time; +} +static inline void +ethtool_mm_set_req_set_tx_enabled(struct ethtool_mm_set_req *req, + __u8 tx_enabled) +{ + req->_present.tx_enabled = 1; + req->tx_enabled = tx_enabled; +} +static inline void +ethtool_mm_set_req_set_pmac_enabled(struct ethtool_mm_set_req *req, + __u8 pmac_enabled) +{ + req->_present.pmac_enabled = 1; + req->pmac_enabled = pmac_enabled; +} +static inline void +ethtool_mm_set_req_set_tx_min_frag_size(struct ethtool_mm_set_req *req, + __u32 tx_min_frag_size) +{ + req->_present.tx_min_frag_size = 1; + req->tx_min_frag_size = tx_min_frag_size; +} + +/* + * Set MAC Merge configuration + */ +int ethtool_mm_set(struct ynl_sock *ys, struct ethtool_mm_set_req *req); + +/* ETHTOOL_MSG_CABLE_TEST_NTF - event */ +struct ethtool_cable_test_ntf_rsp { + struct { + __u32 header:1; + __u32 status:1; + } _present; + + struct ethtool_header header; + __u8 status; +}; + +struct ethtool_cable_test_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_cable_test_ntf *ntf); + struct ethtool_cable_test_ntf_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_cable_test_ntf_free(struct ethtool_cable_test_ntf *rsp); + +/* ETHTOOL_MSG_CABLE_TEST_TDR_NTF - event */ +struct ethtool_cable_test_tdr_ntf_rsp { + struct { + __u32 header:1; + __u32 status:1; + __u32 nest:1; + } _present; + + struct ethtool_header header; + __u8 status; + struct ethtool_cable_nest nest; +}; + +struct ethtool_cable_test_tdr_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct ethtool_cable_test_tdr_ntf *ntf); + struct ethtool_cable_test_tdr_ntf_rsp obj __attribute__((aligned(8))); +}; + +void ethtool_cable_test_tdr_ntf_free(struct ethtool_cable_test_tdr_ntf *rsp); + +#endif /* _LINUX_ETHTOOL_GEN_H */ diff --git a/include/ynl-c/fou.h b/include/ynl-c/fou.h new file mode 100644 index 0000000..fd56671 --- /dev/null +++ b/include/ynl-c/fou.h @@ -0,0 +1,343 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/fou.yaml */ +/* YNL-GEN user header */ + +#ifndef _LINUX_FOU_GEN_H +#define _LINUX_FOU_GEN_H + +#include +#include +#include +#include + +struct ynl_sock; + +extern const struct ynl_family ynl_fou_family; + +/* Enums */ +const char *fou_op_str(int op); +const char *fou_encap_type_str(int value); + +/* Common nested types */ +/* ============== FOU_CMD_ADD ============== */ +/* FOU_CMD_ADD - do */ +struct fou_add_req { + struct { + __u32 port:1; + __u32 ipproto:1; + __u32 type:1; + __u32 remcsum_nopartial:1; + __u32 local_v4:1; + __u32 peer_v4:1; + __u32 local_v6_len; + __u32 peer_v6_len; + __u32 peer_port:1; + __u32 ifindex:1; + } _present; + + __u16 port /* big-endian */; + __u8 ipproto; + __u8 type; + __u32 local_v4; + __u32 peer_v4; + void *local_v6; + void *peer_v6; + __u16 peer_port /* big-endian */; + __s32 ifindex; +}; + +static inline struct fou_add_req *fou_add_req_alloc(void) +{ + return calloc(1, sizeof(struct fou_add_req)); +} +void fou_add_req_free(struct fou_add_req *req); + +static inline void +fou_add_req_set_port(struct fou_add_req *req, __u16 port /* big-endian */) +{ + req->_present.port = 1; + req->port = port; +} +static inline void +fou_add_req_set_ipproto(struct fou_add_req *req, __u8 ipproto) +{ + req->_present.ipproto = 1; + req->ipproto = ipproto; +} +static inline void fou_add_req_set_type(struct fou_add_req *req, __u8 type) +{ + req->_present.type = 1; + req->type = type; +} +static inline void fou_add_req_set_remcsum_nopartial(struct fou_add_req *req) +{ + req->_present.remcsum_nopartial = 1; +} +static inline void +fou_add_req_set_local_v4(struct fou_add_req *req, __u32 local_v4) +{ + req->_present.local_v4 = 1; + req->local_v4 = local_v4; +} +static inline void +fou_add_req_set_peer_v4(struct fou_add_req *req, __u32 peer_v4) +{ + req->_present.peer_v4 = 1; + req->peer_v4 = peer_v4; +} +static inline void +fou_add_req_set_local_v6(struct fou_add_req *req, const void *local_v6, + size_t len) +{ + free(req->local_v6); + req->_present.local_v6_len = len; + req->local_v6 = malloc(req->_present.local_v6_len); + memcpy(req->local_v6, local_v6, req->_present.local_v6_len); +} +static inline void +fou_add_req_set_peer_v6(struct fou_add_req *req, const void *peer_v6, + size_t len) +{ + free(req->peer_v6); + req->_present.peer_v6_len = len; + req->peer_v6 = malloc(req->_present.peer_v6_len); + memcpy(req->peer_v6, peer_v6, req->_present.peer_v6_len); +} +static inline void +fou_add_req_set_peer_port(struct fou_add_req *req, + __u16 peer_port /* big-endian */) +{ + req->_present.peer_port = 1; + req->peer_port = peer_port; +} +static inline void +fou_add_req_set_ifindex(struct fou_add_req *req, __s32 ifindex) +{ + req->_present.ifindex = 1; + req->ifindex = ifindex; +} + +/* + * Add port. + */ +int fou_add(struct ynl_sock *ys, struct fou_add_req *req); + +/* ============== FOU_CMD_DEL ============== */ +/* FOU_CMD_DEL - do */ +struct fou_del_req { + struct { + __u32 af:1; + __u32 ifindex:1; + __u32 port:1; + __u32 peer_port:1; + __u32 local_v4:1; + __u32 peer_v4:1; + __u32 local_v6_len; + __u32 peer_v6_len; + } _present; + + __u8 af; + __s32 ifindex; + __u16 port /* big-endian */; + __u16 peer_port /* big-endian */; + __u32 local_v4; + __u32 peer_v4; + void *local_v6; + void *peer_v6; +}; + +static inline struct fou_del_req *fou_del_req_alloc(void) +{ + return calloc(1, sizeof(struct fou_del_req)); +} +void fou_del_req_free(struct fou_del_req *req); + +static inline void fou_del_req_set_af(struct fou_del_req *req, __u8 af) +{ + req->_present.af = 1; + req->af = af; +} +static inline void +fou_del_req_set_ifindex(struct fou_del_req *req, __s32 ifindex) +{ + req->_present.ifindex = 1; + req->ifindex = ifindex; +} +static inline void +fou_del_req_set_port(struct fou_del_req *req, __u16 port /* big-endian */) +{ + req->_present.port = 1; + req->port = port; +} +static inline void +fou_del_req_set_peer_port(struct fou_del_req *req, + __u16 peer_port /* big-endian */) +{ + req->_present.peer_port = 1; + req->peer_port = peer_port; +} +static inline void +fou_del_req_set_local_v4(struct fou_del_req *req, __u32 local_v4) +{ + req->_present.local_v4 = 1; + req->local_v4 = local_v4; +} +static inline void +fou_del_req_set_peer_v4(struct fou_del_req *req, __u32 peer_v4) +{ + req->_present.peer_v4 = 1; + req->peer_v4 = peer_v4; +} +static inline void +fou_del_req_set_local_v6(struct fou_del_req *req, const void *local_v6, + size_t len) +{ + free(req->local_v6); + req->_present.local_v6_len = len; + req->local_v6 = malloc(req->_present.local_v6_len); + memcpy(req->local_v6, local_v6, req->_present.local_v6_len); +} +static inline void +fou_del_req_set_peer_v6(struct fou_del_req *req, const void *peer_v6, + size_t len) +{ + free(req->peer_v6); + req->_present.peer_v6_len = len; + req->peer_v6 = malloc(req->_present.peer_v6_len); + memcpy(req->peer_v6, peer_v6, req->_present.peer_v6_len); +} + +/* + * Delete port. + */ +int fou_del(struct ynl_sock *ys, struct fou_del_req *req); + +/* ============== FOU_CMD_GET ============== */ +/* FOU_CMD_GET - do */ +struct fou_get_req { + struct { + __u32 af:1; + __u32 ifindex:1; + __u32 port:1; + __u32 peer_port:1; + __u32 local_v4:1; + __u32 peer_v4:1; + __u32 local_v6_len; + __u32 peer_v6_len; + } _present; + + __u8 af; + __s32 ifindex; + __u16 port /* big-endian */; + __u16 peer_port /* big-endian */; + __u32 local_v4; + __u32 peer_v4; + void *local_v6; + void *peer_v6; +}; + +static inline struct fou_get_req *fou_get_req_alloc(void) +{ + return calloc(1, sizeof(struct fou_get_req)); +} +void fou_get_req_free(struct fou_get_req *req); + +static inline void fou_get_req_set_af(struct fou_get_req *req, __u8 af) +{ + req->_present.af = 1; + req->af = af; +} +static inline void +fou_get_req_set_ifindex(struct fou_get_req *req, __s32 ifindex) +{ + req->_present.ifindex = 1; + req->ifindex = ifindex; +} +static inline void +fou_get_req_set_port(struct fou_get_req *req, __u16 port /* big-endian */) +{ + req->_present.port = 1; + req->port = port; +} +static inline void +fou_get_req_set_peer_port(struct fou_get_req *req, + __u16 peer_port /* big-endian */) +{ + req->_present.peer_port = 1; + req->peer_port = peer_port; +} +static inline void +fou_get_req_set_local_v4(struct fou_get_req *req, __u32 local_v4) +{ + req->_present.local_v4 = 1; + req->local_v4 = local_v4; +} +static inline void +fou_get_req_set_peer_v4(struct fou_get_req *req, __u32 peer_v4) +{ + req->_present.peer_v4 = 1; + req->peer_v4 = peer_v4; +} +static inline void +fou_get_req_set_local_v6(struct fou_get_req *req, const void *local_v6, + size_t len) +{ + free(req->local_v6); + req->_present.local_v6_len = len; + req->local_v6 = malloc(req->_present.local_v6_len); + memcpy(req->local_v6, local_v6, req->_present.local_v6_len); +} +static inline void +fou_get_req_set_peer_v6(struct fou_get_req *req, const void *peer_v6, + size_t len) +{ + free(req->peer_v6); + req->_present.peer_v6_len = len; + req->peer_v6 = malloc(req->_present.peer_v6_len); + memcpy(req->peer_v6, peer_v6, req->_present.peer_v6_len); +} + +struct fou_get_rsp { + struct { + __u32 port:1; + __u32 ipproto:1; + __u32 type:1; + __u32 remcsum_nopartial:1; + __u32 local_v4:1; + __u32 peer_v4:1; + __u32 local_v6_len; + __u32 peer_v6_len; + __u32 peer_port:1; + __u32 ifindex:1; + } _present; + + __u16 port /* big-endian */; + __u8 ipproto; + __u8 type; + __u32 local_v4; + __u32 peer_v4; + void *local_v6; + void *peer_v6; + __u16 peer_port /* big-endian */; + __s32 ifindex; +}; + +void fou_get_rsp_free(struct fou_get_rsp *rsp); + +/* + * Get tunnel info. + */ +struct fou_get_rsp *fou_get(struct ynl_sock *ys, struct fou_get_req *req); + +/* FOU_CMD_GET - dump */ +struct fou_get_list { + struct fou_get_list *next; + struct fou_get_rsp obj __attribute__((aligned(8))); +}; + +void fou_get_list_free(struct fou_get_list *rsp); + +struct fou_get_list *fou_get_dump(struct ynl_sock *ys); + +#endif /* _LINUX_FOU_GEN_H */ diff --git a/include/ynl-c/handshake.h b/include/ynl-c/handshake.h new file mode 100644 index 0000000..bce537d --- /dev/null +++ b/include/ynl-c/handshake.h @@ -0,0 +1,145 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/handshake.yaml */ +/* YNL-GEN user header */ + +#ifndef _LINUX_HANDSHAKE_GEN_H +#define _LINUX_HANDSHAKE_GEN_H + +#include +#include +#include +#include + +struct ynl_sock; + +extern const struct ynl_family ynl_handshake_family; + +/* Enums */ +const char *handshake_op_str(int op); +const char *handshake_handler_class_str(enum handshake_handler_class value); +const char *handshake_msg_type_str(enum handshake_msg_type value); +const char *handshake_auth_str(enum handshake_auth value); + +/* Common nested types */ +struct handshake_x509 { + struct { + __u32 cert:1; + __u32 privkey:1; + } _present; + + __s32 cert; + __s32 privkey; +}; + +/* ============== HANDSHAKE_CMD_ACCEPT ============== */ +/* HANDSHAKE_CMD_ACCEPT - do */ +struct handshake_accept_req { + struct { + __u32 handler_class:1; + } _present; + + enum handshake_handler_class handler_class; +}; + +static inline struct handshake_accept_req *handshake_accept_req_alloc(void) +{ + return calloc(1, sizeof(struct handshake_accept_req)); +} +void handshake_accept_req_free(struct handshake_accept_req *req); + +static inline void +handshake_accept_req_set_handler_class(struct handshake_accept_req *req, + enum handshake_handler_class handler_class) +{ + req->_present.handler_class = 1; + req->handler_class = handler_class; +} + +struct handshake_accept_rsp { + struct { + __u32 sockfd:1; + __u32 message_type:1; + __u32 timeout:1; + __u32 auth_mode:1; + __u32 peername_len; + } _present; + + __s32 sockfd; + enum handshake_msg_type message_type; + __u32 timeout; + enum handshake_auth auth_mode; + unsigned int n_peer_identity; + __u32 *peer_identity; + unsigned int n_certificate; + struct handshake_x509 *certificate; + char *peername; +}; + +void handshake_accept_rsp_free(struct handshake_accept_rsp *rsp); + +/* + * Handler retrieves next queued handshake request + */ +struct handshake_accept_rsp * +handshake_accept(struct ynl_sock *ys, struct handshake_accept_req *req); + +/* HANDSHAKE_CMD_ACCEPT - notify */ +struct handshake_accept_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct handshake_accept_ntf *ntf); + struct handshake_accept_rsp obj __attribute__((aligned(8))); +}; + +void handshake_accept_ntf_free(struct handshake_accept_ntf *rsp); + +/* ============== HANDSHAKE_CMD_DONE ============== */ +/* HANDSHAKE_CMD_DONE - do */ +struct handshake_done_req { + struct { + __u32 status:1; + __u32 sockfd:1; + } _present; + + __u32 status; + __s32 sockfd; + unsigned int n_remote_auth; + __u32 *remote_auth; +}; + +static inline struct handshake_done_req *handshake_done_req_alloc(void) +{ + return calloc(1, sizeof(struct handshake_done_req)); +} +void handshake_done_req_free(struct handshake_done_req *req); + +static inline void +handshake_done_req_set_status(struct handshake_done_req *req, __u32 status) +{ + req->_present.status = 1; + req->status = status; +} +static inline void +handshake_done_req_set_sockfd(struct handshake_done_req *req, __s32 sockfd) +{ + req->_present.sockfd = 1; + req->sockfd = sockfd; +} +static inline void +__handshake_done_req_set_remote_auth(struct handshake_done_req *req, + __u32 *remote_auth, + unsigned int n_remote_auth) +{ + free(req->remote_auth); + req->remote_auth = remote_auth; + req->n_remote_auth = n_remote_auth; +} + +/* + * Handler reports handshake completion + */ +int handshake_done(struct ynl_sock *ys, struct handshake_done_req *req); + +#endif /* _LINUX_HANDSHAKE_GEN_H */ diff --git a/include/ynl-c/mptcp_pm.h b/include/ynl-c/mptcp_pm.h new file mode 100644 index 0000000..a7b27e6 --- /dev/null +++ b/include/ynl-c/mptcp_pm.h @@ -0,0 +1,1048 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/mptcp_pm.yaml */ +/* YNL-GEN user header */ + +#ifndef _LINUX_MPTCP_PM_GEN_H +#define _LINUX_MPTCP_PM_GEN_H + +#include +#include +#include +#include + +struct ynl_sock; + +extern const struct ynl_family ynl_mptcp_pm_family; + +/* Enums */ +const char *mptcp_pm_op_str(int op); +const char *mptcp_pm_event_type_str(enum mptcp_event_type value); + +/* Common nested types */ +struct mptcp_pm_address { + struct { + __u32 family:1; + __u32 id:1; + __u32 addr4:1; + __u32 addr6_len; + __u32 port:1; + __u32 flags:1; + __u32 if_idx:1; + } _present; + + __u16 family; + __u8 id; + __u32 addr4 /* big-endian */; + void *addr6; + __u16 port /* big-endian */; + __u32 flags; + __s32 if_idx; +}; + +/* ============== MPTCP_PM_CMD_ADD_ADDR ============== */ +/* MPTCP_PM_CMD_ADD_ADDR - do */ +struct mptcp_pm_add_addr_req { + struct { + __u32 addr:1; + } _present; + + struct mptcp_pm_address addr; +}; + +static inline struct mptcp_pm_add_addr_req *mptcp_pm_add_addr_req_alloc(void) +{ + return calloc(1, sizeof(struct mptcp_pm_add_addr_req)); +} +void mptcp_pm_add_addr_req_free(struct mptcp_pm_add_addr_req *req); + +static inline void +mptcp_pm_add_addr_req_set_addr_family(struct mptcp_pm_add_addr_req *req, + __u16 family) +{ + req->_present.addr = 1; + req->addr._present.family = 1; + req->addr.family = family; +} +static inline void +mptcp_pm_add_addr_req_set_addr_id(struct mptcp_pm_add_addr_req *req, __u8 id) +{ + req->_present.addr = 1; + req->addr._present.id = 1; + req->addr.id = id; +} +static inline void +mptcp_pm_add_addr_req_set_addr_addr4(struct mptcp_pm_add_addr_req *req, + __u32 addr4 /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.addr4 = 1; + req->addr.addr4 = addr4; +} +static inline void +mptcp_pm_add_addr_req_set_addr_addr6(struct mptcp_pm_add_addr_req *req, + const void *addr6, size_t len) +{ + free(req->addr.addr6); + req->addr._present.addr6_len = len; + req->addr.addr6 = malloc(req->addr._present.addr6_len); + memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); +} +static inline void +mptcp_pm_add_addr_req_set_addr_port(struct mptcp_pm_add_addr_req *req, + __u16 port /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.port = 1; + req->addr.port = port; +} +static inline void +mptcp_pm_add_addr_req_set_addr_flags(struct mptcp_pm_add_addr_req *req, + __u32 flags) +{ + req->_present.addr = 1; + req->addr._present.flags = 1; + req->addr.flags = flags; +} +static inline void +mptcp_pm_add_addr_req_set_addr_if_idx(struct mptcp_pm_add_addr_req *req, + __s32 if_idx) +{ + req->_present.addr = 1; + req->addr._present.if_idx = 1; + req->addr.if_idx = if_idx; +} + +/* + * Add endpoint + */ +int mptcp_pm_add_addr(struct ynl_sock *ys, struct mptcp_pm_add_addr_req *req); + +/* ============== MPTCP_PM_CMD_DEL_ADDR ============== */ +/* MPTCP_PM_CMD_DEL_ADDR - do */ +struct mptcp_pm_del_addr_req { + struct { + __u32 addr:1; + } _present; + + struct mptcp_pm_address addr; +}; + +static inline struct mptcp_pm_del_addr_req *mptcp_pm_del_addr_req_alloc(void) +{ + return calloc(1, sizeof(struct mptcp_pm_del_addr_req)); +} +void mptcp_pm_del_addr_req_free(struct mptcp_pm_del_addr_req *req); + +static inline void +mptcp_pm_del_addr_req_set_addr_family(struct mptcp_pm_del_addr_req *req, + __u16 family) +{ + req->_present.addr = 1; + req->addr._present.family = 1; + req->addr.family = family; +} +static inline void +mptcp_pm_del_addr_req_set_addr_id(struct mptcp_pm_del_addr_req *req, __u8 id) +{ + req->_present.addr = 1; + req->addr._present.id = 1; + req->addr.id = id; +} +static inline void +mptcp_pm_del_addr_req_set_addr_addr4(struct mptcp_pm_del_addr_req *req, + __u32 addr4 /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.addr4 = 1; + req->addr.addr4 = addr4; +} +static inline void +mptcp_pm_del_addr_req_set_addr_addr6(struct mptcp_pm_del_addr_req *req, + const void *addr6, size_t len) +{ + free(req->addr.addr6); + req->addr._present.addr6_len = len; + req->addr.addr6 = malloc(req->addr._present.addr6_len); + memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); +} +static inline void +mptcp_pm_del_addr_req_set_addr_port(struct mptcp_pm_del_addr_req *req, + __u16 port /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.port = 1; + req->addr.port = port; +} +static inline void +mptcp_pm_del_addr_req_set_addr_flags(struct mptcp_pm_del_addr_req *req, + __u32 flags) +{ + req->_present.addr = 1; + req->addr._present.flags = 1; + req->addr.flags = flags; +} +static inline void +mptcp_pm_del_addr_req_set_addr_if_idx(struct mptcp_pm_del_addr_req *req, + __s32 if_idx) +{ + req->_present.addr = 1; + req->addr._present.if_idx = 1; + req->addr.if_idx = if_idx; +} + +/* + * Delete endpoint + */ +int mptcp_pm_del_addr(struct ynl_sock *ys, struct mptcp_pm_del_addr_req *req); + +/* ============== MPTCP_PM_CMD_GET_ADDR ============== */ +/* MPTCP_PM_CMD_GET_ADDR - do */ +struct mptcp_pm_get_addr_req { + struct { + __u32 addr:1; + __u32 token:1; + } _present; + + struct mptcp_pm_address addr; + __u32 token; +}; + +static inline struct mptcp_pm_get_addr_req *mptcp_pm_get_addr_req_alloc(void) +{ + return calloc(1, sizeof(struct mptcp_pm_get_addr_req)); +} +void mptcp_pm_get_addr_req_free(struct mptcp_pm_get_addr_req *req); + +static inline void +mptcp_pm_get_addr_req_set_addr_family(struct mptcp_pm_get_addr_req *req, + __u16 family) +{ + req->_present.addr = 1; + req->addr._present.family = 1; + req->addr.family = family; +} +static inline void +mptcp_pm_get_addr_req_set_addr_id(struct mptcp_pm_get_addr_req *req, __u8 id) +{ + req->_present.addr = 1; + req->addr._present.id = 1; + req->addr.id = id; +} +static inline void +mptcp_pm_get_addr_req_set_addr_addr4(struct mptcp_pm_get_addr_req *req, + __u32 addr4 /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.addr4 = 1; + req->addr.addr4 = addr4; +} +static inline void +mptcp_pm_get_addr_req_set_addr_addr6(struct mptcp_pm_get_addr_req *req, + const void *addr6, size_t len) +{ + free(req->addr.addr6); + req->addr._present.addr6_len = len; + req->addr.addr6 = malloc(req->addr._present.addr6_len); + memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); +} +static inline void +mptcp_pm_get_addr_req_set_addr_port(struct mptcp_pm_get_addr_req *req, + __u16 port /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.port = 1; + req->addr.port = port; +} +static inline void +mptcp_pm_get_addr_req_set_addr_flags(struct mptcp_pm_get_addr_req *req, + __u32 flags) +{ + req->_present.addr = 1; + req->addr._present.flags = 1; + req->addr.flags = flags; +} +static inline void +mptcp_pm_get_addr_req_set_addr_if_idx(struct mptcp_pm_get_addr_req *req, + __s32 if_idx) +{ + req->_present.addr = 1; + req->addr._present.if_idx = 1; + req->addr.if_idx = if_idx; +} +static inline void +mptcp_pm_get_addr_req_set_token(struct mptcp_pm_get_addr_req *req, __u32 token) +{ + req->_present.token = 1; + req->token = token; +} + +struct mptcp_pm_get_addr_rsp { + struct { + __u32 addr:1; + } _present; + + struct mptcp_pm_address addr; +}; + +void mptcp_pm_get_addr_rsp_free(struct mptcp_pm_get_addr_rsp *rsp); + +/* + * Get endpoint information + */ +struct mptcp_pm_get_addr_rsp * +mptcp_pm_get_addr(struct ynl_sock *ys, struct mptcp_pm_get_addr_req *req); + +/* MPTCP_PM_CMD_GET_ADDR - dump */ +struct mptcp_pm_get_addr_list { + struct mptcp_pm_get_addr_list *next; + struct mptcp_pm_get_addr_rsp obj __attribute__((aligned(8))); +}; + +void mptcp_pm_get_addr_list_free(struct mptcp_pm_get_addr_list *rsp); + +struct mptcp_pm_get_addr_list *mptcp_pm_get_addr_dump(struct ynl_sock *ys); + +/* ============== MPTCP_PM_CMD_FLUSH_ADDRS ============== */ +/* MPTCP_PM_CMD_FLUSH_ADDRS - do */ +struct mptcp_pm_flush_addrs_req { + struct { + __u32 addr:1; + } _present; + + struct mptcp_pm_address addr; +}; + +static inline struct mptcp_pm_flush_addrs_req * +mptcp_pm_flush_addrs_req_alloc(void) +{ + return calloc(1, sizeof(struct mptcp_pm_flush_addrs_req)); +} +void mptcp_pm_flush_addrs_req_free(struct mptcp_pm_flush_addrs_req *req); + +static inline void +mptcp_pm_flush_addrs_req_set_addr_family(struct mptcp_pm_flush_addrs_req *req, + __u16 family) +{ + req->_present.addr = 1; + req->addr._present.family = 1; + req->addr.family = family; +} +static inline void +mptcp_pm_flush_addrs_req_set_addr_id(struct mptcp_pm_flush_addrs_req *req, + __u8 id) +{ + req->_present.addr = 1; + req->addr._present.id = 1; + req->addr.id = id; +} +static inline void +mptcp_pm_flush_addrs_req_set_addr_addr4(struct mptcp_pm_flush_addrs_req *req, + __u32 addr4 /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.addr4 = 1; + req->addr.addr4 = addr4; +} +static inline void +mptcp_pm_flush_addrs_req_set_addr_addr6(struct mptcp_pm_flush_addrs_req *req, + const void *addr6, size_t len) +{ + free(req->addr.addr6); + req->addr._present.addr6_len = len; + req->addr.addr6 = malloc(req->addr._present.addr6_len); + memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); +} +static inline void +mptcp_pm_flush_addrs_req_set_addr_port(struct mptcp_pm_flush_addrs_req *req, + __u16 port /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.port = 1; + req->addr.port = port; +} +static inline void +mptcp_pm_flush_addrs_req_set_addr_flags(struct mptcp_pm_flush_addrs_req *req, + __u32 flags) +{ + req->_present.addr = 1; + req->addr._present.flags = 1; + req->addr.flags = flags; +} +static inline void +mptcp_pm_flush_addrs_req_set_addr_if_idx(struct mptcp_pm_flush_addrs_req *req, + __s32 if_idx) +{ + req->_present.addr = 1; + req->addr._present.if_idx = 1; + req->addr.if_idx = if_idx; +} + +/* + * flush addresses + */ +int mptcp_pm_flush_addrs(struct ynl_sock *ys, + struct mptcp_pm_flush_addrs_req *req); + +/* ============== MPTCP_PM_CMD_SET_LIMITS ============== */ +/* MPTCP_PM_CMD_SET_LIMITS - do */ +struct mptcp_pm_set_limits_req { + struct { + __u32 rcv_add_addrs:1; + __u32 subflows:1; + } _present; + + __u32 rcv_add_addrs; + __u32 subflows; +}; + +static inline struct mptcp_pm_set_limits_req * +mptcp_pm_set_limits_req_alloc(void) +{ + return calloc(1, sizeof(struct mptcp_pm_set_limits_req)); +} +void mptcp_pm_set_limits_req_free(struct mptcp_pm_set_limits_req *req); + +static inline void +mptcp_pm_set_limits_req_set_rcv_add_addrs(struct mptcp_pm_set_limits_req *req, + __u32 rcv_add_addrs) +{ + req->_present.rcv_add_addrs = 1; + req->rcv_add_addrs = rcv_add_addrs; +} +static inline void +mptcp_pm_set_limits_req_set_subflows(struct mptcp_pm_set_limits_req *req, + __u32 subflows) +{ + req->_present.subflows = 1; + req->subflows = subflows; +} + +/* + * Set protocol limits + */ +int mptcp_pm_set_limits(struct ynl_sock *ys, + struct mptcp_pm_set_limits_req *req); + +/* ============== MPTCP_PM_CMD_GET_LIMITS ============== */ +/* MPTCP_PM_CMD_GET_LIMITS - do */ +struct mptcp_pm_get_limits_req { + struct { + __u32 rcv_add_addrs:1; + __u32 subflows:1; + } _present; + + __u32 rcv_add_addrs; + __u32 subflows; +}; + +static inline struct mptcp_pm_get_limits_req * +mptcp_pm_get_limits_req_alloc(void) +{ + return calloc(1, sizeof(struct mptcp_pm_get_limits_req)); +} +void mptcp_pm_get_limits_req_free(struct mptcp_pm_get_limits_req *req); + +static inline void +mptcp_pm_get_limits_req_set_rcv_add_addrs(struct mptcp_pm_get_limits_req *req, + __u32 rcv_add_addrs) +{ + req->_present.rcv_add_addrs = 1; + req->rcv_add_addrs = rcv_add_addrs; +} +static inline void +mptcp_pm_get_limits_req_set_subflows(struct mptcp_pm_get_limits_req *req, + __u32 subflows) +{ + req->_present.subflows = 1; + req->subflows = subflows; +} + +struct mptcp_pm_get_limits_rsp { + struct { + __u32 rcv_add_addrs:1; + __u32 subflows:1; + } _present; + + __u32 rcv_add_addrs; + __u32 subflows; +}; + +void mptcp_pm_get_limits_rsp_free(struct mptcp_pm_get_limits_rsp *rsp); + +/* + * Get protocol limits + */ +struct mptcp_pm_get_limits_rsp * +mptcp_pm_get_limits(struct ynl_sock *ys, struct mptcp_pm_get_limits_req *req); + +/* ============== MPTCP_PM_CMD_SET_FLAGS ============== */ +/* MPTCP_PM_CMD_SET_FLAGS - do */ +struct mptcp_pm_set_flags_req { + struct { + __u32 addr:1; + __u32 token:1; + __u32 addr_remote:1; + } _present; + + struct mptcp_pm_address addr; + __u32 token; + struct mptcp_pm_address addr_remote; +}; + +static inline struct mptcp_pm_set_flags_req *mptcp_pm_set_flags_req_alloc(void) +{ + return calloc(1, sizeof(struct mptcp_pm_set_flags_req)); +} +void mptcp_pm_set_flags_req_free(struct mptcp_pm_set_flags_req *req); + +static inline void +mptcp_pm_set_flags_req_set_addr_family(struct mptcp_pm_set_flags_req *req, + __u16 family) +{ + req->_present.addr = 1; + req->addr._present.family = 1; + req->addr.family = family; +} +static inline void +mptcp_pm_set_flags_req_set_addr_id(struct mptcp_pm_set_flags_req *req, __u8 id) +{ + req->_present.addr = 1; + req->addr._present.id = 1; + req->addr.id = id; +} +static inline void +mptcp_pm_set_flags_req_set_addr_addr4(struct mptcp_pm_set_flags_req *req, + __u32 addr4 /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.addr4 = 1; + req->addr.addr4 = addr4; +} +static inline void +mptcp_pm_set_flags_req_set_addr_addr6(struct mptcp_pm_set_flags_req *req, + const void *addr6, size_t len) +{ + free(req->addr.addr6); + req->addr._present.addr6_len = len; + req->addr.addr6 = malloc(req->addr._present.addr6_len); + memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); +} +static inline void +mptcp_pm_set_flags_req_set_addr_port(struct mptcp_pm_set_flags_req *req, + __u16 port /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.port = 1; + req->addr.port = port; +} +static inline void +mptcp_pm_set_flags_req_set_addr_flags(struct mptcp_pm_set_flags_req *req, + __u32 flags) +{ + req->_present.addr = 1; + req->addr._present.flags = 1; + req->addr.flags = flags; +} +static inline void +mptcp_pm_set_flags_req_set_addr_if_idx(struct mptcp_pm_set_flags_req *req, + __s32 if_idx) +{ + req->_present.addr = 1; + req->addr._present.if_idx = 1; + req->addr.if_idx = if_idx; +} +static inline void +mptcp_pm_set_flags_req_set_token(struct mptcp_pm_set_flags_req *req, + __u32 token) +{ + req->_present.token = 1; + req->token = token; +} +static inline void +mptcp_pm_set_flags_req_set_addr_remote_family(struct mptcp_pm_set_flags_req *req, + __u16 family) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.family = 1; + req->addr_remote.family = family; +} +static inline void +mptcp_pm_set_flags_req_set_addr_remote_id(struct mptcp_pm_set_flags_req *req, + __u8 id) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.id = 1; + req->addr_remote.id = id; +} +static inline void +mptcp_pm_set_flags_req_set_addr_remote_addr4(struct mptcp_pm_set_flags_req *req, + __u32 addr4 /* big-endian */) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.addr4 = 1; + req->addr_remote.addr4 = addr4; +} +static inline void +mptcp_pm_set_flags_req_set_addr_remote_addr6(struct mptcp_pm_set_flags_req *req, + const void *addr6, size_t len) +{ + free(req->addr_remote.addr6); + req->addr_remote._present.addr6_len = len; + req->addr_remote.addr6 = malloc(req->addr_remote._present.addr6_len); + memcpy(req->addr_remote.addr6, addr6, req->addr_remote._present.addr6_len); +} +static inline void +mptcp_pm_set_flags_req_set_addr_remote_port(struct mptcp_pm_set_flags_req *req, + __u16 port /* big-endian */) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.port = 1; + req->addr_remote.port = port; +} +static inline void +mptcp_pm_set_flags_req_set_addr_remote_flags(struct mptcp_pm_set_flags_req *req, + __u32 flags) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.flags = 1; + req->addr_remote.flags = flags; +} +static inline void +mptcp_pm_set_flags_req_set_addr_remote_if_idx(struct mptcp_pm_set_flags_req *req, + __s32 if_idx) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.if_idx = 1; + req->addr_remote.if_idx = if_idx; +} + +/* + * Change endpoint flags + */ +int mptcp_pm_set_flags(struct ynl_sock *ys, struct mptcp_pm_set_flags_req *req); + +/* ============== MPTCP_PM_CMD_ANNOUNCE ============== */ +/* MPTCP_PM_CMD_ANNOUNCE - do */ +struct mptcp_pm_announce_req { + struct { + __u32 addr:1; + __u32 token:1; + } _present; + + struct mptcp_pm_address addr; + __u32 token; +}; + +static inline struct mptcp_pm_announce_req *mptcp_pm_announce_req_alloc(void) +{ + return calloc(1, sizeof(struct mptcp_pm_announce_req)); +} +void mptcp_pm_announce_req_free(struct mptcp_pm_announce_req *req); + +static inline void +mptcp_pm_announce_req_set_addr_family(struct mptcp_pm_announce_req *req, + __u16 family) +{ + req->_present.addr = 1; + req->addr._present.family = 1; + req->addr.family = family; +} +static inline void +mptcp_pm_announce_req_set_addr_id(struct mptcp_pm_announce_req *req, __u8 id) +{ + req->_present.addr = 1; + req->addr._present.id = 1; + req->addr.id = id; +} +static inline void +mptcp_pm_announce_req_set_addr_addr4(struct mptcp_pm_announce_req *req, + __u32 addr4 /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.addr4 = 1; + req->addr.addr4 = addr4; +} +static inline void +mptcp_pm_announce_req_set_addr_addr6(struct mptcp_pm_announce_req *req, + const void *addr6, size_t len) +{ + free(req->addr.addr6); + req->addr._present.addr6_len = len; + req->addr.addr6 = malloc(req->addr._present.addr6_len); + memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); +} +static inline void +mptcp_pm_announce_req_set_addr_port(struct mptcp_pm_announce_req *req, + __u16 port /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.port = 1; + req->addr.port = port; +} +static inline void +mptcp_pm_announce_req_set_addr_flags(struct mptcp_pm_announce_req *req, + __u32 flags) +{ + req->_present.addr = 1; + req->addr._present.flags = 1; + req->addr.flags = flags; +} +static inline void +mptcp_pm_announce_req_set_addr_if_idx(struct mptcp_pm_announce_req *req, + __s32 if_idx) +{ + req->_present.addr = 1; + req->addr._present.if_idx = 1; + req->addr.if_idx = if_idx; +} +static inline void +mptcp_pm_announce_req_set_token(struct mptcp_pm_announce_req *req, __u32 token) +{ + req->_present.token = 1; + req->token = token; +} + +/* + * announce new sf + */ +int mptcp_pm_announce(struct ynl_sock *ys, struct mptcp_pm_announce_req *req); + +/* ============== MPTCP_PM_CMD_REMOVE ============== */ +/* MPTCP_PM_CMD_REMOVE - do */ +struct mptcp_pm_remove_req { + struct { + __u32 token:1; + __u32 loc_id:1; + } _present; + + __u32 token; + __u8 loc_id; +}; + +static inline struct mptcp_pm_remove_req *mptcp_pm_remove_req_alloc(void) +{ + return calloc(1, sizeof(struct mptcp_pm_remove_req)); +} +void mptcp_pm_remove_req_free(struct mptcp_pm_remove_req *req); + +static inline void +mptcp_pm_remove_req_set_token(struct mptcp_pm_remove_req *req, __u32 token) +{ + req->_present.token = 1; + req->token = token; +} +static inline void +mptcp_pm_remove_req_set_loc_id(struct mptcp_pm_remove_req *req, __u8 loc_id) +{ + req->_present.loc_id = 1; + req->loc_id = loc_id; +} + +/* + * announce removal + */ +int mptcp_pm_remove(struct ynl_sock *ys, struct mptcp_pm_remove_req *req); + +/* ============== MPTCP_PM_CMD_SUBFLOW_CREATE ============== */ +/* MPTCP_PM_CMD_SUBFLOW_CREATE - do */ +struct mptcp_pm_subflow_create_req { + struct { + __u32 addr:1; + __u32 token:1; + __u32 addr_remote:1; + } _present; + + struct mptcp_pm_address addr; + __u32 token; + struct mptcp_pm_address addr_remote; +}; + +static inline struct mptcp_pm_subflow_create_req * +mptcp_pm_subflow_create_req_alloc(void) +{ + return calloc(1, sizeof(struct mptcp_pm_subflow_create_req)); +} +void mptcp_pm_subflow_create_req_free(struct mptcp_pm_subflow_create_req *req); + +static inline void +mptcp_pm_subflow_create_req_set_addr_family(struct mptcp_pm_subflow_create_req *req, + __u16 family) +{ + req->_present.addr = 1; + req->addr._present.family = 1; + req->addr.family = family; +} +static inline void +mptcp_pm_subflow_create_req_set_addr_id(struct mptcp_pm_subflow_create_req *req, + __u8 id) +{ + req->_present.addr = 1; + req->addr._present.id = 1; + req->addr.id = id; +} +static inline void +mptcp_pm_subflow_create_req_set_addr_addr4(struct mptcp_pm_subflow_create_req *req, + __u32 addr4 /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.addr4 = 1; + req->addr.addr4 = addr4; +} +static inline void +mptcp_pm_subflow_create_req_set_addr_addr6(struct mptcp_pm_subflow_create_req *req, + const void *addr6, size_t len) +{ + free(req->addr.addr6); + req->addr._present.addr6_len = len; + req->addr.addr6 = malloc(req->addr._present.addr6_len); + memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); +} +static inline void +mptcp_pm_subflow_create_req_set_addr_port(struct mptcp_pm_subflow_create_req *req, + __u16 port /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.port = 1; + req->addr.port = port; +} +static inline void +mptcp_pm_subflow_create_req_set_addr_flags(struct mptcp_pm_subflow_create_req *req, + __u32 flags) +{ + req->_present.addr = 1; + req->addr._present.flags = 1; + req->addr.flags = flags; +} +static inline void +mptcp_pm_subflow_create_req_set_addr_if_idx(struct mptcp_pm_subflow_create_req *req, + __s32 if_idx) +{ + req->_present.addr = 1; + req->addr._present.if_idx = 1; + req->addr.if_idx = if_idx; +} +static inline void +mptcp_pm_subflow_create_req_set_token(struct mptcp_pm_subflow_create_req *req, + __u32 token) +{ + req->_present.token = 1; + req->token = token; +} +static inline void +mptcp_pm_subflow_create_req_set_addr_remote_family(struct mptcp_pm_subflow_create_req *req, + __u16 family) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.family = 1; + req->addr_remote.family = family; +} +static inline void +mptcp_pm_subflow_create_req_set_addr_remote_id(struct mptcp_pm_subflow_create_req *req, + __u8 id) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.id = 1; + req->addr_remote.id = id; +} +static inline void +mptcp_pm_subflow_create_req_set_addr_remote_addr4(struct mptcp_pm_subflow_create_req *req, + __u32 addr4 /* big-endian */) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.addr4 = 1; + req->addr_remote.addr4 = addr4; +} +static inline void +mptcp_pm_subflow_create_req_set_addr_remote_addr6(struct mptcp_pm_subflow_create_req *req, + const void *addr6, + size_t len) +{ + free(req->addr_remote.addr6); + req->addr_remote._present.addr6_len = len; + req->addr_remote.addr6 = malloc(req->addr_remote._present.addr6_len); + memcpy(req->addr_remote.addr6, addr6, req->addr_remote._present.addr6_len); +} +static inline void +mptcp_pm_subflow_create_req_set_addr_remote_port(struct mptcp_pm_subflow_create_req *req, + __u16 port /* big-endian */) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.port = 1; + req->addr_remote.port = port; +} +static inline void +mptcp_pm_subflow_create_req_set_addr_remote_flags(struct mptcp_pm_subflow_create_req *req, + __u32 flags) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.flags = 1; + req->addr_remote.flags = flags; +} +static inline void +mptcp_pm_subflow_create_req_set_addr_remote_if_idx(struct mptcp_pm_subflow_create_req *req, + __s32 if_idx) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.if_idx = 1; + req->addr_remote.if_idx = if_idx; +} + +/* + * todo + */ +int mptcp_pm_subflow_create(struct ynl_sock *ys, + struct mptcp_pm_subflow_create_req *req); + +/* ============== MPTCP_PM_CMD_SUBFLOW_DESTROY ============== */ +/* MPTCP_PM_CMD_SUBFLOW_DESTROY - do */ +struct mptcp_pm_subflow_destroy_req { + struct { + __u32 addr:1; + __u32 token:1; + __u32 addr_remote:1; + } _present; + + struct mptcp_pm_address addr; + __u32 token; + struct mptcp_pm_address addr_remote; +}; + +static inline struct mptcp_pm_subflow_destroy_req * +mptcp_pm_subflow_destroy_req_alloc(void) +{ + return calloc(1, sizeof(struct mptcp_pm_subflow_destroy_req)); +} +void +mptcp_pm_subflow_destroy_req_free(struct mptcp_pm_subflow_destroy_req *req); + +static inline void +mptcp_pm_subflow_destroy_req_set_addr_family(struct mptcp_pm_subflow_destroy_req *req, + __u16 family) +{ + req->_present.addr = 1; + req->addr._present.family = 1; + req->addr.family = family; +} +static inline void +mptcp_pm_subflow_destroy_req_set_addr_id(struct mptcp_pm_subflow_destroy_req *req, + __u8 id) +{ + req->_present.addr = 1; + req->addr._present.id = 1; + req->addr.id = id; +} +static inline void +mptcp_pm_subflow_destroy_req_set_addr_addr4(struct mptcp_pm_subflow_destroy_req *req, + __u32 addr4 /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.addr4 = 1; + req->addr.addr4 = addr4; +} +static inline void +mptcp_pm_subflow_destroy_req_set_addr_addr6(struct mptcp_pm_subflow_destroy_req *req, + const void *addr6, size_t len) +{ + free(req->addr.addr6); + req->addr._present.addr6_len = len; + req->addr.addr6 = malloc(req->addr._present.addr6_len); + memcpy(req->addr.addr6, addr6, req->addr._present.addr6_len); +} +static inline void +mptcp_pm_subflow_destroy_req_set_addr_port(struct mptcp_pm_subflow_destroy_req *req, + __u16 port /* big-endian */) +{ + req->_present.addr = 1; + req->addr._present.port = 1; + req->addr.port = port; +} +static inline void +mptcp_pm_subflow_destroy_req_set_addr_flags(struct mptcp_pm_subflow_destroy_req *req, + __u32 flags) +{ + req->_present.addr = 1; + req->addr._present.flags = 1; + req->addr.flags = flags; +} +static inline void +mptcp_pm_subflow_destroy_req_set_addr_if_idx(struct mptcp_pm_subflow_destroy_req *req, + __s32 if_idx) +{ + req->_present.addr = 1; + req->addr._present.if_idx = 1; + req->addr.if_idx = if_idx; +} +static inline void +mptcp_pm_subflow_destroy_req_set_token(struct mptcp_pm_subflow_destroy_req *req, + __u32 token) +{ + req->_present.token = 1; + req->token = token; +} +static inline void +mptcp_pm_subflow_destroy_req_set_addr_remote_family(struct mptcp_pm_subflow_destroy_req *req, + __u16 family) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.family = 1; + req->addr_remote.family = family; +} +static inline void +mptcp_pm_subflow_destroy_req_set_addr_remote_id(struct mptcp_pm_subflow_destroy_req *req, + __u8 id) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.id = 1; + req->addr_remote.id = id; +} +static inline void +mptcp_pm_subflow_destroy_req_set_addr_remote_addr4(struct mptcp_pm_subflow_destroy_req *req, + __u32 addr4 /* big-endian */) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.addr4 = 1; + req->addr_remote.addr4 = addr4; +} +static inline void +mptcp_pm_subflow_destroy_req_set_addr_remote_addr6(struct mptcp_pm_subflow_destroy_req *req, + const void *addr6, + size_t len) +{ + free(req->addr_remote.addr6); + req->addr_remote._present.addr6_len = len; + req->addr_remote.addr6 = malloc(req->addr_remote._present.addr6_len); + memcpy(req->addr_remote.addr6, addr6, req->addr_remote._present.addr6_len); +} +static inline void +mptcp_pm_subflow_destroy_req_set_addr_remote_port(struct mptcp_pm_subflow_destroy_req *req, + __u16 port /* big-endian */) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.port = 1; + req->addr_remote.port = port; +} +static inline void +mptcp_pm_subflow_destroy_req_set_addr_remote_flags(struct mptcp_pm_subflow_destroy_req *req, + __u32 flags) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.flags = 1; + req->addr_remote.flags = flags; +} +static inline void +mptcp_pm_subflow_destroy_req_set_addr_remote_if_idx(struct mptcp_pm_subflow_destroy_req *req, + __s32 if_idx) +{ + req->_present.addr_remote = 1; + req->addr_remote._present.if_idx = 1; + req->addr_remote.if_idx = if_idx; +} + +/* + * todo + */ +int mptcp_pm_subflow_destroy(struct ynl_sock *ys, + struct mptcp_pm_subflow_destroy_req *req); + +#endif /* _LINUX_MPTCP_PM_GEN_H */ diff --git a/include/ynl-c/netdev.h b/include/ynl-c/netdev.h new file mode 100644 index 0000000..7b0fdd7 --- /dev/null +++ b/include/ynl-c/netdev.h @@ -0,0 +1,499 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/netdev.yaml */ +/* YNL-GEN user header */ + +#ifndef _LINUX_NETDEV_GEN_H +#define _LINUX_NETDEV_GEN_H + +#include +#include +#include +#include + +struct ynl_sock; + +extern const struct ynl_family ynl_netdev_family; + +/* Enums */ +const char *netdev_op_str(int op); +const char *netdev_xdp_act_str(enum netdev_xdp_act value); +const char *netdev_xdp_rx_metadata_str(enum netdev_xdp_rx_metadata value); +const char *netdev_xsk_flags_str(enum netdev_xsk_flags value); +const char *netdev_queue_type_str(enum netdev_queue_type value); +const char *netdev_qstats_scope_str(enum netdev_qstats_scope value); + +/* Common nested types */ +struct netdev_page_pool_info { + struct { + __u32 id:1; + __u32 ifindex:1; + } _present; + + __u64 id; + __u32 ifindex; +}; + +/* ============== NETDEV_CMD_DEV_GET ============== */ +/* NETDEV_CMD_DEV_GET - do */ +struct netdev_dev_get_req { + struct { + __u32 ifindex:1; + } _present; + + __u32 ifindex; +}; + +static inline struct netdev_dev_get_req *netdev_dev_get_req_alloc(void) +{ + return calloc(1, sizeof(struct netdev_dev_get_req)); +} +void netdev_dev_get_req_free(struct netdev_dev_get_req *req); + +static inline void +netdev_dev_get_req_set_ifindex(struct netdev_dev_get_req *req, __u32 ifindex) +{ + req->_present.ifindex = 1; + req->ifindex = ifindex; +} + +struct netdev_dev_get_rsp { + struct { + __u32 ifindex:1; + __u32 xdp_features:1; + __u32 xdp_zc_max_segs:1; + __u32 xdp_rx_metadata_features:1; + __u32 xsk_features:1; + } _present; + + __u32 ifindex; + __u64 xdp_features; + __u32 xdp_zc_max_segs; + __u64 xdp_rx_metadata_features; + __u64 xsk_features; +}; + +void netdev_dev_get_rsp_free(struct netdev_dev_get_rsp *rsp); + +/* + * Get / dump information about a netdev. + */ +struct netdev_dev_get_rsp * +netdev_dev_get(struct ynl_sock *ys, struct netdev_dev_get_req *req); + +/* NETDEV_CMD_DEV_GET - dump */ +struct netdev_dev_get_list { + struct netdev_dev_get_list *next; + struct netdev_dev_get_rsp obj __attribute__((aligned(8))); +}; + +void netdev_dev_get_list_free(struct netdev_dev_get_list *rsp); + +struct netdev_dev_get_list *netdev_dev_get_dump(struct ynl_sock *ys); + +/* NETDEV_CMD_DEV_GET - notify */ +struct netdev_dev_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct netdev_dev_get_ntf *ntf); + struct netdev_dev_get_rsp obj __attribute__((aligned(8))); +}; + +void netdev_dev_get_ntf_free(struct netdev_dev_get_ntf *rsp); + +/* ============== NETDEV_CMD_PAGE_POOL_GET ============== */ +/* NETDEV_CMD_PAGE_POOL_GET - do */ +struct netdev_page_pool_get_req { + struct { + __u32 id:1; + } _present; + + __u64 id; +}; + +static inline struct netdev_page_pool_get_req * +netdev_page_pool_get_req_alloc(void) +{ + return calloc(1, sizeof(struct netdev_page_pool_get_req)); +} +void netdev_page_pool_get_req_free(struct netdev_page_pool_get_req *req); + +static inline void +netdev_page_pool_get_req_set_id(struct netdev_page_pool_get_req *req, __u64 id) +{ + req->_present.id = 1; + req->id = id; +} + +struct netdev_page_pool_get_rsp { + struct { + __u32 id:1; + __u32 ifindex:1; + __u32 napi_id:1; + __u32 inflight:1; + __u32 inflight_mem:1; + __u32 detach_time:1; + } _present; + + __u64 id; + __u32 ifindex; + __u64 napi_id; + __u64 inflight; + __u64 inflight_mem; + __u64 detach_time; +}; + +void netdev_page_pool_get_rsp_free(struct netdev_page_pool_get_rsp *rsp); + +/* + * Get / dump information about Page Pools. +(Only Page Pools associated with a net_device can be listed.) + + */ +struct netdev_page_pool_get_rsp * +netdev_page_pool_get(struct ynl_sock *ys, struct netdev_page_pool_get_req *req); + +/* NETDEV_CMD_PAGE_POOL_GET - dump */ +struct netdev_page_pool_get_list { + struct netdev_page_pool_get_list *next; + struct netdev_page_pool_get_rsp obj __attribute__((aligned(8))); +}; + +void netdev_page_pool_get_list_free(struct netdev_page_pool_get_list *rsp); + +struct netdev_page_pool_get_list * +netdev_page_pool_get_dump(struct ynl_sock *ys); + +/* NETDEV_CMD_PAGE_POOL_GET - notify */ +struct netdev_page_pool_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct netdev_page_pool_get_ntf *ntf); + struct netdev_page_pool_get_rsp obj __attribute__((aligned(8))); +}; + +void netdev_page_pool_get_ntf_free(struct netdev_page_pool_get_ntf *rsp); + +/* ============== NETDEV_CMD_PAGE_POOL_STATS_GET ============== */ +/* NETDEV_CMD_PAGE_POOL_STATS_GET - do */ +struct netdev_page_pool_stats_get_req { + struct { + __u32 info:1; + } _present; + + struct netdev_page_pool_info info; +}; + +static inline struct netdev_page_pool_stats_get_req * +netdev_page_pool_stats_get_req_alloc(void) +{ + return calloc(1, sizeof(struct netdev_page_pool_stats_get_req)); +} +void +netdev_page_pool_stats_get_req_free(struct netdev_page_pool_stats_get_req *req); + +static inline void +netdev_page_pool_stats_get_req_set_info_id(struct netdev_page_pool_stats_get_req *req, + __u64 id) +{ + req->_present.info = 1; + req->info._present.id = 1; + req->info.id = id; +} +static inline void +netdev_page_pool_stats_get_req_set_info_ifindex(struct netdev_page_pool_stats_get_req *req, + __u32 ifindex) +{ + req->_present.info = 1; + req->info._present.ifindex = 1; + req->info.ifindex = ifindex; +} + +struct netdev_page_pool_stats_get_rsp { + struct { + __u32 info:1; + __u32 alloc_fast:1; + __u32 alloc_slow:1; + __u32 alloc_slow_high_order:1; + __u32 alloc_empty:1; + __u32 alloc_refill:1; + __u32 alloc_waive:1; + __u32 recycle_cached:1; + __u32 recycle_cache_full:1; + __u32 recycle_ring:1; + __u32 recycle_ring_full:1; + __u32 recycle_released_refcnt:1; + } _present; + + struct netdev_page_pool_info info; + __u64 alloc_fast; + __u64 alloc_slow; + __u64 alloc_slow_high_order; + __u64 alloc_empty; + __u64 alloc_refill; + __u64 alloc_waive; + __u64 recycle_cached; + __u64 recycle_cache_full; + __u64 recycle_ring; + __u64 recycle_ring_full; + __u64 recycle_released_refcnt; +}; + +void +netdev_page_pool_stats_get_rsp_free(struct netdev_page_pool_stats_get_rsp *rsp); + +/* + * Get page pool statistics. + */ +struct netdev_page_pool_stats_get_rsp * +netdev_page_pool_stats_get(struct ynl_sock *ys, + struct netdev_page_pool_stats_get_req *req); + +/* NETDEV_CMD_PAGE_POOL_STATS_GET - dump */ +struct netdev_page_pool_stats_get_list { + struct netdev_page_pool_stats_get_list *next; + struct netdev_page_pool_stats_get_rsp obj __attribute__((aligned(8))); +}; + +void +netdev_page_pool_stats_get_list_free(struct netdev_page_pool_stats_get_list *rsp); + +struct netdev_page_pool_stats_get_list * +netdev_page_pool_stats_get_dump(struct ynl_sock *ys); + +/* ============== NETDEV_CMD_QUEUE_GET ============== */ +/* NETDEV_CMD_QUEUE_GET - do */ +struct netdev_queue_get_req { + struct { + __u32 ifindex:1; + __u32 type:1; + __u32 id:1; + } _present; + + __u32 ifindex; + enum netdev_queue_type type; + __u32 id; +}; + +static inline struct netdev_queue_get_req *netdev_queue_get_req_alloc(void) +{ + return calloc(1, sizeof(struct netdev_queue_get_req)); +} +void netdev_queue_get_req_free(struct netdev_queue_get_req *req); + +static inline void +netdev_queue_get_req_set_ifindex(struct netdev_queue_get_req *req, + __u32 ifindex) +{ + req->_present.ifindex = 1; + req->ifindex = ifindex; +} +static inline void +netdev_queue_get_req_set_type(struct netdev_queue_get_req *req, + enum netdev_queue_type type) +{ + req->_present.type = 1; + req->type = type; +} +static inline void +netdev_queue_get_req_set_id(struct netdev_queue_get_req *req, __u32 id) +{ + req->_present.id = 1; + req->id = id; +} + +struct netdev_queue_get_rsp { + struct { + __u32 id:1; + __u32 type:1; + __u32 napi_id:1; + __u32 ifindex:1; + } _present; + + __u32 id; + enum netdev_queue_type type; + __u32 napi_id; + __u32 ifindex; +}; + +void netdev_queue_get_rsp_free(struct netdev_queue_get_rsp *rsp); + +/* + * Get queue information from the kernel. Only configured queues will be reported (as opposed to all available hardware queues). + */ +struct netdev_queue_get_rsp * +netdev_queue_get(struct ynl_sock *ys, struct netdev_queue_get_req *req); + +/* NETDEV_CMD_QUEUE_GET - dump */ +struct netdev_queue_get_req_dump { + struct { + __u32 ifindex:1; + } _present; + + __u32 ifindex; +}; + +static inline struct netdev_queue_get_req_dump * +netdev_queue_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct netdev_queue_get_req_dump)); +} +void netdev_queue_get_req_dump_free(struct netdev_queue_get_req_dump *req); + +static inline void +netdev_queue_get_req_dump_set_ifindex(struct netdev_queue_get_req_dump *req, + __u32 ifindex) +{ + req->_present.ifindex = 1; + req->ifindex = ifindex; +} + +struct netdev_queue_get_list { + struct netdev_queue_get_list *next; + struct netdev_queue_get_rsp obj __attribute__((aligned(8))); +}; + +void netdev_queue_get_list_free(struct netdev_queue_get_list *rsp); + +struct netdev_queue_get_list * +netdev_queue_get_dump(struct ynl_sock *ys, + struct netdev_queue_get_req_dump *req); + +/* ============== NETDEV_CMD_NAPI_GET ============== */ +/* NETDEV_CMD_NAPI_GET - do */ +struct netdev_napi_get_req { + struct { + __u32 id:1; + } _present; + + __u32 id; +}; + +static inline struct netdev_napi_get_req *netdev_napi_get_req_alloc(void) +{ + return calloc(1, sizeof(struct netdev_napi_get_req)); +} +void netdev_napi_get_req_free(struct netdev_napi_get_req *req); + +static inline void +netdev_napi_get_req_set_id(struct netdev_napi_get_req *req, __u32 id) +{ + req->_present.id = 1; + req->id = id; +} + +struct netdev_napi_get_rsp { + struct { + __u32 id:1; + __u32 ifindex:1; + __u32 irq:1; + __u32 pid:1; + } _present; + + __u32 id; + __u32 ifindex; + __u32 irq; + __u32 pid; +}; + +void netdev_napi_get_rsp_free(struct netdev_napi_get_rsp *rsp); + +/* + * Get information about NAPI instances configured on the system. + */ +struct netdev_napi_get_rsp * +netdev_napi_get(struct ynl_sock *ys, struct netdev_napi_get_req *req); + +/* NETDEV_CMD_NAPI_GET - dump */ +struct netdev_napi_get_req_dump { + struct { + __u32 ifindex:1; + } _present; + + __u32 ifindex; +}; + +static inline struct netdev_napi_get_req_dump * +netdev_napi_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct netdev_napi_get_req_dump)); +} +void netdev_napi_get_req_dump_free(struct netdev_napi_get_req_dump *req); + +static inline void +netdev_napi_get_req_dump_set_ifindex(struct netdev_napi_get_req_dump *req, + __u32 ifindex) +{ + req->_present.ifindex = 1; + req->ifindex = ifindex; +} + +struct netdev_napi_get_list { + struct netdev_napi_get_list *next; + struct netdev_napi_get_rsp obj __attribute__((aligned(8))); +}; + +void netdev_napi_get_list_free(struct netdev_napi_get_list *rsp); + +struct netdev_napi_get_list * +netdev_napi_get_dump(struct ynl_sock *ys, struct netdev_napi_get_req_dump *req); + +/* ============== NETDEV_CMD_QSTATS_GET ============== */ +/* NETDEV_CMD_QSTATS_GET - dump */ +struct netdev_qstats_get_req_dump { + struct { + __u32 scope:1; + } _present; + + __u64 scope; +}; + +static inline struct netdev_qstats_get_req_dump * +netdev_qstats_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct netdev_qstats_get_req_dump)); +} +void netdev_qstats_get_req_dump_free(struct netdev_qstats_get_req_dump *req); + +static inline void +netdev_qstats_get_req_dump_set_scope(struct netdev_qstats_get_req_dump *req, + __u64 scope) +{ + req->_present.scope = 1; + req->scope = scope; +} + +struct netdev_qstats_get_rsp_dump { + struct { + __u32 ifindex:1; + __u32 queue_type:1; + __u32 queue_id:1; + __u32 rx_packets:1; + __u32 rx_bytes:1; + __u32 tx_packets:1; + __u32 tx_bytes:1; + } _present; + + __u32 ifindex; + enum netdev_queue_type queue_type; + __u32 queue_id; + __u64 rx_packets; + __u64 rx_bytes; + __u64 tx_packets; + __u64 tx_bytes; +}; + +struct netdev_qstats_get_rsp_list { + struct netdev_qstats_get_rsp_list *next; + struct netdev_qstats_get_rsp_dump obj __attribute__((aligned(8))); +}; + +void netdev_qstats_get_rsp_list_free(struct netdev_qstats_get_rsp_list *rsp); + +struct netdev_qstats_get_rsp_list * +netdev_qstats_get_dump(struct ynl_sock *ys, + struct netdev_qstats_get_req_dump *req); + +#endif /* _LINUX_NETDEV_GEN_H */ diff --git a/include/ynl-c/nfsd.h b/include/ynl-c/nfsd.h new file mode 100644 index 0000000..989c6e2 --- /dev/null +++ b/include/ynl-c/nfsd.h @@ -0,0 +1,67 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/nfsd.yaml */ +/* YNL-GEN user header */ + +#ifndef _LINUX_NFSD_GEN_H +#define _LINUX_NFSD_GEN_H + +#include +#include +#include +#include + +struct ynl_sock; + +extern const struct ynl_family ynl_nfsd_family; + +/* Enums */ +const char *nfsd_op_str(int op); + +/* Common nested types */ +/* ============== NFSD_CMD_RPC_STATUS_GET ============== */ +/* NFSD_CMD_RPC_STATUS_GET - dump */ +struct nfsd_rpc_status_get_rsp_dump { + struct { + __u32 xid:1; + __u32 flags:1; + __u32 prog:1; + __u32 version:1; + __u32 proc:1; + __u32 service_time:1; + __u32 saddr4:1; + __u32 daddr4:1; + __u32 saddr6_len; + __u32 daddr6_len; + __u32 sport:1; + __u32 dport:1; + } _present; + + __u32 xid /* big-endian */; + __u32 flags; + __u32 prog; + __u8 version; + __u32 proc; + __s64 service_time; + __u32 saddr4 /* big-endian */; + __u32 daddr4 /* big-endian */; + void *saddr6; + void *daddr6; + __u16 sport /* big-endian */; + __u16 dport /* big-endian */; + unsigned int n_compound_ops; + __u32 *compound_ops; +}; + +struct nfsd_rpc_status_get_rsp_list { + struct nfsd_rpc_status_get_rsp_list *next; + struct nfsd_rpc_status_get_rsp_dump obj __attribute__((aligned(8))); +}; + +void +nfsd_rpc_status_get_rsp_list_free(struct nfsd_rpc_status_get_rsp_list *rsp); + +struct nfsd_rpc_status_get_rsp_list * +nfsd_rpc_status_get_dump(struct ynl_sock *ys); + +#endif /* _LINUX_NFSD_GEN_H */ diff --git a/include/ynl-c/nlctrl.h b/include/ynl-c/nlctrl.h new file mode 100644 index 0000000..e2f7275 --- /dev/null +++ b/include/ynl-c/nlctrl.h @@ -0,0 +1,221 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/nlctrl.yaml */ +/* YNL-GEN user header */ + +#ifndef _LINUX_NLCTRL_GEN_H +#define _LINUX_NLCTRL_GEN_H + +#include +#include +#include +#include + +struct ynl_sock; + +extern const struct ynl_family ynl_nlctrl_family; + +/* Enums */ +const char *nlctrl_op_str(int op); +const char *nlctrl_op_flags_str(int value); +const char *nlctrl_attr_type_str(enum netlink_attribute_type value); + +/* Common nested types */ +struct nlctrl_op_attrs { + struct { + __u32 id:1; + __u32 flags:1; + } _present; + + __u32 idx; + __u32 id; + __u32 flags; +}; + +struct nlctrl_mcast_group_attrs { + struct { + __u32 name_len; + __u32 id:1; + } _present; + + __u32 idx; + char *name; + __u32 id; +}; + +struct nlctrl_policy_attrs { + struct { + __u32 type:1; + __u32 min_value_s:1; + __u32 max_value_s:1; + __u32 min_value_u:1; + __u32 max_value_u:1; + __u32 min_length:1; + __u32 max_length:1; + __u32 policy_idx:1; + __u32 policy_maxtype:1; + __u32 bitfield32_mask:1; + __u32 mask:1; + } _present; + + __u32 attr_id; + __u32 policy_id; + enum netlink_attribute_type type; + __s64 min_value_s; + __s64 max_value_s; + __u64 min_value_u; + __u64 max_value_u; + __u32 min_length; + __u32 max_length; + __u32 policy_idx; + __u32 policy_maxtype; + __u32 bitfield32_mask; + __u64 mask; +}; + +struct nlctrl_op_policy_attrs { + struct { + __u32 do_:1; + __u32 dump:1; + } _present; + + __u32 op_id; + __u32 do_; + __u32 dump; +}; + +/* ============== CTRL_CMD_GETFAMILY ============== */ +/* CTRL_CMD_GETFAMILY - do */ +struct nlctrl_getfamily_req { + struct { + __u32 family_name_len; + } _present; + + char *family_name; +}; + +static inline struct nlctrl_getfamily_req *nlctrl_getfamily_req_alloc(void) +{ + return calloc(1, sizeof(struct nlctrl_getfamily_req)); +} +void nlctrl_getfamily_req_free(struct nlctrl_getfamily_req *req); + +static inline void +nlctrl_getfamily_req_set_family_name(struct nlctrl_getfamily_req *req, + const char *family_name) +{ + free(req->family_name); + req->_present.family_name_len = strlen(family_name); + req->family_name = malloc(req->_present.family_name_len + 1); + memcpy(req->family_name, family_name, req->_present.family_name_len); + req->family_name[req->_present.family_name_len] = 0; +} + +struct nlctrl_getfamily_rsp { + struct { + __u32 family_id:1; + __u32 family_name_len; + __u32 hdrsize:1; + __u32 maxattr:1; + __u32 version:1; + } _present; + + __u16 family_id; + char *family_name; + __u32 hdrsize; + __u32 maxattr; + unsigned int n_mcast_groups; + struct nlctrl_mcast_group_attrs *mcast_groups; + unsigned int n_ops; + struct nlctrl_op_attrs *ops; + __u32 version; +}; + +void nlctrl_getfamily_rsp_free(struct nlctrl_getfamily_rsp *rsp); + +/* + * Get / dump genetlink families + */ +struct nlctrl_getfamily_rsp * +nlctrl_getfamily(struct ynl_sock *ys, struct nlctrl_getfamily_req *req); + +/* CTRL_CMD_GETFAMILY - dump */ +struct nlctrl_getfamily_list { + struct nlctrl_getfamily_list *next; + struct nlctrl_getfamily_rsp obj __attribute__((aligned(8))); +}; + +void nlctrl_getfamily_list_free(struct nlctrl_getfamily_list *rsp); + +struct nlctrl_getfamily_list *nlctrl_getfamily_dump(struct ynl_sock *ys); + +/* ============== CTRL_CMD_GETPOLICY ============== */ +/* CTRL_CMD_GETPOLICY - dump */ +struct nlctrl_getpolicy_req_dump { + struct { + __u32 family_name_len; + __u32 family_id:1; + __u32 op:1; + } _present; + + char *family_name; + __u16 family_id; + __u32 op; +}; + +static inline struct nlctrl_getpolicy_req_dump * +nlctrl_getpolicy_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct nlctrl_getpolicy_req_dump)); +} +void nlctrl_getpolicy_req_dump_free(struct nlctrl_getpolicy_req_dump *req); + +static inline void +nlctrl_getpolicy_req_dump_set_family_name(struct nlctrl_getpolicy_req_dump *req, + const char *family_name) +{ + free(req->family_name); + req->_present.family_name_len = strlen(family_name); + req->family_name = malloc(req->_present.family_name_len + 1); + memcpy(req->family_name, family_name, req->_present.family_name_len); + req->family_name[req->_present.family_name_len] = 0; +} +static inline void +nlctrl_getpolicy_req_dump_set_family_id(struct nlctrl_getpolicy_req_dump *req, + __u16 family_id) +{ + req->_present.family_id = 1; + req->family_id = family_id; +} +static inline void +nlctrl_getpolicy_req_dump_set_op(struct nlctrl_getpolicy_req_dump *req, + __u32 op) +{ + req->_present.op = 1; + req->op = op; +} + +struct nlctrl_getpolicy_rsp_dump { + struct { + __u32 family_id:1; + __u32 op_policy:1; + __u32 policy:1; + } _present; + + __u16 family_id; + struct nlctrl_op_policy_attrs op_policy; + struct nlctrl_policy_attrs policy; +}; + +struct nlctrl_getpolicy_rsp_list { + struct nlctrl_getpolicy_rsp_list *next; + struct nlctrl_getpolicy_rsp_dump obj __attribute__((aligned(8))); +}; + +void nlctrl_getpolicy_rsp_list_free(struct nlctrl_getpolicy_rsp_list *rsp); + +struct nlctrl_getpolicy_rsp_list * +nlctrl_getpolicy_dump(struct ynl_sock *ys, + struct nlctrl_getpolicy_req_dump *req); + +#endif /* _LINUX_NLCTRL_GEN_H */ diff --git a/include/ynl-c/ovs_datapath.h b/include/ynl-c/ovs_datapath.h new file mode 100644 index 0000000..fcd5b46 --- /dev/null +++ b/include/ynl-c/ovs_datapath.h @@ -0,0 +1,208 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/ovs_datapath.yaml */ +/* YNL-GEN user header */ + +#ifndef _LINUX_OVS_DATAPATH_GEN_H +#define _LINUX_OVS_DATAPATH_GEN_H + +#include +#include +#include +#include + +struct ynl_sock; + +extern const struct ynl_family ynl_ovs_datapath_family; + +/* Enums */ +const char *ovs_datapath_op_str(int op); +const char *ovs_datapath_user_features_str(int value); + +/* Common nested types */ +/* ============== OVS_DP_CMD_GET ============== */ +/* OVS_DP_CMD_GET - do */ +struct ovs_datapath_get_req { + struct ovs_header _hdr; + + struct { + __u32 name_len; + } _present; + + char *name; +}; + +static inline struct ovs_datapath_get_req *ovs_datapath_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ovs_datapath_get_req)); +} +void ovs_datapath_get_req_free(struct ovs_datapath_get_req *req); + +static inline void +ovs_datapath_get_req_set_name(struct ovs_datapath_get_req *req, + const char *name) +{ + free(req->name); + req->_present.name_len = strlen(name); + req->name = malloc(req->_present.name_len + 1); + memcpy(req->name, name, req->_present.name_len); + req->name[req->_present.name_len] = 0; +} + +struct ovs_datapath_get_rsp { + struct ovs_header _hdr; + + struct { + __u32 name_len; + __u32 upcall_pid:1; + __u32 stats_len; + __u32 megaflow_stats_len; + __u32 user_features:1; + __u32 masks_cache_size:1; + __u32 per_cpu_pids_len; + } _present; + + char *name; + __u32 upcall_pid; + void *stats; + void *megaflow_stats; + __u32 user_features; + __u32 masks_cache_size; + void *per_cpu_pids; +}; + +void ovs_datapath_get_rsp_free(struct ovs_datapath_get_rsp *rsp); + +/* + * Get / dump OVS data path configuration and state + */ +struct ovs_datapath_get_rsp * +ovs_datapath_get(struct ynl_sock *ys, struct ovs_datapath_get_req *req); + +/* OVS_DP_CMD_GET - dump */ +struct ovs_datapath_get_req_dump { + struct ovs_header _hdr; + + struct { + __u32 name_len; + } _present; + + char *name; +}; + +static inline struct ovs_datapath_get_req_dump * +ovs_datapath_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ovs_datapath_get_req_dump)); +} +void ovs_datapath_get_req_dump_free(struct ovs_datapath_get_req_dump *req); + +static inline void +ovs_datapath_get_req_dump_set_name(struct ovs_datapath_get_req_dump *req, + const char *name) +{ + free(req->name); + req->_present.name_len = strlen(name); + req->name = malloc(req->_present.name_len + 1); + memcpy(req->name, name, req->_present.name_len); + req->name[req->_present.name_len] = 0; +} + +struct ovs_datapath_get_list { + struct ovs_datapath_get_list *next; + struct ovs_datapath_get_rsp obj __attribute__((aligned(8))); +}; + +void ovs_datapath_get_list_free(struct ovs_datapath_get_list *rsp); + +struct ovs_datapath_get_list * +ovs_datapath_get_dump(struct ynl_sock *ys, + struct ovs_datapath_get_req_dump *req); + +/* ============== OVS_DP_CMD_NEW ============== */ +/* OVS_DP_CMD_NEW - do */ +struct ovs_datapath_new_req { + struct ovs_header _hdr; + + struct { + __u32 name_len; + __u32 upcall_pid:1; + __u32 user_features:1; + } _present; + + char *name; + __u32 upcall_pid; + __u32 user_features; +}; + +static inline struct ovs_datapath_new_req *ovs_datapath_new_req_alloc(void) +{ + return calloc(1, sizeof(struct ovs_datapath_new_req)); +} +void ovs_datapath_new_req_free(struct ovs_datapath_new_req *req); + +static inline void +ovs_datapath_new_req_set_name(struct ovs_datapath_new_req *req, + const char *name) +{ + free(req->name); + req->_present.name_len = strlen(name); + req->name = malloc(req->_present.name_len + 1); + memcpy(req->name, name, req->_present.name_len); + req->name[req->_present.name_len] = 0; +} +static inline void +ovs_datapath_new_req_set_upcall_pid(struct ovs_datapath_new_req *req, + __u32 upcall_pid) +{ + req->_present.upcall_pid = 1; + req->upcall_pid = upcall_pid; +} +static inline void +ovs_datapath_new_req_set_user_features(struct ovs_datapath_new_req *req, + __u32 user_features) +{ + req->_present.user_features = 1; + req->user_features = user_features; +} + +/* + * Create new OVS data path + */ +int ovs_datapath_new(struct ynl_sock *ys, struct ovs_datapath_new_req *req); + +/* ============== OVS_DP_CMD_DEL ============== */ +/* OVS_DP_CMD_DEL - do */ +struct ovs_datapath_del_req { + struct ovs_header _hdr; + + struct { + __u32 name_len; + } _present; + + char *name; +}; + +static inline struct ovs_datapath_del_req *ovs_datapath_del_req_alloc(void) +{ + return calloc(1, sizeof(struct ovs_datapath_del_req)); +} +void ovs_datapath_del_req_free(struct ovs_datapath_del_req *req); + +static inline void +ovs_datapath_del_req_set_name(struct ovs_datapath_del_req *req, + const char *name) +{ + free(req->name); + req->_present.name_len = strlen(name); + req->name = malloc(req->_present.name_len + 1); + memcpy(req->name, name, req->_present.name_len); + req->name[req->_present.name_len] = 0; +} + +/* + * Delete existing OVS data path + */ +int ovs_datapath_del(struct ynl_sock *ys, struct ovs_datapath_del_req *req); + +#endif /* _LINUX_OVS_DATAPATH_GEN_H */ diff --git a/include/ynl-c/ovs_flow.h b/include/ynl-c/ovs_flow.h new file mode 100644 index 0000000..c5f5c08 --- /dev/null +++ b/include/ynl-c/ovs_flow.h @@ -0,0 +1,2449 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/ovs_flow.yaml */ +/* YNL-GEN user header */ + +#ifndef _LINUX_OVS_FLOW_GEN_H +#define _LINUX_OVS_FLOW_GEN_H + +#include +#include +#include +#include + +struct ynl_sock; + +extern const struct ynl_family ynl_ovs_flow_family; + +/* Enums */ +const char *ovs_flow_op_str(int op); +const char *ovs_flow_ovs_frag_type_str(enum ovs_frag_type value); +const char *ovs_flow_ovs_ufid_flags_str(int value); +const char *ovs_flow_ovs_hash_alg_str(enum ovs_hash_alg value); +const char *ovs_flow_ct_state_flags_str(int value); + +/* Common nested types */ +struct ovs_flow_ovs_nsh_key_attrs { + struct { + __u32 base_len; + __u32 md1_len; + __u32 md2_len; + } _present; + + void *base; + void *md1; + void *md2; +}; + +struct ovs_flow_userspace_attrs { + struct { + __u32 pid:1; + __u32 userdata_len; + __u32 egress_tun_port:1; + __u32 actions:1; + } _present; + + __u32 pid; + void *userdata; + __u32 egress_tun_port; +}; + +struct ovs_flow_vxlan_ext_attrs { + struct { + __u32 gbp:1; + } _present; + + __u32 gbp; +}; + +struct ovs_flow_nat_attrs { + struct { + __u32 src:1; + __u32 dst:1; + __u32 ip_min_len; + __u32 ip_max_len; + __u32 proto_min:1; + __u32 proto_max:1; + __u32 persistent:1; + __u32 proto_hash:1; + __u32 proto_random:1; + } _present; + + void *ip_min; + void *ip_max; + __u16 proto_min; + __u16 proto_max; +}; + +struct ovs_flow_tunnel_key_attrs { + struct { + __u32 id:1; + __u32 ipv4_src:1; + __u32 ipv4_dst:1; + __u32 tos:1; + __u32 ttl:1; + __u32 dont_fragment:1; + __u32 csum:1; + __u32 oam:1; + __u32 geneve_opts_len; + __u32 tp_src:1; + __u32 tp_dst:1; + __u32 vxlan_opts:1; + __u32 ipv6_src_len; + __u32 ipv6_dst_len; + __u32 pad_len; + __u32 erspan_opts_len; + __u32 ipv4_info_bridge:1; + } _present; + + __u64 id /* big-endian */; + __u32 ipv4_src /* big-endian */; + __u32 ipv4_dst /* big-endian */; + __u8 tos; + __u8 ttl; + void *geneve_opts; + __u16 tp_src /* big-endian */; + __u16 tp_dst /* big-endian */; + struct ovs_flow_vxlan_ext_attrs vxlan_opts; + void *ipv6_src; + void *ipv6_dst; + void *pad; + void *erspan_opts; +}; + +struct ovs_flow_ct_attrs { + struct { + __u32 commit:1; + __u32 zone:1; + __u32 mark_len; + __u32 labels_len; + __u32 helper_len; + __u32 nat:1; + __u32 force_commit:1; + __u32 eventmask:1; + __u32 timeout_len; + } _present; + + __u16 zone; + void *mark; + void *labels; + char *helper; + struct ovs_flow_nat_attrs nat; + __u32 eventmask; + char *timeout; +}; + +struct ovs_flow_check_pkt_len_attrs { + struct { + __u32 pkt_len:1; + __u32 actions_if_greater:1; + __u32 actions_if_less_equal:1; + } _present; + + __u16 pkt_len; + struct ovs_flow_action_attrs *actions_if_greater; + struct ovs_flow_action_attrs *actions_if_less_equal; +}; + +struct ovs_flow_dec_ttl_attrs { + struct { + __u32 action:1; + } _present; + + struct ovs_flow_action_attrs *action; +}; + +struct ovs_flow_key_attrs { + struct { + __u32 encap:1; + __u32 priority:1; + __u32 in_port:1; + __u32 ethernet_len; + __u32 vlan:1; + __u32 ethertype:1; + __u32 ipv4_len; + __u32 ipv6_len; + __u32 tcp_len; + __u32 udp_len; + __u32 icmp_len; + __u32 icmpv6_len; + __u32 arp_len; + __u32 nd_len; + __u32 skb_mark:1; + __u32 tunnel:1; + __u32 sctp_len; + __u32 tcp_flags:1; + __u32 dp_hash:1; + __u32 recirc_id:1; + __u32 mpls_len; + __u32 ct_state:1; + __u32 ct_zone:1; + __u32 ct_mark:1; + __u32 ct_labels_len; + __u32 ct_orig_tuple_ipv4_len; + __u32 ct_orig_tuple_ipv6_len; + __u32 nsh:1; + __u32 packet_type:1; + __u32 nd_extensions_len; + __u32 tunnel_info_len; + __u32 ipv6_exthdrs_len; + } _present; + + struct ovs_flow_key_attrs *encap; + __u32 priority; + __u32 in_port; + void *ethernet; + __u16 vlan /* big-endian */; + __u16 ethertype /* big-endian */; + void *ipv4; + void *ipv6; + void *tcp; + void *udp; + void *icmp; + void *icmpv6; + void *arp; + void *nd; + __u32 skb_mark; + struct ovs_flow_tunnel_key_attrs tunnel; + void *sctp; + __u16 tcp_flags /* big-endian */; + __u32 dp_hash; + __u32 recirc_id; + void *mpls; + __u32 ct_state; + __u16 ct_zone; + __u32 ct_mark; + void *ct_labels; + void *ct_orig_tuple_ipv4; + void *ct_orig_tuple_ipv6; + struct ovs_flow_ovs_nsh_key_attrs nsh; + __u32 packet_type /* big-endian */; + void *nd_extensions; + void *tunnel_info; + void *ipv6_exthdrs; +}; + +struct ovs_flow_sample_attrs { + struct { + __u32 probability:1; + __u32 actions:1; + } _present; + + __u32 probability; + struct ovs_flow_action_attrs *actions; +}; + +struct ovs_flow_action_attrs { + struct { + __u32 output:1; + __u32 userspace:1; + __u32 set:1; + __u32 push_vlan_len; + __u32 pop_vlan:1; + __u32 sample:1; + __u32 recirc:1; + __u32 hash_len; + __u32 push_mpls_len; + __u32 pop_mpls:1; + __u32 set_masked:1; + __u32 ct:1; + __u32 trunc:1; + __u32 push_eth_len; + __u32 pop_eth:1; + __u32 ct_clear:1; + __u32 push_nsh:1; + __u32 pop_nsh:1; + __u32 meter:1; + __u32 clone:1; + __u32 check_pkt_len:1; + __u32 add_mpls_len; + __u32 dec_ttl:1; + } _present; + + __u32 output; + struct ovs_flow_userspace_attrs userspace; + struct ovs_flow_key_attrs *set; + void *push_vlan; + struct ovs_flow_sample_attrs sample; + __u32 recirc; + void *hash; + void *push_mpls; + __u16 pop_mpls /* big-endian */; + struct ovs_flow_key_attrs *set_masked; + struct ovs_flow_ct_attrs ct; + __u32 trunc; + void *push_eth; + struct ovs_flow_ovs_nsh_key_attrs push_nsh; + __u32 meter; + struct ovs_flow_action_attrs *clone; + struct ovs_flow_check_pkt_len_attrs check_pkt_len; + void *add_mpls; + struct ovs_flow_dec_ttl_attrs dec_ttl; +}; + +/* ============== OVS_FLOW_CMD_GET ============== */ +/* OVS_FLOW_CMD_GET - do */ +struct ovs_flow_get_req { + struct ovs_header _hdr; + + struct { + __u32 key:1; + __u32 ufid_len; + __u32 ufid_flags:1; + } _present; + + struct ovs_flow_key_attrs key; + void *ufid; + __u32 ufid_flags; +}; + +static inline struct ovs_flow_get_req *ovs_flow_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ovs_flow_get_req)); +} +void ovs_flow_get_req_free(struct ovs_flow_get_req *req); + +static inline void +ovs_flow_get_req_set_key_priority(struct ovs_flow_get_req *req, __u32 priority) +{ + req->_present.key = 1; + req->key._present.priority = 1; + req->key.priority = priority; +} +static inline void +ovs_flow_get_req_set_key_in_port(struct ovs_flow_get_req *req, __u32 in_port) +{ + req->_present.key = 1; + req->key._present.in_port = 1; + req->key.in_port = in_port; +} +static inline void +ovs_flow_get_req_set_key_ethernet(struct ovs_flow_get_req *req, + const void *ethernet, size_t len) +{ + free(req->key.ethernet); + req->key._present.ethernet_len = len; + req->key.ethernet = malloc(req->key._present.ethernet_len); + memcpy(req->key.ethernet, ethernet, req->key._present.ethernet_len); +} +static inline void +ovs_flow_get_req_set_key_vlan(struct ovs_flow_get_req *req, + __u16 vlan /* big-endian */) +{ + req->_present.key = 1; + req->key._present.vlan = 1; + req->key.vlan = vlan; +} +static inline void +ovs_flow_get_req_set_key_ethertype(struct ovs_flow_get_req *req, + __u16 ethertype /* big-endian */) +{ + req->_present.key = 1; + req->key._present.ethertype = 1; + req->key.ethertype = ethertype; +} +static inline void +ovs_flow_get_req_set_key_ipv4(struct ovs_flow_get_req *req, const void *ipv4, + size_t len) +{ + free(req->key.ipv4); + req->key._present.ipv4_len = len; + req->key.ipv4 = malloc(req->key._present.ipv4_len); + memcpy(req->key.ipv4, ipv4, req->key._present.ipv4_len); +} +static inline void +ovs_flow_get_req_set_key_ipv6(struct ovs_flow_get_req *req, const void *ipv6, + size_t len) +{ + free(req->key.ipv6); + req->key._present.ipv6_len = len; + req->key.ipv6 = malloc(req->key._present.ipv6_len); + memcpy(req->key.ipv6, ipv6, req->key._present.ipv6_len); +} +static inline void +ovs_flow_get_req_set_key_tcp(struct ovs_flow_get_req *req, const void *tcp, + size_t len) +{ + free(req->key.tcp); + req->key._present.tcp_len = len; + req->key.tcp = malloc(req->key._present.tcp_len); + memcpy(req->key.tcp, tcp, req->key._present.tcp_len); +} +static inline void +ovs_flow_get_req_set_key_udp(struct ovs_flow_get_req *req, const void *udp, + size_t len) +{ + free(req->key.udp); + req->key._present.udp_len = len; + req->key.udp = malloc(req->key._present.udp_len); + memcpy(req->key.udp, udp, req->key._present.udp_len); +} +static inline void +ovs_flow_get_req_set_key_icmp(struct ovs_flow_get_req *req, const void *icmp, + size_t len) +{ + free(req->key.icmp); + req->key._present.icmp_len = len; + req->key.icmp = malloc(req->key._present.icmp_len); + memcpy(req->key.icmp, icmp, req->key._present.icmp_len); +} +static inline void +ovs_flow_get_req_set_key_icmpv6(struct ovs_flow_get_req *req, + const void *icmpv6, size_t len) +{ + free(req->key.icmpv6); + req->key._present.icmpv6_len = len; + req->key.icmpv6 = malloc(req->key._present.icmpv6_len); + memcpy(req->key.icmpv6, icmpv6, req->key._present.icmpv6_len); +} +static inline void +ovs_flow_get_req_set_key_arp(struct ovs_flow_get_req *req, const void *arp, + size_t len) +{ + free(req->key.arp); + req->key._present.arp_len = len; + req->key.arp = malloc(req->key._present.arp_len); + memcpy(req->key.arp, arp, req->key._present.arp_len); +} +static inline void +ovs_flow_get_req_set_key_nd(struct ovs_flow_get_req *req, const void *nd, + size_t len) +{ + free(req->key.nd); + req->key._present.nd_len = len; + req->key.nd = malloc(req->key._present.nd_len); + memcpy(req->key.nd, nd, req->key._present.nd_len); +} +static inline void +ovs_flow_get_req_set_key_skb_mark(struct ovs_flow_get_req *req, __u32 skb_mark) +{ + req->_present.key = 1; + req->key._present.skb_mark = 1; + req->key.skb_mark = skb_mark; +} +static inline void +ovs_flow_get_req_set_key_tunnel_id(struct ovs_flow_get_req *req, + __u64 id /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.id = 1; + req->key.tunnel.id = id; +} +static inline void +ovs_flow_get_req_set_key_tunnel_ipv4_src(struct ovs_flow_get_req *req, + __u32 ipv4_src /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.ipv4_src = 1; + req->key.tunnel.ipv4_src = ipv4_src; +} +static inline void +ovs_flow_get_req_set_key_tunnel_ipv4_dst(struct ovs_flow_get_req *req, + __u32 ipv4_dst /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.ipv4_dst = 1; + req->key.tunnel.ipv4_dst = ipv4_dst; +} +static inline void +ovs_flow_get_req_set_key_tunnel_tos(struct ovs_flow_get_req *req, __u8 tos) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.tos = 1; + req->key.tunnel.tos = tos; +} +static inline void +ovs_flow_get_req_set_key_tunnel_ttl(struct ovs_flow_get_req *req, __u8 ttl) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.ttl = 1; + req->key.tunnel.ttl = ttl; +} +static inline void +ovs_flow_get_req_set_key_tunnel_dont_fragment(struct ovs_flow_get_req *req) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.dont_fragment = 1; +} +static inline void +ovs_flow_get_req_set_key_tunnel_csum(struct ovs_flow_get_req *req) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.csum = 1; +} +static inline void +ovs_flow_get_req_set_key_tunnel_oam(struct ovs_flow_get_req *req) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.oam = 1; +} +static inline void +ovs_flow_get_req_set_key_tunnel_geneve_opts(struct ovs_flow_get_req *req, + const void *geneve_opts, + size_t len) +{ + free(req->key.tunnel.geneve_opts); + req->key.tunnel._present.geneve_opts_len = len; + req->key.tunnel.geneve_opts = malloc(req->key.tunnel._present.geneve_opts_len); + memcpy(req->key.tunnel.geneve_opts, geneve_opts, req->key.tunnel._present.geneve_opts_len); +} +static inline void +ovs_flow_get_req_set_key_tunnel_tp_src(struct ovs_flow_get_req *req, + __u16 tp_src /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.tp_src = 1; + req->key.tunnel.tp_src = tp_src; +} +static inline void +ovs_flow_get_req_set_key_tunnel_tp_dst(struct ovs_flow_get_req *req, + __u16 tp_dst /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.tp_dst = 1; + req->key.tunnel.tp_dst = tp_dst; +} +static inline void +ovs_flow_get_req_set_key_tunnel_vxlan_opts_gbp(struct ovs_flow_get_req *req, + __u32 gbp) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.vxlan_opts = 1; + req->key.tunnel.vxlan_opts._present.gbp = 1; + req->key.tunnel.vxlan_opts.gbp = gbp; +} +static inline void +ovs_flow_get_req_set_key_tunnel_ipv6_src(struct ovs_flow_get_req *req, + const void *ipv6_src, size_t len) +{ + free(req->key.tunnel.ipv6_src); + req->key.tunnel._present.ipv6_src_len = len; + req->key.tunnel.ipv6_src = malloc(req->key.tunnel._present.ipv6_src_len); + memcpy(req->key.tunnel.ipv6_src, ipv6_src, req->key.tunnel._present.ipv6_src_len); +} +static inline void +ovs_flow_get_req_set_key_tunnel_ipv6_dst(struct ovs_flow_get_req *req, + const void *ipv6_dst, size_t len) +{ + free(req->key.tunnel.ipv6_dst); + req->key.tunnel._present.ipv6_dst_len = len; + req->key.tunnel.ipv6_dst = malloc(req->key.tunnel._present.ipv6_dst_len); + memcpy(req->key.tunnel.ipv6_dst, ipv6_dst, req->key.tunnel._present.ipv6_dst_len); +} +static inline void +ovs_flow_get_req_set_key_tunnel_pad(struct ovs_flow_get_req *req, + const void *pad, size_t len) +{ + free(req->key.tunnel.pad); + req->key.tunnel._present.pad_len = len; + req->key.tunnel.pad = malloc(req->key.tunnel._present.pad_len); + memcpy(req->key.tunnel.pad, pad, req->key.tunnel._present.pad_len); +} +static inline void +ovs_flow_get_req_set_key_tunnel_erspan_opts(struct ovs_flow_get_req *req, + const void *erspan_opts, + size_t len) +{ + free(req->key.tunnel.erspan_opts); + req->key.tunnel._present.erspan_opts_len = len; + req->key.tunnel.erspan_opts = malloc(req->key.tunnel._present.erspan_opts_len); + memcpy(req->key.tunnel.erspan_opts, erspan_opts, req->key.tunnel._present.erspan_opts_len); +} +static inline void +ovs_flow_get_req_set_key_tunnel_ipv4_info_bridge(struct ovs_flow_get_req *req) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.ipv4_info_bridge = 1; +} +static inline void +ovs_flow_get_req_set_key_sctp(struct ovs_flow_get_req *req, const void *sctp, + size_t len) +{ + free(req->key.sctp); + req->key._present.sctp_len = len; + req->key.sctp = malloc(req->key._present.sctp_len); + memcpy(req->key.sctp, sctp, req->key._present.sctp_len); +} +static inline void +ovs_flow_get_req_set_key_tcp_flags(struct ovs_flow_get_req *req, + __u16 tcp_flags /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tcp_flags = 1; + req->key.tcp_flags = tcp_flags; +} +static inline void +ovs_flow_get_req_set_key_dp_hash(struct ovs_flow_get_req *req, __u32 dp_hash) +{ + req->_present.key = 1; + req->key._present.dp_hash = 1; + req->key.dp_hash = dp_hash; +} +static inline void +ovs_flow_get_req_set_key_recirc_id(struct ovs_flow_get_req *req, + __u32 recirc_id) +{ + req->_present.key = 1; + req->key._present.recirc_id = 1; + req->key.recirc_id = recirc_id; +} +static inline void +ovs_flow_get_req_set_key_mpls(struct ovs_flow_get_req *req, const void *mpls, + size_t len) +{ + free(req->key.mpls); + req->key._present.mpls_len = len; + req->key.mpls = malloc(req->key._present.mpls_len); + memcpy(req->key.mpls, mpls, req->key._present.mpls_len); +} +static inline void +ovs_flow_get_req_set_key_ct_state(struct ovs_flow_get_req *req, __u32 ct_state) +{ + req->_present.key = 1; + req->key._present.ct_state = 1; + req->key.ct_state = ct_state; +} +static inline void +ovs_flow_get_req_set_key_ct_zone(struct ovs_flow_get_req *req, __u16 ct_zone) +{ + req->_present.key = 1; + req->key._present.ct_zone = 1; + req->key.ct_zone = ct_zone; +} +static inline void +ovs_flow_get_req_set_key_ct_mark(struct ovs_flow_get_req *req, __u32 ct_mark) +{ + req->_present.key = 1; + req->key._present.ct_mark = 1; + req->key.ct_mark = ct_mark; +} +static inline void +ovs_flow_get_req_set_key_ct_labels(struct ovs_flow_get_req *req, + const void *ct_labels, size_t len) +{ + free(req->key.ct_labels); + req->key._present.ct_labels_len = len; + req->key.ct_labels = malloc(req->key._present.ct_labels_len); + memcpy(req->key.ct_labels, ct_labels, req->key._present.ct_labels_len); +} +static inline void +ovs_flow_get_req_set_key_ct_orig_tuple_ipv4(struct ovs_flow_get_req *req, + const void *ct_orig_tuple_ipv4, + size_t len) +{ + free(req->key.ct_orig_tuple_ipv4); + req->key._present.ct_orig_tuple_ipv4_len = len; + req->key.ct_orig_tuple_ipv4 = malloc(req->key._present.ct_orig_tuple_ipv4_len); + memcpy(req->key.ct_orig_tuple_ipv4, ct_orig_tuple_ipv4, req->key._present.ct_orig_tuple_ipv4_len); +} +static inline void +ovs_flow_get_req_set_key_ct_orig_tuple_ipv6(struct ovs_flow_get_req *req, + const void *ct_orig_tuple_ipv6, + size_t len) +{ + free(req->key.ct_orig_tuple_ipv6); + req->key._present.ct_orig_tuple_ipv6_len = len; + req->key.ct_orig_tuple_ipv6 = malloc(req->key._present.ct_orig_tuple_ipv6_len); + memcpy(req->key.ct_orig_tuple_ipv6, ct_orig_tuple_ipv6, req->key._present.ct_orig_tuple_ipv6_len); +} +static inline void +ovs_flow_get_req_set_key_nsh_base(struct ovs_flow_get_req *req, + const void *base, size_t len) +{ + free(req->key.nsh.base); + req->key.nsh._present.base_len = len; + req->key.nsh.base = malloc(req->key.nsh._present.base_len); + memcpy(req->key.nsh.base, base, req->key.nsh._present.base_len); +} +static inline void +ovs_flow_get_req_set_key_nsh_md1(struct ovs_flow_get_req *req, const void *md1, + size_t len) +{ + free(req->key.nsh.md1); + req->key.nsh._present.md1_len = len; + req->key.nsh.md1 = malloc(req->key.nsh._present.md1_len); + memcpy(req->key.nsh.md1, md1, req->key.nsh._present.md1_len); +} +static inline void +ovs_flow_get_req_set_key_nsh_md2(struct ovs_flow_get_req *req, const void *md2, + size_t len) +{ + free(req->key.nsh.md2); + req->key.nsh._present.md2_len = len; + req->key.nsh.md2 = malloc(req->key.nsh._present.md2_len); + memcpy(req->key.nsh.md2, md2, req->key.nsh._present.md2_len); +} +static inline void +ovs_flow_get_req_set_key_packet_type(struct ovs_flow_get_req *req, + __u32 packet_type /* big-endian */) +{ + req->_present.key = 1; + req->key._present.packet_type = 1; + req->key.packet_type = packet_type; +} +static inline void +ovs_flow_get_req_set_key_nd_extensions(struct ovs_flow_get_req *req, + const void *nd_extensions, size_t len) +{ + free(req->key.nd_extensions); + req->key._present.nd_extensions_len = len; + req->key.nd_extensions = malloc(req->key._present.nd_extensions_len); + memcpy(req->key.nd_extensions, nd_extensions, req->key._present.nd_extensions_len); +} +static inline void +ovs_flow_get_req_set_key_tunnel_info(struct ovs_flow_get_req *req, + const void *tunnel_info, size_t len) +{ + free(req->key.tunnel_info); + req->key._present.tunnel_info_len = len; + req->key.tunnel_info = malloc(req->key._present.tunnel_info_len); + memcpy(req->key.tunnel_info, tunnel_info, req->key._present.tunnel_info_len); +} +static inline void +ovs_flow_get_req_set_key_ipv6_exthdrs(struct ovs_flow_get_req *req, + const void *ipv6_exthdrs, size_t len) +{ + free(req->key.ipv6_exthdrs); + req->key._present.ipv6_exthdrs_len = len; + req->key.ipv6_exthdrs = malloc(req->key._present.ipv6_exthdrs_len); + memcpy(req->key.ipv6_exthdrs, ipv6_exthdrs, req->key._present.ipv6_exthdrs_len); +} +static inline void +ovs_flow_get_req_set_ufid(struct ovs_flow_get_req *req, const void *ufid, + size_t len) +{ + free(req->ufid); + req->_present.ufid_len = len; + req->ufid = malloc(req->_present.ufid_len); + memcpy(req->ufid, ufid, req->_present.ufid_len); +} +static inline void +ovs_flow_get_req_set_ufid_flags(struct ovs_flow_get_req *req, __u32 ufid_flags) +{ + req->_present.ufid_flags = 1; + req->ufid_flags = ufid_flags; +} + +struct ovs_flow_get_rsp { + struct ovs_header _hdr; + + struct { + __u32 key:1; + __u32 ufid_len; + __u32 mask:1; + __u32 stats_len; + __u32 actions:1; + } _present; + + struct ovs_flow_key_attrs key; + void *ufid; + struct ovs_flow_key_attrs mask; + void *stats; + struct ovs_flow_action_attrs actions; +}; + +void ovs_flow_get_rsp_free(struct ovs_flow_get_rsp *rsp); + +/* + * Get / dump OVS flow configuration and state + */ +struct ovs_flow_get_rsp * +ovs_flow_get(struct ynl_sock *ys, struct ovs_flow_get_req *req); + +/* OVS_FLOW_CMD_GET - dump */ +struct ovs_flow_get_req_dump { + struct ovs_header _hdr; + + struct { + __u32 key:1; + __u32 ufid_len; + __u32 ufid_flags:1; + } _present; + + struct ovs_flow_key_attrs key; + void *ufid; + __u32 ufid_flags; +}; + +static inline struct ovs_flow_get_req_dump *ovs_flow_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ovs_flow_get_req_dump)); +} +void ovs_flow_get_req_dump_free(struct ovs_flow_get_req_dump *req); + +static inline void +ovs_flow_get_req_dump_set_key_priority(struct ovs_flow_get_req_dump *req, + __u32 priority) +{ + req->_present.key = 1; + req->key._present.priority = 1; + req->key.priority = priority; +} +static inline void +ovs_flow_get_req_dump_set_key_in_port(struct ovs_flow_get_req_dump *req, + __u32 in_port) +{ + req->_present.key = 1; + req->key._present.in_port = 1; + req->key.in_port = in_port; +} +static inline void +ovs_flow_get_req_dump_set_key_ethernet(struct ovs_flow_get_req_dump *req, + const void *ethernet, size_t len) +{ + free(req->key.ethernet); + req->key._present.ethernet_len = len; + req->key.ethernet = malloc(req->key._present.ethernet_len); + memcpy(req->key.ethernet, ethernet, req->key._present.ethernet_len); +} +static inline void +ovs_flow_get_req_dump_set_key_vlan(struct ovs_flow_get_req_dump *req, + __u16 vlan /* big-endian */) +{ + req->_present.key = 1; + req->key._present.vlan = 1; + req->key.vlan = vlan; +} +static inline void +ovs_flow_get_req_dump_set_key_ethertype(struct ovs_flow_get_req_dump *req, + __u16 ethertype /* big-endian */) +{ + req->_present.key = 1; + req->key._present.ethertype = 1; + req->key.ethertype = ethertype; +} +static inline void +ovs_flow_get_req_dump_set_key_ipv4(struct ovs_flow_get_req_dump *req, + const void *ipv4, size_t len) +{ + free(req->key.ipv4); + req->key._present.ipv4_len = len; + req->key.ipv4 = malloc(req->key._present.ipv4_len); + memcpy(req->key.ipv4, ipv4, req->key._present.ipv4_len); +} +static inline void +ovs_flow_get_req_dump_set_key_ipv6(struct ovs_flow_get_req_dump *req, + const void *ipv6, size_t len) +{ + free(req->key.ipv6); + req->key._present.ipv6_len = len; + req->key.ipv6 = malloc(req->key._present.ipv6_len); + memcpy(req->key.ipv6, ipv6, req->key._present.ipv6_len); +} +static inline void +ovs_flow_get_req_dump_set_key_tcp(struct ovs_flow_get_req_dump *req, + const void *tcp, size_t len) +{ + free(req->key.tcp); + req->key._present.tcp_len = len; + req->key.tcp = malloc(req->key._present.tcp_len); + memcpy(req->key.tcp, tcp, req->key._present.tcp_len); +} +static inline void +ovs_flow_get_req_dump_set_key_udp(struct ovs_flow_get_req_dump *req, + const void *udp, size_t len) +{ + free(req->key.udp); + req->key._present.udp_len = len; + req->key.udp = malloc(req->key._present.udp_len); + memcpy(req->key.udp, udp, req->key._present.udp_len); +} +static inline void +ovs_flow_get_req_dump_set_key_icmp(struct ovs_flow_get_req_dump *req, + const void *icmp, size_t len) +{ + free(req->key.icmp); + req->key._present.icmp_len = len; + req->key.icmp = malloc(req->key._present.icmp_len); + memcpy(req->key.icmp, icmp, req->key._present.icmp_len); +} +static inline void +ovs_flow_get_req_dump_set_key_icmpv6(struct ovs_flow_get_req_dump *req, + const void *icmpv6, size_t len) +{ + free(req->key.icmpv6); + req->key._present.icmpv6_len = len; + req->key.icmpv6 = malloc(req->key._present.icmpv6_len); + memcpy(req->key.icmpv6, icmpv6, req->key._present.icmpv6_len); +} +static inline void +ovs_flow_get_req_dump_set_key_arp(struct ovs_flow_get_req_dump *req, + const void *arp, size_t len) +{ + free(req->key.arp); + req->key._present.arp_len = len; + req->key.arp = malloc(req->key._present.arp_len); + memcpy(req->key.arp, arp, req->key._present.arp_len); +} +static inline void +ovs_flow_get_req_dump_set_key_nd(struct ovs_flow_get_req_dump *req, + const void *nd, size_t len) +{ + free(req->key.nd); + req->key._present.nd_len = len; + req->key.nd = malloc(req->key._present.nd_len); + memcpy(req->key.nd, nd, req->key._present.nd_len); +} +static inline void +ovs_flow_get_req_dump_set_key_skb_mark(struct ovs_flow_get_req_dump *req, + __u32 skb_mark) +{ + req->_present.key = 1; + req->key._present.skb_mark = 1; + req->key.skb_mark = skb_mark; +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_id(struct ovs_flow_get_req_dump *req, + __u64 id /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.id = 1; + req->key.tunnel.id = id; +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_ipv4_src(struct ovs_flow_get_req_dump *req, + __u32 ipv4_src /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.ipv4_src = 1; + req->key.tunnel.ipv4_src = ipv4_src; +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_ipv4_dst(struct ovs_flow_get_req_dump *req, + __u32 ipv4_dst /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.ipv4_dst = 1; + req->key.tunnel.ipv4_dst = ipv4_dst; +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_tos(struct ovs_flow_get_req_dump *req, + __u8 tos) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.tos = 1; + req->key.tunnel.tos = tos; +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_ttl(struct ovs_flow_get_req_dump *req, + __u8 ttl) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.ttl = 1; + req->key.tunnel.ttl = ttl; +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_dont_fragment(struct ovs_flow_get_req_dump *req) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.dont_fragment = 1; +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_csum(struct ovs_flow_get_req_dump *req) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.csum = 1; +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_oam(struct ovs_flow_get_req_dump *req) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.oam = 1; +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_geneve_opts(struct ovs_flow_get_req_dump *req, + const void *geneve_opts, + size_t len) +{ + free(req->key.tunnel.geneve_opts); + req->key.tunnel._present.geneve_opts_len = len; + req->key.tunnel.geneve_opts = malloc(req->key.tunnel._present.geneve_opts_len); + memcpy(req->key.tunnel.geneve_opts, geneve_opts, req->key.tunnel._present.geneve_opts_len); +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_tp_src(struct ovs_flow_get_req_dump *req, + __u16 tp_src /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.tp_src = 1; + req->key.tunnel.tp_src = tp_src; +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_tp_dst(struct ovs_flow_get_req_dump *req, + __u16 tp_dst /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.tp_dst = 1; + req->key.tunnel.tp_dst = tp_dst; +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_vxlan_opts_gbp(struct ovs_flow_get_req_dump *req, + __u32 gbp) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.vxlan_opts = 1; + req->key.tunnel.vxlan_opts._present.gbp = 1; + req->key.tunnel.vxlan_opts.gbp = gbp; +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_ipv6_src(struct ovs_flow_get_req_dump *req, + const void *ipv6_src, size_t len) +{ + free(req->key.tunnel.ipv6_src); + req->key.tunnel._present.ipv6_src_len = len; + req->key.tunnel.ipv6_src = malloc(req->key.tunnel._present.ipv6_src_len); + memcpy(req->key.tunnel.ipv6_src, ipv6_src, req->key.tunnel._present.ipv6_src_len); +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_ipv6_dst(struct ovs_flow_get_req_dump *req, + const void *ipv6_dst, size_t len) +{ + free(req->key.tunnel.ipv6_dst); + req->key.tunnel._present.ipv6_dst_len = len; + req->key.tunnel.ipv6_dst = malloc(req->key.tunnel._present.ipv6_dst_len); + memcpy(req->key.tunnel.ipv6_dst, ipv6_dst, req->key.tunnel._present.ipv6_dst_len); +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_pad(struct ovs_flow_get_req_dump *req, + const void *pad, size_t len) +{ + free(req->key.tunnel.pad); + req->key.tunnel._present.pad_len = len; + req->key.tunnel.pad = malloc(req->key.tunnel._present.pad_len); + memcpy(req->key.tunnel.pad, pad, req->key.tunnel._present.pad_len); +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_erspan_opts(struct ovs_flow_get_req_dump *req, + const void *erspan_opts, + size_t len) +{ + free(req->key.tunnel.erspan_opts); + req->key.tunnel._present.erspan_opts_len = len; + req->key.tunnel.erspan_opts = malloc(req->key.tunnel._present.erspan_opts_len); + memcpy(req->key.tunnel.erspan_opts, erspan_opts, req->key.tunnel._present.erspan_opts_len); +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_ipv4_info_bridge(struct ovs_flow_get_req_dump *req) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.ipv4_info_bridge = 1; +} +static inline void +ovs_flow_get_req_dump_set_key_sctp(struct ovs_flow_get_req_dump *req, + const void *sctp, size_t len) +{ + free(req->key.sctp); + req->key._present.sctp_len = len; + req->key.sctp = malloc(req->key._present.sctp_len); + memcpy(req->key.sctp, sctp, req->key._present.sctp_len); +} +static inline void +ovs_flow_get_req_dump_set_key_tcp_flags(struct ovs_flow_get_req_dump *req, + __u16 tcp_flags /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tcp_flags = 1; + req->key.tcp_flags = tcp_flags; +} +static inline void +ovs_flow_get_req_dump_set_key_dp_hash(struct ovs_flow_get_req_dump *req, + __u32 dp_hash) +{ + req->_present.key = 1; + req->key._present.dp_hash = 1; + req->key.dp_hash = dp_hash; +} +static inline void +ovs_flow_get_req_dump_set_key_recirc_id(struct ovs_flow_get_req_dump *req, + __u32 recirc_id) +{ + req->_present.key = 1; + req->key._present.recirc_id = 1; + req->key.recirc_id = recirc_id; +} +static inline void +ovs_flow_get_req_dump_set_key_mpls(struct ovs_flow_get_req_dump *req, + const void *mpls, size_t len) +{ + free(req->key.mpls); + req->key._present.mpls_len = len; + req->key.mpls = malloc(req->key._present.mpls_len); + memcpy(req->key.mpls, mpls, req->key._present.mpls_len); +} +static inline void +ovs_flow_get_req_dump_set_key_ct_state(struct ovs_flow_get_req_dump *req, + __u32 ct_state) +{ + req->_present.key = 1; + req->key._present.ct_state = 1; + req->key.ct_state = ct_state; +} +static inline void +ovs_flow_get_req_dump_set_key_ct_zone(struct ovs_flow_get_req_dump *req, + __u16 ct_zone) +{ + req->_present.key = 1; + req->key._present.ct_zone = 1; + req->key.ct_zone = ct_zone; +} +static inline void +ovs_flow_get_req_dump_set_key_ct_mark(struct ovs_flow_get_req_dump *req, + __u32 ct_mark) +{ + req->_present.key = 1; + req->key._present.ct_mark = 1; + req->key.ct_mark = ct_mark; +} +static inline void +ovs_flow_get_req_dump_set_key_ct_labels(struct ovs_flow_get_req_dump *req, + const void *ct_labels, size_t len) +{ + free(req->key.ct_labels); + req->key._present.ct_labels_len = len; + req->key.ct_labels = malloc(req->key._present.ct_labels_len); + memcpy(req->key.ct_labels, ct_labels, req->key._present.ct_labels_len); +} +static inline void +ovs_flow_get_req_dump_set_key_ct_orig_tuple_ipv4(struct ovs_flow_get_req_dump *req, + const void *ct_orig_tuple_ipv4, + size_t len) +{ + free(req->key.ct_orig_tuple_ipv4); + req->key._present.ct_orig_tuple_ipv4_len = len; + req->key.ct_orig_tuple_ipv4 = malloc(req->key._present.ct_orig_tuple_ipv4_len); + memcpy(req->key.ct_orig_tuple_ipv4, ct_orig_tuple_ipv4, req->key._present.ct_orig_tuple_ipv4_len); +} +static inline void +ovs_flow_get_req_dump_set_key_ct_orig_tuple_ipv6(struct ovs_flow_get_req_dump *req, + const void *ct_orig_tuple_ipv6, + size_t len) +{ + free(req->key.ct_orig_tuple_ipv6); + req->key._present.ct_orig_tuple_ipv6_len = len; + req->key.ct_orig_tuple_ipv6 = malloc(req->key._present.ct_orig_tuple_ipv6_len); + memcpy(req->key.ct_orig_tuple_ipv6, ct_orig_tuple_ipv6, req->key._present.ct_orig_tuple_ipv6_len); +} +static inline void +ovs_flow_get_req_dump_set_key_nsh_base(struct ovs_flow_get_req_dump *req, + const void *base, size_t len) +{ + free(req->key.nsh.base); + req->key.nsh._present.base_len = len; + req->key.nsh.base = malloc(req->key.nsh._present.base_len); + memcpy(req->key.nsh.base, base, req->key.nsh._present.base_len); +} +static inline void +ovs_flow_get_req_dump_set_key_nsh_md1(struct ovs_flow_get_req_dump *req, + const void *md1, size_t len) +{ + free(req->key.nsh.md1); + req->key.nsh._present.md1_len = len; + req->key.nsh.md1 = malloc(req->key.nsh._present.md1_len); + memcpy(req->key.nsh.md1, md1, req->key.nsh._present.md1_len); +} +static inline void +ovs_flow_get_req_dump_set_key_nsh_md2(struct ovs_flow_get_req_dump *req, + const void *md2, size_t len) +{ + free(req->key.nsh.md2); + req->key.nsh._present.md2_len = len; + req->key.nsh.md2 = malloc(req->key.nsh._present.md2_len); + memcpy(req->key.nsh.md2, md2, req->key.nsh._present.md2_len); +} +static inline void +ovs_flow_get_req_dump_set_key_packet_type(struct ovs_flow_get_req_dump *req, + __u32 packet_type /* big-endian */) +{ + req->_present.key = 1; + req->key._present.packet_type = 1; + req->key.packet_type = packet_type; +} +static inline void +ovs_flow_get_req_dump_set_key_nd_extensions(struct ovs_flow_get_req_dump *req, + const void *nd_extensions, + size_t len) +{ + free(req->key.nd_extensions); + req->key._present.nd_extensions_len = len; + req->key.nd_extensions = malloc(req->key._present.nd_extensions_len); + memcpy(req->key.nd_extensions, nd_extensions, req->key._present.nd_extensions_len); +} +static inline void +ovs_flow_get_req_dump_set_key_tunnel_info(struct ovs_flow_get_req_dump *req, + const void *tunnel_info, size_t len) +{ + free(req->key.tunnel_info); + req->key._present.tunnel_info_len = len; + req->key.tunnel_info = malloc(req->key._present.tunnel_info_len); + memcpy(req->key.tunnel_info, tunnel_info, req->key._present.tunnel_info_len); +} +static inline void +ovs_flow_get_req_dump_set_key_ipv6_exthdrs(struct ovs_flow_get_req_dump *req, + const void *ipv6_exthdrs, + size_t len) +{ + free(req->key.ipv6_exthdrs); + req->key._present.ipv6_exthdrs_len = len; + req->key.ipv6_exthdrs = malloc(req->key._present.ipv6_exthdrs_len); + memcpy(req->key.ipv6_exthdrs, ipv6_exthdrs, req->key._present.ipv6_exthdrs_len); +} +static inline void +ovs_flow_get_req_dump_set_ufid(struct ovs_flow_get_req_dump *req, + const void *ufid, size_t len) +{ + free(req->ufid); + req->_present.ufid_len = len; + req->ufid = malloc(req->_present.ufid_len); + memcpy(req->ufid, ufid, req->_present.ufid_len); +} +static inline void +ovs_flow_get_req_dump_set_ufid_flags(struct ovs_flow_get_req_dump *req, + __u32 ufid_flags) +{ + req->_present.ufid_flags = 1; + req->ufid_flags = ufid_flags; +} + +struct ovs_flow_get_list { + struct ovs_flow_get_list *next; + struct ovs_flow_get_rsp obj __attribute__((aligned(8))); +}; + +void ovs_flow_get_list_free(struct ovs_flow_get_list *rsp); + +struct ovs_flow_get_list * +ovs_flow_get_dump(struct ynl_sock *ys, struct ovs_flow_get_req_dump *req); + +/* ============== OVS_FLOW_CMD_NEW ============== */ +/* OVS_FLOW_CMD_NEW - do */ +struct ovs_flow_new_req { + struct ovs_header _hdr; + + struct { + __u32 key:1; + __u32 ufid_len; + __u32 mask:1; + __u32 actions:1; + } _present; + + struct ovs_flow_key_attrs key; + void *ufid; + struct ovs_flow_key_attrs mask; + struct ovs_flow_action_attrs actions; +}; + +static inline struct ovs_flow_new_req *ovs_flow_new_req_alloc(void) +{ + return calloc(1, sizeof(struct ovs_flow_new_req)); +} +void ovs_flow_new_req_free(struct ovs_flow_new_req *req); + +static inline void +ovs_flow_new_req_set_key_priority(struct ovs_flow_new_req *req, __u32 priority) +{ + req->_present.key = 1; + req->key._present.priority = 1; + req->key.priority = priority; +} +static inline void +ovs_flow_new_req_set_key_in_port(struct ovs_flow_new_req *req, __u32 in_port) +{ + req->_present.key = 1; + req->key._present.in_port = 1; + req->key.in_port = in_port; +} +static inline void +ovs_flow_new_req_set_key_ethernet(struct ovs_flow_new_req *req, + const void *ethernet, size_t len) +{ + free(req->key.ethernet); + req->key._present.ethernet_len = len; + req->key.ethernet = malloc(req->key._present.ethernet_len); + memcpy(req->key.ethernet, ethernet, req->key._present.ethernet_len); +} +static inline void +ovs_flow_new_req_set_key_vlan(struct ovs_flow_new_req *req, + __u16 vlan /* big-endian */) +{ + req->_present.key = 1; + req->key._present.vlan = 1; + req->key.vlan = vlan; +} +static inline void +ovs_flow_new_req_set_key_ethertype(struct ovs_flow_new_req *req, + __u16 ethertype /* big-endian */) +{ + req->_present.key = 1; + req->key._present.ethertype = 1; + req->key.ethertype = ethertype; +} +static inline void +ovs_flow_new_req_set_key_ipv4(struct ovs_flow_new_req *req, const void *ipv4, + size_t len) +{ + free(req->key.ipv4); + req->key._present.ipv4_len = len; + req->key.ipv4 = malloc(req->key._present.ipv4_len); + memcpy(req->key.ipv4, ipv4, req->key._present.ipv4_len); +} +static inline void +ovs_flow_new_req_set_key_ipv6(struct ovs_flow_new_req *req, const void *ipv6, + size_t len) +{ + free(req->key.ipv6); + req->key._present.ipv6_len = len; + req->key.ipv6 = malloc(req->key._present.ipv6_len); + memcpy(req->key.ipv6, ipv6, req->key._present.ipv6_len); +} +static inline void +ovs_flow_new_req_set_key_tcp(struct ovs_flow_new_req *req, const void *tcp, + size_t len) +{ + free(req->key.tcp); + req->key._present.tcp_len = len; + req->key.tcp = malloc(req->key._present.tcp_len); + memcpy(req->key.tcp, tcp, req->key._present.tcp_len); +} +static inline void +ovs_flow_new_req_set_key_udp(struct ovs_flow_new_req *req, const void *udp, + size_t len) +{ + free(req->key.udp); + req->key._present.udp_len = len; + req->key.udp = malloc(req->key._present.udp_len); + memcpy(req->key.udp, udp, req->key._present.udp_len); +} +static inline void +ovs_flow_new_req_set_key_icmp(struct ovs_flow_new_req *req, const void *icmp, + size_t len) +{ + free(req->key.icmp); + req->key._present.icmp_len = len; + req->key.icmp = malloc(req->key._present.icmp_len); + memcpy(req->key.icmp, icmp, req->key._present.icmp_len); +} +static inline void +ovs_flow_new_req_set_key_icmpv6(struct ovs_flow_new_req *req, + const void *icmpv6, size_t len) +{ + free(req->key.icmpv6); + req->key._present.icmpv6_len = len; + req->key.icmpv6 = malloc(req->key._present.icmpv6_len); + memcpy(req->key.icmpv6, icmpv6, req->key._present.icmpv6_len); +} +static inline void +ovs_flow_new_req_set_key_arp(struct ovs_flow_new_req *req, const void *arp, + size_t len) +{ + free(req->key.arp); + req->key._present.arp_len = len; + req->key.arp = malloc(req->key._present.arp_len); + memcpy(req->key.arp, arp, req->key._present.arp_len); +} +static inline void +ovs_flow_new_req_set_key_nd(struct ovs_flow_new_req *req, const void *nd, + size_t len) +{ + free(req->key.nd); + req->key._present.nd_len = len; + req->key.nd = malloc(req->key._present.nd_len); + memcpy(req->key.nd, nd, req->key._present.nd_len); +} +static inline void +ovs_flow_new_req_set_key_skb_mark(struct ovs_flow_new_req *req, __u32 skb_mark) +{ + req->_present.key = 1; + req->key._present.skb_mark = 1; + req->key.skb_mark = skb_mark; +} +static inline void +ovs_flow_new_req_set_key_tunnel_id(struct ovs_flow_new_req *req, + __u64 id /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.id = 1; + req->key.tunnel.id = id; +} +static inline void +ovs_flow_new_req_set_key_tunnel_ipv4_src(struct ovs_flow_new_req *req, + __u32 ipv4_src /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.ipv4_src = 1; + req->key.tunnel.ipv4_src = ipv4_src; +} +static inline void +ovs_flow_new_req_set_key_tunnel_ipv4_dst(struct ovs_flow_new_req *req, + __u32 ipv4_dst /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.ipv4_dst = 1; + req->key.tunnel.ipv4_dst = ipv4_dst; +} +static inline void +ovs_flow_new_req_set_key_tunnel_tos(struct ovs_flow_new_req *req, __u8 tos) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.tos = 1; + req->key.tunnel.tos = tos; +} +static inline void +ovs_flow_new_req_set_key_tunnel_ttl(struct ovs_flow_new_req *req, __u8 ttl) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.ttl = 1; + req->key.tunnel.ttl = ttl; +} +static inline void +ovs_flow_new_req_set_key_tunnel_dont_fragment(struct ovs_flow_new_req *req) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.dont_fragment = 1; +} +static inline void +ovs_flow_new_req_set_key_tunnel_csum(struct ovs_flow_new_req *req) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.csum = 1; +} +static inline void +ovs_flow_new_req_set_key_tunnel_oam(struct ovs_flow_new_req *req) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.oam = 1; +} +static inline void +ovs_flow_new_req_set_key_tunnel_geneve_opts(struct ovs_flow_new_req *req, + const void *geneve_opts, + size_t len) +{ + free(req->key.tunnel.geneve_opts); + req->key.tunnel._present.geneve_opts_len = len; + req->key.tunnel.geneve_opts = malloc(req->key.tunnel._present.geneve_opts_len); + memcpy(req->key.tunnel.geneve_opts, geneve_opts, req->key.tunnel._present.geneve_opts_len); +} +static inline void +ovs_flow_new_req_set_key_tunnel_tp_src(struct ovs_flow_new_req *req, + __u16 tp_src /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.tp_src = 1; + req->key.tunnel.tp_src = tp_src; +} +static inline void +ovs_flow_new_req_set_key_tunnel_tp_dst(struct ovs_flow_new_req *req, + __u16 tp_dst /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.tp_dst = 1; + req->key.tunnel.tp_dst = tp_dst; +} +static inline void +ovs_flow_new_req_set_key_tunnel_vxlan_opts_gbp(struct ovs_flow_new_req *req, + __u32 gbp) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.vxlan_opts = 1; + req->key.tunnel.vxlan_opts._present.gbp = 1; + req->key.tunnel.vxlan_opts.gbp = gbp; +} +static inline void +ovs_flow_new_req_set_key_tunnel_ipv6_src(struct ovs_flow_new_req *req, + const void *ipv6_src, size_t len) +{ + free(req->key.tunnel.ipv6_src); + req->key.tunnel._present.ipv6_src_len = len; + req->key.tunnel.ipv6_src = malloc(req->key.tunnel._present.ipv6_src_len); + memcpy(req->key.tunnel.ipv6_src, ipv6_src, req->key.tunnel._present.ipv6_src_len); +} +static inline void +ovs_flow_new_req_set_key_tunnel_ipv6_dst(struct ovs_flow_new_req *req, + const void *ipv6_dst, size_t len) +{ + free(req->key.tunnel.ipv6_dst); + req->key.tunnel._present.ipv6_dst_len = len; + req->key.tunnel.ipv6_dst = malloc(req->key.tunnel._present.ipv6_dst_len); + memcpy(req->key.tunnel.ipv6_dst, ipv6_dst, req->key.tunnel._present.ipv6_dst_len); +} +static inline void +ovs_flow_new_req_set_key_tunnel_pad(struct ovs_flow_new_req *req, + const void *pad, size_t len) +{ + free(req->key.tunnel.pad); + req->key.tunnel._present.pad_len = len; + req->key.tunnel.pad = malloc(req->key.tunnel._present.pad_len); + memcpy(req->key.tunnel.pad, pad, req->key.tunnel._present.pad_len); +} +static inline void +ovs_flow_new_req_set_key_tunnel_erspan_opts(struct ovs_flow_new_req *req, + const void *erspan_opts, + size_t len) +{ + free(req->key.tunnel.erspan_opts); + req->key.tunnel._present.erspan_opts_len = len; + req->key.tunnel.erspan_opts = malloc(req->key.tunnel._present.erspan_opts_len); + memcpy(req->key.tunnel.erspan_opts, erspan_opts, req->key.tunnel._present.erspan_opts_len); +} +static inline void +ovs_flow_new_req_set_key_tunnel_ipv4_info_bridge(struct ovs_flow_new_req *req) +{ + req->_present.key = 1; + req->key._present.tunnel = 1; + req->key.tunnel._present.ipv4_info_bridge = 1; +} +static inline void +ovs_flow_new_req_set_key_sctp(struct ovs_flow_new_req *req, const void *sctp, + size_t len) +{ + free(req->key.sctp); + req->key._present.sctp_len = len; + req->key.sctp = malloc(req->key._present.sctp_len); + memcpy(req->key.sctp, sctp, req->key._present.sctp_len); +} +static inline void +ovs_flow_new_req_set_key_tcp_flags(struct ovs_flow_new_req *req, + __u16 tcp_flags /* big-endian */) +{ + req->_present.key = 1; + req->key._present.tcp_flags = 1; + req->key.tcp_flags = tcp_flags; +} +static inline void +ovs_flow_new_req_set_key_dp_hash(struct ovs_flow_new_req *req, __u32 dp_hash) +{ + req->_present.key = 1; + req->key._present.dp_hash = 1; + req->key.dp_hash = dp_hash; +} +static inline void +ovs_flow_new_req_set_key_recirc_id(struct ovs_flow_new_req *req, + __u32 recirc_id) +{ + req->_present.key = 1; + req->key._present.recirc_id = 1; + req->key.recirc_id = recirc_id; +} +static inline void +ovs_flow_new_req_set_key_mpls(struct ovs_flow_new_req *req, const void *mpls, + size_t len) +{ + free(req->key.mpls); + req->key._present.mpls_len = len; + req->key.mpls = malloc(req->key._present.mpls_len); + memcpy(req->key.mpls, mpls, req->key._present.mpls_len); +} +static inline void +ovs_flow_new_req_set_key_ct_state(struct ovs_flow_new_req *req, __u32 ct_state) +{ + req->_present.key = 1; + req->key._present.ct_state = 1; + req->key.ct_state = ct_state; +} +static inline void +ovs_flow_new_req_set_key_ct_zone(struct ovs_flow_new_req *req, __u16 ct_zone) +{ + req->_present.key = 1; + req->key._present.ct_zone = 1; + req->key.ct_zone = ct_zone; +} +static inline void +ovs_flow_new_req_set_key_ct_mark(struct ovs_flow_new_req *req, __u32 ct_mark) +{ + req->_present.key = 1; + req->key._present.ct_mark = 1; + req->key.ct_mark = ct_mark; +} +static inline void +ovs_flow_new_req_set_key_ct_labels(struct ovs_flow_new_req *req, + const void *ct_labels, size_t len) +{ + free(req->key.ct_labels); + req->key._present.ct_labels_len = len; + req->key.ct_labels = malloc(req->key._present.ct_labels_len); + memcpy(req->key.ct_labels, ct_labels, req->key._present.ct_labels_len); +} +static inline void +ovs_flow_new_req_set_key_ct_orig_tuple_ipv4(struct ovs_flow_new_req *req, + const void *ct_orig_tuple_ipv4, + size_t len) +{ + free(req->key.ct_orig_tuple_ipv4); + req->key._present.ct_orig_tuple_ipv4_len = len; + req->key.ct_orig_tuple_ipv4 = malloc(req->key._present.ct_orig_tuple_ipv4_len); + memcpy(req->key.ct_orig_tuple_ipv4, ct_orig_tuple_ipv4, req->key._present.ct_orig_tuple_ipv4_len); +} +static inline void +ovs_flow_new_req_set_key_ct_orig_tuple_ipv6(struct ovs_flow_new_req *req, + const void *ct_orig_tuple_ipv6, + size_t len) +{ + free(req->key.ct_orig_tuple_ipv6); + req->key._present.ct_orig_tuple_ipv6_len = len; + req->key.ct_orig_tuple_ipv6 = malloc(req->key._present.ct_orig_tuple_ipv6_len); + memcpy(req->key.ct_orig_tuple_ipv6, ct_orig_tuple_ipv6, req->key._present.ct_orig_tuple_ipv6_len); +} +static inline void +ovs_flow_new_req_set_key_nsh_base(struct ovs_flow_new_req *req, + const void *base, size_t len) +{ + free(req->key.nsh.base); + req->key.nsh._present.base_len = len; + req->key.nsh.base = malloc(req->key.nsh._present.base_len); + memcpy(req->key.nsh.base, base, req->key.nsh._present.base_len); +} +static inline void +ovs_flow_new_req_set_key_nsh_md1(struct ovs_flow_new_req *req, const void *md1, + size_t len) +{ + free(req->key.nsh.md1); + req->key.nsh._present.md1_len = len; + req->key.nsh.md1 = malloc(req->key.nsh._present.md1_len); + memcpy(req->key.nsh.md1, md1, req->key.nsh._present.md1_len); +} +static inline void +ovs_flow_new_req_set_key_nsh_md2(struct ovs_flow_new_req *req, const void *md2, + size_t len) +{ + free(req->key.nsh.md2); + req->key.nsh._present.md2_len = len; + req->key.nsh.md2 = malloc(req->key.nsh._present.md2_len); + memcpy(req->key.nsh.md2, md2, req->key.nsh._present.md2_len); +} +static inline void +ovs_flow_new_req_set_key_packet_type(struct ovs_flow_new_req *req, + __u32 packet_type /* big-endian */) +{ + req->_present.key = 1; + req->key._present.packet_type = 1; + req->key.packet_type = packet_type; +} +static inline void +ovs_flow_new_req_set_key_nd_extensions(struct ovs_flow_new_req *req, + const void *nd_extensions, size_t len) +{ + free(req->key.nd_extensions); + req->key._present.nd_extensions_len = len; + req->key.nd_extensions = malloc(req->key._present.nd_extensions_len); + memcpy(req->key.nd_extensions, nd_extensions, req->key._present.nd_extensions_len); +} +static inline void +ovs_flow_new_req_set_key_tunnel_info(struct ovs_flow_new_req *req, + const void *tunnel_info, size_t len) +{ + free(req->key.tunnel_info); + req->key._present.tunnel_info_len = len; + req->key.tunnel_info = malloc(req->key._present.tunnel_info_len); + memcpy(req->key.tunnel_info, tunnel_info, req->key._present.tunnel_info_len); +} +static inline void +ovs_flow_new_req_set_key_ipv6_exthdrs(struct ovs_flow_new_req *req, + const void *ipv6_exthdrs, size_t len) +{ + free(req->key.ipv6_exthdrs); + req->key._present.ipv6_exthdrs_len = len; + req->key.ipv6_exthdrs = malloc(req->key._present.ipv6_exthdrs_len); + memcpy(req->key.ipv6_exthdrs, ipv6_exthdrs, req->key._present.ipv6_exthdrs_len); +} +static inline void +ovs_flow_new_req_set_ufid(struct ovs_flow_new_req *req, const void *ufid, + size_t len) +{ + free(req->ufid); + req->_present.ufid_len = len; + req->ufid = malloc(req->_present.ufid_len); + memcpy(req->ufid, ufid, req->_present.ufid_len); +} +static inline void +ovs_flow_new_req_set_mask_priority(struct ovs_flow_new_req *req, + __u32 priority) +{ + req->_present.mask = 1; + req->mask._present.priority = 1; + req->mask.priority = priority; +} +static inline void +ovs_flow_new_req_set_mask_in_port(struct ovs_flow_new_req *req, __u32 in_port) +{ + req->_present.mask = 1; + req->mask._present.in_port = 1; + req->mask.in_port = in_port; +} +static inline void +ovs_flow_new_req_set_mask_ethernet(struct ovs_flow_new_req *req, + const void *ethernet, size_t len) +{ + free(req->mask.ethernet); + req->mask._present.ethernet_len = len; + req->mask.ethernet = malloc(req->mask._present.ethernet_len); + memcpy(req->mask.ethernet, ethernet, req->mask._present.ethernet_len); +} +static inline void +ovs_flow_new_req_set_mask_vlan(struct ovs_flow_new_req *req, + __u16 vlan /* big-endian */) +{ + req->_present.mask = 1; + req->mask._present.vlan = 1; + req->mask.vlan = vlan; +} +static inline void +ovs_flow_new_req_set_mask_ethertype(struct ovs_flow_new_req *req, + __u16 ethertype /* big-endian */) +{ + req->_present.mask = 1; + req->mask._present.ethertype = 1; + req->mask.ethertype = ethertype; +} +static inline void +ovs_flow_new_req_set_mask_ipv4(struct ovs_flow_new_req *req, const void *ipv4, + size_t len) +{ + free(req->mask.ipv4); + req->mask._present.ipv4_len = len; + req->mask.ipv4 = malloc(req->mask._present.ipv4_len); + memcpy(req->mask.ipv4, ipv4, req->mask._present.ipv4_len); +} +static inline void +ovs_flow_new_req_set_mask_ipv6(struct ovs_flow_new_req *req, const void *ipv6, + size_t len) +{ + free(req->mask.ipv6); + req->mask._present.ipv6_len = len; + req->mask.ipv6 = malloc(req->mask._present.ipv6_len); + memcpy(req->mask.ipv6, ipv6, req->mask._present.ipv6_len); +} +static inline void +ovs_flow_new_req_set_mask_tcp(struct ovs_flow_new_req *req, const void *tcp, + size_t len) +{ + free(req->mask.tcp); + req->mask._present.tcp_len = len; + req->mask.tcp = malloc(req->mask._present.tcp_len); + memcpy(req->mask.tcp, tcp, req->mask._present.tcp_len); +} +static inline void +ovs_flow_new_req_set_mask_udp(struct ovs_flow_new_req *req, const void *udp, + size_t len) +{ + free(req->mask.udp); + req->mask._present.udp_len = len; + req->mask.udp = malloc(req->mask._present.udp_len); + memcpy(req->mask.udp, udp, req->mask._present.udp_len); +} +static inline void +ovs_flow_new_req_set_mask_icmp(struct ovs_flow_new_req *req, const void *icmp, + size_t len) +{ + free(req->mask.icmp); + req->mask._present.icmp_len = len; + req->mask.icmp = malloc(req->mask._present.icmp_len); + memcpy(req->mask.icmp, icmp, req->mask._present.icmp_len); +} +static inline void +ovs_flow_new_req_set_mask_icmpv6(struct ovs_flow_new_req *req, + const void *icmpv6, size_t len) +{ + free(req->mask.icmpv6); + req->mask._present.icmpv6_len = len; + req->mask.icmpv6 = malloc(req->mask._present.icmpv6_len); + memcpy(req->mask.icmpv6, icmpv6, req->mask._present.icmpv6_len); +} +static inline void +ovs_flow_new_req_set_mask_arp(struct ovs_flow_new_req *req, const void *arp, + size_t len) +{ + free(req->mask.arp); + req->mask._present.arp_len = len; + req->mask.arp = malloc(req->mask._present.arp_len); + memcpy(req->mask.arp, arp, req->mask._present.arp_len); +} +static inline void +ovs_flow_new_req_set_mask_nd(struct ovs_flow_new_req *req, const void *nd, + size_t len) +{ + free(req->mask.nd); + req->mask._present.nd_len = len; + req->mask.nd = malloc(req->mask._present.nd_len); + memcpy(req->mask.nd, nd, req->mask._present.nd_len); +} +static inline void +ovs_flow_new_req_set_mask_skb_mark(struct ovs_flow_new_req *req, + __u32 skb_mark) +{ + req->_present.mask = 1; + req->mask._present.skb_mark = 1; + req->mask.skb_mark = skb_mark; +} +static inline void +ovs_flow_new_req_set_mask_tunnel_id(struct ovs_flow_new_req *req, + __u64 id /* big-endian */) +{ + req->_present.mask = 1; + req->mask._present.tunnel = 1; + req->mask.tunnel._present.id = 1; + req->mask.tunnel.id = id; +} +static inline void +ovs_flow_new_req_set_mask_tunnel_ipv4_src(struct ovs_flow_new_req *req, + __u32 ipv4_src /* big-endian */) +{ + req->_present.mask = 1; + req->mask._present.tunnel = 1; + req->mask.tunnel._present.ipv4_src = 1; + req->mask.tunnel.ipv4_src = ipv4_src; +} +static inline void +ovs_flow_new_req_set_mask_tunnel_ipv4_dst(struct ovs_flow_new_req *req, + __u32 ipv4_dst /* big-endian */) +{ + req->_present.mask = 1; + req->mask._present.tunnel = 1; + req->mask.tunnel._present.ipv4_dst = 1; + req->mask.tunnel.ipv4_dst = ipv4_dst; +} +static inline void +ovs_flow_new_req_set_mask_tunnel_tos(struct ovs_flow_new_req *req, __u8 tos) +{ + req->_present.mask = 1; + req->mask._present.tunnel = 1; + req->mask.tunnel._present.tos = 1; + req->mask.tunnel.tos = tos; +} +static inline void +ovs_flow_new_req_set_mask_tunnel_ttl(struct ovs_flow_new_req *req, __u8 ttl) +{ + req->_present.mask = 1; + req->mask._present.tunnel = 1; + req->mask.tunnel._present.ttl = 1; + req->mask.tunnel.ttl = ttl; +} +static inline void +ovs_flow_new_req_set_mask_tunnel_dont_fragment(struct ovs_flow_new_req *req) +{ + req->_present.mask = 1; + req->mask._present.tunnel = 1; + req->mask.tunnel._present.dont_fragment = 1; +} +static inline void +ovs_flow_new_req_set_mask_tunnel_csum(struct ovs_flow_new_req *req) +{ + req->_present.mask = 1; + req->mask._present.tunnel = 1; + req->mask.tunnel._present.csum = 1; +} +static inline void +ovs_flow_new_req_set_mask_tunnel_oam(struct ovs_flow_new_req *req) +{ + req->_present.mask = 1; + req->mask._present.tunnel = 1; + req->mask.tunnel._present.oam = 1; +} +static inline void +ovs_flow_new_req_set_mask_tunnel_geneve_opts(struct ovs_flow_new_req *req, + const void *geneve_opts, + size_t len) +{ + free(req->mask.tunnel.geneve_opts); + req->mask.tunnel._present.geneve_opts_len = len; + req->mask.tunnel.geneve_opts = malloc(req->mask.tunnel._present.geneve_opts_len); + memcpy(req->mask.tunnel.geneve_opts, geneve_opts, req->mask.tunnel._present.geneve_opts_len); +} +static inline void +ovs_flow_new_req_set_mask_tunnel_tp_src(struct ovs_flow_new_req *req, + __u16 tp_src /* big-endian */) +{ + req->_present.mask = 1; + req->mask._present.tunnel = 1; + req->mask.tunnel._present.tp_src = 1; + req->mask.tunnel.tp_src = tp_src; +} +static inline void +ovs_flow_new_req_set_mask_tunnel_tp_dst(struct ovs_flow_new_req *req, + __u16 tp_dst /* big-endian */) +{ + req->_present.mask = 1; + req->mask._present.tunnel = 1; + req->mask.tunnel._present.tp_dst = 1; + req->mask.tunnel.tp_dst = tp_dst; +} +static inline void +ovs_flow_new_req_set_mask_tunnel_vxlan_opts_gbp(struct ovs_flow_new_req *req, + __u32 gbp) +{ + req->_present.mask = 1; + req->mask._present.tunnel = 1; + req->mask.tunnel._present.vxlan_opts = 1; + req->mask.tunnel.vxlan_opts._present.gbp = 1; + req->mask.tunnel.vxlan_opts.gbp = gbp; +} +static inline void +ovs_flow_new_req_set_mask_tunnel_ipv6_src(struct ovs_flow_new_req *req, + const void *ipv6_src, size_t len) +{ + free(req->mask.tunnel.ipv6_src); + req->mask.tunnel._present.ipv6_src_len = len; + req->mask.tunnel.ipv6_src = malloc(req->mask.tunnel._present.ipv6_src_len); + memcpy(req->mask.tunnel.ipv6_src, ipv6_src, req->mask.tunnel._present.ipv6_src_len); +} +static inline void +ovs_flow_new_req_set_mask_tunnel_ipv6_dst(struct ovs_flow_new_req *req, + const void *ipv6_dst, size_t len) +{ + free(req->mask.tunnel.ipv6_dst); + req->mask.tunnel._present.ipv6_dst_len = len; + req->mask.tunnel.ipv6_dst = malloc(req->mask.tunnel._present.ipv6_dst_len); + memcpy(req->mask.tunnel.ipv6_dst, ipv6_dst, req->mask.tunnel._present.ipv6_dst_len); +} +static inline void +ovs_flow_new_req_set_mask_tunnel_pad(struct ovs_flow_new_req *req, + const void *pad, size_t len) +{ + free(req->mask.tunnel.pad); + req->mask.tunnel._present.pad_len = len; + req->mask.tunnel.pad = malloc(req->mask.tunnel._present.pad_len); + memcpy(req->mask.tunnel.pad, pad, req->mask.tunnel._present.pad_len); +} +static inline void +ovs_flow_new_req_set_mask_tunnel_erspan_opts(struct ovs_flow_new_req *req, + const void *erspan_opts, + size_t len) +{ + free(req->mask.tunnel.erspan_opts); + req->mask.tunnel._present.erspan_opts_len = len; + req->mask.tunnel.erspan_opts = malloc(req->mask.tunnel._present.erspan_opts_len); + memcpy(req->mask.tunnel.erspan_opts, erspan_opts, req->mask.tunnel._present.erspan_opts_len); +} +static inline void +ovs_flow_new_req_set_mask_tunnel_ipv4_info_bridge(struct ovs_flow_new_req *req) +{ + req->_present.mask = 1; + req->mask._present.tunnel = 1; + req->mask.tunnel._present.ipv4_info_bridge = 1; +} +static inline void +ovs_flow_new_req_set_mask_sctp(struct ovs_flow_new_req *req, const void *sctp, + size_t len) +{ + free(req->mask.sctp); + req->mask._present.sctp_len = len; + req->mask.sctp = malloc(req->mask._present.sctp_len); + memcpy(req->mask.sctp, sctp, req->mask._present.sctp_len); +} +static inline void +ovs_flow_new_req_set_mask_tcp_flags(struct ovs_flow_new_req *req, + __u16 tcp_flags /* big-endian */) +{ + req->_present.mask = 1; + req->mask._present.tcp_flags = 1; + req->mask.tcp_flags = tcp_flags; +} +static inline void +ovs_flow_new_req_set_mask_dp_hash(struct ovs_flow_new_req *req, __u32 dp_hash) +{ + req->_present.mask = 1; + req->mask._present.dp_hash = 1; + req->mask.dp_hash = dp_hash; +} +static inline void +ovs_flow_new_req_set_mask_recirc_id(struct ovs_flow_new_req *req, + __u32 recirc_id) +{ + req->_present.mask = 1; + req->mask._present.recirc_id = 1; + req->mask.recirc_id = recirc_id; +} +static inline void +ovs_flow_new_req_set_mask_mpls(struct ovs_flow_new_req *req, const void *mpls, + size_t len) +{ + free(req->mask.mpls); + req->mask._present.mpls_len = len; + req->mask.mpls = malloc(req->mask._present.mpls_len); + memcpy(req->mask.mpls, mpls, req->mask._present.mpls_len); +} +static inline void +ovs_flow_new_req_set_mask_ct_state(struct ovs_flow_new_req *req, + __u32 ct_state) +{ + req->_present.mask = 1; + req->mask._present.ct_state = 1; + req->mask.ct_state = ct_state; +} +static inline void +ovs_flow_new_req_set_mask_ct_zone(struct ovs_flow_new_req *req, __u16 ct_zone) +{ + req->_present.mask = 1; + req->mask._present.ct_zone = 1; + req->mask.ct_zone = ct_zone; +} +static inline void +ovs_flow_new_req_set_mask_ct_mark(struct ovs_flow_new_req *req, __u32 ct_mark) +{ + req->_present.mask = 1; + req->mask._present.ct_mark = 1; + req->mask.ct_mark = ct_mark; +} +static inline void +ovs_flow_new_req_set_mask_ct_labels(struct ovs_flow_new_req *req, + const void *ct_labels, size_t len) +{ + free(req->mask.ct_labels); + req->mask._present.ct_labels_len = len; + req->mask.ct_labels = malloc(req->mask._present.ct_labels_len); + memcpy(req->mask.ct_labels, ct_labels, req->mask._present.ct_labels_len); +} +static inline void +ovs_flow_new_req_set_mask_ct_orig_tuple_ipv4(struct ovs_flow_new_req *req, + const void *ct_orig_tuple_ipv4, + size_t len) +{ + free(req->mask.ct_orig_tuple_ipv4); + req->mask._present.ct_orig_tuple_ipv4_len = len; + req->mask.ct_orig_tuple_ipv4 = malloc(req->mask._present.ct_orig_tuple_ipv4_len); + memcpy(req->mask.ct_orig_tuple_ipv4, ct_orig_tuple_ipv4, req->mask._present.ct_orig_tuple_ipv4_len); +} +static inline void +ovs_flow_new_req_set_mask_ct_orig_tuple_ipv6(struct ovs_flow_new_req *req, + const void *ct_orig_tuple_ipv6, + size_t len) +{ + free(req->mask.ct_orig_tuple_ipv6); + req->mask._present.ct_orig_tuple_ipv6_len = len; + req->mask.ct_orig_tuple_ipv6 = malloc(req->mask._present.ct_orig_tuple_ipv6_len); + memcpy(req->mask.ct_orig_tuple_ipv6, ct_orig_tuple_ipv6, req->mask._present.ct_orig_tuple_ipv6_len); +} +static inline void +ovs_flow_new_req_set_mask_nsh_base(struct ovs_flow_new_req *req, + const void *base, size_t len) +{ + free(req->mask.nsh.base); + req->mask.nsh._present.base_len = len; + req->mask.nsh.base = malloc(req->mask.nsh._present.base_len); + memcpy(req->mask.nsh.base, base, req->mask.nsh._present.base_len); +} +static inline void +ovs_flow_new_req_set_mask_nsh_md1(struct ovs_flow_new_req *req, + const void *md1, size_t len) +{ + free(req->mask.nsh.md1); + req->mask.nsh._present.md1_len = len; + req->mask.nsh.md1 = malloc(req->mask.nsh._present.md1_len); + memcpy(req->mask.nsh.md1, md1, req->mask.nsh._present.md1_len); +} +static inline void +ovs_flow_new_req_set_mask_nsh_md2(struct ovs_flow_new_req *req, + const void *md2, size_t len) +{ + free(req->mask.nsh.md2); + req->mask.nsh._present.md2_len = len; + req->mask.nsh.md2 = malloc(req->mask.nsh._present.md2_len); + memcpy(req->mask.nsh.md2, md2, req->mask.nsh._present.md2_len); +} +static inline void +ovs_flow_new_req_set_mask_packet_type(struct ovs_flow_new_req *req, + __u32 packet_type /* big-endian */) +{ + req->_present.mask = 1; + req->mask._present.packet_type = 1; + req->mask.packet_type = packet_type; +} +static inline void +ovs_flow_new_req_set_mask_nd_extensions(struct ovs_flow_new_req *req, + const void *nd_extensions, size_t len) +{ + free(req->mask.nd_extensions); + req->mask._present.nd_extensions_len = len; + req->mask.nd_extensions = malloc(req->mask._present.nd_extensions_len); + memcpy(req->mask.nd_extensions, nd_extensions, req->mask._present.nd_extensions_len); +} +static inline void +ovs_flow_new_req_set_mask_tunnel_info(struct ovs_flow_new_req *req, + const void *tunnel_info, size_t len) +{ + free(req->mask.tunnel_info); + req->mask._present.tunnel_info_len = len; + req->mask.tunnel_info = malloc(req->mask._present.tunnel_info_len); + memcpy(req->mask.tunnel_info, tunnel_info, req->mask._present.tunnel_info_len); +} +static inline void +ovs_flow_new_req_set_mask_ipv6_exthdrs(struct ovs_flow_new_req *req, + const void *ipv6_exthdrs, size_t len) +{ + free(req->mask.ipv6_exthdrs); + req->mask._present.ipv6_exthdrs_len = len; + req->mask.ipv6_exthdrs = malloc(req->mask._present.ipv6_exthdrs_len); + memcpy(req->mask.ipv6_exthdrs, ipv6_exthdrs, req->mask._present.ipv6_exthdrs_len); +} +static inline void +ovs_flow_new_req_set_actions_output(struct ovs_flow_new_req *req, __u32 output) +{ + req->_present.actions = 1; + req->actions._present.output = 1; + req->actions.output = output; +} +static inline void +ovs_flow_new_req_set_actions_userspace_pid(struct ovs_flow_new_req *req, + __u32 pid) +{ + req->_present.actions = 1; + req->actions._present.userspace = 1; + req->actions.userspace._present.pid = 1; + req->actions.userspace.pid = pid; +} +static inline void +ovs_flow_new_req_set_actions_userspace_userdata(struct ovs_flow_new_req *req, + const void *userdata, + size_t len) +{ + free(req->actions.userspace.userdata); + req->actions.userspace._present.userdata_len = len; + req->actions.userspace.userdata = malloc(req->actions.userspace._present.userdata_len); + memcpy(req->actions.userspace.userdata, userdata, req->actions.userspace._present.userdata_len); +} +static inline void +ovs_flow_new_req_set_actions_userspace_egress_tun_port(struct ovs_flow_new_req *req, + __u32 egress_tun_port) +{ + req->_present.actions = 1; + req->actions._present.userspace = 1; + req->actions.userspace._present.egress_tun_port = 1; + req->actions.userspace.egress_tun_port = egress_tun_port; +} +static inline void +ovs_flow_new_req_set_actions_userspace_actions(struct ovs_flow_new_req *req) +{ + req->_present.actions = 1; + req->actions._present.userspace = 1; + req->actions.userspace._present.actions = 1; +} +static inline void +ovs_flow_new_req_set_actions_push_vlan(struct ovs_flow_new_req *req, + const void *push_vlan, size_t len) +{ + free(req->actions.push_vlan); + req->actions._present.push_vlan_len = len; + req->actions.push_vlan = malloc(req->actions._present.push_vlan_len); + memcpy(req->actions.push_vlan, push_vlan, req->actions._present.push_vlan_len); +} +static inline void +ovs_flow_new_req_set_actions_pop_vlan(struct ovs_flow_new_req *req) +{ + req->_present.actions = 1; + req->actions._present.pop_vlan = 1; +} +static inline void +ovs_flow_new_req_set_actions_sample_probability(struct ovs_flow_new_req *req, + __u32 probability) +{ + req->_present.actions = 1; + req->actions._present.sample = 1; + req->actions.sample._present.probability = 1; + req->actions.sample.probability = probability; +} +static inline void +ovs_flow_new_req_set_actions_recirc(struct ovs_flow_new_req *req, __u32 recirc) +{ + req->_present.actions = 1; + req->actions._present.recirc = 1; + req->actions.recirc = recirc; +} +static inline void +ovs_flow_new_req_set_actions_hash(struct ovs_flow_new_req *req, + const void *hash, size_t len) +{ + free(req->actions.hash); + req->actions._present.hash_len = len; + req->actions.hash = malloc(req->actions._present.hash_len); + memcpy(req->actions.hash, hash, req->actions._present.hash_len); +} +static inline void +ovs_flow_new_req_set_actions_push_mpls(struct ovs_flow_new_req *req, + const void *push_mpls, size_t len) +{ + free(req->actions.push_mpls); + req->actions._present.push_mpls_len = len; + req->actions.push_mpls = malloc(req->actions._present.push_mpls_len); + memcpy(req->actions.push_mpls, push_mpls, req->actions._present.push_mpls_len); +} +static inline void +ovs_flow_new_req_set_actions_pop_mpls(struct ovs_flow_new_req *req, + __u16 pop_mpls /* big-endian */) +{ + req->_present.actions = 1; + req->actions._present.pop_mpls = 1; + req->actions.pop_mpls = pop_mpls; +} +static inline void +ovs_flow_new_req_set_actions_ct_commit(struct ovs_flow_new_req *req) +{ + req->_present.actions = 1; + req->actions._present.ct = 1; + req->actions.ct._present.commit = 1; +} +static inline void +ovs_flow_new_req_set_actions_ct_zone(struct ovs_flow_new_req *req, __u16 zone) +{ + req->_present.actions = 1; + req->actions._present.ct = 1; + req->actions.ct._present.zone = 1; + req->actions.ct.zone = zone; +} +static inline void +ovs_flow_new_req_set_actions_ct_mark(struct ovs_flow_new_req *req, + const void *mark, size_t len) +{ + free(req->actions.ct.mark); + req->actions.ct._present.mark_len = len; + req->actions.ct.mark = malloc(req->actions.ct._present.mark_len); + memcpy(req->actions.ct.mark, mark, req->actions.ct._present.mark_len); +} +static inline void +ovs_flow_new_req_set_actions_ct_labels(struct ovs_flow_new_req *req, + const void *labels, size_t len) +{ + free(req->actions.ct.labels); + req->actions.ct._present.labels_len = len; + req->actions.ct.labels = malloc(req->actions.ct._present.labels_len); + memcpy(req->actions.ct.labels, labels, req->actions.ct._present.labels_len); +} +static inline void +ovs_flow_new_req_set_actions_ct_helper(struct ovs_flow_new_req *req, + const char *helper) +{ + free(req->actions.ct.helper); + req->actions.ct._present.helper_len = strlen(helper); + req->actions.ct.helper = malloc(req->actions.ct._present.helper_len + 1); + memcpy(req->actions.ct.helper, helper, req->actions.ct._present.helper_len); + req->actions.ct.helper[req->actions.ct._present.helper_len] = 0; +} +static inline void +ovs_flow_new_req_set_actions_ct_nat_src(struct ovs_flow_new_req *req) +{ + req->_present.actions = 1; + req->actions._present.ct = 1; + req->actions.ct._present.nat = 1; + req->actions.ct.nat._present.src = 1; +} +static inline void +ovs_flow_new_req_set_actions_ct_nat_dst(struct ovs_flow_new_req *req) +{ + req->_present.actions = 1; + req->actions._present.ct = 1; + req->actions.ct._present.nat = 1; + req->actions.ct.nat._present.dst = 1; +} +static inline void +ovs_flow_new_req_set_actions_ct_nat_ip_min(struct ovs_flow_new_req *req, + const void *ip_min, size_t len) +{ + free(req->actions.ct.nat.ip_min); + req->actions.ct.nat._present.ip_min_len = len; + req->actions.ct.nat.ip_min = malloc(req->actions.ct.nat._present.ip_min_len); + memcpy(req->actions.ct.nat.ip_min, ip_min, req->actions.ct.nat._present.ip_min_len); +} +static inline void +ovs_flow_new_req_set_actions_ct_nat_ip_max(struct ovs_flow_new_req *req, + const void *ip_max, size_t len) +{ + free(req->actions.ct.nat.ip_max); + req->actions.ct.nat._present.ip_max_len = len; + req->actions.ct.nat.ip_max = malloc(req->actions.ct.nat._present.ip_max_len); + memcpy(req->actions.ct.nat.ip_max, ip_max, req->actions.ct.nat._present.ip_max_len); +} +static inline void +ovs_flow_new_req_set_actions_ct_nat_proto_min(struct ovs_flow_new_req *req, + __u16 proto_min) +{ + req->_present.actions = 1; + req->actions._present.ct = 1; + req->actions.ct._present.nat = 1; + req->actions.ct.nat._present.proto_min = 1; + req->actions.ct.nat.proto_min = proto_min; +} +static inline void +ovs_flow_new_req_set_actions_ct_nat_proto_max(struct ovs_flow_new_req *req, + __u16 proto_max) +{ + req->_present.actions = 1; + req->actions._present.ct = 1; + req->actions.ct._present.nat = 1; + req->actions.ct.nat._present.proto_max = 1; + req->actions.ct.nat.proto_max = proto_max; +} +static inline void +ovs_flow_new_req_set_actions_ct_nat_persistent(struct ovs_flow_new_req *req) +{ + req->_present.actions = 1; + req->actions._present.ct = 1; + req->actions.ct._present.nat = 1; + req->actions.ct.nat._present.persistent = 1; +} +static inline void +ovs_flow_new_req_set_actions_ct_nat_proto_hash(struct ovs_flow_new_req *req) +{ + req->_present.actions = 1; + req->actions._present.ct = 1; + req->actions.ct._present.nat = 1; + req->actions.ct.nat._present.proto_hash = 1; +} +static inline void +ovs_flow_new_req_set_actions_ct_nat_proto_random(struct ovs_flow_new_req *req) +{ + req->_present.actions = 1; + req->actions._present.ct = 1; + req->actions.ct._present.nat = 1; + req->actions.ct.nat._present.proto_random = 1; +} +static inline void +ovs_flow_new_req_set_actions_ct_force_commit(struct ovs_flow_new_req *req) +{ + req->_present.actions = 1; + req->actions._present.ct = 1; + req->actions.ct._present.force_commit = 1; +} +static inline void +ovs_flow_new_req_set_actions_ct_eventmask(struct ovs_flow_new_req *req, + __u32 eventmask) +{ + req->_present.actions = 1; + req->actions._present.ct = 1; + req->actions.ct._present.eventmask = 1; + req->actions.ct.eventmask = eventmask; +} +static inline void +ovs_flow_new_req_set_actions_ct_timeout(struct ovs_flow_new_req *req, + const char *timeout) +{ + free(req->actions.ct.timeout); + req->actions.ct._present.timeout_len = strlen(timeout); + req->actions.ct.timeout = malloc(req->actions.ct._present.timeout_len + 1); + memcpy(req->actions.ct.timeout, timeout, req->actions.ct._present.timeout_len); + req->actions.ct.timeout[req->actions.ct._present.timeout_len] = 0; +} +static inline void +ovs_flow_new_req_set_actions_trunc(struct ovs_flow_new_req *req, __u32 trunc) +{ + req->_present.actions = 1; + req->actions._present.trunc = 1; + req->actions.trunc = trunc; +} +static inline void +ovs_flow_new_req_set_actions_push_eth(struct ovs_flow_new_req *req, + const void *push_eth, size_t len) +{ + free(req->actions.push_eth); + req->actions._present.push_eth_len = len; + req->actions.push_eth = malloc(req->actions._present.push_eth_len); + memcpy(req->actions.push_eth, push_eth, req->actions._present.push_eth_len); +} +static inline void +ovs_flow_new_req_set_actions_pop_eth(struct ovs_flow_new_req *req) +{ + req->_present.actions = 1; + req->actions._present.pop_eth = 1; +} +static inline void +ovs_flow_new_req_set_actions_ct_clear(struct ovs_flow_new_req *req) +{ + req->_present.actions = 1; + req->actions._present.ct_clear = 1; +} +static inline void +ovs_flow_new_req_set_actions_push_nsh_base(struct ovs_flow_new_req *req, + const void *base, size_t len) +{ + free(req->actions.push_nsh.base); + req->actions.push_nsh._present.base_len = len; + req->actions.push_nsh.base = malloc(req->actions.push_nsh._present.base_len); + memcpy(req->actions.push_nsh.base, base, req->actions.push_nsh._present.base_len); +} +static inline void +ovs_flow_new_req_set_actions_push_nsh_md1(struct ovs_flow_new_req *req, + const void *md1, size_t len) +{ + free(req->actions.push_nsh.md1); + req->actions.push_nsh._present.md1_len = len; + req->actions.push_nsh.md1 = malloc(req->actions.push_nsh._present.md1_len); + memcpy(req->actions.push_nsh.md1, md1, req->actions.push_nsh._present.md1_len); +} +static inline void +ovs_flow_new_req_set_actions_push_nsh_md2(struct ovs_flow_new_req *req, + const void *md2, size_t len) +{ + free(req->actions.push_nsh.md2); + req->actions.push_nsh._present.md2_len = len; + req->actions.push_nsh.md2 = malloc(req->actions.push_nsh._present.md2_len); + memcpy(req->actions.push_nsh.md2, md2, req->actions.push_nsh._present.md2_len); +} +static inline void +ovs_flow_new_req_set_actions_pop_nsh(struct ovs_flow_new_req *req) +{ + req->_present.actions = 1; + req->actions._present.pop_nsh = 1; +} +static inline void +ovs_flow_new_req_set_actions_meter(struct ovs_flow_new_req *req, __u32 meter) +{ + req->_present.actions = 1; + req->actions._present.meter = 1; + req->actions.meter = meter; +} +static inline void +ovs_flow_new_req_set_actions_check_pkt_len_pkt_len(struct ovs_flow_new_req *req, + __u16 pkt_len) +{ + req->_present.actions = 1; + req->actions._present.check_pkt_len = 1; + req->actions.check_pkt_len._present.pkt_len = 1; + req->actions.check_pkt_len.pkt_len = pkt_len; +} +static inline void +ovs_flow_new_req_set_actions_add_mpls(struct ovs_flow_new_req *req, + const void *add_mpls, size_t len) +{ + free(req->actions.add_mpls); + req->actions._present.add_mpls_len = len; + req->actions.add_mpls = malloc(req->actions._present.add_mpls_len); + memcpy(req->actions.add_mpls, add_mpls, req->actions._present.add_mpls_len); +} + +/* + * Create OVS flow configuration in a data path + */ +int ovs_flow_new(struct ynl_sock *ys, struct ovs_flow_new_req *req); + +#endif /* _LINUX_OVS_FLOW_GEN_H */ diff --git a/include/ynl-c/ovs_vport.h b/include/ynl-c/ovs_vport.h new file mode 100644 index 0000000..493a638 --- /dev/null +++ b/include/ynl-c/ovs_vport.h @@ -0,0 +1,270 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/ovs_vport.yaml */ +/* YNL-GEN user header */ + +#ifndef _LINUX_OVS_VPORT_GEN_H +#define _LINUX_OVS_VPORT_GEN_H + +#include +#include +#include +#include + +struct ynl_sock; + +extern const struct ynl_family ynl_ovs_vport_family; + +/* Enums */ +const char *ovs_vport_op_str(int op); +const char *ovs_vport_vport_type_str(enum ovs_vport_type value); + +/* Common nested types */ +struct ovs_vport_vport_options { + struct { + __u32 dst_port:1; + __u32 extension:1; + } _present; + + __u32 dst_port; + __u32 extension; +}; + +struct ovs_vport_upcall_stats { + struct { + __u32 success:1; + __u32 fail:1; + } _present; + + __u64 success; + __u64 fail; +}; + +/* ============== OVS_VPORT_CMD_NEW ============== */ +/* OVS_VPORT_CMD_NEW - do */ +struct ovs_vport_new_req { + struct ovs_header _hdr; + + struct { + __u32 name_len; + __u32 type:1; + __u32 upcall_pid_len; + __u32 ifindex:1; + __u32 options:1; + } _present; + + char *name; + enum ovs_vport_type type; + void *upcall_pid; + __u32 ifindex; + struct ovs_vport_vport_options options; +}; + +static inline struct ovs_vport_new_req *ovs_vport_new_req_alloc(void) +{ + return calloc(1, sizeof(struct ovs_vport_new_req)); +} +void ovs_vport_new_req_free(struct ovs_vport_new_req *req); + +static inline void +ovs_vport_new_req_set_name(struct ovs_vport_new_req *req, const char *name) +{ + free(req->name); + req->_present.name_len = strlen(name); + req->name = malloc(req->_present.name_len + 1); + memcpy(req->name, name, req->_present.name_len); + req->name[req->_present.name_len] = 0; +} +static inline void +ovs_vport_new_req_set_type(struct ovs_vport_new_req *req, + enum ovs_vport_type type) +{ + req->_present.type = 1; + req->type = type; +} +static inline void +ovs_vport_new_req_set_upcall_pid(struct ovs_vport_new_req *req, + const void *upcall_pid, size_t len) +{ + free(req->upcall_pid); + req->_present.upcall_pid_len = len; + req->upcall_pid = malloc(req->_present.upcall_pid_len); + memcpy(req->upcall_pid, upcall_pid, req->_present.upcall_pid_len); +} +static inline void +ovs_vport_new_req_set_ifindex(struct ovs_vport_new_req *req, __u32 ifindex) +{ + req->_present.ifindex = 1; + req->ifindex = ifindex; +} +static inline void +ovs_vport_new_req_set_options_dst_port(struct ovs_vport_new_req *req, + __u32 dst_port) +{ + req->_present.options = 1; + req->options._present.dst_port = 1; + req->options.dst_port = dst_port; +} +static inline void +ovs_vport_new_req_set_options_extension(struct ovs_vport_new_req *req, + __u32 extension) +{ + req->_present.options = 1; + req->options._present.extension = 1; + req->options.extension = extension; +} + +/* + * Create a new OVS vport + */ +int ovs_vport_new(struct ynl_sock *ys, struct ovs_vport_new_req *req); + +/* ============== OVS_VPORT_CMD_DEL ============== */ +/* OVS_VPORT_CMD_DEL - do */ +struct ovs_vport_del_req { + struct ovs_header _hdr; + + struct { + __u32 port_no:1; + __u32 type:1; + __u32 name_len; + } _present; + + __u32 port_no; + enum ovs_vport_type type; + char *name; +}; + +static inline struct ovs_vport_del_req *ovs_vport_del_req_alloc(void) +{ + return calloc(1, sizeof(struct ovs_vport_del_req)); +} +void ovs_vport_del_req_free(struct ovs_vport_del_req *req); + +static inline void +ovs_vport_del_req_set_port_no(struct ovs_vport_del_req *req, __u32 port_no) +{ + req->_present.port_no = 1; + req->port_no = port_no; +} +static inline void +ovs_vport_del_req_set_type(struct ovs_vport_del_req *req, + enum ovs_vport_type type) +{ + req->_present.type = 1; + req->type = type; +} +static inline void +ovs_vport_del_req_set_name(struct ovs_vport_del_req *req, const char *name) +{ + free(req->name); + req->_present.name_len = strlen(name); + req->name = malloc(req->_present.name_len + 1); + memcpy(req->name, name, req->_present.name_len); + req->name[req->_present.name_len] = 0; +} + +/* + * Delete existing OVS vport from a data path + */ +int ovs_vport_del(struct ynl_sock *ys, struct ovs_vport_del_req *req); + +/* ============== OVS_VPORT_CMD_GET ============== */ +/* OVS_VPORT_CMD_GET - do */ +struct ovs_vport_get_req { + struct ovs_header _hdr; + + struct { + __u32 name_len; + } _present; + + char *name; +}; + +static inline struct ovs_vport_get_req *ovs_vport_get_req_alloc(void) +{ + return calloc(1, sizeof(struct ovs_vport_get_req)); +} +void ovs_vport_get_req_free(struct ovs_vport_get_req *req); + +static inline void +ovs_vport_get_req_set_name(struct ovs_vport_get_req *req, const char *name) +{ + free(req->name); + req->_present.name_len = strlen(name); + req->name = malloc(req->_present.name_len + 1); + memcpy(req->name, name, req->_present.name_len); + req->name[req->_present.name_len] = 0; +} + +struct ovs_vport_get_rsp { + struct ovs_header _hdr; + + struct { + __u32 port_no:1; + __u32 type:1; + __u32 name_len; + __u32 upcall_pid_len; + __u32 stats_len; + __u32 ifindex:1; + __u32 netnsid:1; + __u32 upcall_stats:1; + } _present; + + __u32 port_no; + enum ovs_vport_type type; + char *name; + void *upcall_pid; + void *stats; + __u32 ifindex; + __u32 netnsid; + struct ovs_vport_upcall_stats upcall_stats; +}; + +void ovs_vport_get_rsp_free(struct ovs_vport_get_rsp *rsp); + +/* + * Get / dump OVS vport configuration and state + */ +struct ovs_vport_get_rsp * +ovs_vport_get(struct ynl_sock *ys, struct ovs_vport_get_req *req); + +/* OVS_VPORT_CMD_GET - dump */ +struct ovs_vport_get_req_dump { + struct ovs_header _hdr; + + struct { + __u32 name_len; + } _present; + + char *name; +}; + +static inline struct ovs_vport_get_req_dump *ovs_vport_get_req_dump_alloc(void) +{ + return calloc(1, sizeof(struct ovs_vport_get_req_dump)); +} +void ovs_vport_get_req_dump_free(struct ovs_vport_get_req_dump *req); + +static inline void +ovs_vport_get_req_dump_set_name(struct ovs_vport_get_req_dump *req, + const char *name) +{ + free(req->name); + req->_present.name_len = strlen(name); + req->name = malloc(req->_present.name_len + 1); + memcpy(req->name, name, req->_present.name_len); + req->name[req->_present.name_len] = 0; +} + +struct ovs_vport_get_list { + struct ovs_vport_get_list *next; + struct ovs_vport_get_rsp obj __attribute__((aligned(8))); +}; + +void ovs_vport_get_list_free(struct ovs_vport_get_list *rsp); + +struct ovs_vport_get_list * +ovs_vport_get_dump(struct ynl_sock *ys, struct ovs_vport_get_req_dump *req); + +#endif /* _LINUX_OVS_VPORT_GEN_H */ diff --git a/include/ynl-c/psp.h b/include/ynl-c/psp.h new file mode 100644 index 0000000..e9b4c1a --- /dev/null +++ b/include/ynl-c/psp.h @@ -0,0 +1,368 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/psp.yaml */ +/* YNL-GEN user header */ + +#ifndef _LINUX_PSP_GEN_H +#define _LINUX_PSP_GEN_H + +#include +#include +#include +#include + +struct ynl_sock; + +extern const struct ynl_family ynl_psp_family; + +/* Enums */ +const char *psp_op_str(int op); +const char *psp_version_str(enum psp_version value); + +/* Common nested types */ +struct psp_keys { + struct { + __u32 key_len; + __u32 spi:1; + } _present; + + void *key; + __u32 spi; +}; + +/* ============== PSP_CMD_DEV_GET ============== */ +/* PSP_CMD_DEV_GET - do */ +struct psp_dev_get_req { + struct { + __u32 id:1; + } _present; + + __u32 id; +}; + +static inline struct psp_dev_get_req *psp_dev_get_req_alloc(void) +{ + return calloc(1, sizeof(struct psp_dev_get_req)); +} +void psp_dev_get_req_free(struct psp_dev_get_req *req); + +static inline void +psp_dev_get_req_set_id(struct psp_dev_get_req *req, __u32 id) +{ + req->_present.id = 1; + req->id = id; +} + +struct psp_dev_get_rsp { + struct { + __u32 id:1; + __u32 ifindex:1; + __u32 psp_versions_cap:1; + __u32 psp_versions_ena:1; + } _present; + + __u32 id; + __u32 ifindex; + __u32 psp_versions_cap; + __u32 psp_versions_ena; +}; + +void psp_dev_get_rsp_free(struct psp_dev_get_rsp *rsp); + +/* + * Get / dump information about PSP capable devices on the system. + */ +struct psp_dev_get_rsp * +psp_dev_get(struct ynl_sock *ys, struct psp_dev_get_req *req); + +/* PSP_CMD_DEV_GET - dump */ +struct psp_dev_get_list { + struct psp_dev_get_list *next; + struct psp_dev_get_rsp obj __attribute__((aligned(8))); +}; + +void psp_dev_get_list_free(struct psp_dev_get_list *rsp); + +struct psp_dev_get_list *psp_dev_get_dump(struct ynl_sock *ys); + +/* PSP_CMD_DEV_GET - notify */ +struct psp_dev_get_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct psp_dev_get_ntf *ntf); + struct psp_dev_get_rsp obj __attribute__((aligned(8))); +}; + +void psp_dev_get_ntf_free(struct psp_dev_get_ntf *rsp); + +/* ============== PSP_CMD_DEV_SET ============== */ +/* PSP_CMD_DEV_SET - do */ +struct psp_dev_set_req { + struct { + __u32 id:1; + __u32 psp_versions_ena:1; + } _present; + + __u32 id; + __u32 psp_versions_ena; +}; + +static inline struct psp_dev_set_req *psp_dev_set_req_alloc(void) +{ + return calloc(1, sizeof(struct psp_dev_set_req)); +} +void psp_dev_set_req_free(struct psp_dev_set_req *req); + +static inline void +psp_dev_set_req_set_id(struct psp_dev_set_req *req, __u32 id) +{ + req->_present.id = 1; + req->id = id; +} +static inline void +psp_dev_set_req_set_psp_versions_ena(struct psp_dev_set_req *req, + __u32 psp_versions_ena) +{ + req->_present.psp_versions_ena = 1; + req->psp_versions_ena = psp_versions_ena; +} + +/* + * Set the configuration of a PSP device. + */ +int psp_dev_set(struct ynl_sock *ys, struct psp_dev_set_req *req); + +/* ============== PSP_CMD_KEY_ROTATE ============== */ +/* PSP_CMD_KEY_ROTATE - do */ +struct psp_key_rotate_req { + struct { + __u32 id:1; + } _present; + + __u32 id; +}; + +static inline struct psp_key_rotate_req *psp_key_rotate_req_alloc(void) +{ + return calloc(1, sizeof(struct psp_key_rotate_req)); +} +void psp_key_rotate_req_free(struct psp_key_rotate_req *req); + +static inline void +psp_key_rotate_req_set_id(struct psp_key_rotate_req *req, __u32 id) +{ + req->_present.id = 1; + req->id = id; +} + +struct psp_key_rotate_rsp { + struct { + __u32 id:1; + } _present; + + __u32 id; +}; + +void psp_key_rotate_rsp_free(struct psp_key_rotate_rsp *rsp); + +/* + * Rotate the main key. + */ +struct psp_key_rotate_rsp * +psp_key_rotate(struct ynl_sock *ys, struct psp_key_rotate_req *req); + +/* PSP_CMD_KEY_ROTATE - notify */ +struct psp_key_rotate_ntf { + __u16 family; + __u8 cmd; + struct ynl_ntf_base_type *next; + void (*free)(struct psp_key_rotate_ntf *ntf); + struct psp_key_rotate_rsp obj __attribute__((aligned(8))); +}; + +void psp_key_rotate_ntf_free(struct psp_key_rotate_ntf *rsp); + +/* ============== PSP_CMD_RX_ASSOC ============== */ +/* PSP_CMD_RX_ASSOC - do */ +struct psp_rx_assoc_req { + struct { + __u32 dev_id:1; + __u32 version:1; + __u32 sock_fd:1; + } _present; + + __u32 dev_id; + enum psp_version version; + __u32 sock_fd; +}; + +static inline struct psp_rx_assoc_req *psp_rx_assoc_req_alloc(void) +{ + return calloc(1, sizeof(struct psp_rx_assoc_req)); +} +void psp_rx_assoc_req_free(struct psp_rx_assoc_req *req); + +static inline void +psp_rx_assoc_req_set_dev_id(struct psp_rx_assoc_req *req, __u32 dev_id) +{ + req->_present.dev_id = 1; + req->dev_id = dev_id; +} +static inline void +psp_rx_assoc_req_set_version(struct psp_rx_assoc_req *req, + enum psp_version version) +{ + req->_present.version = 1; + req->version = version; +} +static inline void +psp_rx_assoc_req_set_sock_fd(struct psp_rx_assoc_req *req, __u32 sock_fd) +{ + req->_present.sock_fd = 1; + req->sock_fd = sock_fd; +} + +struct psp_rx_assoc_rsp { + struct { + __u32 dev_id:1; + __u32 version:1; + __u32 rx_key:1; + } _present; + + __u32 dev_id; + enum psp_version version; + struct psp_keys rx_key; +}; + +void psp_rx_assoc_rsp_free(struct psp_rx_assoc_rsp *rsp); + +/* + * Allocate a new Rx key + SPI pair, associate it with a socket. + */ +struct psp_rx_assoc_rsp * +psp_rx_assoc(struct ynl_sock *ys, struct psp_rx_assoc_req *req); + +/* ============== PSP_CMD_TX_ASSOC ============== */ +/* PSP_CMD_TX_ASSOC - do */ +struct psp_tx_assoc_req { + struct { + __u32 dev_id:1; + __u32 version:1; + __u32 tx_key:1; + __u32 sock_fd:1; + } _present; + + __u32 dev_id; + enum psp_version version; + struct psp_keys tx_key; + __u32 sock_fd; +}; + +static inline struct psp_tx_assoc_req *psp_tx_assoc_req_alloc(void) +{ + return calloc(1, sizeof(struct psp_tx_assoc_req)); +} +void psp_tx_assoc_req_free(struct psp_tx_assoc_req *req); + +static inline void +psp_tx_assoc_req_set_dev_id(struct psp_tx_assoc_req *req, __u32 dev_id) +{ + req->_present.dev_id = 1; + req->dev_id = dev_id; +} +static inline void +psp_tx_assoc_req_set_version(struct psp_tx_assoc_req *req, + enum psp_version version) +{ + req->_present.version = 1; + req->version = version; +} +static inline void +psp_tx_assoc_req_set_tx_key_key(struct psp_tx_assoc_req *req, const void *key, + size_t len) +{ + free(req->tx_key.key); + req->tx_key._present.key_len = len; + req->tx_key.key = malloc(req->tx_key._present.key_len); + memcpy(req->tx_key.key, key, req->tx_key._present.key_len); +} +static inline void +psp_tx_assoc_req_set_tx_key_spi(struct psp_tx_assoc_req *req, __u32 spi) +{ + req->_present.tx_key = 1; + req->tx_key._present.spi = 1; + req->tx_key.spi = spi; +} +static inline void +psp_tx_assoc_req_set_sock_fd(struct psp_tx_assoc_req *req, __u32 sock_fd) +{ + req->_present.sock_fd = 1; + req->sock_fd = sock_fd; +} + +struct psp_tx_assoc_rsp { +}; + +void psp_tx_assoc_rsp_free(struct psp_tx_assoc_rsp *rsp); + +/* + * Add a PSP Tx association. + */ +struct psp_tx_assoc_rsp * +psp_tx_assoc(struct ynl_sock *ys, struct psp_tx_assoc_req *req); + +/* ============== PSP_CMD_GET_STATS ============== */ +/* PSP_CMD_GET_STATS - do */ +struct psp_get_stats_req { + struct { + __u32 dev_id:1; + } _present; + + __u32 dev_id; +}; + +static inline struct psp_get_stats_req *psp_get_stats_req_alloc(void) +{ + return calloc(1, sizeof(struct psp_get_stats_req)); +} +void psp_get_stats_req_free(struct psp_get_stats_req *req); + +static inline void +psp_get_stats_req_set_dev_id(struct psp_get_stats_req *req, __u32 dev_id) +{ + req->_present.dev_id = 1; + req->dev_id = dev_id; +} + +struct psp_get_stats_rsp { + struct { + __u32 dev_id:1; + __u32 key_rotations:1; + __u32 stale_events:1; + } _present; + + __u32 dev_id; + __u64 key_rotations; + __u64 stale_events; +}; + +void psp_get_stats_rsp_free(struct psp_get_stats_rsp *rsp); + +/* + * Get device statistics. + */ +struct psp_get_stats_rsp * +psp_get_stats(struct ynl_sock *ys, struct psp_get_stats_req *req); + +/* PSP_CMD_GET_STATS - dump */ +struct psp_get_stats_list { + struct psp_get_stats_list *next; + struct psp_get_stats_rsp obj __attribute__((aligned(8))); +}; + +void psp_get_stats_list_free(struct psp_get_stats_list *rsp); + +struct psp_get_stats_list *psp_get_stats_dump(struct ynl_sock *ys); + +#endif /* _LINUX_PSP_GEN_H */ diff --git a/update-from-kernel.sh b/update-from-kernel.sh index d043bb2..e00ca4b 100755 --- a/update-from-kernel.sh +++ b/update-from-kernel.sh @@ -26,3 +26,12 @@ cp -v ${KSRC}/tools/net/ynl/lib/*.{c,h} ./ mkdir -p generated cp -v ${KSRC}/tools/net/ynl/generated/*.{c,h} ./generated/ + +mkdir -p include/ynl-c +for hdr in $(ls generated/ | grep -user.h); do + mv -v generated/$hdr ./include/ynl-c/${hdr/-user/} + ( + cd generated + ln -sv ../include/ynl-c/${hdr/-user/} ./$hdr + ) +done