diff options
Diffstat (limited to 'include/rdma')
-rw-r--r-- | include/rdma/Kbuild | 5 | ||||
-rw-r--r-- | include/rdma/ib_addr.h | 135 | ||||
-rw-r--r-- | include/rdma/ib_pack.h | 39 | ||||
-rw-r--r-- | include/rdma/ib_user_cm.h | 1 | ||||
-rw-r--r-- | include/rdma/ib_user_verbs.h | 3 | ||||
-rw-r--r-- | include/rdma/ib_verbs.h | 14 | ||||
-rw-r--r-- | include/rdma/iw_cm.h | 11 | ||||
-rw-r--r-- | include/rdma/rdma_cm.h | 29 | ||||
-rw-r--r-- | include/rdma/rdma_netlink.h | 92 | ||||
-rw-r--r-- | include/rdma/rdma_user_cm.h | 5 |
10 files changed, 311 insertions, 23 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_addr.h b/include/rdma/ib_addr.h index fa0d52b8e622..ae8c68f30f1b 100644 --- a/include/rdma/ib_addr.h +++ b/include/rdma/ib_addr.h | |||
@@ -39,7 +39,9 @@ | |||
39 | #include <linux/if_arp.h> | 39 | #include <linux/if_arp.h> |
40 | #include <linux/netdevice.h> | 40 | #include <linux/netdevice.h> |
41 | #include <linux/socket.h> | 41 | #include <linux/socket.h> |
42 | #include <linux/if_vlan.h> | ||
42 | #include <rdma/ib_verbs.h> | 43 | #include <rdma/ib_verbs.h> |
44 | #include <rdma/ib_pack.h> | ||
43 | 45 | ||
44 | struct rdma_addr_client { | 46 | struct rdma_addr_client { |
45 | atomic_t refcount; | 47 | atomic_t refcount; |
@@ -63,6 +65,7 @@ struct rdma_dev_addr { | |||
63 | unsigned char broadcast[MAX_ADDR_LEN]; | 65 | unsigned char broadcast[MAX_ADDR_LEN]; |
64 | unsigned short dev_type; | 66 | unsigned short dev_type; |
65 | int bound_dev_if; | 67 | int bound_dev_if; |
68 | enum rdma_transport_type transport; | ||
66 | }; | 69 | }; |
67 | 70 | ||
68 | /** | 71 | /** |
@@ -127,9 +130,51 @@ static inline int rdma_addr_gid_offset(struct rdma_dev_addr *dev_addr) | |||
127 | return dev_addr->dev_type == ARPHRD_INFINIBAND ? 4 : 0; | 130 | return dev_addr->dev_type == ARPHRD_INFINIBAND ? 4 : 0; |
128 | } | 131 | } |
129 | 132 | ||
133 | static inline void iboe_mac_vlan_to_ll(union ib_gid *gid, u8 *mac, u16 vid) | ||
134 | { | ||
135 | memset(gid->raw, 0, 16); | ||
136 | *((__be32 *) gid->raw) = cpu_to_be32(0xfe800000); | ||
137 | if (vid < 0x1000) { | ||
138 | gid->raw[12] = vid & 0xff; | ||
139 | gid->raw[11] = vid >> 8; | ||
140 | } else { | ||
141 | gid->raw[12] = 0xfe; | ||
142 | gid->raw[11] = 0xff; | ||
143 | } | ||
144 | memcpy(gid->raw + 13, mac + 3, 3); | ||
145 | memcpy(gid->raw + 8, mac, 3); | ||
146 | gid->raw[8] ^= 2; | ||
147 | } | ||
148 | |||
149 | static inline u16 rdma_vlan_dev_vlan_id(const struct net_device *dev) | ||
150 | { | ||
151 | return dev->priv_flags & IFF_802_1Q_VLAN ? | ||
152 | vlan_dev_vlan_id(dev) : 0xffff; | ||
153 | } | ||
154 | |||
155 | static inline void iboe_addr_get_sgid(struct rdma_dev_addr *dev_addr, | ||
156 | union ib_gid *gid) | ||
157 | { | ||
158 | struct net_device *dev; | ||
159 | u16 vid = 0xffff; | ||
160 | |||
161 | dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if); | ||
162 | if (dev) { | ||
163 | vid = rdma_vlan_dev_vlan_id(dev); | ||
164 | dev_put(dev); | ||
165 | } | ||
166 | |||
167 | iboe_mac_vlan_to_ll(gid, dev_addr->src_dev_addr, vid); | ||
168 | } | ||
169 | |||
130 | static inline void rdma_addr_get_sgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) | 170 | static inline void rdma_addr_get_sgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) |
131 | { | 171 | { |
132 | memcpy(gid, dev_addr->src_dev_addr + rdma_addr_gid_offset(dev_addr), sizeof *gid); | 172 | if (dev_addr->transport == RDMA_TRANSPORT_IB && |
173 | dev_addr->dev_type != ARPHRD_INFINIBAND) | ||
174 | iboe_addr_get_sgid(dev_addr, gid); | ||
175 | else | ||
176 | memcpy(gid, dev_addr->src_dev_addr + | ||
177 | rdma_addr_gid_offset(dev_addr), sizeof *gid); | ||
133 | } | 178 | } |
134 | 179 | ||
135 | static inline void rdma_addr_set_sgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) | 180 | static inline void rdma_addr_set_sgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) |
@@ -147,4 +192,92 @@ static inline void rdma_addr_set_dgid(struct rdma_dev_addr *dev_addr, union ib_g | |||
147 | memcpy(dev_addr->dst_dev_addr + rdma_addr_gid_offset(dev_addr), gid, sizeof *gid); | 192 | memcpy(dev_addr->dst_dev_addr + rdma_addr_gid_offset(dev_addr), gid, sizeof *gid); |
148 | } | 193 | } |
149 | 194 | ||
195 | static inline enum ib_mtu iboe_get_mtu(int mtu) | ||
196 | { | ||
197 | /* | ||
198 | * reduce IB headers from effective IBoE MTU. 28 stands for | ||
199 | * atomic header which is the biggest possible header after BTH | ||
200 | */ | ||
201 | mtu = mtu - IB_GRH_BYTES - IB_BTH_BYTES - 28; | ||
202 | |||
203 | if (mtu >= ib_mtu_enum_to_int(IB_MTU_4096)) | ||
204 | return IB_MTU_4096; | ||
205 | else if (mtu >= ib_mtu_enum_to_int(IB_MTU_2048)) | ||
206 | return IB_MTU_2048; | ||
207 | else if (mtu >= ib_mtu_enum_to_int(IB_MTU_1024)) | ||
208 | return IB_MTU_1024; | ||
209 | else if (mtu >= ib_mtu_enum_to_int(IB_MTU_512)) | ||
210 | return IB_MTU_512; | ||
211 | else if (mtu >= ib_mtu_enum_to_int(IB_MTU_256)) | ||
212 | return IB_MTU_256; | ||
213 | else | ||
214 | return 0; | ||
215 | } | ||
216 | |||
217 | static inline int iboe_get_rate(struct net_device *dev) | ||
218 | { | ||
219 | struct ethtool_cmd cmd; | ||
220 | u32 speed; | ||
221 | |||
222 | if (dev_ethtool_get_settings(dev, &cmd)) | ||
223 | return IB_RATE_PORT_CURRENT; | ||
224 | |||
225 | speed = ethtool_cmd_speed(&cmd); | ||
226 | if (speed >= 40000) | ||
227 | return IB_RATE_40_GBPS; | ||
228 | else if (speed >= 30000) | ||
229 | return IB_RATE_30_GBPS; | ||
230 | else if (speed >= 20000) | ||
231 | return IB_RATE_20_GBPS; | ||
232 | else if (speed >= 10000) | ||
233 | return IB_RATE_10_GBPS; | ||
234 | else | ||
235 | return IB_RATE_PORT_CURRENT; | ||
236 | } | ||
237 | |||
238 | static inline int rdma_link_local_addr(struct in6_addr *addr) | ||
239 | { | ||
240 | if (addr->s6_addr32[0] == htonl(0xfe800000) && | ||
241 | addr->s6_addr32[1] == 0) | ||
242 | return 1; | ||
243 | |||
244 | return 0; | ||
245 | } | ||
246 | |||
247 | static inline void rdma_get_ll_mac(struct in6_addr *addr, u8 *mac) | ||
248 | { | ||
249 | memcpy(mac, &addr->s6_addr[8], 3); | ||
250 | memcpy(mac + 3, &addr->s6_addr[13], 3); | ||
251 | mac[0] ^= 2; | ||
252 | } | ||
253 | |||
254 | static inline int rdma_is_multicast_addr(struct in6_addr *addr) | ||
255 | { | ||
256 | return addr->s6_addr[0] == 0xff; | ||
257 | } | ||
258 | |||
259 | static inline void rdma_get_mcast_mac(struct in6_addr *addr, u8 *mac) | ||
260 | { | ||
261 | int i; | ||
262 | |||
263 | mac[0] = 0x33; | ||
264 | mac[1] = 0x33; | ||
265 | for (i = 2; i < 6; ++i) | ||
266 | mac[i] = addr->s6_addr[i + 10]; | ||
267 | } | ||
268 | |||
269 | static inline u16 rdma_get_vlan_id(union ib_gid *dgid) | ||
270 | { | ||
271 | u16 vid; | ||
272 | |||
273 | vid = dgid->raw[11] << 8 | dgid->raw[12]; | ||
274 | return vid < 0x1000 ? vid : 0xffff; | ||
275 | } | ||
276 | |||
277 | static inline struct net_device *rdma_vlan_dev_real_dev(const struct net_device *dev) | ||
278 | { | ||
279 | return dev->priv_flags & IFF_802_1Q_VLAN ? | ||
280 | vlan_dev_real_dev(dev) : 0; | ||
281 | } | ||
282 | |||
150 | #endif /* IB_ADDR_H */ | 283 | #endif /* IB_ADDR_H */ |
diff --git a/include/rdma/ib_pack.h b/include/rdma/ib_pack.h index cbb50f4da3dd..b37fe3b10a9d 100644 --- a/include/rdma/ib_pack.h +++ b/include/rdma/ib_pack.h | |||
@@ -37,6 +37,8 @@ | |||
37 | 37 | ||
38 | enum { | 38 | enum { |
39 | IB_LRH_BYTES = 8, | 39 | IB_LRH_BYTES = 8, |
40 | IB_ETH_BYTES = 14, | ||
41 | IB_VLAN_BYTES = 4, | ||
40 | IB_GRH_BYTES = 40, | 42 | IB_GRH_BYTES = 40, |
41 | IB_BTH_BYTES = 12, | 43 | IB_BTH_BYTES = 12, |
42 | IB_DETH_BYTES = 8 | 44 | IB_DETH_BYTES = 8 |
@@ -210,14 +212,32 @@ struct ib_unpacked_deth { | |||
210 | __be32 source_qpn; | 212 | __be32 source_qpn; |
211 | }; | 213 | }; |
212 | 214 | ||
215 | struct ib_unpacked_eth { | ||
216 | u8 dmac_h[4]; | ||
217 | u8 dmac_l[2]; | ||
218 | u8 smac_h[2]; | ||
219 | u8 smac_l[4]; | ||
220 | __be16 type; | ||
221 | }; | ||
222 | |||
223 | struct ib_unpacked_vlan { | ||
224 | __be16 tag; | ||
225 | __be16 type; | ||
226 | }; | ||
227 | |||
213 | struct ib_ud_header { | 228 | struct ib_ud_header { |
229 | int lrh_present; | ||
214 | struct ib_unpacked_lrh lrh; | 230 | struct ib_unpacked_lrh lrh; |
215 | int grh_present; | 231 | int eth_present; |
216 | struct ib_unpacked_grh grh; | 232 | struct ib_unpacked_eth eth; |
217 | struct ib_unpacked_bth bth; | 233 | int vlan_present; |
234 | struct ib_unpacked_vlan vlan; | ||
235 | int grh_present; | ||
236 | struct ib_unpacked_grh grh; | ||
237 | struct ib_unpacked_bth bth; | ||
218 | struct ib_unpacked_deth deth; | 238 | struct ib_unpacked_deth deth; |
219 | int immediate_present; | 239 | int immediate_present; |
220 | __be32 immediate_data; | 240 | __be32 immediate_data; |
221 | }; | 241 | }; |
222 | 242 | ||
223 | void ib_pack(const struct ib_field *desc, | 243 | void ib_pack(const struct ib_field *desc, |
@@ -230,9 +250,12 @@ void ib_unpack(const struct ib_field *desc, | |||
230 | void *buf, | 250 | void *buf, |
231 | void *structure); | 251 | void *structure); |
232 | 252 | ||
233 | void ib_ud_header_init(int payload_bytes, | 253 | void ib_ud_header_init(int payload_bytes, |
234 | int grh_present, | 254 | int lrh_present, |
235 | int immediate_present, | 255 | int eth_present, |
256 | int vlan_present, | ||
257 | int grh_present, | ||
258 | int immediate_present, | ||
236 | struct ib_ud_header *header); | 259 | struct ib_ud_header *header); |
237 | 260 | ||
238 | int ib_ud_header_pack(struct ib_ud_header *header, | 261 | int ib_ud_header_pack(struct ib_ud_header *header, |
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/ib_user_verbs.h b/include/rdma/ib_user_verbs.h index a17f77106149..fe5b05177a2c 100644 --- a/include/rdma/ib_user_verbs.h +++ b/include/rdma/ib_user_verbs.h | |||
@@ -205,7 +205,8 @@ struct ib_uverbs_query_port_resp { | |||
205 | __u8 active_width; | 205 | __u8 active_width; |
206 | __u8 active_speed; | 206 | __u8 active_speed; |
207 | __u8 phys_state; | 207 | __u8 phys_state; |
208 | __u8 reserved[3]; | 208 | __u8 link_layer; |
209 | __u8 reserved[2]; | ||
209 | }; | 210 | }; |
210 | 211 | ||
211 | struct ib_uverbs_alloc_pd { | 212 | struct ib_uverbs_alloc_pd { |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 857b3b9cf120..55cd0a0bc977 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -47,10 +47,13 @@ | |||
47 | #include <linux/list.h> | 47 | #include <linux/list.h> |
48 | #include <linux/rwsem.h> | 48 | #include <linux/rwsem.h> |
49 | #include <linux/scatterlist.h> | 49 | #include <linux/scatterlist.h> |
50 | #include <linux/workqueue.h> | ||
50 | 51 | ||
51 | #include <asm/atomic.h> | 52 | #include <asm/atomic.h> |
52 | #include <asm/uaccess.h> | 53 | #include <asm/uaccess.h> |
53 | 54 | ||
55 | extern struct workqueue_struct *ib_wq; | ||
56 | |||
54 | union ib_gid { | 57 | union ib_gid { |
55 | u8 raw[16]; | 58 | u8 raw[16]; |
56 | struct { | 59 | struct { |
@@ -75,6 +78,12 @@ enum rdma_transport_type { | |||
75 | enum rdma_transport_type | 78 | enum rdma_transport_type |
76 | rdma_node_get_transport(enum rdma_node_type node_type) __attribute_const__; | 79 | rdma_node_get_transport(enum rdma_node_type node_type) __attribute_const__; |
77 | 80 | ||
81 | enum rdma_link_layer { | ||
82 | IB_LINK_LAYER_UNSPECIFIED, | ||
83 | IB_LINK_LAYER_INFINIBAND, | ||
84 | IB_LINK_LAYER_ETHERNET, | ||
85 | }; | ||
86 | |||
78 | enum ib_device_cap_flags { | 87 | enum ib_device_cap_flags { |
79 | IB_DEVICE_RESIZE_MAX_WR = 1, | 88 | IB_DEVICE_RESIZE_MAX_WR = 1, |
80 | IB_DEVICE_BAD_PKEY_CNTR = (1<<1), | 89 | IB_DEVICE_BAD_PKEY_CNTR = (1<<1), |
@@ -1010,6 +1019,8 @@ struct ib_device { | |||
1010 | int (*query_port)(struct ib_device *device, | 1019 | int (*query_port)(struct ib_device *device, |
1011 | u8 port_num, | 1020 | u8 port_num, |
1012 | struct ib_port_attr *port_attr); | 1021 | struct ib_port_attr *port_attr); |
1022 | enum rdma_link_layer (*get_link_layer)(struct ib_device *device, | ||
1023 | u8 port_num); | ||
1013 | int (*query_gid)(struct ib_device *device, | 1024 | int (*query_gid)(struct ib_device *device, |
1014 | u8 port_num, int index, | 1025 | u8 port_num, int index, |
1015 | union ib_gid *gid); | 1026 | union ib_gid *gid); |
@@ -1222,6 +1233,9 @@ int ib_query_device(struct ib_device *device, | |||
1222 | int ib_query_port(struct ib_device *device, | 1233 | int ib_query_port(struct ib_device *device, |
1223 | u8 port_num, struct ib_port_attr *port_attr); | 1234 | u8 port_num, struct ib_port_attr *port_attr); |
1224 | 1235 | ||
1236 | enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, | ||
1237 | u8 port_num); | ||
1238 | |||
1225 | int ib_query_gid(struct ib_device *device, | 1239 | int ib_query_gid(struct ib_device *device, |
1226 | u8 port_num, int index, union ib_gid *gid); | 1240 | u8 port_num, int index, union ib_gid *gid); |
1227 | 1241 | ||
diff --git a/include/rdma/iw_cm.h b/include/rdma/iw_cm.h index cbb822e8d791..2d0191c90f9e 100644 --- a/include/rdma/iw_cm.h +++ b/include/rdma/iw_cm.h | |||
@@ -46,18 +46,9 @@ enum iw_cm_event_type { | |||
46 | IW_CM_EVENT_CLOSE /* close complete */ | 46 | IW_CM_EVENT_CLOSE /* close complete */ |
47 | }; | 47 | }; |
48 | 48 | ||
49 | enum iw_cm_event_status { | ||
50 | IW_CM_EVENT_STATUS_OK = 0, /* request successful */ | ||
51 | IW_CM_EVENT_STATUS_ACCEPTED = 0, /* connect request accepted */ | ||
52 | IW_CM_EVENT_STATUS_REJECTED, /* connect request rejected */ | ||
53 | IW_CM_EVENT_STATUS_TIMEOUT, /* the operation timed out */ | ||
54 | IW_CM_EVENT_STATUS_RESET, /* reset from remote peer */ | ||
55 | IW_CM_EVENT_STATUS_EINVAL, /* asynchronous failure for bad parm */ | ||
56 | }; | ||
57 | |||
58 | struct iw_cm_event { | 49 | struct iw_cm_event { |
59 | enum iw_cm_event_type event; | 50 | enum iw_cm_event_type event; |
60 | enum iw_cm_event_status status; | 51 | int status; |
61 | struct sockaddr_in local_addr; | 52 | struct sockaddr_in local_addr; |
62 | struct sockaddr_in remote_addr; | 53 | struct sockaddr_in remote_addr; |
63 | void *private_data; | 54 | void *private_data; |
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h index 4fae90304648..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. |
@@ -329,4 +346,14 @@ void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr); | |||
329 | */ | 346 | */ |
330 | void rdma_set_service_type(struct rdma_cm_id *id, int tos); | 347 | void rdma_set_service_type(struct rdma_cm_id *id, int tos); |
331 | 348 | ||
349 | /** | ||
350 | * rdma_set_reuseaddr - Allow the reuse of local addresses when binding | ||
351 | * the rdma_cm_id. | ||
352 | * @id: Communication identifier to configure. | ||
353 | * @reuse: Value indicating if the bound address is reusable. | ||
354 | * | ||
355 | * Reuse must be set before an address is bound to the id. | ||
356 | */ | ||
357 | int rdma_set_reuseaddr(struct rdma_cm_id *id, int reuse); | ||
358 | |||
332 | #endif /* RDMA_CM_H */ | 359 | #endif /* RDMA_CM_H */ |
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 */ | ||
diff --git a/include/rdma/rdma_user_cm.h b/include/rdma/rdma_user_cm.h index 1d165022c02d..fc82c1896f75 100644 --- a/include/rdma/rdma_user_cm.h +++ b/include/rdma/rdma_user_cm.h | |||
@@ -221,8 +221,9 @@ enum { | |||
221 | 221 | ||
222 | /* Option details */ | 222 | /* Option details */ |
223 | enum { | 223 | enum { |
224 | RDMA_OPTION_ID_TOS = 0, | 224 | RDMA_OPTION_ID_TOS = 0, |
225 | RDMA_OPTION_IB_PATH = 1 | 225 | RDMA_OPTION_ID_REUSEADDR = 1, |
226 | RDMA_OPTION_IB_PATH = 1 | ||
226 | }; | 227 | }; |
227 | 228 | ||
228 | struct rdma_ucm_set_option { | 229 | struct rdma_ucm_set_option { |