[ofa-general] [PATCHv4 04/10] IB/umad: Enable support for RDMAoE ports

Eli Cohen eli at mellanox.co.il
Wed Aug 5 01:29:10 PDT 2009


Initialize umad context for devices that have any of their ports either IB or
RDMAoE so as to allow user space apps to send and receive MADs on QP1.

Signed-off-by: Eli Cohen <eli at mellanox.co.il>
---
 drivers/infiniband/core/user_mad.c |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 3e58fc0..2189e65 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -1112,6 +1112,7 @@ static void ib_umad_add_one(struct ib_device *device)
 {
 	struct ib_umad_device *umad_dev;
 	int s, e, i;
+	enum rdma_transport_type tt;
 
 	if (device->node_type == RDMA_NODE_IB_SWITCH)
 		s = e = 0;
@@ -1120,9 +1121,14 @@ static void ib_umad_add_one(struct ib_device *device)
 		e = device->phys_port_cnt;
 	}
 
-	for (i = s; i <= e; ++i)
-		if (rdma_port_get_transport(device, i) != RDMA_TRANSPORT_IB)
-			return;
+	for (i = s; i <= e; ++i) {
+		tt = rdma_port_get_transport(device, i);
+		if (tt == RDMA_TRANSPORT_IB || tt == RDMA_TRANSPORT_RDMAOE)
+			break;
+	}
+
+	if (i > e)
+		return;
 
 	umad_dev = kzalloc(sizeof *umad_dev +
 			   (e - s + 1) * sizeof (struct ib_umad_port),
@@ -1147,8 +1153,11 @@ static void ib_umad_add_one(struct ib_device *device)
 	return;
 
 err:
-	while (--i >= s)
-		ib_umad_kill_port(&umad_dev->port[i - s]);
+	while (--i >= s) {
+		tt = rdma_port_get_transport(device, i);
+		if (tt == RDMA_TRANSPORT_IB || tt == RDMA_TRANSPORT_RDMAOE)
+			ib_umad_kill_port(&umad_dev->port[i - s]);
+	}
 
 	kref_put(&umad_dev->ref, ib_umad_release_dev);
 }
@@ -1157,12 +1166,16 @@ static void ib_umad_remove_one(struct ib_device *device)
 {
 	struct ib_umad_device *umad_dev = ib_get_client_data(device, &umad_client);
 	int i;
+	enum rdma_transport_type tt;
 
 	if (!umad_dev)
 		return;
 
-	for (i = 0; i <= umad_dev->end_port - umad_dev->start_port; ++i)
-		ib_umad_kill_port(&umad_dev->port[i]);
+	for (i = 0; i <= umad_dev->end_port - umad_dev->start_port; ++i) {
+		tt = rdma_port_get_transport(device, i);
+		if (tt == RDMA_TRANSPORT_IB || tt == RDMA_TRANSPORT_RDMAOE)
+			ib_umad_kill_port(&umad_dev->port[i]);
+	}
 
 	kref_put(&umad_dev->ref, ib_umad_release_dev);
 }
-- 
1.6.3.3




More information about the general mailing list