github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/socket_netlink_generic_devlink.txt (about)

     1  # Copyright 2019 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  # AF_NETLINK/NETLINK_GENERIC/devlink support.
     5  
     6  include <linux/net.h>
     7  include <net/netlink.h>
     8  include <uapi/linux/netlink.h>
     9  include <uapi/linux/genetlink.h>
    10  include <uapi/linux/devlink.h>
    11  
    12  resource genl_devlink_family_id[int16]
    13  syz_genetlink_get_family_id$devlink(name ptr[in, string["devlink"]], fd sock_nl_generic) genl_devlink_family_id
    14  
    15  type msghdr_nl_devlink[CMD, POLICY] msghdr_netlink[netlink_msg_t[genl_devlink_family_id, genlmsghdr_t[CMD], POLICY]]
    16  
    17  sendmsg$DEVLINK_CMD_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_GET, devlink_handle]], f flags[send_flags])
    18  sendmsg$DEVLINK_CMD_RELOAD(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_RELOAD, devlink_reload_policy]], f flags[send_flags])
    19  sendmsg$DEVLINK_CMD_PORT_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_PORT_GET, devlink_port_get_policy]], f flags[send_flags])
    20  sendmsg$DEVLINK_CMD_PORT_SET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_PORT_SET, devlink_port_set_policy]], f flags[send_flags])
    21  sendmsg$DEVLINK_CMD_PORT_SPLIT(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_PORT_SPLIT, devlink_port_split_policy]], f flags[send_flags])
    22  sendmsg$DEVLINK_CMD_PORT_UNSPLIT(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_PORT_UNSPLIT, devlink_port_unsplit_policy]], f flags[send_flags])
    23  sendmsg$DEVLINK_CMD_TRAP_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_TRAP_GET, devlink_trap_get_policy]], f flags[send_flags])
    24  sendmsg$DEVLINK_CMD_TRAP_SET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_TRAP_SET, devlink_trap_set_policy]], f flags[send_flags])
    25  sendmsg$DEVLINK_CMD_TRAP_GROUP_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_TRAP_GROUP_GET, devlink_trap_group_get_policy]], f flags[send_flags])
    26  sendmsg$DEVLINK_CMD_TRAP_GROUP_SET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_TRAP_GROUP_SET, devlink_trap_group_set_policy]], f flags[send_flags])
    27  sendmsg$DEVLINK_CMD_TRAP_POLICER_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_TRAP_POLICER_GET, devlink_trap_policer_get_policy]], f flags[send_flags])
    28  sendmsg$DEVLINK_CMD_TRAP_POLICER_SET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_TRAP_POLICER_SET, devlink_trap_policer_set_policy]], f flags[send_flags])
    29  sendmsg$DEVLINK_CMD_SB_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_SB_GET, devlink_sb_get_policy]], f flags[send_flags])
    30  sendmsg$DEVLINK_CMD_SB_POOL_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_SB_POOL_GET, devlink_sb_pool_get_policy]], f flags[send_flags])
    31  sendmsg$DEVLINK_CMD_SB_POOL_SET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_SB_POOL_SET, devlink_sb_pool_set_policy]], f flags[send_flags])
    32  sendmsg$DEVLINK_CMD_SB_PORT_POOL_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_SB_PORT_POOL_GET, devlink_sb_port_pool_get_policy]], f flags[send_flags])
    33  sendmsg$DEVLINK_CMD_SB_PORT_POOL_SET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_SB_PORT_POOL_SET, devlink_sb_port_pool_set_policy]], f flags[send_flags])
    34  sendmsg$DEVLINK_CMD_SB_TC_POOL_BIND_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_SB_TC_POOL_BIND_GET, devlink_sb_tc_pool_bind_get_policy]], f flags[send_flags])
    35  sendmsg$DEVLINK_CMD_SB_TC_POOL_BIND_SET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_SB_TC_POOL_BIND_SET, devlink_sb_tc_pool_bind_set_policy]], f flags[send_flags])
    36  sendmsg$DEVLINK_CMD_SB_OCC_SNAPSHOT(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_SB_OCC_SNAPSHOT, devlink_sb_occ_snapshot_policy]], f flags[send_flags])
    37  sendmsg$DEVLINK_CMD_SB_OCC_MAX_CLEAR(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_SB_OCC_MAX_CLEAR, devlink_sb_occ_max_clear_policy]], f flags[send_flags])
    38  sendmsg$DEVLINK_CMD_RATE_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_RATE_GET, devlink_nl_rate_get_policy]], f flags[send_flags])
    39  sendmsg$DEVLINK_CMD_RATE_SET(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_RATE_SET, devlink_nl_rate_set_policy]], f flags[send_flags])
    40  sendmsg$DEVLINK_CMD_RATE_NEW(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_RATE_NEW, devlink_nl_rate_set_policy]], f flags[send_flags])
    41  sendmsg$DEVLINK_CMD_RATE_DEL(fd sock_nl_generic, msg ptr[in, msghdr_nl_devlink[DEVLINK_CMD_RATE_DEL, devlink_nl_rate_get_policy]], f flags[send_flags])
    42  
    43  devlink_devname {
    44  	prefix	stringnoz["netdevsim"]
    45  	id	proc['0', 1, int8]
    46  	z	const[0, int8]
    47  } [packed]
    48  
    49  devlink_nl_policy$nsim {
    50  	DEVLINK_ATTR_BUS_NAME	nlattr[DEVLINK_ATTR_BUS_NAME, string["netdevsim"]]
    51  	DEVLINK_ATTR_DEV_NAME	nlattr[DEVLINK_ATTR_DEV_NAME, devlink_devname]
    52  } [packed, align[4]]
    53  
    54  devlink_nl_policy$pci {
    55  	DEVLINK_ATTR_BUS_NAME	nlattr[DEVLINK_ATTR_BUS_NAME, string["pci"]]
    56  # 0000:00:10.0 is a fixed pci address what is moved from initial network namespace by initialize_devlink()
    57  	DEVLINK_ATTR_DEV_NAME	nlattr[DEVLINK_ATTR_DEV_NAME, string["0000:00:10.0"]]
    58  } [packed, align[4]]
    59  
    60  devlink_handle [
    61  	nsim	devlink_nl_policy$nsim
    62  	pci	devlink_nl_policy$pci
    63  ] [varlen]
    64  
    65  devlink_port_handle {
    66  	port_handle		devlink_handle
    67  # 0:3 is in sync with number of ports created by netdevsim_add()
    68  	DEVLINK_ATTR_PORT_INDEX	nlattr[DEVLINK_ATTR_PORT_INDEX, int32[0:3]]
    69  } [packed, align[4]]
    70  
    71  devlink_nl_policy$reload [
    72  	DEVLINK_ATTR_NETNS_PID	nlattr[DEVLINK_ATTR_NETNS_PID, pid]
    73  	DEVLINK_ATTR_NETNS_FD	nlattr[DEVLINK_ATTR_NETNS_FD, fd_namespace]
    74  	DEVLINK_ATTR_NETNS_ID	nlattr[DEVLINK_ATTR_NETNS_ID, netns_id]
    75  ] [varlen]
    76  
    77  devlink_reload_policy {
    78  	handle	devlink_handle
    79  	arg	devlink_nl_policy$reload
    80  } [packed, align[4]]
    81  
    82  devlink_port_get_policy {
    83  	port_handle	devlink_port_handle
    84  } [packed, align[4]]
    85  
    86  devlink_port_set_policy {
    87  	port_handle		devlink_port_handle
    88  	DEVLINK_ATTR_PORT_TYPE	nlattr[DEVLINK_ATTR_PORT_TYPE, int16[DEVLINK_PORT_TYPE_NOTSET:DEVLINK_PORT_TYPE_IB]]
    89  } [packed, align[4]]
    90  
    91  devlink_port_split_policy {
    92  	port_handle			devlink_port_handle
    93  	DEVLINK_ATTR_PORT_SPLIT_COUNT	nlattr[DEVLINK_ATTR_PORT_SPLIT_COUNT, int32[0:8]]
    94  } [packed, align[4]]
    95  
    96  devlink_port_unsplit_policy {
    97  	port_handle	devlink_port_handle
    98  } [packed, align[4]]
    99  
   100  devlink_trap_get_policy {
   101  	dev_handle		devlink_handle
   102  	DEVLINK_ATTR_TRAP_NAME	nlattr[DEVLINK_ATTR_TRAP_NAME, string["source_mac_is_multicast"]]
   103  } [packed, align[4]]
   104  
   105  devlink_trap_set_policy {
   106  	dev_handle			devlink_handle
   107  	DEVLINK_ATTR_TRAP_NAME		nlattr[DEVLINK_ATTR_TRAP_NAME, string["source_mac_is_multicast"]]
   108  	DEVLINK_ATTR_TRAP_ACTION	nlattr[DEVLINK_ATTR_TRAP_ACTION, int8[DEVLINK_TRAP_ACTION_DROP:DEVLINK_TRAP_ACTION_TRAP]]
   109  } [packed, align[4]]
   110  
   111  # 0 stands for the only invalid policer id, the rest has no special meaning but
   112  #  used to ease collision in policer ids between system calls.
   113  trap_policer_ids = 0, 1, 2, 3
   114  
   115  devlink_trap_policer_get_policy {
   116  	dev_handle			devlink_handle
   117  	DEVLINK_ATTR_TRAP_POLICER_ID	nlattr[DEVLINK_ATTR_TRAP_POLICER_ID, flags[trap_policer_ids, int32]]
   118  } [packed, align[4]]
   119  
   120  devlink_trap_policer_set_policy {
   121  	dev_handle			devlink_handle
   122  	DEVLINK_ATTR_TRAP_POLICER_ID	nlattr[DEVLINK_ATTR_TRAP_POLICER_ID, flags[trap_policer_ids, int32]]
   123  	DEVLINK_ATTR_TRAP_POLICER_RATE	nlattr[DEVLINK_ATTR_TRAP_POLICER_RATE, int64]
   124  	DEVLINK_ATTR_TRAP_POLICER_BURST	nlattr[DEVLINK_ATTR_TRAP_POLICER_BURST, int64]
   125  } [packed, align[4]]
   126  
   127  devlink_trap_group_get_policy {
   128  	dev_handle			devlink_handle
   129  	DEVLINK_ATTR_TRAP_GROUP_NAME	nlattr[DEVLINK_ATTR_TRAP_GROUP_NAME, string["l2_drops"]]
   130  } [packed, align[4]]
   131  
   132  devlink_trap_group_set_policy {
   133  	dev_handle			devlink_handle
   134  	DEVLINK_ATTR_TRAP_GROUP_NAME	nlattr[DEVLINK_ATTR_TRAP_GROUP_NAME, string["l2_drops"]]
   135  	DEVLINK_ATTR_TRAP_ACTION	nlattr[DEVLINK_ATTR_TRAP_ACTION, int8[DEVLINK_TRAP_ACTION_DROP:DEVLINK_TRAP_ACTION_TRAP]]
   136  } [packed, align[4]]
   137  
   138  devlink_sb_get_policy {
   139  	handle			devlink_handle
   140  	DEVLINK_ATTR_SB_INDEX	nlattr[DEVLINK_ATTR_SB_INDEX, int32]
   141  } [packed, align[4]]
   142  
   143  devlink_sb_pool_get_policy {
   144  	handle				devlink_handle
   145  	DEVLINK_ATTR_SB_INDEX		nlattr[DEVLINK_ATTR_SB_INDEX, int32]
   146  	DEVLINK_ATTR_SB_POOL_INDEX	nlattr[DEVLINK_ATTR_SB_POOL_INDEX, int16]
   147  } [packed, align[4]]
   148  
   149  devlink_sb_pool_set_policy {
   150  	handle					devlink_handle
   151  	DEVLINK_ATTR_SB_INDEX			nlattr[DEVLINK_ATTR_SB_INDEX, int32]
   152  	DEVLINK_ATTR_SB_POOL_INDEX		nlattr[DEVLINK_ATTR_SB_POOL_INDEX, int16]
   153  	DEVLINK_ATTR_SB_POOL_SIZE		nlattr[DEVLINK_ATTR_SB_POOL_SIZE, int32]
   154  	DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE	nlattr[DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE, int8[DEVLINK_SB_THRESHOLD_TYPE_STATIC:DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC]]
   155  } [packed, align[4]]
   156  
   157  devlink_sb_port_pool_get_policy {
   158  	port_handle			devlink_port_handle
   159  	DEVLINK_ATTR_SB_INDEX		nlattr[DEVLINK_ATTR_SB_INDEX, int32]
   160  	DEVLINK_ATTR_SB_POOL_INDEX	nlattr[DEVLINK_ATTR_SB_POOL_INDEX, int16]
   161  } [packed, align[4]]
   162  
   163  devlink_sb_port_pool_set_policy {
   164  	port_handle			devlink_port_handle
   165  	DEVLINK_ATTR_SB_INDEX		nlattr[DEVLINK_ATTR_SB_INDEX, int32]
   166  	DEVLINK_ATTR_SB_POOL_INDEX	nlattr[DEVLINK_ATTR_SB_POOL_INDEX, int16]
   167  	DEVLINK_ATTR_SB_THRESHOLD	nlattr[DEVLINK_ATTR_SB_THRESHOLD, int32]
   168  } [packed, align[4]]
   169  
   170  devlink_sb_tc_pool_bind_get_policy {
   171  	port_handle			devlink_port_handle
   172  	DEVLINK_ATTR_SB_INDEX		nlattr[DEVLINK_ATTR_SB_INDEX, int32]
   173  	DEVLINK_ATTR_SB_TC_INDEX	nlattr[DEVLINK_ATTR_SB_TC_INDEX, int16]
   174  	DEVLINK_ATTR_SB_POOL_TYPE	nlattr[DEVLINK_ATTR_SB_POOL_TYPE, int8[DEVLINK_SB_POOL_TYPE_INGRESS:DEVLINK_SB_POOL_TYPE_EGRESS]]
   175  } [packed, align[4]]
   176  
   177  devlink_sb_tc_pool_bind_set_policy {
   178  	port_handle			devlink_port_handle
   179  	DEVLINK_ATTR_SB_INDEX		nlattr[DEVLINK_ATTR_SB_INDEX, int32]
   180  	DEVLINK_ATTR_SB_TC_INDEX	nlattr[DEVLINK_ATTR_SB_TC_INDEX, int16]
   181  	DEVLINK_ATTR_SB_POOL_TYPE	nlattr[DEVLINK_ATTR_SB_POOL_TYPE, int8[DEVLINK_SB_POOL_TYPE_INGRESS:DEVLINK_SB_POOL_TYPE_EGRESS]]
   182  	DEVLINK_ATTR_SB_POOL_INDEX	nlattr[DEVLINK_ATTR_SB_POOL_INDEX, int16]
   183  	DEVLINK_ATTR_SB_THRESHOLD	nlattr[DEVLINK_ATTR_SB_INDEX, int32]
   184  } [packed, align[4]]
   185  
   186  devlink_sb_occ_snapshot_policy {
   187  	handle			devlink_handle
   188  	DEVLINK_ATTR_SB_INDEX	nlattr[DEVLINK_ATTR_SB_INDEX, int32]
   189  } [packed, align[4]]
   190  
   191  devlink_sb_occ_max_clear_policy {
   192  	handle			devlink_handle
   193  	DEVLINK_ATTR_SB_INDEX	nlattr[DEVLINK_ATTR_SB_INDEX, int32]
   194  } [packed, align[4]]
   195  
   196  devlink_rate_node_name [
   197  	name1	string["firstname"]
   198  	name2	string["secondname"]
   199  	random	array[int8]
   200  ] [varlen]
   201  
   202  devlink_nl_rate_get_policy [
   203  	handle				devlink_handle
   204  	DEVLINK_ATTR_RATE_NODE_NAME	nlattr[DEVLINK_ATTR_RATE_NODE_NAME, devlink_rate_node_name]
   205  	DEVLINK_ATTR_PORT_INDEX		nlattr[DEVLINK_ATTR_PORT_INDEX, int32[0:3]]
   206  ] [varlen]
   207  
   208  devlink_nl_rate_set_policy [
   209  	handle					devlink_handle
   210  	DEVLINK_ATTR_RATE_NODE_NAME		nlattr[DEVLINK_ATTR_RATE_NODE_NAME, devlink_rate_node_name]
   211  	DEVLINK_ATTR_PORT_INDEX			nlattr[DEVLINK_ATTR_PORT_INDEX, int32[0:3]]
   212  	DEVLINK_ATTR_RATE_TX_SHARE		nlattr[DEVLINK_ATTR_RATE_TX_SHARE, int64]
   213  	DEVLINK_ATTR_RATE_TX_MAX		nlattr[DEVLINK_ATTR_RATE_TX_MAX, int64]
   214  	DEVLINK_ATTR_RATE_PARENT_NODE_NAME	nlattr[DEVLINK_ATTR_RATE_PARENT_NODE_NAME, devlink_rate_node_name]
   215  ] [varlen]