github.com/vishvananda/netlink@v1.3.0/nl/devlink_linux.go (about)

     1  package nl
     2  
     3  // All the following constants are coming from:
     4  // https://github.com/torvalds/linux/blob/master/include/uapi/linux/devlink.h
     5  
     6  const (
     7  	GENL_DEVLINK_VERSION = 1
     8  	GENL_DEVLINK_NAME    = "devlink"
     9  )
    10  
    11  const (
    12  	DEVLINK_CMD_GET           = 1
    13  	DEVLINK_CMD_PORT_GET      = 5
    14  	DEVLINK_CMD_PORT_SET      = 6
    15  	DEVLINK_CMD_PORT_NEW      = 7
    16  	DEVLINK_CMD_PORT_DEL      = 8
    17  	DEVLINK_CMD_ESWITCH_GET   = 29
    18  	DEVLINK_CMD_ESWITCH_SET   = 30
    19  	DEVLINK_CMD_RESOURCE_DUMP = 36
    20  	DEVLINK_CMD_PARAM_GET     = 38
    21  	DEVLINK_CMD_PARAM_SET     = 39
    22  	DEVLINK_CMD_INFO_GET      = 51
    23  )
    24  
    25  const (
    26  	DEVLINK_ATTR_BUS_NAME                   = 1
    27  	DEVLINK_ATTR_DEV_NAME                   = 2
    28  	DEVLINK_ATTR_PORT_INDEX                 = 3
    29  	DEVLINK_ATTR_PORT_TYPE                  = 4
    30  	DEVLINK_ATTR_PORT_NETDEV_IFINDEX        = 6
    31  	DEVLINK_ATTR_PORT_NETDEV_NAME           = 7
    32  	DEVLINK_ATTR_PORT_IBDEV_NAME            = 8
    33  	DEVLINK_ATTR_ESWITCH_MODE               = 25
    34  	DEVLINK_ATTR_ESWITCH_INLINE_MODE        = 26
    35  	DEVLINK_ATTR_ESWITCH_ENCAP_MODE         = 62
    36  	DEVLINK_ATTR_RESOURCE_LIST              = 63 /* nested */
    37  	DEVLINK_ATTR_RESOURCE                   = 64 /* nested */
    38  	DEVLINK_ATTR_RESOURCE_NAME              = 65 /* string */
    39  	DEVLINK_ATTR_RESOURCE_ID                = 66 /* u64 */
    40  	DEVLINK_ATTR_RESOURCE_SIZE              = 67 /* u64 */
    41  	DEVLINK_ATTR_RESOURCE_SIZE_NEW          = 68 /* u64 */
    42  	DEVLINK_ATTR_RESOURCE_SIZE_VALID        = 69 /* u8 */
    43  	DEVLINK_ATTR_RESOURCE_SIZE_MIN          = 70 /* u64 */
    44  	DEVLINK_ATTR_RESOURCE_SIZE_MAX          = 71 /* u64 */
    45  	DEVLINK_ATTR_RESOURCE_SIZE_GRAN         = 72 /* u64 */
    46  	DEVLINK_ATTR_RESOURCE_UNIT              = 73 /* u8 */
    47  	DEVLINK_ATTR_RESOURCE_OCC               = 74 /* u64 */
    48  	DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID    = 75 /* u64 */
    49  	DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS = 76 /* u64 */
    50  	DEVLINK_ATTR_PORT_FLAVOUR               = 77
    51  	DEVLINK_ATTR_INFO_DRIVER_NAME           = 98
    52  	DEVLINK_ATTR_INFO_SERIAL_NUMBER         = 99
    53  	DEVLINK_ATTR_INFO_VERSION_FIXED         = 100
    54  	DEVLINK_ATTR_INFO_VERSION_RUNNING       = 101
    55  	DEVLINK_ATTR_INFO_VERSION_STORED        = 102
    56  	DEVLINK_ATTR_INFO_VERSION_NAME          = 103
    57  	DEVLINK_ATTR_INFO_VERSION_VALUE         = 104
    58  	DEVLINK_ATTR_PORT_PCI_PF_NUMBER         = 127
    59  	DEVLINK_ATTR_PORT_FUNCTION              = 145
    60  	DEVLINK_ATTR_PORT_CONTROLLER_NUMBER     = 150
    61  	DEVLINK_ATTR_PORT_PCI_SF_NUMBER         = 164
    62  )
    63  
    64  const (
    65  	DEVLINK_ESWITCH_MODE_LEGACY    = 0
    66  	DEVLINK_ESWITCH_MODE_SWITCHDEV = 1
    67  )
    68  
    69  const (
    70  	DEVLINK_ESWITCH_INLINE_MODE_NONE      = 0
    71  	DEVLINK_ESWITCH_INLINE_MODE_LINK      = 1
    72  	DEVLINK_ESWITCH_INLINE_MODE_NETWORK   = 2
    73  	DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT = 3
    74  )
    75  
    76  const (
    77  	DEVLINK_ESWITCH_ENCAP_MODE_NONE  = 0
    78  	DEVLINK_ESWITCH_ENCAP_MODE_BASIC = 1
    79  )
    80  
    81  const (
    82  	DEVLINK_PORT_FLAVOUR_PHYSICAL = 0
    83  	DEVLINK_PORT_FLAVOUR_CPU      = 1
    84  	DEVLINK_PORT_FLAVOUR_DSA      = 2
    85  	DEVLINK_PORT_FLAVOUR_PCI_PF   = 3
    86  	DEVLINK_PORT_FLAVOUR_PCI_VF   = 4
    87  	DEVLINK_PORT_FLAVOUR_VIRTUAL  = 5
    88  	DEVLINK_PORT_FLAVOUR_UNUSED   = 6
    89  	DEVLINK_PORT_FLAVOUR_PCI_SF   = 7
    90  )
    91  
    92  const (
    93  	DEVLINK_PORT_TYPE_NOTSET = 0
    94  	DEVLINK_PORT_TYPE_AUTO   = 1
    95  	DEVLINK_PORT_TYPE_ETH    = 2
    96  	DEVLINK_PORT_TYPE_IB     = 3
    97  )
    98  
    99  const (
   100  	DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR = 1
   101  	DEVLINK_PORT_FN_ATTR_STATE         = 2
   102  	DEVLINK_PORT_FN_ATTR_OPSTATE       = 3
   103  )
   104  
   105  const (
   106  	DEVLINK_PORT_FN_STATE_INACTIVE = 0
   107  	DEVLINK_PORT_FN_STATE_ACTIVE   = 1
   108  )
   109  
   110  const (
   111  	DEVLINK_PORT_FN_OPSTATE_DETACHED = 0
   112  	DEVLINK_PORT_FN_OPSTATE_ATTACHED = 1
   113  )
   114  
   115  const (
   116  	DEVLINK_RESOURCE_UNIT_ENTRY uint8 = 0
   117  )
   118  
   119  const (
   120  	DEVLINK_ATTR_PARAM             = iota + 80 /* nested */
   121  	DEVLINK_ATTR_PARAM_NAME                    /* string */
   122  	DEVLINK_ATTR_PARAM_GENERIC                 /* flag */
   123  	DEVLINK_ATTR_PARAM_TYPE                    /* u8 */
   124  	DEVLINK_ATTR_PARAM_VALUES_LIST             /* nested */
   125  	DEVLINK_ATTR_PARAM_VALUE                   /* nested */
   126  	DEVLINK_ATTR_PARAM_VALUE_DATA              /* dynamic */
   127  	DEVLINK_ATTR_PARAM_VALUE_CMODE             /* u8 */
   128  )
   129  
   130  const (
   131  	DEVLINK_PARAM_TYPE_U8     = 1
   132  	DEVLINK_PARAM_TYPE_U16    = 2
   133  	DEVLINK_PARAM_TYPE_U32    = 3
   134  	DEVLINK_PARAM_TYPE_STRING = 5
   135  	DEVLINK_PARAM_TYPE_BOOL   = 6
   136  )
   137  
   138  const (
   139  	DEVLINK_PARAM_CMODE_RUNTIME = iota
   140  	DEVLINK_PARAM_CMODE_DRIVERINIT
   141  	DEVLINK_PARAM_CMODE_PERMANENT
   142  )