1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  *  Shared Memory Communications over RDMA (SMC-R) and RoCE
4  *
5  *  Definitions for generic netlink based configuration of an SMC-R PNET table
6  *
7  *  Copyright IBM Corp. 2016
8  *
9  *  Author(s):  Thomas Richter <tmricht@linux.vnet.ibm.com>
10  */
11 
12 #ifndef _UAPI_LINUX_SMC_H_
13 #define _UAPI_LINUX_SMC_H_
14 
15 /* Netlink SMC_PNETID attributes */
16 enum {
17 	SMC_PNETID_UNSPEC,
18 	SMC_PNETID_NAME,
19 	SMC_PNETID_ETHNAME,
20 	SMC_PNETID_IBNAME,
21 	SMC_PNETID_IBPORT,
22 	__SMC_PNETID_MAX,
23 	SMC_PNETID_MAX = __SMC_PNETID_MAX - 1
24 };
25 
26 enum {				/* SMC PNET Table commands */
27 	SMC_PNETID_GET = 1,
28 	SMC_PNETID_ADD,
29 	SMC_PNETID_DEL,
30 	SMC_PNETID_FLUSH
31 };
32 
33 #define SMCR_GENL_FAMILY_NAME		"SMC_PNETID"
34 #define SMCR_GENL_FAMILY_VERSION	1
35 
36 /* gennetlink interface to access non-socket information from SMC module */
37 #define SMC_GENL_FAMILY_NAME		"SMC_GEN_NETLINK"
38 #define SMC_GENL_FAMILY_VERSION		1
39 
40 #define SMC_PCI_ID_STR_LEN		16 /* Max length of pci id string */
41 
42 /* SMC_GENL_FAMILY commands */
43 enum {
44 	SMC_NETLINK_GET_SYS_INFO = 1,
45 	SMC_NETLINK_GET_LGR_SMCR,
46 	SMC_NETLINK_GET_LINK_SMCR,
47 	SMC_NETLINK_GET_LGR_SMCD,
48 	SMC_NETLINK_GET_DEV_SMCD,
49 	SMC_NETLINK_GET_DEV_SMCR,
50 };
51 
52 /* SMC_GENL_FAMILY top level attributes */
53 enum {
54 	SMC_GEN_UNSPEC,
55 	SMC_GEN_SYS_INFO,		/* nest */
56 	SMC_GEN_LGR_SMCR,		/* nest */
57 	SMC_GEN_LINK_SMCR,		/* nest */
58 	SMC_GEN_LGR_SMCD,		/* nest */
59 	SMC_GEN_DEV_SMCD,		/* nest */
60 	SMC_GEN_DEV_SMCR,		/* nest */
61 	__SMC_GEN_MAX,
62 	SMC_GEN_MAX = __SMC_GEN_MAX - 1
63 };
64 
65 /* SMC_GEN_SYS_INFO attributes */
66 enum {
67 	SMC_NLA_SYS_UNSPEC,
68 	SMC_NLA_SYS_VER,		/* u8 */
69 	SMC_NLA_SYS_REL,		/* u8 */
70 	SMC_NLA_SYS_IS_ISM_V2,		/* u8 */
71 	SMC_NLA_SYS_LOCAL_HOST,		/* string */
72 	SMC_NLA_SYS_SEID,		/* string */
73 	__SMC_NLA_SYS_MAX,
74 	SMC_NLA_SYS_MAX = __SMC_NLA_SYS_MAX - 1
75 };
76 
77 /* SMC_NLA_LGR_V2 nested attributes */
78 enum {
79 	SMC_NLA_LGR_V2_VER,		/* u8 */
80 	SMC_NLA_LGR_V2_REL,		/* u8 */
81 	SMC_NLA_LGR_V2_OS,		/* u8 */
82 	SMC_NLA_LGR_V2_NEG_EID,		/* string */
83 	SMC_NLA_LGR_V2_PEER_HOST,	/* string */
84 };
85 
86 /* SMC_GEN_LGR_SMCR attributes */
87 enum {
88 	SMC_NLA_LGR_R_UNSPEC,
89 	SMC_NLA_LGR_R_ID,		/* u32 */
90 	SMC_NLA_LGR_R_ROLE,		/* u8 */
91 	SMC_NLA_LGR_R_TYPE,		/* u8 */
92 	SMC_NLA_LGR_R_PNETID,		/* string */
93 	SMC_NLA_LGR_R_VLAN_ID,		/* u8 */
94 	SMC_NLA_LGR_R_CONNS_NUM,	/* u32 */
95 	__SMC_NLA_LGR_R_MAX,
96 	SMC_NLA_LGR_R_MAX = __SMC_NLA_LGR_R_MAX - 1
97 };
98 
99 /* SMC_GEN_LINK_SMCR attributes */
100 enum {
101 	SMC_NLA_LINK_UNSPEC,
102 	SMC_NLA_LINK_ID,		/* u8 */
103 	SMC_NLA_LINK_IB_DEV,		/* string */
104 	SMC_NLA_LINK_IB_PORT,		/* u8 */
105 	SMC_NLA_LINK_GID,		/* string */
106 	SMC_NLA_LINK_PEER_GID,		/* string */
107 	SMC_NLA_LINK_CONN_CNT,		/* u32 */
108 	SMC_NLA_LINK_NET_DEV,		/* u32 */
109 	SMC_NLA_LINK_UID,		/* u32 */
110 	SMC_NLA_LINK_PEER_UID,		/* u32 */
111 	SMC_NLA_LINK_STATE,		/* u32 */
112 	__SMC_NLA_LINK_MAX,
113 	SMC_NLA_LINK_MAX = __SMC_NLA_LINK_MAX - 1
114 };
115 
116 /* SMC_GEN_LGR_SMCD attributes */
117 enum {
118 	SMC_NLA_LGR_D_UNSPEC,
119 	SMC_NLA_LGR_D_ID,		/* u32 */
120 	SMC_NLA_LGR_D_GID,		/* u64 */
121 	SMC_NLA_LGR_D_PEER_GID,		/* u64 */
122 	SMC_NLA_LGR_D_VLAN_ID,		/* u8 */
123 	SMC_NLA_LGR_D_CONNS_NUM,	/* u32 */
124 	SMC_NLA_LGR_D_PNETID,		/* string */
125 	SMC_NLA_LGR_D_CHID,		/* u16 */
126 	SMC_NLA_LGR_D_PAD,		/* flag */
127 	SMC_NLA_LGR_V2,			/* nest */
128 	__SMC_NLA_LGR_D_MAX,
129 	SMC_NLA_LGR_D_MAX = __SMC_NLA_LGR_D_MAX - 1
130 };
131 
132 /* SMC_NLA_DEV_PORT nested attributes */
133 enum {
134 	SMC_NLA_DEV_PORT_UNSPEC,
135 	SMC_NLA_DEV_PORT_PNET_USR,	/* u8 */
136 	SMC_NLA_DEV_PORT_PNETID,	/* string */
137 	SMC_NLA_DEV_PORT_NETDEV,	/* u32 */
138 	SMC_NLA_DEV_PORT_STATE,		/* u8 */
139 	SMC_NLA_DEV_PORT_VALID,		/* u8 */
140 	SMC_NLA_DEV_PORT_LNK_CNT,	/* u32 */
141 	__SMC_NLA_DEV_PORT_MAX,
142 	SMC_NLA_DEV_PORT_MAX = __SMC_NLA_DEV_PORT_MAX - 1
143 };
144 
145 /* SMC_GEN_DEV_SMCD and SMC_GEN_DEV_SMCR attributes */
146 enum {
147 	SMC_NLA_DEV_UNSPEC,
148 	SMC_NLA_DEV_USE_CNT,		/* u32 */
149 	SMC_NLA_DEV_IS_CRIT,		/* u8 */
150 	SMC_NLA_DEV_PCI_FID,		/* u32 */
151 	SMC_NLA_DEV_PCI_CHID,		/* u16 */
152 	SMC_NLA_DEV_PCI_VENDOR,		/* u16 */
153 	SMC_NLA_DEV_PCI_DEVICE,		/* u16 */
154 	SMC_NLA_DEV_PCI_ID,		/* string */
155 	SMC_NLA_DEV_PORT,		/* nest */
156 	SMC_NLA_DEV_PORT2,		/* nest */
157 	SMC_NLA_DEV_IB_NAME,		/* string */
158 	__SMC_NLA_DEV_MAX,
159 	SMC_NLA_DEV_MAX = __SMC_NLA_DEV_MAX - 1
160 };
161 
162 #endif /* _UAPI_LINUX_SMC_H */
163