mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [git patch review 3/5] IB/cm: avoid reusing local ID
  2005-12-09 21:51 ` [git patch review 2/5] IB/cm: correct reported reject code Roland Dreier
@ 2005-12-09 21:51   ` Roland Dreier
  2005-12-09 21:51     ` [git patch review 4/5] IB/umad: fix memory leaks Roland Dreier
  0 siblings, 1 reply; 5+ messages in thread
From: Roland Dreier @ 2005-12-09 21:51 UTC (permalink / raw)
  To: linux-kernel, openib-general

Use an increasing local ID to avoid re-using identifiers while
messages may still be outstanding on the old ID.  Without this, a
quick connect-disconnect-connect sequence can fail by matching
messages for the new connection with the old connection.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>

---

 drivers/infiniband/core/cm.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

de1bb1a64c29bae4f5330c70bd1dc6a62954c9f4
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 1fe2186..3a611fe 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -308,10 +308,11 @@ static int cm_alloc_id(struct cm_id_priv
 {
 	unsigned long flags;
 	int ret;
+	static int next_id;
 
 	do {
 		spin_lock_irqsave(&cm.lock, flags);
-		ret = idr_get_new_above(&cm.local_id_table, cm_id_priv, 1,
+		ret = idr_get_new_above(&cm.local_id_table, cm_id_priv, next_id++,
 					(__force int *) &cm_id_priv->id.local_id);
 		spin_unlock_irqrestore(&cm.lock, flags);
 	} while( (ret == -EAGAIN) && idr_pre_get(&cm.local_id_table, GFP_KERNEL) );
-- 
0.99.9l

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [git patch review 2/5] IB/cm: correct reported reject code
  2005-12-09 21:51 [git patch review 1/5] IB/mthca: fix QP size limits for mem-free HCAs Roland Dreier
@ 2005-12-09 21:51 ` Roland Dreier
  2005-12-09 21:51   ` [git patch review 3/5] IB/cm: avoid reusing local ID Roland Dreier
  0 siblings, 1 reply; 5+ messages in thread
From: Roland Dreier @ 2005-12-09 21:51 UTC (permalink / raw)
  To: linux-kernel, openib-general

Change reject code from TIMEOUT to CONSUMER_REJECT when destroying a
cm_id in the process of connecting.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>

---

 drivers/infiniband/core/cm.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

227eca83690da7dcbd698d3268e29402e0571723
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 02110e0..1fe2186 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -684,6 +684,13 @@ retest:
 		cm_reject_sidr_req(cm_id_priv, IB_SIDR_REJECT);
 		break;
 	case IB_CM_REQ_SENT:
+		ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg);
+		spin_unlock_irqrestore(&cm_id_priv->lock, flags);
+		ib_send_cm_rej(cm_id, IB_CM_REJ_TIMEOUT,
+			       &cm_id_priv->av.port->cm_dev->ca_guid,
+			       sizeof cm_id_priv->av.port->cm_dev->ca_guid,
+			       NULL, 0);
+		break;
 	case IB_CM_MRA_REQ_RCVD:
 	case IB_CM_REP_SENT:
 	case IB_CM_MRA_REP_RCVD:
@@ -694,10 +701,8 @@ retest:
 	case IB_CM_REP_RCVD:
 	case IB_CM_MRA_REP_SENT:
 		spin_unlock_irqrestore(&cm_id_priv->lock, flags);
-		ib_send_cm_rej(cm_id, IB_CM_REJ_TIMEOUT,
-			       &cm_id_priv->av.port->cm_dev->ca_guid,
-			       sizeof cm_id_priv->av.port->cm_dev->ca_guid,
-			       NULL, 0);
+		ib_send_cm_rej(cm_id, IB_CM_REJ_CONSUMER_DEFINED,
+			       NULL, 0, NULL, 0);
 		break;
 	case IB_CM_ESTABLISHED:
 		spin_unlock_irqrestore(&cm_id_priv->lock, flags);
-- 
0.99.9l

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [git patch review 5/5] IB/mthca: fix memory user DB table leak
  2005-12-09 21:51     ` [git patch review 4/5] IB/umad: fix memory leaks Roland Dreier
@ 2005-12-09 21:51       ` Roland Dreier
  0 siblings, 0 replies; 5+ messages in thread
From: Roland Dreier @ 2005-12-09 21:51 UTC (permalink / raw)
  To: linux-kernel, openib-general

Free the memory allocated in mthca_init_user_db_tab() when releasing
the db_tab in mthca_cleanup_user_db_tab().

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>

---

 drivers/infiniband/hw/mthca/mthca_memfree.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

52d0df153c987e4ad57d15f5df91848f65858e5d
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c
index d72fe95..5798ed0 100644
--- a/drivers/infiniband/hw/mthca/mthca_memfree.c
+++ b/drivers/infiniband/hw/mthca/mthca_memfree.c
@@ -485,6 +485,8 @@ void mthca_cleanup_user_db_tab(struct mt
 			put_page(db_tab->page[i].mem.page);
 		}
 	}
+
+	kfree(db_tab);
 }
 
 int mthca_alloc_db(struct mthca_dev *dev, enum mthca_db_type type,
-- 
0.99.9l

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [git patch review 1/5] IB/mthca: fix QP size limits for mem-free HCAs
@ 2005-12-09 21:51 Roland Dreier
  2005-12-09 21:51 ` [git patch review 2/5] IB/cm: correct reported reject code Roland Dreier
  0 siblings, 1 reply; 5+ messages in thread
From: Roland Dreier @ 2005-12-09 21:51 UTC (permalink / raw)
  To: linux-kernel, openib-general

Unlike tavor, the max work queue size is an exact power of 2 for arbel
mode, despite what the documentation (of the QUERY_DEV_LIM firmware
command) says.  Without this patch, on Arbel, we can start with a QP
of a valid size and get above the reported limit after rounding to the
next power of two.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>

---

 drivers/infiniband/hw/mthca/mthca_cmd.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

a3c8ab4fe8f006d742c24be677518bfa9862e732
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c
index 9ed3458..22ac72b 100644
--- a/drivers/infiniband/hw/mthca/mthca_cmd.c
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.c
@@ -937,10 +937,6 @@ int mthca_QUERY_DEV_LIM(struct mthca_dev
 	if (err)
 		goto out;
 
-	MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_SRQ_SZ_OFFSET);
-	dev_lim->max_srq_sz = (1 << field) - 1;
-	MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_QP_SZ_OFFSET);
-	dev_lim->max_qp_sz = (1 << field) - 1;
 	MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSVD_QP_OFFSET);
 	dev_lim->reserved_qps = 1 << (field & 0xf);
 	MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_QP_OFFSET);
@@ -1056,6 +1052,10 @@ int mthca_QUERY_DEV_LIM(struct mthca_dev
 	mthca_dbg(dev, "Flags: %08x\n", dev_lim->flags);
 
 	if (mthca_is_memfree(dev)) {
+		MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_SRQ_SZ_OFFSET);
+		dev_lim->max_srq_sz = 1 << field;
+		MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_QP_SZ_OFFSET);
+		dev_lim->max_qp_sz = 1 << field;
 		MTHCA_GET(field, outbox, QUERY_DEV_LIM_RSZ_SRQ_OFFSET);
 		dev_lim->hca.arbel.resize_srq = field & 1;
 		MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_SG_RQ_OFFSET);
@@ -1087,6 +1087,10 @@ int mthca_QUERY_DEV_LIM(struct mthca_dev
 		mthca_dbg(dev, "Max ICM size %lld MB\n",
 			  (unsigned long long) dev_lim->hca.arbel.max_icm_sz >> 20);
 	} else {
+		MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_SRQ_SZ_OFFSET);
+		dev_lim->max_srq_sz = (1 << field) - 1;
+		MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_QP_SZ_OFFSET);
+		dev_lim->max_qp_sz = (1 << field) - 1;
 		MTHCA_GET(field, outbox, QUERY_DEV_LIM_MAX_AV_OFFSET);
 		dev_lim->hca.tavor.max_avs = 1 << (field & 0x3f);
 		dev_lim->mpt_entry_sz = MTHCA_MPT_ENTRY_SIZE;
-- 
0.99.9l

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [git patch review 4/5] IB/umad: fix memory leaks
  2005-12-09 21:51   ` [git patch review 3/5] IB/cm: avoid reusing local ID Roland Dreier
@ 2005-12-09 21:51     ` Roland Dreier
  2005-12-09 21:51       ` [git patch review 5/5] IB/mthca: fix memory user DB table leak Roland Dreier
  0 siblings, 1 reply; 5+ messages in thread
From: Roland Dreier @ 2005-12-09 21:51 UTC (permalink / raw)
  To: linux-kernel, openib-general

Don't leak packet if it had a timeout, and don't leak timeout struct
if queue_packet() fails.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>

---

 drivers/infiniband/core/user_mad.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

0efc4883a6b3de12476cd7a35e638c0a9f5fd75f
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index eb7f525..c908de8 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -197,8 +197,8 @@ static void send_handler(struct ib_mad_a
 		memcpy(timeout->mad.data, packet->mad.data,
 		       sizeof (struct ib_mad_hdr));
 
-		if (!queue_packet(file, agent, timeout))
-				return;
+		if (queue_packet(file, agent, timeout))
+			kfree(timeout);
 	}
 out:
 	kfree(packet);
-- 
0.99.9l

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-12-09 21:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-09 21:51 [git patch review 1/5] IB/mthca: fix QP size limits for mem-free HCAs Roland Dreier
2005-12-09 21:51 ` [git patch review 2/5] IB/cm: correct reported reject code Roland Dreier
2005-12-09 21:51   ` [git patch review 3/5] IB/cm: avoid reusing local ID Roland Dreier
2005-12-09 21:51     ` [git patch review 4/5] IB/umad: fix memory leaks Roland Dreier
2005-12-09 21:51       ` [git patch review 5/5] IB/mthca: fix memory user DB table leak Roland Dreier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®