[openib-general] [RFC] [PATCH] RDMA/iwcm: Cleanup IWCM_F_CALLBACK_DESTROY usage.
Krishna Kumar
krkumar2 at in.ibm.com
Thu Nov 16 20:31:25 PST 2006
Cleanup IWCM_F_CALLBACK_DESTROY usage. It is being set
only in cm_conn_req_handler(), and that too on a child
handle. Remove IWCM_F_CALLBACK_DESTROY as the same
result can be achieved otherwise.
Patch against 2.6.19-rc5.
Signed-off-by: Krishna Kumar <krkumar2 at in.ibm.com>
---
diff -ruNp org/drivers/infiniband/core/iwcm.c new/drivers/infiniband/core/iwcm.c
--- org/drivers/infiniband/core/iwcm.c 2006-10-09 16:40:04.000000000 +0530
+++ new/drivers/infiniband/core/iwcm.c 2006-10-09 16:52:03.000000000 +0530
@@ -161,8 +161,6 @@ static int iwcm_deref_id(struct iwcm_id_
BUG_ON(!list_empty(&cm_id_priv->work_list));
if (waitqueue_active(&cm_id_priv->destroy_comp.wait)) {
BUG_ON(cm_id_priv->state != IW_CM_STATE_DESTROYING);
- BUG_ON(test_bit(IWCM_F_CALLBACK_DESTROY,
- &cm_id_priv->flags));
ret = 1;
}
complete(&cm_id_priv->destroy_comp);
@@ -386,7 +384,6 @@ void iw_destroy_cm_id(struct iw_cm_id *c
struct iwcm_id_private *cm_id_priv;
cm_id_priv = container_of(cm_id, struct iwcm_id_private, id);
- BUG_ON(test_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags));
destroy_cm_id(cm_id);
@@ -833,11 +830,12 @@ static void cm_work_handler(void *arg)
struct iwcm_id_private *cm_id_priv = work->cm_id;
unsigned long flags;
int empty;
- int ret = 0;
spin_lock_irqsave(&cm_id_priv->lock, flags);
empty = list_empty(&cm_id_priv->work_list);
while (!empty) {
+ int ret;
+
work = list_entry(cm_id_priv->work_list.next,
struct iwcm_work, list);
list_del_init(&work->list);
@@ -847,16 +845,13 @@ static void cm_work_handler(void *arg)
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
ret = process_event(cm_id_priv, &work->event);
- if (ret) {
- set_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags);
+ if (ret)
destroy_cm_id(&cm_id_priv->id);
- }
BUG_ON(atomic_read(&cm_id_priv->refcount)==0);
if (iwcm_deref_id(cm_id_priv))
return;
- if (atomic_read(&cm_id_priv->refcount)==0 &&
- test_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags)) {
+ if (ret && atomic_read(&cm_id_priv->refcount) == 0) {
dealloc_work_entries(cm_id_priv);
kfree(cm_id_priv);
return;
diff -ruNp org/drivers/infiniband/core/iwcm.h new/drivers/infiniband/core/iwcm.h
--- org/drivers/infiniband/core/iwcm.h 2006-10-09 16:40:04.000000000 +0530
+++ new/drivers/infiniband/core/iwcm.h 2006-10-09 16:52:03.000000000 +0530
@@ -56,7 +56,6 @@ struct iwcm_id_private {
struct list_head work_free_list;
};
-#define IWCM_F_CALLBACK_DESTROY 1
-#define IWCM_F_CONNECT_WAIT 2
+#define IWCM_F_CONNECT_WAIT 1
#endif /* IWCM_H */
More information about the general
mailing list