Antw: [PATCH 11/16] BNX2I: Added return code check for chip kwqe submission request

2010-11-10 Thread Ulrich Windl
>>> "Eddie Wai"  schrieb am 11.11.2010 um 00:04 in
Nachricht <1289430297-30221-12-git-send-email-eddie@broadcom.com>:

[...]
> diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h 
> index d153607..72feb6c 100644 
> --- a/drivers/scsi/bnx2i/bnx2i.h 
> +++ b/drivers/scsi/bnx2i/bnx2i.h 
> @@ -652,6 +652,7 @@ enum { 
>  EP_STATE_OFLD_FAILED= 0x800, 

I'd add a leading zero in front of the '8' for cosmetical reasons. 
Alternatively one could use a macro like this to define Bit masks:
#defineBIT(n)  (1U << (n))

>  EP_STATE_CONNECT_FAILED = 0x1000, 
>  EP_STATE_DISCONN_TIMEDOUT   = 0x2000, 
> +EP_STATE_OFLD_FAILED_CID_BUSY   = 0x8000, 
>  }; 

[...]

Reagrds,
Ulrich


-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



[PATCH 11/16] BNX2I: Added return code check for chip kwqe submission request

2010-11-10 Thread Eddie Wai
Added the handling for cases when a chip request is made to the
CNIC module but the hardware is not ready to accept.  This would
lead to many unnecessary wait timeouts.
This code adds check in the connect establishment and destruction
path.

Signed-off-by: Eddie Wai 
---
 drivers/scsi/bnx2i/bnx2i.h   |9 +++---
 drivers/scsi/bnx2i/bnx2i_hwi.c   |   54 --
 drivers/scsi/bnx2i/bnx2i_iscsi.c |   17 ++-
 3 files changed, 60 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index d153607..72feb6c 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -652,6 +652,7 @@ enum {
EP_STATE_OFLD_FAILED= 0x800,
EP_STATE_CONNECT_FAILED = 0x1000,
EP_STATE_DISCONN_TIMEDOUT   = 0x2000,
+   EP_STATE_OFLD_FAILED_CID_BUSY   = 0x8000,
 };
 
 /**
@@ -761,11 +762,11 @@ extern int bnx2i_send_iscsi_logout(struct bnx2i_conn 
*conn,
   struct iscsi_task *mtask);
 extern void bnx2i_send_cmd_cleanup_req(struct bnx2i_hba *hba,
   struct bnx2i_cmd *cmd);
-extern void bnx2i_send_conn_ofld_req(struct bnx2i_hba *hba,
-struct bnx2i_endpoint *ep);
-extern void bnx2i_update_iscsi_conn(struct iscsi_conn *conn);
-extern void bnx2i_send_conn_destroy(struct bnx2i_hba *hba,
+extern int bnx2i_send_conn_ofld_req(struct bnx2i_hba *hba,
struct bnx2i_endpoint *ep);
+extern void bnx2i_update_iscsi_conn(struct iscsi_conn *conn);
+extern int bnx2i_send_conn_destroy(struct bnx2i_hba *hba,
+  struct bnx2i_endpoint *ep);
 
 extern int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba,
   struct bnx2i_endpoint *ep);
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 4609ef5..c577da6 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -701,10 +701,11 @@ void bnx2i_send_cmd_cleanup_req(struct bnx2i_hba *hba, 
struct bnx2i_cmd *cmd)
  * this routine prepares and posts CONN_OFLD_REQ1/2 KWQE to initiate
  * iscsi connection context clean-up process
  */
-void bnx2i_send_conn_destroy(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
+int bnx2i_send_conn_destroy(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
 {
struct kwqe *kwqe_arr[2];
struct iscsi_kwqe_conn_destroy conn_cleanup;
+   int rc = -EINVAL;
 
memset(&conn_cleanup, 0x00, sizeof(struct iscsi_kwqe_conn_destroy));
 
@@ -721,7 +722,9 @@ void bnx2i_send_conn_destroy(struct bnx2i_hba *hba, struct 
bnx2i_endpoint *ep)
 
kwqe_arr[0] = (struct kwqe *) &conn_cleanup;
if (hba->cnic && hba->cnic->submit_kwqes)
-   hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, 1);
+   rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, 1);
+
+   return rc;
 }
 
 
@@ -732,8 +735,8 @@ void bnx2i_send_conn_destroy(struct bnx2i_hba *hba, struct 
bnx2i_endpoint *ep)
  *
  * 5706/5708/5709 specific - prepares and posts CONN_OFLD_REQ1/2 KWQE
  */
-static void bnx2i_570x_send_conn_ofld_req(struct bnx2i_hba *hba,
- struct bnx2i_endpoint *ep)
+static int bnx2i_570x_send_conn_ofld_req(struct bnx2i_hba *hba,
+struct bnx2i_endpoint *ep)
 {
struct kwqe *kwqe_arr[2];
struct iscsi_kwqe_conn_offload1 ofld_req1;
@@ -741,6 +744,7 @@ static void bnx2i_570x_send_conn_ofld_req(struct bnx2i_hba 
*hba,
dma_addr_t dma_addr;
int num_kwqes = 2;
u32 *ptbl;
+   int rc = -EINVAL;
 
ofld_req1.hdr.op_code = ISCSI_KWQE_OPCODE_OFFLOAD_CONN1;
ofld_req1.hdr.flags =
@@ -778,7 +782,9 @@ static void bnx2i_570x_send_conn_ofld_req(struct bnx2i_hba 
*hba,
ofld_req2.num_additional_wqes = 0;
 
if (hba->cnic && hba->cnic->submit_kwqes)
-   hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes);
+   rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes);
+
+   return rc;
 }
 
 
@@ -789,8 +795,8 @@ static void bnx2i_570x_send_conn_ofld_req(struct bnx2i_hba 
*hba,
  *
  * 57710 specific - prepares and posts CONN_OFLD_REQ1/2 KWQE
  */
-static void bnx2i_5771x_send_conn_ofld_req(struct bnx2i_hba *hba,
-  struct bnx2i_endpoint *ep)
+static int bnx2i_5771x_send_conn_ofld_req(struct bnx2i_hba *hba,
+ struct bnx2i_endpoint *ep)
 {
struct kwqe *kwqe_arr[5];
struct iscsi_kwqe_conn_offload1 ofld_req1;
@@ -799,6 +805,7 @@ static void bnx2i_5771x_send_conn_ofld_req(struct bnx2i_hba 
*hba,
dma_addr_t dma_addr;
int num_kwqes = 2;
u32 *ptbl;
+   int rc = -EINVAL;
 
ofld_req1.hdr.op_code = ISCSI_KWQE_OPCODE_OFFLOAD_CONN1;
ofld_req1.hdr.flags =
@@ -844,7 +851,9