[ofa-general] [RFC][PATCH] release IPoIB-cm stale connections resouce

Shirley Ma xma at us.ibm.com
Tue Jun 24 17:57:56 PDT 2008





Hello Roland,

      I am sorry I missed one line during splitting so regenrate this
patch.

This patch releases all staled connections, otherwise all statled connections
will remain untill the nodes down or IPoIB module being removed. It causes
waste lots of resource in the long run.

Signed-off-by: Shirley Ma <xma at us.ibm.com>
---------------------

 drivers/infiniband/ulp/ipoib/ipoib_cm.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index ae67379..9bc12ea 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -61,6 +61,7 @@ MODULE_PARM_DESC(cm_data_debug_level,

 #define IPOIB_CM_RX_UPDATE_TIME (256 * HZ)
 #define IPOIB_CM_RX_TIMEOUT     (2 * 256 * HZ)
+#define IPOIB_CM_RX_DRAIN    (60 * HZ)
 #define IPOIB_CM_RX_DELAY       (3 * 256 * HZ)
 #define IPOIB_CM_RX_UPDATE_MASK (0x3)

@@ -1343,6 +1344,15 @@ static void ipoib_cm_stale_task(struct work_struct *work)
      int ret;

      spin_lock_irq(&priv->lock);
+     /* wait for the CQ drain, and clean up stale connections */
+     while (!list_empty(&priv->cm.rx_error_list)) {
+           /* List is sorted by LRU, start from tail,
+            * stop when we see a recently used entry */
+           p = list_entry(priv->cm.rx_error_list.prev, typeof(*p), list);
+           if (time_before_eq(jiffies, p->jiffies + IPOIB_CM_RX_DRAIN))
+                 break;
+           list_move(&p->list, &priv->cm.rx_reap_list);
+     }
      while (!list_empty(&priv->cm.passive_ids)) {
            /* List is sorted by LRU, start from tail,
             * stop when we see a recently used entry */
@@ -1351,6 +1361,7 @@ static void ipoib_cm_stale_task(struct work_struct *work)
                  break;
            list_move(&p->list, &priv->cm.rx_error_list);
            p->state = IPOIB_CM_RX_ERROR;
+           p->jiffies = jiffies;
            spin_unlock_irq(&priv->lock);
            ret = ib_modify_qp(p->qp, &ipoib_cm_err_attr, IB_QP_STATE);
            if (ret)

(See attached file: stale_connection_cleanup.patch)

Thanks
Shirley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20080624/e48ea168/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stale_connection_cleanup.patch
Type: application/octet-stream
Size: 1835 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20080624/e48ea168/attachment.obj>


More information about the general mailing list