[openib-general] [PATCH] IB/SRP add need_reset

ishai ishai at dev.mellanox.co.il
Tue Jan 16 07:26:22 PST 2007


When there is a call to send_tsk_mgmt it posts a send and waits for 5 seconds
to get a response.
When the QP is in an error state it is obvious that there will be no response
so it is quite useless to wait.
This timeout causes SRP to wait a long time to reconnect. (Each abort and
each reset_device call send_tsk_mgmt that waits for the timeout).
The following patch solves this problem by identifying the failure 
and returning an immediate error code.

Signed-off-by: Ishai Rabinovitz <ishai at mellanox.co.il>
---
Hi Roland,

This is an old patch. We thought at first that the timeout is because there
is a bug in low level driver. After rechecking it, I found that the bug is
internal to SRP.


Index: last_stable/drivers/infiniband/ulp/srp/ib_srp.c
===================================================================
--- last_stable.orig/drivers/infiniband/ulp/srp/ib_srp.c	2006-09-25 13:51:47.000000000 +0300
+++ last_stable/drivers/infiniband/ulp/srp/ib_srp.c	2006-09-25 15:40:04.000000000 +0300
@@ -543,6 +543,7 @@ static int srp_reconnect_target(struct s
 	target->tx_head	 = 0;
 	target->tx_tail  = 0;
 
+	target->need_reset = 0;
 	ret = srp_connect_target(target);
 	if (ret)
 		goto err;
@@ -858,6 +859,7 @@ static void srp_completion(struct ib_cq 
 			printk(KERN_ERR PFX "failed %s status %d\n",
 			       wc.wr_id & SRP_OP_RECV ? "receive" : "send",
 			       wc.status);
+			target->need_reset = 1;
 			break;
 		}
 
@@ -1313,6 +1315,8 @@ static int srp_abort(struct scsi_cmnd *s
 
 	printk(KERN_ERR "SRP abort called\n");
 
+	if (target->need_reset)
+		return FAILED;
 	if (srp_find_req(target, scmnd, &req))
 		return FAILED;
 	if (srp_send_tsk_mgmt(target, req, SRP_TSK_ABORT_TASK))
@@ -1341,6 +1345,8 @@ static int srp_reset_device(struct scsi_
 
 	printk(KERN_ERR "SRP reset_device called\n");
 
+	if (target->need_reset)
+		return FAILED;
 	if (srp_find_req(target, scmnd, &req))
 		return FAILED;
 	if (srp_send_tsk_mgmt(target, req, SRP_TSK_LUN_RESET))
@@ -1750,6 +1756,7 @@ static ssize_t srp_create_target(struct 
 		goto err_free;
 	}
 
+	target->need_reset = 0;
 	ret = srp_connect_target(target);
 	if (ret) {
 		printk(KERN_ERR PFX "Connection failed\n");
Index: last_stable/drivers/infiniband/ulp/srp/ib_srp.h
===================================================================
--- last_stable.orig/drivers/infiniband/ulp/srp/ib_srp.h	2006-09-25 13:51:47.000000000 +0300
+++ last_stable/drivers/infiniband/ulp/srp/ib_srp.h	2006-09-25 14:00:36.000000000 +0300
@@ -158,6 +158,7 @@ struct srp_target_port {
 	struct completion	done;
 	int			status;
 	enum srp_target_state	state;
+	int			need_reset;
 };
 
 struct srp_iu {




More information about the general mailing list