diff options
Diffstat (limited to 'include/rdma')
-rw-r--r-- | include/rdma/Kbuild | 5 | ||||
-rw-r--r-- | include/rdma/ib_user_cm.h | 1 | ||||
-rw-r--r-- | include/rdma/rdma_cm.h | 19 | ||||
-rw-r--r-- | include/rdma/rdma_netlink.h | 92 |
4 files changed, 116 insertions, 1 deletions
diff --git a/include/rdma/Kbuild b/include/rdma/Kbuild index e7c043216558..ea56f76c0c22 100644 --- a/include/rdma/Kbuild +++ b/include/rdma/Kbuild | |||
@@ -1 +1,6 @@ | |||
1 | header-y += ib_user_cm.h | ||
1 | header-y += ib_user_mad.h | 2 | header-y += ib_user_mad.h |
3 | header-y += ib_user_sa.h | ||
4 | header-y += ib_user_verbs.h | ||
5 | header-y += rdma_netlink.h | ||
6 | header-y += rdma_user_cm.h | ||
diff --git a/include/rdma/ib_user_cm.h b/include/rdma/ib_user_cm.h index bd3d380781e0..f79014aa28f9 100644 --- a/include/rdma/ib_user_cm.h +++ b/include/rdma/ib_user_cm.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #ifndef IB_USER_CM_H | 34 | #ifndef IB_USER_CM_H |
35 | #define IB_USER_CM_H | 35 | #define IB_USER_CM_H |
36 | 36 | ||
37 | #include <linux/types.h> | ||
37 | #include <rdma/ib_user_sa.h> | 38 | #include <rdma/ib_user_sa.h> |
38 | 39 | ||
39 | #define IB_USER_CM_ABI_VERSION 5 | 40 | #define IB_USER_CM_ABI_VERSION 5 |
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h index 169f7a53fb0c..26977c149c41 100644 --- a/include/rdma/rdma_cm.h +++ b/include/rdma/rdma_cm.h | |||
@@ -111,6 +111,20 @@ struct rdma_cm_event { | |||
111 | } param; | 111 | } param; |
112 | }; | 112 | }; |
113 | 113 | ||
114 | enum rdma_cm_state { | ||
115 | RDMA_CM_IDLE, | ||
116 | RDMA_CM_ADDR_QUERY, | ||
117 | RDMA_CM_ADDR_RESOLVED, | ||
118 | RDMA_CM_ROUTE_QUERY, | ||
119 | RDMA_CM_ROUTE_RESOLVED, | ||
120 | RDMA_CM_CONNECT, | ||
121 | RDMA_CM_DISCONNECT, | ||
122 | RDMA_CM_ADDR_BOUND, | ||
123 | RDMA_CM_LISTEN, | ||
124 | RDMA_CM_DEVICE_REMOVAL, | ||
125 | RDMA_CM_DESTROYING | ||
126 | }; | ||
127 | |||
114 | struct rdma_cm_id; | 128 | struct rdma_cm_id; |
115 | 129 | ||
116 | /** | 130 | /** |
@@ -130,6 +144,7 @@ struct rdma_cm_id { | |||
130 | rdma_cm_event_handler event_handler; | 144 | rdma_cm_event_handler event_handler; |
131 | struct rdma_route route; | 145 | struct rdma_route route; |
132 | enum rdma_port_space ps; | 146 | enum rdma_port_space ps; |
147 | enum ib_qp_type qp_type; | ||
133 | u8 port_num; | 148 | u8 port_num; |
134 | }; | 149 | }; |
135 | 150 | ||
@@ -140,9 +155,11 @@ struct rdma_cm_id { | |||
140 | * returned rdma_id. | 155 | * returned rdma_id. |
141 | * @context: User specified context associated with the id. | 156 | * @context: User specified context associated with the id. |
142 | * @ps: RDMA port space. | 157 | * @ps: RDMA port space. |
158 | * @qp_type: type of queue pair associated with the id. | ||
143 | */ | 159 | */ |
144 | struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler, | 160 | struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler, |
145 | void *context, enum rdma_port_space ps); | 161 | void *context, enum rdma_port_space ps, |
162 | enum ib_qp_type qp_type); | ||
146 | 163 | ||
147 | /** | 164 | /** |
148 | * rdma_destroy_id - Destroys an RDMA identifier. | 165 | * rdma_destroy_id - Destroys an RDMA identifier. |
diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h new file mode 100644 index 000000000000..3c5363ab867b --- /dev/null +++ b/include/rdma/rdma_netlink.h | |||
@@ -0,0 +1,92 @@ | |||
1 | #ifndef _RDMA_NETLINK_H | ||
2 | #define _RDMA_NETLINK_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | enum { | ||
7 | RDMA_NL_RDMA_CM = 1 | ||
8 | }; | ||
9 | |||
10 | #define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10) | ||
11 | #define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1)) | ||
12 | #define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op) | ||
13 | |||
14 | enum { | ||
15 | RDMA_NL_RDMA_CM_ID_STATS = 0, | ||
16 | RDMA_NL_RDMA_CM_NUM_OPS | ||
17 | }; | ||
18 | |||
19 | enum { | ||
20 | RDMA_NL_RDMA_CM_ATTR_SRC_ADDR = 1, | ||
21 | RDMA_NL_RDMA_CM_ATTR_DST_ADDR, | ||
22 | RDMA_NL_RDMA_CM_NUM_ATTR, | ||
23 | }; | ||
24 | |||
25 | struct rdma_cm_id_stats { | ||
26 | __u32 qp_num; | ||
27 | __u32 bound_dev_if; | ||
28 | __u32 port_space; | ||
29 | __s32 pid; | ||
30 | __u8 cm_state; | ||
31 | __u8 node_type; | ||
32 | __u8 port_num; | ||
33 | __u8 qp_type; | ||
34 | }; | ||
35 | |||
36 | #ifdef __KERNEL__ | ||
37 | |||
38 | #include <linux/netlink.h> | ||
39 | |||
40 | struct ibnl_client_cbs { | ||
41 | int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb); | ||
42 | }; | ||
43 | |||
44 | int ibnl_init(void); | ||
45 | void ibnl_cleanup(void); | ||
46 | |||
47 | /** | ||
48 | * Add a a client to the list of IB netlink exporters. | ||
49 | * @index: Index of the added client | ||
50 | * @nops: Number of supported ops by the added client. | ||
51 | * @cb_table: A table for op->callback | ||
52 | * | ||
53 | * Returns 0 on success or a negative error code. | ||
54 | */ | ||
55 | int ibnl_add_client(int index, int nops, | ||
56 | const struct ibnl_client_cbs cb_table[]); | ||
57 | |||
58 | /** | ||
59 | * Remove a client from IB netlink. | ||
60 | * @index: Index of the removed IB client. | ||
61 | * | ||
62 | * Returns 0 on success or a negative error code. | ||
63 | */ | ||
64 | int ibnl_remove_client(int index); | ||
65 | |||
66 | /** | ||
67 | * Put a new message in a supplied skb. | ||
68 | * @skb: The netlink skb. | ||
69 | * @nlh: Pointer to put the header of the new netlink message. | ||
70 | * @seq: The message sequence number. | ||
71 | * @len: The requested message length to allocate. | ||
72 | * @client: Calling IB netlink client. | ||
73 | * @op: message content op. | ||
74 | * Returns the allocated buffer on success and NULL on failure. | ||
75 | */ | ||
76 | void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq, | ||
77 | int len, int client, int op); | ||
78 | /** | ||
79 | * Put a new attribute in a supplied skb. | ||
80 | * @skb: The netlink skb. | ||
81 | * @nlh: Header of the netlink message to append the attribute to. | ||
82 | * @len: The length of the attribute data. | ||
83 | * @data: The attribute data to put. | ||
84 | * @type: The attribute type. | ||
85 | * Returns the 0 and a negative error code on failure. | ||
86 | */ | ||
87 | int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh, | ||
88 | int len, void *data, int type); | ||
89 | |||
90 | #endif /* __KERNEL__ */ | ||
91 | |||
92 | #endif /* _RDMA_NETLINK_H */ | ||