diff options
author | Tom Tucker <tom@opengridcomputing.com> | 2006-08-03 17:02:42 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-09-22 18:22:47 -0400 |
commit | 07ebafbaaa72aa6a35472879008f5a1d1d469a0c (patch) | |
tree | c42ed5c70e5bea1382f1cbde3f4a70d172e2f650 | |
parent | 922a8e9fb2e0711212badce47a41137e2ca04cb3 (diff) |
RDMA: iWARP Core Changes.
Modifications to the existing rdma header files, core files, drivers,
and ulp files to support iWARP, including:
- Hook iWARP CM into the build system and use it in rdma_cm.
- Convert enum ib_node_type to enum rdma_node_type, which includes
the possibility of RDMA_NODE_RNIC, and update everything for this.
Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | drivers/infiniband/core/Makefile | 4 | ||||
-rw-r--r-- | drivers/infiniband/core/addr.c | 18 | ||||
-rw-r--r-- | drivers/infiniband/core/cache.c | 5 | ||||
-rw-r--r-- | drivers/infiniband/core/cm.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/core/cma.c | 356 | ||||
-rw-r--r-- | drivers/infiniband/core/device.c | 4 | ||||
-rw-r--r-- | drivers/infiniband/core/mad.c | 7 | ||||
-rw-r--r-- | drivers/infiniband/core/sa_query.c | 5 | ||||
-rw-r--r-- | drivers/infiniband/core/smi.c | 16 | ||||
-rw-r--r-- | drivers/infiniband/core/sysfs.c | 11 | ||||
-rw-r--r-- | drivers/infiniband/core/ucm.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/core/user_mad.c | 5 | ||||
-rw-r--r-- | drivers/infiniband/core/verbs.c | 17 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_main.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_verbs.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_provider.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_main.c | 8 | ||||
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.c | 2 | ||||
-rw-r--r-- | include/rdma/ib_addr.h | 17 | ||||
-rw-r--r-- | include/rdma/ib_verbs.h | 25 |
20 files changed, 431 insertions, 81 deletions
diff --git a/drivers/infiniband/core/Makefile b/drivers/infiniband/core/Makefile index 68e73ec2d1f8..163d991eb8c9 100644 --- a/drivers/infiniband/core/Makefile +++ b/drivers/infiniband/core/Makefile | |||
@@ -1,7 +1,7 @@ | |||
1 | infiniband-$(CONFIG_INFINIBAND_ADDR_TRANS) := ib_addr.o rdma_cm.o | 1 | infiniband-$(CONFIG_INFINIBAND_ADDR_TRANS) := ib_addr.o rdma_cm.o |
2 | 2 | ||
3 | obj-$(CONFIG_INFINIBAND) += ib_core.o ib_mad.o ib_sa.o \ | 3 | obj-$(CONFIG_INFINIBAND) += ib_core.o ib_mad.o ib_sa.o \ |
4 | ib_cm.o $(infiniband-y) | 4 | ib_cm.o iw_cm.o $(infiniband-y) |
5 | obj-$(CONFIG_INFINIBAND_USER_MAD) += ib_umad.o | 5 | obj-$(CONFIG_INFINIBAND_USER_MAD) += ib_umad.o |
6 | obj-$(CONFIG_INFINIBAND_USER_ACCESS) += ib_uverbs.o ib_ucm.o | 6 | obj-$(CONFIG_INFINIBAND_USER_ACCESS) += ib_uverbs.o ib_ucm.o |
7 | 7 | ||
@@ -14,6 +14,8 @@ ib_sa-y := sa_query.o | |||
14 | 14 | ||
15 | ib_cm-y := cm.o | 15 | ib_cm-y := cm.o |
16 | 16 | ||
17 | iw_cm-y := iwcm.o | ||
18 | |||
17 | rdma_cm-y := cma.o | 19 | rdma_cm-y := cma.o |
18 | 20 | ||
19 | ib_addr-y := addr.o | 21 | ib_addr-y := addr.o |
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index d8e54e002ce3..9cbf09e2052f 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c | |||
@@ -61,12 +61,15 @@ static LIST_HEAD(req_list); | |||
61 | static DECLARE_WORK(work, process_req, NULL); | 61 | static DECLARE_WORK(work, process_req, NULL); |
62 | static struct workqueue_struct *addr_wq; | 62 | static struct workqueue_struct *addr_wq; |
63 | 63 | ||
64 | static int copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev, | 64 | int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev, |
65 | unsigned char *dst_dev_addr) | 65 | const unsigned char *dst_dev_addr) |
66 | { | 66 | { |
67 | switch (dev->type) { | 67 | switch (dev->type) { |
68 | case ARPHRD_INFINIBAND: | 68 | case ARPHRD_INFINIBAND: |
69 | dev_addr->dev_type = IB_NODE_CA; | 69 | dev_addr->dev_type = RDMA_NODE_IB_CA; |
70 | break; | ||
71 | case ARPHRD_ETHER: | ||
72 | dev_addr->dev_type = RDMA_NODE_RNIC; | ||
70 | break; | 73 | break; |
71 | default: | 74 | default: |
72 | return -EADDRNOTAVAIL; | 75 | return -EADDRNOTAVAIL; |
@@ -78,6 +81,7 @@ static int copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev, | |||
78 | memcpy(dev_addr->dst_dev_addr, dst_dev_addr, MAX_ADDR_LEN); | 81 | memcpy(dev_addr->dst_dev_addr, dst_dev_addr, MAX_ADDR_LEN); |
79 | return 0; | 82 | return 0; |
80 | } | 83 | } |
84 | EXPORT_SYMBOL(rdma_copy_addr); | ||
81 | 85 | ||
82 | int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr) | 86 | int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr) |
83 | { | 87 | { |
@@ -89,7 +93,7 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr) | |||
89 | if (!dev) | 93 | if (!dev) |
90 | return -EADDRNOTAVAIL; | 94 | return -EADDRNOTAVAIL; |
91 | 95 | ||
92 | ret = copy_addr(dev_addr, dev, NULL); | 96 | ret = rdma_copy_addr(dev_addr, dev, NULL); |
93 | dev_put(dev); | 97 | dev_put(dev); |
94 | return ret; | 98 | return ret; |
95 | } | 99 | } |
@@ -161,7 +165,7 @@ static int addr_resolve_remote(struct sockaddr_in *src_in, | |||
161 | 165 | ||
162 | /* If the device does ARP internally, return 'done' */ | 166 | /* If the device does ARP internally, return 'done' */ |
163 | if (rt->idev->dev->flags & IFF_NOARP) { | 167 | if (rt->idev->dev->flags & IFF_NOARP) { |
164 | copy_addr(addr, rt->idev->dev, NULL); | 168 | rdma_copy_addr(addr, rt->idev->dev, NULL); |
165 | goto put; | 169 | goto put; |
166 | } | 170 | } |
167 | 171 | ||
@@ -181,7 +185,7 @@ static int addr_resolve_remote(struct sockaddr_in *src_in, | |||
181 | src_in->sin_addr.s_addr = rt->rt_src; | 185 | src_in->sin_addr.s_addr = rt->rt_src; |
182 | } | 186 | } |
183 | 187 | ||
184 | ret = copy_addr(addr, neigh->dev, neigh->ha); | 188 | ret = rdma_copy_addr(addr, neigh->dev, neigh->ha); |
185 | release: | 189 | release: |
186 | neigh_release(neigh); | 190 | neigh_release(neigh); |
187 | put: | 191 | put: |
@@ -245,7 +249,7 @@ static int addr_resolve_local(struct sockaddr_in *src_in, | |||
245 | if (ZERONET(src_ip)) { | 249 | if (ZERONET(src_ip)) { |
246 | src_in->sin_family = dst_in->sin_family; | 250 | src_in->sin_family = dst_in->sin_family; |
247 | src_in->sin_addr.s_addr = dst_ip; | 251 | src_in->sin_addr.s_addr = dst_ip; |
248 | ret = copy_addr(addr, dev, dev->dev_addr); | 252 | ret = rdma_copy_addr(addr, dev, dev->dev_addr); |
249 | } else if (LOOPBACK(src_ip)) { | 253 | } else if (LOOPBACK(src_ip)) { |
250 | ret = rdma_translate_ip((struct sockaddr *)dst_in, addr); | 254 | ret = rdma_translate_ip((struct sockaddr *)dst_in, addr); |
251 | if (!ret) | 255 | if (!ret) |
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index 75313ade2e0d..20e9f64e67a6 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c | |||
@@ -62,12 +62,13 @@ struct ib_update_work { | |||
62 | 62 | ||
63 | static inline int start_port(struct ib_device *device) | 63 | static inline int start_port(struct ib_device *device) |
64 | { | 64 | { |
65 | return device->node_type == IB_NODE_SWITCH ? 0 : 1; | 65 | return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1; |
66 | } | 66 | } |
67 | 67 | ||
68 | static inline int end_port(struct ib_device *device) | 68 | static inline int end_port(struct ib_device *device) |
69 | { | 69 | { |
70 | return device->node_type == IB_NODE_SWITCH ? 0 : device->phys_port_cnt; | 70 | return (device->node_type == RDMA_NODE_IB_SWITCH) ? |
71 | 0 : device->phys_port_cnt; | ||
71 | } | 72 | } |
72 | 73 | ||
73 | int ib_get_cached_gid(struct ib_device *device, | 74 | int ib_get_cached_gid(struct ib_device *device, |
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 1c145fe92a54..e130d2e89515 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -3280,6 +3280,9 @@ static void cm_add_one(struct ib_device *device) | |||
3280 | int ret; | 3280 | int ret; |
3281 | u8 i; | 3281 | u8 i; |
3282 | 3282 | ||
3283 | if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB) | ||
3284 | return; | ||
3285 | |||
3283 | cm_dev = kmalloc(sizeof(*cm_dev) + sizeof(*port) * | 3286 | cm_dev = kmalloc(sizeof(*cm_dev) + sizeof(*port) * |
3284 | device->phys_port_cnt, GFP_KERNEL); | 3287 | device->phys_port_cnt, GFP_KERNEL); |
3285 | if (!cm_dev) | 3288 | if (!cm_dev) |
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 9d58bb59cd45..e88a7c652ca0 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/mutex.h> | 35 | #include <linux/mutex.h> |
36 | #include <linux/random.h> | 36 | #include <linux/random.h> |
37 | #include <linux/idr.h> | 37 | #include <linux/idr.h> |
38 | #include <linux/inetdevice.h> | ||
38 | 39 | ||
39 | #include <net/tcp.h> | 40 | #include <net/tcp.h> |
40 | 41 | ||
@@ -43,6 +44,7 @@ | |||
43 | #include <rdma/ib_cache.h> | 44 | #include <rdma/ib_cache.h> |
44 | #include <rdma/ib_cm.h> | 45 | #include <rdma/ib_cm.h> |
45 | #include <rdma/ib_sa.h> | 46 | #include <rdma/ib_sa.h> |
47 | #include <rdma/iw_cm.h> | ||
46 | 48 | ||
47 | MODULE_AUTHOR("Sean Hefty"); | 49 | MODULE_AUTHOR("Sean Hefty"); |
48 | MODULE_DESCRIPTION("Generic RDMA CM Agent"); | 50 | MODULE_DESCRIPTION("Generic RDMA CM Agent"); |
@@ -124,6 +126,7 @@ struct rdma_id_private { | |||
124 | int query_id; | 126 | int query_id; |
125 | union { | 127 | union { |
126 | struct ib_cm_id *ib; | 128 | struct ib_cm_id *ib; |
129 | struct iw_cm_id *iw; | ||
127 | } cm_id; | 130 | } cm_id; |
128 | 131 | ||
129 | u32 seq_num; | 132 | u32 seq_num; |
@@ -259,14 +262,23 @@ static void cma_detach_from_dev(struct rdma_id_private *id_priv) | |||
259 | id_priv->cma_dev = NULL; | 262 | id_priv->cma_dev = NULL; |
260 | } | 263 | } |
261 | 264 | ||
262 | static int cma_acquire_ib_dev(struct rdma_id_private *id_priv) | 265 | static int cma_acquire_dev(struct rdma_id_private *id_priv) |
263 | { | 266 | { |
267 | enum rdma_node_type dev_type = id_priv->id.route.addr.dev_addr.dev_type; | ||
264 | struct cma_device *cma_dev; | 268 | struct cma_device *cma_dev; |
265 | union ib_gid gid; | 269 | union ib_gid gid; |
266 | int ret = -ENODEV; | 270 | int ret = -ENODEV; |
267 | 271 | ||
268 | ib_addr_get_sgid(&id_priv->id.route.addr.dev_addr, &gid), | 272 | switch (rdma_node_get_transport(dev_type)) { |
269 | 273 | case RDMA_TRANSPORT_IB: | |
274 | ib_addr_get_sgid(&id_priv->id.route.addr.dev_addr, &gid); | ||
275 | break; | ||
276 | case RDMA_TRANSPORT_IWARP: | ||
277 | iw_addr_get_sgid(&id_priv->id.route.addr.dev_addr, &gid); | ||
278 | break; | ||
279 | default: | ||
280 | return -ENODEV; | ||
281 | } | ||
270 | mutex_lock(&lock); | 282 | mutex_lock(&lock); |
271 | list_for_each_entry(cma_dev, &dev_list, list) { | 283 | list_for_each_entry(cma_dev, &dev_list, list) { |
272 | ret = ib_find_cached_gid(cma_dev->device, &gid, | 284 | ret = ib_find_cached_gid(cma_dev->device, &gid, |
@@ -280,16 +292,6 @@ static int cma_acquire_ib_dev(struct rdma_id_private *id_priv) | |||
280 | return ret; | 292 | return ret; |
281 | } | 293 | } |
282 | 294 | ||
283 | static int cma_acquire_dev(struct rdma_id_private *id_priv) | ||
284 | { | ||
285 | switch (id_priv->id.route.addr.dev_addr.dev_type) { | ||
286 | case IB_NODE_CA: | ||
287 | return cma_acquire_ib_dev(id_priv); | ||
288 | default: | ||
289 | return -ENODEV; | ||
290 | } | ||
291 | } | ||
292 | |||
293 | static void cma_deref_id(struct rdma_id_private *id_priv) | 295 | static void cma_deref_id(struct rdma_id_private *id_priv) |
294 | { | 296 | { |
295 | if (atomic_dec_and_test(&id_priv->refcount)) | 297 | if (atomic_dec_and_test(&id_priv->refcount)) |
@@ -347,6 +349,16 @@ static int cma_init_ib_qp(struct rdma_id_private *id_priv, struct ib_qp *qp) | |||
347 | IB_QP_PKEY_INDEX | IB_QP_PORT); | 349 | IB_QP_PKEY_INDEX | IB_QP_PORT); |
348 | } | 350 | } |
349 | 351 | ||
352 | static int cma_init_iw_qp(struct rdma_id_private *id_priv, struct ib_qp *qp) | ||
353 | { | ||
354 | struct ib_qp_attr qp_attr; | ||
355 | |||
356 | qp_attr.qp_state = IB_QPS_INIT; | ||
357 | qp_attr.qp_access_flags = IB_ACCESS_LOCAL_WRITE; | ||
358 | |||
359 | return ib_modify_qp(qp, &qp_attr, IB_QP_STATE | IB_QP_ACCESS_FLAGS); | ||
360 | } | ||
361 | |||
350 | int rdma_create_qp(struct rdma_cm_id *id, struct ib_pd *pd, | 362 | int rdma_create_qp(struct rdma_cm_id *id, struct ib_pd *pd, |
351 | struct ib_qp_init_attr *qp_init_attr) | 363 | struct ib_qp_init_attr *qp_init_attr) |
352 | { | 364 | { |
@@ -362,10 +374,13 @@ int rdma_create_qp(struct rdma_cm_id *id, struct ib_pd *pd, | |||
362 | if (IS_ERR(qp)) | 374 | if (IS_ERR(qp)) |
363 | return PTR_ERR(qp); | 375 | return PTR_ERR(qp); |
364 | 376 | ||
365 | switch (id->device->node_type) { | 377 | switch (rdma_node_get_transport(id->device->node_type)) { |
366 | case IB_NODE_CA: | 378 | case RDMA_TRANSPORT_IB: |
367 | ret = cma_init_ib_qp(id_priv, qp); | 379 | ret = cma_init_ib_qp(id_priv, qp); |
368 | break; | 380 | break; |
381 | case RDMA_TRANSPORT_IWARP: | ||
382 | ret = cma_init_iw_qp(id_priv, qp); | ||
383 | break; | ||
369 | default: | 384 | default: |
370 | ret = -ENOSYS; | 385 | ret = -ENOSYS; |
371 | break; | 386 | break; |
@@ -451,13 +466,17 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr, | |||
451 | int ret; | 466 | int ret; |
452 | 467 | ||
453 | id_priv = container_of(id, struct rdma_id_private, id); | 468 | id_priv = container_of(id, struct rdma_id_private, id); |
454 | switch (id_priv->id.device->node_type) { | 469 | switch (rdma_node_get_transport(id_priv->id.device->node_type)) { |
455 | case IB_NODE_CA: | 470 | case RDMA_TRANSPORT_IB: |
456 | ret = ib_cm_init_qp_attr(id_priv->cm_id.ib, qp_attr, | 471 | ret = ib_cm_init_qp_attr(id_priv->cm_id.ib, qp_attr, |
457 | qp_attr_mask); | 472 | qp_attr_mask); |
458 | if (qp_attr->qp_state == IB_QPS_RTR) | 473 | if (qp_attr->qp_state == IB_QPS_RTR) |
459 | qp_attr->rq_psn = id_priv->seq_num; | 474 | qp_attr->rq_psn = id_priv->seq_num; |
460 | break; | 475 | break; |
476 | case RDMA_TRANSPORT_IWARP: | ||
477 | ret = iw_cm_init_qp_attr(id_priv->cm_id.iw, qp_attr, | ||
478 | qp_attr_mask); | ||
479 | break; | ||
461 | default: | 480 | default: |
462 | ret = -ENOSYS; | 481 | ret = -ENOSYS; |
463 | break; | 482 | break; |
@@ -590,8 +609,8 @@ static int cma_notify_user(struct rdma_id_private *id_priv, | |||
590 | 609 | ||
591 | static void cma_cancel_route(struct rdma_id_private *id_priv) | 610 | static void cma_cancel_route(struct rdma_id_private *id_priv) |
592 | { | 611 | { |
593 | switch (id_priv->id.device->node_type) { | 612 | switch (rdma_node_get_transport(id_priv->id.device->node_type)) { |
594 | case IB_NODE_CA: | 613 | case RDMA_TRANSPORT_IB: |
595 | if (id_priv->query) | 614 | if (id_priv->query) |
596 | ib_sa_cancel_query(id_priv->query_id, id_priv->query); | 615 | ib_sa_cancel_query(id_priv->query_id, id_priv->query); |
597 | break; | 616 | break; |
@@ -611,11 +630,15 @@ static void cma_destroy_listen(struct rdma_id_private *id_priv) | |||
611 | cma_exch(id_priv, CMA_DESTROYING); | 630 | cma_exch(id_priv, CMA_DESTROYING); |
612 | 631 | ||
613 | if (id_priv->cma_dev) { | 632 | if (id_priv->cma_dev) { |
614 | switch (id_priv->id.device->node_type) { | 633 | switch (rdma_node_get_transport(id_priv->id.device->node_type)) { |
615 | case IB_NODE_CA: | 634 | case RDMA_TRANSPORT_IB: |
616 | if (id_priv->cm_id.ib && !IS_ERR(id_priv->cm_id.ib)) | 635 | if (id_priv->cm_id.ib && !IS_ERR(id_priv->cm_id.ib)) |
617 | ib_destroy_cm_id(id_priv->cm_id.ib); | 636 | ib_destroy_cm_id(id_priv->cm_id.ib); |
618 | break; | 637 | break; |
638 | case RDMA_TRANSPORT_IWARP: | ||
639 | if (id_priv->cm_id.iw && !IS_ERR(id_priv->cm_id.iw)) | ||
640 | iw_destroy_cm_id(id_priv->cm_id.iw); | ||
641 | break; | ||
619 | default: | 642 | default: |
620 | break; | 643 | break; |
621 | } | 644 | } |
@@ -690,11 +713,15 @@ void rdma_destroy_id(struct rdma_cm_id *id) | |||
690 | cma_cancel_operation(id_priv, state); | 713 | cma_cancel_operation(id_priv, state); |
691 | 714 | ||
692 | if (id_priv->cma_dev) { | 715 | if (id_priv->cma_dev) { |
693 | switch (id->device->node_type) { | 716 | switch (rdma_node_get_transport(id->device->node_type)) { |
694 | case IB_NODE_CA: | 717 | case RDMA_TRANSPORT_IB: |
695 | if (id_priv->cm_id.ib && !IS_ERR(id_priv->cm_id.ib)) | 718 | if (id_priv->cm_id.ib && !IS_ERR(id_priv->cm_id.ib)) |
696 | ib_destroy_cm_id(id_priv->cm_id.ib); | 719 | ib_destroy_cm_id(id_priv->cm_id.ib); |
697 | break; | 720 | break; |
721 | case RDMA_TRANSPORT_IWARP: | ||
722 | if (id_priv->cm_id.iw && !IS_ERR(id_priv->cm_id.iw)) | ||
723 | iw_destroy_cm_id(id_priv->cm_id.iw); | ||
724 | break; | ||
698 | default: | 725 | default: |
699 | break; | 726 | break; |
700 | } | 727 | } |
@@ -869,7 +896,7 @@ static struct rdma_id_private *cma_new_id(struct rdma_cm_id *listen_id, | |||
869 | ib_addr_set_sgid(&rt->addr.dev_addr, &rt->path_rec[0].sgid); | 896 | ib_addr_set_sgid(&rt->addr.dev_addr, &rt->path_rec[0].sgid); |
870 | ib_addr_set_dgid(&rt->addr.dev_addr, &rt->path_rec[0].dgid); | 897 | ib_addr_set_dgid(&rt->addr.dev_addr, &rt->path_rec[0].dgid); |
871 | ib_addr_set_pkey(&rt->addr.dev_addr, be16_to_cpu(rt->path_rec[0].pkey)); | 898 | ib_addr_set_pkey(&rt->addr.dev_addr, be16_to_cpu(rt->path_rec[0].pkey)); |
872 | rt->addr.dev_addr.dev_type = IB_NODE_CA; | 899 | rt->addr.dev_addr.dev_type = RDMA_NODE_IB_CA; |
873 | 900 | ||
874 | id_priv = container_of(id, struct rdma_id_private, id); | 901 | id_priv = container_of(id, struct rdma_id_private, id); |
875 | id_priv->state = CMA_CONNECT; | 902 | id_priv->state = CMA_CONNECT; |
@@ -898,7 +925,7 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event) | |||
898 | } | 925 | } |
899 | 926 | ||
900 | atomic_inc(&conn_id->dev_remove); | 927 | atomic_inc(&conn_id->dev_remove); |
901 | ret = cma_acquire_ib_dev(conn_id); | 928 | ret = cma_acquire_dev(conn_id); |
902 | if (ret) { | 929 | if (ret) { |
903 | ret = -ENODEV; | 930 | ret = -ENODEV; |
904 | cma_release_remove(conn_id); | 931 | cma_release_remove(conn_id); |
@@ -982,6 +1009,128 @@ static void cma_set_compare_data(enum rdma_port_space ps, struct sockaddr *addr, | |||
982 | } | 1009 | } |
983 | } | 1010 | } |
984 | 1011 | ||
1012 | static int cma_iw_handler(struct iw_cm_id *iw_id, struct iw_cm_event *iw_event) | ||
1013 | { | ||
1014 | struct rdma_id_private *id_priv = iw_id->context; | ||
1015 | enum rdma_cm_event_type event = 0; | ||
1016 | struct sockaddr_in *sin; | ||
1017 | int ret = 0; | ||
1018 | |||
1019 | atomic_inc(&id_priv->dev_remove); | ||
1020 | |||
1021 | switch (iw_event->event) { | ||
1022 | case IW_CM_EVENT_CLOSE: | ||
1023 | event = RDMA_CM_EVENT_DISCONNECTED; | ||
1024 | break; | ||
1025 | case IW_CM_EVENT_CONNECT_REPLY: | ||
1026 | sin = (struct sockaddr_in *) &id_priv->id.route.addr.src_addr; | ||
1027 | *sin = iw_event->local_addr; | ||
1028 | sin = (struct sockaddr_in *) &id_priv->id.route.addr.dst_addr; | ||
1029 | *sin = iw_event->remote_addr; | ||
1030 | if (iw_event->status) | ||
1031 | event = RDMA_CM_EVENT_REJECTED; | ||
1032 | else | ||
1033 | event = RDMA_CM_EVENT_ESTABLISHED; | ||
1034 | break; | ||
1035 | case IW_CM_EVENT_ESTABLISHED: | ||
1036 | event = RDMA_CM_EVENT_ESTABLISHED; | ||
1037 | break; | ||
1038 | default: | ||
1039 | BUG_ON(1); | ||
1040 | } | ||
1041 | |||
1042 | ret = cma_notify_user(id_priv, event, iw_event->status, | ||
1043 | iw_event->private_data, | ||
1044 | iw_event->private_data_len); | ||
1045 | if (ret) { | ||
1046 | /* Destroy the CM ID by returning a non-zero value. */ | ||
1047 | id_priv->cm_id.iw = NULL; | ||
1048 | cma_exch(id_priv, CMA_DESTROYING); | ||
1049 | cma_release_remove(id_priv); | ||
1050 | rdma_destroy_id(&id_priv->id); | ||
1051 | return ret; | ||
1052 | } | ||
1053 | |||
1054 | cma_release_remove(id_priv); | ||
1055 | return ret; | ||
1056 | } | ||
1057 | |||
1058 | static int iw_conn_req_handler(struct iw_cm_id *cm_id, | ||
1059 | struct iw_cm_event *iw_event) | ||
1060 | { | ||
1061 | struct rdma_cm_id *new_cm_id; | ||
1062 | struct rdma_id_private *listen_id, *conn_id; | ||
1063 | struct sockaddr_in *sin; | ||
1064 | struct net_device *dev = NULL; | ||
1065 | int ret; | ||
1066 | |||
1067 | listen_id = cm_id->context; | ||
1068 | atomic_inc(&listen_id->dev_remove); | ||
1069 | if (!cma_comp(listen_id, CMA_LISTEN)) { | ||
1070 | ret = -ECONNABORTED; | ||
1071 | goto out; | ||
1072 | } | ||
1073 | |||
1074 | /* Create a new RDMA id for the new IW CM ID */ | ||
1075 | new_cm_id = rdma_create_id(listen_id->id.event_handler, | ||
1076 | listen_id->id.context, | ||
1077 | RDMA_PS_TCP); | ||
1078 | if (!new_cm_id) { | ||
1079 | ret = -ENOMEM; | ||
1080 | goto out; | ||
1081 | } | ||
1082 | conn_id = container_of(new_cm_id, struct rdma_id_private, id); | ||
1083 | atomic_inc(&conn_id->dev_remove); | ||
1084 | conn_id->state = CMA_CONNECT; | ||
1085 | |||
1086 | dev = ip_dev_find(iw_event->local_addr.sin_addr.s_addr); | ||
1087 | if (!dev) { | ||
1088 | ret = -EADDRNOTAVAIL; | ||
1089 | cma_release_remove(conn_id); | ||
1090 | rdma_destroy_id(new_cm_id); | ||
1091 | goto out; | ||
1092 | } | ||
1093 | ret = rdma_copy_addr(&conn_id->id.route.addr.dev_addr, dev, NULL); | ||
1094 | if (ret) { | ||
1095 | cma_release_remove(conn_id); | ||
1096 | rdma_destroy_id(new_cm_id); | ||
1097 | goto out; | ||
1098 | } | ||
1099 | |||
1100 | ret = cma_acquire_dev(conn_id); | ||
1101 | if (ret) { | ||
1102 | cma_release_remove(conn_id); | ||
1103 | rdma_destroy_id(new_cm_id); | ||
1104 | goto out; | ||
1105 | } | ||
1106 | |||
1107 | conn_id->cm_id.iw = cm_id; | ||
1108 | cm_id->context = conn_id; | ||
1109 | cm_id->cm_handler = cma_iw_handler; | ||
1110 | |||
1111 | sin = (struct sockaddr_in *) &new_cm_id->route.addr.src_addr; | ||
1112 | *sin = iw_event->local_addr; | ||
1113 | sin = (struct sockaddr_in *) &new_cm_id->route.addr.dst_addr; | ||
1114 | *sin = iw_event->remote_addr; | ||
1115 | |||
1116 | ret = cma_notify_user(conn_id, RDMA_CM_EVENT_CONNECT_REQUEST, 0, | ||
1117 | iw_event->private_data, | ||
1118 | iw_event->private_data_len); | ||
1119 | if (ret) { | ||
1120 | /* User wants to destroy the CM ID */ | ||
1121 | conn_id->cm_id.iw = NULL; | ||
1122 | cma_exch(conn_id, CMA_DESTROYING); | ||
1123 | cma_release_remove(conn_id); | ||
1124 | rdma_destroy_id(&conn_id->id); | ||
1125 | } | ||
1126 | |||
1127 | out: | ||
1128 | if (dev) | ||
1129 | dev_put(dev); | ||
1130 | cma_release_remove(listen_id); | ||
1131 | return ret; | ||
1132 | } | ||
1133 | |||
985 | static int cma_ib_listen(struct rdma_id_private *id_priv) | 1134 | static int cma_ib_listen(struct rdma_id_private *id_priv) |
986 | { | 1135 | { |
987 | struct ib_cm_compare_data compare_data; | 1136 | struct ib_cm_compare_data compare_data; |
@@ -1011,6 +1160,30 @@ static int cma_ib_listen(struct rdma_id_private *id_priv) | |||
1011 | return ret; | 1160 | return ret; |
1012 | } | 1161 | } |
1013 | 1162 | ||
1163 | static int cma_iw_listen(struct rdma_id_private *id_priv, int backlog) | ||
1164 | { | ||
1165 | int ret; | ||
1166 | struct sockaddr_in *sin; | ||
1167 | |||
1168 | id_priv->cm_id.iw = iw_create_cm_id(id_priv->id.device, | ||
1169 | iw_conn_req_handler, | ||
1170 | id_priv); | ||
1171 | if (IS_ERR(id_priv->cm_id.iw)) | ||
1172 | return PTR_ERR(id_priv->cm_id.iw); | ||
1173 | |||
1174 | sin = (struct sockaddr_in *) &id_priv->id.route.addr.src_addr; | ||
1175 | id_priv->cm_id.iw->local_addr = *sin; | ||
1176 | |||
1177 | ret = iw_cm_listen(id_priv->cm_id.iw, backlog); | ||
1178 | |||
1179 | if (ret) { | ||
1180 | iw_destroy_cm_id(id_priv->cm_id.iw); | ||
1181 | id_priv->cm_id.iw = NULL; | ||
1182 | } | ||
1183 | |||
1184 | return ret; | ||
1185 | } | ||
1186 | |||
1014 | static int cma_listen_handler(struct rdma_cm_id *id, | 1187 | static int cma_listen_handler(struct rdma_cm_id *id, |
1015 | struct rdma_cm_event *event) | 1188 | struct rdma_cm_event *event) |
1016 | { | 1189 | { |
@@ -1087,12 +1260,17 @@ int rdma_listen(struct rdma_cm_id *id, int backlog) | |||
1087 | 1260 | ||
1088 | id_priv->backlog = backlog; | 1261 | id_priv->backlog = backlog; |
1089 | if (id->device) { | 1262 | if (id->device) { |
1090 | switch (id->device->node_type) { | 1263 | switch (rdma_node_get_transport(id->device->node_type)) { |
1091 | case IB_NODE_CA: | 1264 | case RDMA_TRANSPORT_IB: |
1092 | ret = cma_ib_listen(id_priv); | 1265 | ret = cma_ib_listen(id_priv); |
1093 | if (ret) | 1266 | if (ret) |
1094 | goto err; | 1267 | goto err; |
1095 | break; | 1268 | break; |
1269 | case RDMA_TRANSPORT_IWARP: | ||
1270 | ret = cma_iw_listen(id_priv, backlog); | ||
1271 | if (ret) | ||
1272 | goto err; | ||
1273 | break; | ||
1096 | default: | 1274 | default: |
1097 | ret = -ENOSYS; | 1275 | ret = -ENOSYS; |
1098 | goto err; | 1276 | goto err; |
@@ -1231,6 +1409,23 @@ err: | |||
1231 | } | 1409 | } |
1232 | EXPORT_SYMBOL(rdma_set_ib_paths); | 1410 | EXPORT_SYMBOL(rdma_set_ib_paths); |
1233 | 1411 | ||
1412 | static int cma_resolve_iw_route(struct rdma_id_private *id_priv, int timeout_ms) | ||
1413 | { | ||
1414 | struct cma_work *work; | ||
1415 | |||
1416 | work = kzalloc(sizeof *work, GFP_KERNEL); | ||
1417 | if (!work) | ||
1418 | return -ENOMEM; | ||
1419 | |||
1420 | work->id = id_priv; | ||
1421 | INIT_WORK(&work->work, cma_work_handler, work); | ||
1422 | work->old_state = CMA_ROUTE_QUERY; | ||
1423 | work->new_state = CMA_ROUTE_RESOLVED; | ||
1424 | work->event.event = RDMA_CM_EVENT_ROUTE_RESOLVED; | ||
1425 | queue_work(cma_wq, &work->work); | ||
1426 | return 0; | ||
1427 | } | ||
1428 | |||
1234 | int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms) | 1429 | int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms) |
1235 | { | 1430 | { |
1236 | struct rdma_id_private *id_priv; | 1431 | struct rdma_id_private *id_priv; |
@@ -1241,10 +1436,13 @@ int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms) | |||
1241 | return -EINVAL; | 1436 | return -EINVAL; |
1242 | 1437 | ||
1243 | atomic_inc(&id_priv->refcount); | 1438 | atomic_inc(&id_priv->refcount); |
1244 | switch (id->device->node_type) { | 1439 | switch (rdma_node_get_transport(id->device->node_type)) { |
1245 | case IB_NODE_CA: | 1440 | case RDMA_TRANSPORT_IB: |
1246 | ret = cma_resolve_ib_route(id_priv, timeout_ms); | 1441 | ret = cma_resolve_ib_route(id_priv, timeout_ms); |
1247 | break; | 1442 | break; |
1443 | case RDMA_TRANSPORT_IWARP: | ||
1444 | ret = cma_resolve_iw_route(id_priv, timeout_ms); | ||
1445 | break; | ||
1248 | default: | 1446 | default: |
1249 | ret = -ENOSYS; | 1447 | ret = -ENOSYS; |
1250 | break; | 1448 | break; |
@@ -1649,6 +1847,47 @@ out: | |||
1649 | return ret; | 1847 | return ret; |
1650 | } | 1848 | } |
1651 | 1849 | ||
1850 | static int cma_connect_iw(struct rdma_id_private *id_priv, | ||
1851 | struct rdma_conn_param *conn_param) | ||
1852 | { | ||
1853 | struct iw_cm_id *cm_id; | ||
1854 | struct sockaddr_in* sin; | ||
1855 | int ret; | ||
1856 | struct iw_cm_conn_param iw_param; | ||
1857 | |||
1858 | cm_id = iw_create_cm_id(id_priv->id.device, cma_iw_handler, id_priv); | ||
1859 | if (IS_ERR(cm_id)) { | ||
1860 | ret = PTR_ERR(cm_id); | ||
1861 | goto out; | ||
1862 | } | ||
1863 | |||
1864 | id_priv->cm_id.iw = cm_id; | ||
1865 | |||
1866 | sin = (struct sockaddr_in*) &id_priv->id.route.addr.src_addr; | ||
1867 | cm_id->local_addr = *sin; | ||
1868 | |||
1869 | sin = (struct sockaddr_in*) &id_priv->id.route.addr.dst_addr; | ||
1870 | cm_id->remote_addr = *sin; | ||
1871 | |||
1872 | ret = cma_modify_qp_rtr(&id_priv->id); | ||
1873 | if (ret) { | ||
1874 | iw_destroy_cm_id(cm_id); | ||
1875 | return ret; | ||
1876 | } | ||
1877 | |||
1878 | iw_param.ord = conn_param->initiator_depth; | ||
1879 | iw_param.ird = conn_param->responder_resources; | ||
1880 | iw_param.private_data = conn_param->private_data; | ||
1881 | iw_param.private_data_len = conn_param->private_data_len; | ||
1882 | if (id_priv->id.qp) | ||
1883 | iw_param.qpn = id_priv->qp_num; | ||
1884 | else | ||
1885 | iw_param.qpn = conn_param->qp_num; | ||
1886 | ret = iw_cm_connect(cm_id, &iw_param); | ||
1887 | out: | ||
1888 | return ret; | ||
1889 | } | ||
1890 | |||
1652 | int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) | 1891 | int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) |
1653 | { | 1892 | { |
1654 | struct rdma_id_private *id_priv; | 1893 | struct rdma_id_private *id_priv; |
@@ -1664,10 +1903,13 @@ int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) | |||
1664 | id_priv->srq = conn_param->srq; | 1903 | id_priv->srq = conn_param->srq; |
1665 | } | 1904 | } |
1666 | 1905 | ||
1667 | switch (id->device->node_type) { | 1906 | switch (rdma_node_get_transport(id->device->node_type)) { |
1668 | case IB_NODE_CA: | 1907 | case RDMA_TRANSPORT_IB: |
1669 | ret = cma_connect_ib(id_priv, conn_param); | 1908 | ret = cma_connect_ib(id_priv, conn_param); |
1670 | break; | 1909 | break; |
1910 | case RDMA_TRANSPORT_IWARP: | ||
1911 | ret = cma_connect_iw(id_priv, conn_param); | ||
1912 | break; | ||
1671 | default: | 1913 | default: |
1672 | ret = -ENOSYS; | 1914 | ret = -ENOSYS; |
1673 | break; | 1915 | break; |
@@ -1708,6 +1950,28 @@ static int cma_accept_ib(struct rdma_id_private *id_priv, | |||
1708 | return ib_send_cm_rep(id_priv->cm_id.ib, &rep); | 1950 | return ib_send_cm_rep(id_priv->cm_id.ib, &rep); |
1709 | } | 1951 | } |
1710 | 1952 | ||
1953 | static int cma_accept_iw(struct rdma_id_private *id_priv, | ||
1954 | struct rdma_conn_param *conn_param) | ||
1955 | { | ||
1956 | struct iw_cm_conn_param iw_param; | ||
1957 | int ret; | ||
1958 | |||
1959 | ret = cma_modify_qp_rtr(&id_priv->id); | ||
1960 | if (ret) | ||
1961 | return ret; | ||
1962 | |||
1963 | iw_param.ord = conn_param->initiator_depth; | ||
1964 | iw_param.ird = conn_param->responder_resources; | ||
1965 | iw_param.private_data = conn_param->private_data; | ||
1966 | iw_param.private_data_len = conn_param->private_data_len; | ||
1967 | if (id_priv->id.qp) { | ||
1968 | iw_param.qpn = id_priv->qp_num; | ||
1969 | } else | ||
1970 | iw_param.qpn = conn_param->qp_num; | ||
1971 | |||
1972 | return iw_cm_accept(id_priv->cm_id.iw, &iw_param); | ||
1973 | } | ||
1974 | |||
1711 | int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) | 1975 | int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) |
1712 | { | 1976 | { |
1713 | struct rdma_id_private *id_priv; | 1977 | struct rdma_id_private *id_priv; |
@@ -1723,13 +1987,16 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) | |||
1723 | id_priv->srq = conn_param->srq; | 1987 | id_priv->srq = conn_param->srq; |
1724 | } | 1988 | } |
1725 | 1989 | ||
1726 | switch (id->device->node_type) { | 1990 | switch (rdma_node_get_transport(id->device->node_type)) { |
1727 | case IB_NODE_CA: | 1991 | case RDMA_TRANSPORT_IB: |
1728 | if (conn_param) | 1992 | if (conn_param) |
1729 | ret = cma_accept_ib(id_priv, conn_param); | 1993 | ret = cma_accept_ib(id_priv, conn_param); |
1730 | else | 1994 | else |
1731 | ret = cma_rep_recv(id_priv); | 1995 | ret = cma_rep_recv(id_priv); |
1732 | break; | 1996 | break; |
1997 | case RDMA_TRANSPORT_IWARP: | ||
1998 | ret = cma_accept_iw(id_priv, conn_param); | ||
1999 | break; | ||
1733 | default: | 2000 | default: |
1734 | ret = -ENOSYS; | 2001 | ret = -ENOSYS; |
1735 | break; | 2002 | break; |
@@ -1756,12 +2023,16 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data, | |||
1756 | if (!cma_comp(id_priv, CMA_CONNECT)) | 2023 | if (!cma_comp(id_priv, CMA_CONNECT)) |
1757 | return -EINVAL; | 2024 | return -EINVAL; |
1758 | 2025 | ||
1759 | switch (id->device->node_type) { | 2026 | switch (rdma_node_get_transport(id->device->node_type)) { |
1760 | case IB_NODE_CA: | 2027 | case RDMA_TRANSPORT_IB: |
1761 | ret = ib_send_cm_rej(id_priv->cm_id.ib, | 2028 | ret = ib_send_cm_rej(id_priv->cm_id.ib, |
1762 | IB_CM_REJ_CONSUMER_DEFINED, NULL, 0, | 2029 | IB_CM_REJ_CONSUMER_DEFINED, NULL, 0, |
1763 | private_data, private_data_len); | 2030 | private_data, private_data_len); |
1764 | break; | 2031 | break; |
2032 | case RDMA_TRANSPORT_IWARP: | ||
2033 | ret = iw_cm_reject(id_priv->cm_id.iw, | ||
2034 | private_data, private_data_len); | ||
2035 | break; | ||
1765 | default: | 2036 | default: |
1766 | ret = -ENOSYS; | 2037 | ret = -ENOSYS; |
1767 | break; | 2038 | break; |
@@ -1780,17 +2051,20 @@ int rdma_disconnect(struct rdma_cm_id *id) | |||
1780 | !cma_comp(id_priv, CMA_DISCONNECT)) | 2051 | !cma_comp(id_priv, CMA_DISCONNECT)) |
1781 | return -EINVAL; | 2052 | return -EINVAL; |
1782 | 2053 | ||
1783 | ret = cma_modify_qp_err(id); | 2054 | switch (rdma_node_get_transport(id->device->node_type)) { |
1784 | if (ret) | 2055 | case RDMA_TRANSPORT_IB: |
1785 | goto out; | 2056 | ret = cma_modify_qp_err(id); |
1786 | 2057 | if (ret) | |
1787 | switch (id->device->node_type) { | 2058 | goto out; |
1788 | case IB_NODE_CA: | ||
1789 | /* Initiate or respond to a disconnect. */ | 2059 | /* Initiate or respond to a disconnect. */ |
1790 | if (ib_send_cm_dreq(id_priv->cm_id.ib, NULL, 0)) | 2060 | if (ib_send_cm_dreq(id_priv->cm_id.ib, NULL, 0)) |
1791 | ib_send_cm_drep(id_priv->cm_id.ib, NULL, 0); | 2061 | ib_send_cm_drep(id_priv->cm_id.ib, NULL, 0); |
1792 | break; | 2062 | break; |
2063 | case RDMA_TRANSPORT_IWARP: | ||
2064 | ret = iw_cm_disconnect(id_priv->cm_id.iw, 0); | ||
2065 | break; | ||
1793 | default: | 2066 | default: |
2067 | ret = -EINVAL; | ||
1794 | break; | 2068 | break; |
1795 | } | 2069 | } |
1796 | out: | 2070 | out: |
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index b2f3cb91d9bc..d978fbe97535 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c | |||
@@ -505,7 +505,7 @@ int ib_query_port(struct ib_device *device, | |||
505 | u8 port_num, | 505 | u8 port_num, |
506 | struct ib_port_attr *port_attr) | 506 | struct ib_port_attr *port_attr) |
507 | { | 507 | { |
508 | if (device->node_type == IB_NODE_SWITCH) { | 508 | if (device->node_type == RDMA_NODE_IB_SWITCH) { |
509 | if (port_num) | 509 | if (port_num) |
510 | return -EINVAL; | 510 | return -EINVAL; |
511 | } else if (port_num < 1 || port_num > device->phys_port_cnt) | 511 | } else if (port_num < 1 || port_num > device->phys_port_cnt) |
@@ -580,7 +580,7 @@ int ib_modify_port(struct ib_device *device, | |||
580 | u8 port_num, int port_modify_mask, | 580 | u8 port_num, int port_modify_mask, |
581 | struct ib_port_modify *port_modify) | 581 | struct ib_port_modify *port_modify) |
582 | { | 582 | { |
583 | if (device->node_type == IB_NODE_SWITCH) { | 583 | if (device->node_type == RDMA_NODE_IB_SWITCH) { |
584 | if (port_num) | 584 | if (port_num) |
585 | return -EINVAL; | 585 | return -EINVAL; |
586 | } else if (port_num < 1 || port_num > device->phys_port_cnt) | 586 | } else if (port_num < 1 || port_num > device->phys_port_cnt) |
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 32d3028b274b..082f03c158f0 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -2876,7 +2876,10 @@ static void ib_mad_init_device(struct ib_device *device) | |||
2876 | { | 2876 | { |
2877 | int start, end, i; | 2877 | int start, end, i; |
2878 | 2878 | ||
2879 | if (device->node_type == IB_NODE_SWITCH) { | 2879 | if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB) |
2880 | return; | ||
2881 | |||
2882 | if (device->node_type == RDMA_NODE_IB_SWITCH) { | ||
2880 | start = 0; | 2883 | start = 0; |
2881 | end = 0; | 2884 | end = 0; |
2882 | } else { | 2885 | } else { |
@@ -2923,7 +2926,7 @@ static void ib_mad_remove_device(struct ib_device *device) | |||
2923 | { | 2926 | { |
2924 | int i, num_ports, cur_port; | 2927 | int i, num_ports, cur_port; |
2925 | 2928 | ||
2926 | if (device->node_type == IB_NODE_SWITCH) { | 2929 | if (device->node_type == RDMA_NODE_IB_SWITCH) { |
2927 | num_ports = 1; | 2930 | num_ports = 1; |
2928 | cur_port = 0; | 2931 | cur_port = 0; |
2929 | } else { | 2932 | } else { |
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index df762ba4868f..ca8760a7d88c 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c | |||
@@ -919,7 +919,10 @@ static void ib_sa_add_one(struct ib_device *device) | |||
919 | struct ib_sa_device *sa_dev; | 919 | struct ib_sa_device *sa_dev; |
920 | int s, e, i; | 920 | int s, e, i; |
921 | 921 | ||
922 | if (device->node_type == IB_NODE_SWITCH) | 922 | if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB) |
923 | return; | ||
924 | |||
925 | if (device->node_type == RDMA_NODE_IB_SWITCH) | ||
923 | s = e = 0; | 926 | s = e = 0; |
924 | else { | 927 | else { |
925 | s = 1; | 928 | s = 1; |
diff --git a/drivers/infiniband/core/smi.c b/drivers/infiniband/core/smi.c index 35852e794e26..54b81e17ad50 100644 --- a/drivers/infiniband/core/smi.c +++ b/drivers/infiniband/core/smi.c | |||
@@ -64,7 +64,7 @@ int smi_handle_dr_smp_send(struct ib_smp *smp, | |||
64 | 64 | ||
65 | /* C14-9:2 */ | 65 | /* C14-9:2 */ |
66 | if (hop_ptr && hop_ptr < hop_cnt) { | 66 | if (hop_ptr && hop_ptr < hop_cnt) { |
67 | if (node_type != IB_NODE_SWITCH) | 67 | if (node_type != RDMA_NODE_IB_SWITCH) |
68 | return 0; | 68 | return 0; |
69 | 69 | ||
70 | /* smp->return_path set when received */ | 70 | /* smp->return_path set when received */ |
@@ -77,7 +77,7 @@ int smi_handle_dr_smp_send(struct ib_smp *smp, | |||
77 | if (hop_ptr == hop_cnt) { | 77 | if (hop_ptr == hop_cnt) { |
78 | /* smp->return_path set when received */ | 78 | /* smp->return_path set when received */ |
79 | smp->hop_ptr++; | 79 | smp->hop_ptr++; |
80 | return (node_type == IB_NODE_SWITCH || | 80 | return (node_type == RDMA_NODE_IB_SWITCH || |
81 | smp->dr_dlid == IB_LID_PERMISSIVE); | 81 | smp->dr_dlid == IB_LID_PERMISSIVE); |
82 | } | 82 | } |
83 | 83 | ||
@@ -95,7 +95,7 @@ int smi_handle_dr_smp_send(struct ib_smp *smp, | |||
95 | 95 | ||
96 | /* C14-13:2 */ | 96 | /* C14-13:2 */ |
97 | if (2 <= hop_ptr && hop_ptr <= hop_cnt) { | 97 | if (2 <= hop_ptr && hop_ptr <= hop_cnt) { |
98 | if (node_type != IB_NODE_SWITCH) | 98 | if (node_type != RDMA_NODE_IB_SWITCH) |
99 | return 0; | 99 | return 0; |
100 | 100 | ||
101 | smp->hop_ptr--; | 101 | smp->hop_ptr--; |
@@ -107,7 +107,7 @@ int smi_handle_dr_smp_send(struct ib_smp *smp, | |||
107 | if (hop_ptr == 1) { | 107 | if (hop_ptr == 1) { |
108 | smp->hop_ptr--; | 108 | smp->hop_ptr--; |
109 | /* C14-13:3 -- SMPs destined for SM shouldn't be here */ | 109 | /* C14-13:3 -- SMPs destined for SM shouldn't be here */ |
110 | return (node_type == IB_NODE_SWITCH || | 110 | return (node_type == RDMA_NODE_IB_SWITCH || |
111 | smp->dr_slid == IB_LID_PERMISSIVE); | 111 | smp->dr_slid == IB_LID_PERMISSIVE); |
112 | } | 112 | } |
113 | 113 | ||
@@ -142,7 +142,7 @@ int smi_handle_dr_smp_recv(struct ib_smp *smp, | |||
142 | 142 | ||
143 | /* C14-9:2 -- intermediate hop */ | 143 | /* C14-9:2 -- intermediate hop */ |
144 | if (hop_ptr && hop_ptr < hop_cnt) { | 144 | if (hop_ptr && hop_ptr < hop_cnt) { |
145 | if (node_type != IB_NODE_SWITCH) | 145 | if (node_type != RDMA_NODE_IB_SWITCH) |
146 | return 0; | 146 | return 0; |
147 | 147 | ||
148 | smp->return_path[hop_ptr] = port_num; | 148 | smp->return_path[hop_ptr] = port_num; |
@@ -156,7 +156,7 @@ int smi_handle_dr_smp_recv(struct ib_smp *smp, | |||
156 | smp->return_path[hop_ptr] = port_num; | 156 | smp->return_path[hop_ptr] = port_num; |
157 | /* smp->hop_ptr updated when sending */ | 157 | /* smp->hop_ptr updated when sending */ |
158 | 158 | ||
159 | return (node_type == IB_NODE_SWITCH || | 159 | return (node_type == RDMA_NODE_IB_SWITCH || |
160 | smp->dr_dlid == IB_LID_PERMISSIVE); | 160 | smp->dr_dlid == IB_LID_PERMISSIVE); |
161 | } | 161 | } |
162 | 162 | ||
@@ -175,7 +175,7 @@ int smi_handle_dr_smp_recv(struct ib_smp *smp, | |||
175 | 175 | ||
176 | /* C14-13:2 */ | 176 | /* C14-13:2 */ |
177 | if (2 <= hop_ptr && hop_ptr <= hop_cnt) { | 177 | if (2 <= hop_ptr && hop_ptr <= hop_cnt) { |
178 | if (node_type != IB_NODE_SWITCH) | 178 | if (node_type != RDMA_NODE_IB_SWITCH) |
179 | return 0; | 179 | return 0; |
180 | 180 | ||
181 | /* smp->hop_ptr updated when sending */ | 181 | /* smp->hop_ptr updated when sending */ |
@@ -190,7 +190,7 @@ int smi_handle_dr_smp_recv(struct ib_smp *smp, | |||
190 | return 1; | 190 | return 1; |
191 | } | 191 | } |
192 | /* smp->hop_ptr updated when sending */ | 192 | /* smp->hop_ptr updated when sending */ |
193 | return (node_type == IB_NODE_SWITCH); | 193 | return (node_type == RDMA_NODE_IB_SWITCH); |
194 | } | 194 | } |
195 | 195 | ||
196 | /* C14-13:4 -- hop_ptr = 0 -> give to SM */ | 196 | /* C14-13:4 -- hop_ptr = 0 -> give to SM */ |
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index fb6660564a30..709323c14c5d 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
@@ -589,10 +589,11 @@ static ssize_t show_node_type(struct class_device *cdev, char *buf) | |||
589 | return -ENODEV; | 589 | return -ENODEV; |
590 | 590 | ||
591 | switch (dev->node_type) { | 591 | switch (dev->node_type) { |
592 | case IB_NODE_CA: return sprintf(buf, "%d: CA\n", dev->node_type); | 592 | case RDMA_NODE_IB_CA: return sprintf(buf, "%d: CA\n", dev->node_type); |
593 | case IB_NODE_SWITCH: return sprintf(buf, "%d: switch\n", dev->node_type); | 593 | case RDMA_NODE_RNIC: return sprintf(buf, "%d: RNIC\n", dev->node_type); |
594 | case IB_NODE_ROUTER: return sprintf(buf, "%d: router\n", dev->node_type); | 594 | case RDMA_NODE_IB_SWITCH: return sprintf(buf, "%d: switch\n", dev->node_type); |
595 | default: return sprintf(buf, "%d: <unknown>\n", dev->node_type); | 595 | case RDMA_NODE_IB_ROUTER: return sprintf(buf, "%d: router\n", dev->node_type); |
596 | default: return sprintf(buf, "%d: <unknown>\n", dev->node_type); | ||
596 | } | 597 | } |
597 | } | 598 | } |
598 | 599 | ||
@@ -708,7 +709,7 @@ int ib_device_register_sysfs(struct ib_device *device) | |||
708 | if (ret) | 709 | if (ret) |
709 | goto err_put; | 710 | goto err_put; |
710 | 711 | ||
711 | if (device->node_type == IB_NODE_SWITCH) { | 712 | if (device->node_type == RDMA_NODE_IB_SWITCH) { |
712 | ret = add_port(device, 0); | 713 | ret = add_port(device, 0); |
713 | if (ret) | 714 | if (ret) |
714 | goto err_put; | 715 | goto err_put; |
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c index e74c964af7fa..ad4f4d5c2924 100644 --- a/drivers/infiniband/core/ucm.c +++ b/drivers/infiniband/core/ucm.c | |||
@@ -1247,7 +1247,8 @@ static void ib_ucm_add_one(struct ib_device *device) | |||
1247 | { | 1247 | { |
1248 | struct ib_ucm_device *ucm_dev; | 1248 | struct ib_ucm_device *ucm_dev; |
1249 | 1249 | ||
1250 | if (!device->alloc_ucontext) | 1250 | if (!device->alloc_ucontext || |
1251 | rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB) | ||
1251 | return; | 1252 | return; |
1252 | 1253 | ||
1253 | ucm_dev = kzalloc(sizeof *ucm_dev, GFP_KERNEL); | 1254 | ucm_dev = kzalloc(sizeof *ucm_dev, GFP_KERNEL); |
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 8a455aec758f..807fbd6b8414 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
@@ -1032,7 +1032,10 @@ static void ib_umad_add_one(struct ib_device *device) | |||
1032 | struct ib_umad_device *umad_dev; | 1032 | struct ib_umad_device *umad_dev; |
1033 | int s, e, i; | 1033 | int s, e, i; |
1034 | 1034 | ||
1035 | if (device->node_type == IB_NODE_SWITCH) | 1035 | if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB) |
1036 | return; | ||
1037 | |||
1038 | if (device->node_type == RDMA_NODE_IB_SWITCH) | ||
1036 | s = e = 0; | 1039 | s = e = 0; |
1037 | else { | 1040 | else { |
1038 | s = 1; | 1041 | s = 1; |
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 06f98e9e14f9..8b5dd3649bbf 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c | |||
@@ -79,6 +79,23 @@ enum ib_rate mult_to_ib_rate(int mult) | |||
79 | } | 79 | } |
80 | EXPORT_SYMBOL(mult_to_ib_rate); | 80 | EXPORT_SYMBOL(mult_to_ib_rate); |
81 | 81 | ||
82 | enum rdma_transport_type | ||
83 | rdma_node_get_transport(enum rdma_node_type node_type) | ||
84 | { | ||
85 | switch (node_type) { | ||
86 | case RDMA_NODE_IB_CA: | ||
87 | case RDMA_NODE_IB_SWITCH: | ||
88 | case RDMA_NODE_IB_ROUTER: | ||
89 | return RDMA_TRANSPORT_IB; | ||
90 | case RDMA_NODE_RNIC: | ||
91 | return RDMA_TRANSPORT_IWARP; | ||
92 | default: | ||
93 | BUG(); | ||
94 | return 0; | ||
95 | } | ||
96 | } | ||
97 | EXPORT_SYMBOL(rdma_node_get_transport); | ||
98 | |||
82 | /* Protection domains */ | 99 | /* Protection domains */ |
83 | 100 | ||
84 | struct ib_pd *ib_alloc_pd(struct ib_device *device) | 101 | struct ib_pd *ib_alloc_pd(struct ib_device *device) |
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c index 2a99f2d13cdb..2380994418a5 100644 --- a/drivers/infiniband/hw/ehca/ehca_main.c +++ b/drivers/infiniband/hw/ehca/ehca_main.c | |||
@@ -269,7 +269,7 @@ int ehca_register_device(struct ehca_shca *shca) | |||
269 | (1ull << IB_USER_VERBS_CMD_ATTACH_MCAST) | | 269 | (1ull << IB_USER_VERBS_CMD_ATTACH_MCAST) | |
270 | (1ull << IB_USER_VERBS_CMD_DETACH_MCAST); | 270 | (1ull << IB_USER_VERBS_CMD_DETACH_MCAST); |
271 | 271 | ||
272 | shca->ib_device.node_type = IB_NODE_CA; | 272 | shca->ib_device.node_type = RDMA_NODE_IB_CA; |
273 | shca->ib_device.phys_port_cnt = shca->num_ports; | 273 | shca->ib_device.phys_port_cnt = shca->num_ports; |
274 | shca->ib_device.dma_device = &shca->ibmebus_dev->ofdev.dev; | 274 | shca->ib_device.dma_device = &shca->ibmebus_dev->ofdev.dev; |
275 | shca->ib_device.query_device = ehca_query_device; | 275 | shca->ib_device.query_device = ehca_query_device; |
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index fbda7739715f..b8381c5e72bd 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c | |||
@@ -1538,7 +1538,7 @@ int ipath_register_ib_device(struct ipath_devdata *dd) | |||
1538 | (1ull << IB_USER_VERBS_CMD_QUERY_SRQ) | | 1538 | (1ull << IB_USER_VERBS_CMD_QUERY_SRQ) | |
1539 | (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ) | | 1539 | (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ) | |
1540 | (1ull << IB_USER_VERBS_CMD_POST_SRQ_RECV); | 1540 | (1ull << IB_USER_VERBS_CMD_POST_SRQ_RECV); |
1541 | dev->node_type = IB_NODE_CA; | 1541 | dev->node_type = RDMA_NODE_IB_CA; |
1542 | dev->phys_port_cnt = 1; | 1542 | dev->phys_port_cnt = 1; |
1543 | dev->dma_device = &dd->pcidev->dev; | 1543 | dev->dma_device = &dd->pcidev->dev; |
1544 | dev->class_dev.dev = dev->dma_device; | 1544 | dev->class_dev.dev = dev->dma_device; |
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index 265b1d1c4a62..981fe2eebdfa 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c | |||
@@ -1288,7 +1288,7 @@ int mthca_register_device(struct mthca_dev *dev) | |||
1288 | (1ull << IB_USER_VERBS_CMD_DESTROY_QP) | | 1288 | (1ull << IB_USER_VERBS_CMD_DESTROY_QP) | |
1289 | (1ull << IB_USER_VERBS_CMD_ATTACH_MCAST) | | 1289 | (1ull << IB_USER_VERBS_CMD_ATTACH_MCAST) | |
1290 | (1ull << IB_USER_VERBS_CMD_DETACH_MCAST); | 1290 | (1ull << IB_USER_VERBS_CMD_DETACH_MCAST); |
1291 | dev->ib_dev.node_type = IB_NODE_CA; | 1291 | dev->ib_dev.node_type = RDMA_NODE_IB_CA; |
1292 | dev->ib_dev.phys_port_cnt = dev->limits.num_ports; | 1292 | dev->ib_dev.phys_port_cnt = dev->limits.num_ports; |
1293 | dev->ib_dev.dma_device = &dev->pdev->dev; | 1293 | dev->ib_dev.dma_device = &dev->pdev->dev; |
1294 | dev->ib_dev.class_dev.dev = &dev->pdev->dev; | 1294 | dev->ib_dev.class_dev.dev = &dev->pdev->dev; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 36d76987a481..e9a7659eb1d7 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -1111,13 +1111,16 @@ static void ipoib_add_one(struct ib_device *device) | |||
1111 | struct ipoib_dev_priv *priv; | 1111 | struct ipoib_dev_priv *priv; |
1112 | int s, e, p; | 1112 | int s, e, p; |
1113 | 1113 | ||
1114 | if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB) | ||
1115 | return; | ||
1116 | |||
1114 | dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL); | 1117 | dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL); |
1115 | if (!dev_list) | 1118 | if (!dev_list) |
1116 | return; | 1119 | return; |
1117 | 1120 | ||
1118 | INIT_LIST_HEAD(dev_list); | 1121 | INIT_LIST_HEAD(dev_list); |
1119 | 1122 | ||
1120 | if (device->node_type == IB_NODE_SWITCH) { | 1123 | if (device->node_type == RDMA_NODE_IB_SWITCH) { |
1121 | s = 0; | 1124 | s = 0; |
1122 | e = 0; | 1125 | e = 0; |
1123 | } else { | 1126 | } else { |
@@ -1141,6 +1144,9 @@ static void ipoib_remove_one(struct ib_device *device) | |||
1141 | struct ipoib_dev_priv *priv, *tmp; | 1144 | struct ipoib_dev_priv *priv, *tmp; |
1142 | struct list_head *dev_list; | 1145 | struct list_head *dev_list; |
1143 | 1146 | ||
1147 | if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB) | ||
1148 | return; | ||
1149 | |||
1144 | dev_list = ib_get_client_data(device, &ipoib_client); | 1150 | dev_list = ib_get_client_data(device, &ipoib_client); |
1145 | 1151 | ||
1146 | list_for_each_entry_safe(priv, tmp, dev_list, list) { | 1152 | list_for_each_entry_safe(priv, tmp, dev_list, list) { |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 61c13d1e0506..feb1fcd0f2fb 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -1899,7 +1899,7 @@ static void srp_add_one(struct ib_device *device) | |||
1899 | if (IS_ERR(srp_dev->fmr_pool)) | 1899 | if (IS_ERR(srp_dev->fmr_pool)) |
1900 | srp_dev->fmr_pool = NULL; | 1900 | srp_dev->fmr_pool = NULL; |
1901 | 1901 | ||
1902 | if (device->node_type == IB_NODE_SWITCH) { | 1902 | if (device->node_type == RDMA_NODE_IB_SWITCH) { |
1903 | s = 0; | 1903 | s = 0; |
1904 | e = 0; | 1904 | e = 0; |
1905 | } else { | 1905 | } else { |
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h index 0ff67398928d..81b62307621d 100644 --- a/include/rdma/ib_addr.h +++ b/include/rdma/ib_addr.h | |||
@@ -40,7 +40,7 @@ struct rdma_dev_addr { | |||
40 | unsigned char src_dev_addr[MAX_ADDR_LEN]; | 40 | unsigned char src_dev_addr[MAX_ADDR_LEN]; |
41 | unsigned char dst_dev_addr[MAX_ADDR_LEN]; | 41 | unsigned char dst_dev_addr[MAX_ADDR_LEN]; |
42 | unsigned char broadcast[MAX_ADDR_LEN]; | 42 | unsigned char broadcast[MAX_ADDR_LEN]; |
43 | enum ib_node_type dev_type; | 43 | enum rdma_node_type dev_type; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | /** | 46 | /** |
@@ -72,6 +72,9 @@ int rdma_resolve_ip(struct sockaddr *src_addr, struct sockaddr *dst_addr, | |||
72 | 72 | ||
73 | void rdma_addr_cancel(struct rdma_dev_addr *addr); | 73 | void rdma_addr_cancel(struct rdma_dev_addr *addr); |
74 | 74 | ||
75 | int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev, | ||
76 | const unsigned char *dst_dev_addr); | ||
77 | |||
75 | static inline int ip_addr_size(struct sockaddr *addr) | 78 | static inline int ip_addr_size(struct sockaddr *addr) |
76 | { | 79 | { |
77 | return addr->sa_family == AF_INET6 ? | 80 | return addr->sa_family == AF_INET6 ? |
@@ -113,4 +116,16 @@ static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr, | |||
113 | memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid); | 116 | memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid); |
114 | } | 117 | } |
115 | 118 | ||
119 | static inline void iw_addr_get_sgid(struct rdma_dev_addr *dev_addr, | ||
120 | union ib_gid *gid) | ||
121 | { | ||
122 | memcpy(gid, dev_addr->src_dev_addr, sizeof *gid); | ||
123 | } | ||
124 | |||
125 | static inline void iw_addr_get_dgid(struct rdma_dev_addr *dev_addr, | ||
126 | union ib_gid *gid) | ||
127 | { | ||
128 | memcpy(gid, dev_addr->dst_dev_addr, sizeof *gid); | ||
129 | } | ||
130 | |||
116 | #endif /* IB_ADDR_H */ | 131 | #endif /* IB_ADDR_H */ |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 61eed3996117..8eacc3510993 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -56,12 +56,22 @@ union ib_gid { | |||
56 | } global; | 56 | } global; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | enum ib_node_type { | 59 | enum rdma_node_type { |
60 | IB_NODE_CA = 1, | 60 | /* IB values map to NodeInfo:NodeType. */ |
61 | IB_NODE_SWITCH, | 61 | RDMA_NODE_IB_CA = 1, |
62 | IB_NODE_ROUTER | 62 | RDMA_NODE_IB_SWITCH, |
63 | RDMA_NODE_IB_ROUTER, | ||
64 | RDMA_NODE_RNIC | ||
63 | }; | 65 | }; |
64 | 66 | ||
67 | enum rdma_transport_type { | ||
68 | RDMA_TRANSPORT_IB, | ||
69 | RDMA_TRANSPORT_IWARP | ||
70 | }; | ||
71 | |||
72 | enum rdma_transport_type | ||
73 | rdma_node_get_transport(enum rdma_node_type node_type) __attribute_const__; | ||
74 | |||
65 | enum ib_device_cap_flags { | 75 | enum ib_device_cap_flags { |
66 | IB_DEVICE_RESIZE_MAX_WR = 1, | 76 | IB_DEVICE_RESIZE_MAX_WR = 1, |
67 | IB_DEVICE_BAD_PKEY_CNTR = (1<<1), | 77 | IB_DEVICE_BAD_PKEY_CNTR = (1<<1), |
@@ -78,6 +88,9 @@ enum ib_device_cap_flags { | |||
78 | IB_DEVICE_RC_RNR_NAK_GEN = (1<<12), | 88 | IB_DEVICE_RC_RNR_NAK_GEN = (1<<12), |
79 | IB_DEVICE_SRQ_RESIZE = (1<<13), | 89 | IB_DEVICE_SRQ_RESIZE = (1<<13), |
80 | IB_DEVICE_N_NOTIFY_CQ = (1<<14), | 90 | IB_DEVICE_N_NOTIFY_CQ = (1<<14), |
91 | IB_DEVICE_ZERO_STAG = (1<<15), | ||
92 | IB_DEVICE_SEND_W_INV = (1<<16), | ||
93 | IB_DEVICE_MEM_WINDOW = (1<<17) | ||
81 | }; | 94 | }; |
82 | 95 | ||
83 | enum ib_atomic_cap { | 96 | enum ib_atomic_cap { |
@@ -835,6 +848,8 @@ struct ib_cache { | |||
835 | u8 *lmc_cache; | 848 | u8 *lmc_cache; |
836 | }; | 849 | }; |
837 | 850 | ||
851 | struct iw_cm_verbs; | ||
852 | |||
838 | struct ib_device { | 853 | struct ib_device { |
839 | struct device *dma_device; | 854 | struct device *dma_device; |
840 | 855 | ||
@@ -851,6 +866,8 @@ struct ib_device { | |||
851 | 866 | ||
852 | u32 flags; | 867 | u32 flags; |
853 | 868 | ||
869 | struct iw_cm_verbs *iwcm; | ||
870 | |||
854 | int (*query_device)(struct ib_device *device, | 871 | int (*query_device)(struct ib_device *device, |
855 | struct ib_device_attr *device_attr); | 872 | struct ib_device_attr *device_attr); |
856 | int (*query_port)(struct ib_device *device, | 873 | int (*query_port)(struct ib_device *device, |