History

Introduce devlink infrastructure

Introduce devlink infrastructure for drivers to register and expose to userspace via generic Netlink interface. There are two basic objects defined: devlink - one instance for every "parent device", for example switch ASIC devlink port - one instance for every physical port of the device. This initial portion implements basic get/dump of objects to userspace. Also, port splitter and port type setting is implemented.

Jiri Pirko committed 10 years ago

Commit bfcd3a41 parent bd070e26 files · +966 −0Browse files

Showing the changes to include/uapi (1 of 6 files). Show all

Unified · Split

include/uapi/linux/devlink.h+72−0
@@ -0,0 +1,72 @@
1+/*
2+ * include/uapi/linux/devlink.h - Network physical device Netlink interface
3+ * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
4+ * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com>
5+ *
6+ * This program is free software; you can redistribute it and/or modify
7+ * it under the terms of the GNU General Public License as published by
8+ * the Free Software Foundation; either version 2 of the License, or
9+ * (at your option) any later version.
10+ */
11+
12+#ifndef _UAPI_LINUX_DEVLINK_H_
13+#define _UAPI_LINUX_DEVLINK_H_
14+
15+#define DEVLINK_GENL_NAME "devlink"
16+#define DEVLINK_GENL_VERSION 0x1
17+#define DEVLINK_GENL_MCGRP_CONFIG_NAME "config"
18+
19+enum devlink_command {
20+ /* don't change the order or add anything between, this is ABI! */
21+ DEVLINK_CMD_UNSPEC,
22+
23+ DEVLINK_CMD_GET, /* can dump */
24+ DEVLINK_CMD_SET,
25+ DEVLINK_CMD_NEW,
26+ DEVLINK_CMD_DEL,
27+
28+ DEVLINK_CMD_PORT_GET, /* can dump */
29+ DEVLINK_CMD_PORT_SET,
30+ DEVLINK_CMD_PORT_NEW,
31+ DEVLINK_CMD_PORT_DEL,
32+
33+ DEVLINK_CMD_PORT_SPLIT,
34+ DEVLINK_CMD_PORT_UNSPLIT,
35+
36+ /* add new commands above here */
37+
38+ __DEVLINK_CMD_MAX,
39+ DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
40+};
41+
42+enum devlink_port_type {
43+ DEVLINK_PORT_TYPE_NOTSET,
44+ DEVLINK_PORT_TYPE_AUTO,
45+ DEVLINK_PORT_TYPE_ETH,
46+ DEVLINK_PORT_TYPE_IB,
47+};
48+
49+enum devlink_attr {
50+ /* don't change the order or add anything between, this is ABI! */
51+ DEVLINK_ATTR_UNSPEC,
52+
53+ /* bus name + dev name together are a handle for devlink entity */
54+ DEVLINK_ATTR_BUS_NAME, /* string */
55+ DEVLINK_ATTR_DEV_NAME, /* string */
56+
57+ DEVLINK_ATTR_PORT_INDEX, /* u32 */
58+ DEVLINK_ATTR_PORT_TYPE, /* u16 */
59+ DEVLINK_ATTR_PORT_DESIRED_TYPE, /* u16 */
60+ DEVLINK_ATTR_PORT_NETDEV_IFINDEX, /* u32 */
61+ DEVLINK_ATTR_PORT_NETDEV_NAME, /* string */
62+ DEVLINK_ATTR_PORT_IBDEV_NAME, /* string */
63+ DEVLINK_ATTR_PORT_SPLIT_COUNT, /* u32 */
64+ DEVLINK_ATTR_PORT_SPLIT_GROUP, /* u32 */
65+
66+ /* add new attributes above here, update the policy in devlink.c */
67+
68+ __DEVLINK_ATTR_MAX,
69+ DEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1
70+};
71+
72+#endif /* _UAPI_LINUX_DEVLINK_H_ */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t