xref: /linux-6.15/include/uapi/linux/ncsi.h (revision 4bf3bd0f)
1 /*
2  * Copyright Samuel Mendoza-Jonas, IBM Corporation 2018.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  */
9 
10 #ifndef __UAPI_NCSI_NETLINK_H__
11 #define __UAPI_NCSI_NETLINK_H__
12 
13 /**
14  * enum ncsi_nl_commands - supported NCSI commands
15  *
16  * @NCSI_CMD_UNSPEC: unspecified command to catch errors
17  * @NCSI_CMD_PKG_INFO: list package and channel attributes. Requires
18  *	NCSI_ATTR_IFINDEX. If NCSI_ATTR_PACKAGE_ID is specified returns the
19  *	specific package and its channels - otherwise a dump request returns
20  *	all packages and their associated channels.
21  * @NCSI_CMD_SET_INTERFACE: set preferred package and channel combination.
22  *	Requires NCSI_ATTR_IFINDEX and the preferred NCSI_ATTR_PACKAGE_ID and
23  *	optionally the preferred NCSI_ATTR_CHANNEL_ID.
24  * @NCSI_CMD_CLEAR_INTERFACE: clear any preferred package/channel combination.
25  *	Requires NCSI_ATTR_IFINDEX.
26  * @NCSI_CMD_SEND_CMD: send NC-SI command to network card.
27  *	Requires NCSI_ATTR_IFINDEX, NCSI_ATTR_PACKAGE_ID
28  *	and NCSI_ATTR_CHANNEL_ID.
29  * @NCSI_CMD_MAX: highest command number
30  */
31 enum ncsi_nl_commands {
32 	NCSI_CMD_UNSPEC,
33 	NCSI_CMD_PKG_INFO,
34 	NCSI_CMD_SET_INTERFACE,
35 	NCSI_CMD_CLEAR_INTERFACE,
36 	NCSI_CMD_SEND_CMD,
37 
38 	__NCSI_CMD_AFTER_LAST,
39 	NCSI_CMD_MAX = __NCSI_CMD_AFTER_LAST - 1
40 };
41 
42 /**
43  * enum ncsi_nl_attrs - General NCSI netlink attributes
44  *
45  * @NCSI_ATTR_UNSPEC: unspecified attributes to catch errors
46  * @NCSI_ATTR_IFINDEX: ifindex of network device using NCSI
47  * @NCSI_ATTR_PACKAGE_LIST: nested array of NCSI_PKG_ATTR attributes
48  * @NCSI_ATTR_PACKAGE_ID: package ID
49  * @NCSI_ATTR_CHANNEL_ID: channel ID
50  * @NCSI_ATTR_DATA: command payload
51  * @NCSI_ATTR_MAX: highest attribute number
52  */
53 enum ncsi_nl_attrs {
54 	NCSI_ATTR_UNSPEC,
55 	NCSI_ATTR_IFINDEX,
56 	NCSI_ATTR_PACKAGE_LIST,
57 	NCSI_ATTR_PACKAGE_ID,
58 	NCSI_ATTR_CHANNEL_ID,
59 	NCSI_ATTR_DATA,
60 
61 	__NCSI_ATTR_AFTER_LAST,
62 	NCSI_ATTR_MAX = __NCSI_ATTR_AFTER_LAST - 1
63 };
64 
65 /**
66  * enum ncsi_nl_pkg_attrs - NCSI netlink package-specific attributes
67  *
68  * @NCSI_PKG_ATTR_UNSPEC: unspecified attributes to catch errors
69  * @NCSI_PKG_ATTR: nested array of package attributes
70  * @NCSI_PKG_ATTR_ID: package ID
71  * @NCSI_PKG_ATTR_FORCED: flag signifying a package has been set as preferred
72  * @NCSI_PKG_ATTR_CHANNEL_LIST: nested array of NCSI_CHANNEL_ATTR attributes
73  * @NCSI_PKG_ATTR_MAX: highest attribute number
74  */
75 enum ncsi_nl_pkg_attrs {
76 	NCSI_PKG_ATTR_UNSPEC,
77 	NCSI_PKG_ATTR,
78 	NCSI_PKG_ATTR_ID,
79 	NCSI_PKG_ATTR_FORCED,
80 	NCSI_PKG_ATTR_CHANNEL_LIST,
81 
82 	__NCSI_PKG_ATTR_AFTER_LAST,
83 	NCSI_PKG_ATTR_MAX = __NCSI_PKG_ATTR_AFTER_LAST - 1
84 };
85 
86 /**
87  * enum ncsi_nl_channel_attrs - NCSI netlink channel-specific attributes
88  *
89  * @NCSI_CHANNEL_ATTR_UNSPEC: unspecified attributes to catch errors
90  * @NCSI_CHANNEL_ATTR: nested array of channel attributes
91  * @NCSI_CHANNEL_ATTR_ID: channel ID
92  * @NCSI_CHANNEL_ATTR_VERSION_MAJOR: channel major version number
93  * @NCSI_CHANNEL_ATTR_VERSION_MINOR: channel minor version number
94  * @NCSI_CHANNEL_ATTR_VERSION_STR: channel version string
95  * @NCSI_CHANNEL_ATTR_LINK_STATE: channel link state flags
96  * @NCSI_CHANNEL_ATTR_ACTIVE: channels with this flag are in
97  *	NCSI_CHANNEL_ACTIVE state
98  * @NCSI_CHANNEL_ATTR_FORCED: flag signifying a channel has been set as
99  *	preferred
100  * @NCSI_CHANNEL_ATTR_VLAN_LIST: nested array of NCSI_CHANNEL_ATTR_VLAN_IDs
101  * @NCSI_CHANNEL_ATTR_VLAN_ID: VLAN ID being filtered on this channel
102  * @NCSI_CHANNEL_ATTR_MAX: highest attribute number
103  */
104 enum ncsi_nl_channel_attrs {
105 	NCSI_CHANNEL_ATTR_UNSPEC,
106 	NCSI_CHANNEL_ATTR,
107 	NCSI_CHANNEL_ATTR_ID,
108 	NCSI_CHANNEL_ATTR_VERSION_MAJOR,
109 	NCSI_CHANNEL_ATTR_VERSION_MINOR,
110 	NCSI_CHANNEL_ATTR_VERSION_STR,
111 	NCSI_CHANNEL_ATTR_LINK_STATE,
112 	NCSI_CHANNEL_ATTR_ACTIVE,
113 	NCSI_CHANNEL_ATTR_FORCED,
114 	NCSI_CHANNEL_ATTR_VLAN_LIST,
115 	NCSI_CHANNEL_ATTR_VLAN_ID,
116 
117 	__NCSI_CHANNEL_ATTR_AFTER_LAST,
118 	NCSI_CHANNEL_ATTR_MAX = __NCSI_CHANNEL_ATTR_AFTER_LAST - 1
119 };
120 
121 #endif /* __UAPI_NCSI_NETLINK_H__ */
122