[PATCH 1/1] IB/iser: Remove hard coded values for cqe and send_wr

2014-10-07 Thread Jay Kallickal
From: Jayamohan Kallickal jayamoh...@gmail.com

This patch allows the underlying hardware to choose 
values other than  hard coded max values for cqe and send_wr
while preventing them from exceeding max supported values.

Signed-off-by: Minh Tran minhduc.t...@emulex.com
Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
 drivers/infiniband/ulp/iser/iser_verbs.c | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c 
b/drivers/infiniband/ulp/iser/iser_verbs.c
index 32849f2..7cdb297 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -73,7 +73,7 @@ static int iser_create_device_ib_res(struct iser_device 
*device)
 {
struct iser_cq_desc *cq_desc;
struct ib_device_attr *dev_attr = device-dev_attr;
-   int ret, i, j;
+   int ret, i, j, max_cqe;
 
ret = ib_query_device(device-ib_device, dev_attr);
if (ret) {
@@ -120,18 +120,24 @@ static int iser_create_device_ib_res(struct iser_device 
*device)
cq_desc[i].device   = device;
cq_desc[i].cq_index = i;
 
+   max_cqe = (dev_attr-max_cqe  ISER_MAX_RX_CQ_LEN) ?
+  dev_attr-max_cqe : ISER_MAX_RX_CQ_LEN;
+
device-rx_cq[i] = ib_create_cq(device-ib_device,
  iser_cq_callback,
  iser_cq_event_callback,
  (void *)cq_desc[i],
- ISER_MAX_RX_CQ_LEN, i);
+ max_cqe, i);
if (IS_ERR(device-rx_cq[i]))
goto cq_err;
 
+   max_cqe = (dev_attr-max_cqe  ISER_MAX_TX_CQ_LEN) ?
+  dev_attr-max_cqe : ISER_MAX_TX_CQ_LEN;
+
device-tx_cq[i] = ib_create_cq(device-ib_device,
  NULL, iser_cq_event_callback,
  (void *)cq_desc[i],
- ISER_MAX_TX_CQ_LEN, i);
+ max_cqe, i);
 
if (IS_ERR(device-tx_cq[i]))
goto cq_err;
@@ -439,6 +445,7 @@ void iser_free_fastreg_pool(struct iser_conn *ib_conn)
 static int iser_create_ib_conn_res(struct iser_conn *ib_conn)
 {
struct iser_device  *device;
+   struct ib_device_attr *dev_attr;
struct ib_qp_init_attr  init_attr;
int ret = -ENOMEM;
int index, min_index = 0;
@@ -459,6 +466,7 @@ static int iser_create_ib_conn_res(struct iser_conn 
*ib_conn)
mutex_unlock(ig.connlist_mutex);
iser_info(cq index %d used for ib_conn %p\n, min_index, ib_conn);
 
+   dev_attr = device-dev_attr;
init_attr.event_handler = iser_qp_event_callback;
init_attr.qp_context= (void *)ib_conn;
init_attr.send_cq   = device-tx_cq[min_index];
@@ -472,7 +480,9 @@ static int iser_create_ib_conn_res(struct iser_conn 
*ib_conn)
init_attr.cap.max_send_wr = ISER_QP_SIG_MAX_REQ_DTOS;
init_attr.create_flags |= IB_QP_CREATE_SIGNATURE_EN;
} else {
-   init_attr.cap.max_send_wr  = ISER_QP_MAX_REQ_DTOS;
+   init_attr.cap.max_send_wr  =
+   (dev_attr-max_qp_wr  ISER_QP_MAX_REQ_DTOS) ?
+dev_attr-max_qp_wr : ISER_QP_MAX_REQ_DTOS;
}
 
ret = rdma_create_qp(ib_conn-cma_id, device-pd, init_attr);
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] be2iscsi: Fix the sparse warning introduced in previous submission

2014-08-07 Thread Jay Kallickal
From: Jayamohan Kallickal jayamohan.kallic...@emulex.com

 commit 73af08e11c6638e2abd6b1fa13cdab58c2bbdbf8
 Author: Jayamohan Kallickal jayamohan.kallic...@emulex.com
 Date:   Mon May 5 21:41:26 2014 -0400

  be2iscsi: Fix interrupt Coalescing mechanism.

Signed-off-by: John Soni Jose sony.joh...@emulex.com
Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
 drivers/scsi/be2iscsi/be_cmds.h | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index cc7405c..4e8cb61 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -26,9 +26,9 @@
  * The commands are serviced by the ARM processor in the OneConnect's MPU.
  */
 struct be_sge {
-   u32 pa_lo;
-   u32 pa_hi;
-   u32 len;
+   __le32 pa_lo;
+   __le32 pa_hi;
+   __le32 len;
 };
 
 #define MCC_WRB_SGE_CNT_SHIFT 3/* bits 3 - 7 of dword 0 */
@@ -624,11 +624,11 @@ static inline struct be_sge *nonembedded_sgl(struct 
be_mcc_wrb *wrb)
 / Modify EQ Delay ***/
 struct be_cmd_req_modify_eq_delay {
struct be_cmd_req_hdr hdr;
-   u32 num_eq;
+   __le32 num_eq;
struct {
-   u32 eq_id;
-   u32 phase;
-   u32 delay_multiplier;
+   __le32 eq_id;
+   __le32 phase;
+   __le32 delay_multiplier;
} delay[MAX_CPUS];
 } __packed;
 
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] be2iscsi: Fix the copyright year

2014-08-07 Thread Jay Kallickal
From: Jayamohan Kallickal jayamohan.kallic...@emulex.com

 Change the copyright year to 2014

Signed-off-by: John Soni Jose sony.joh...@emulex.com
Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
 drivers/scsi/be2iscsi/be.h   | 2 +-
 drivers/scsi/be2iscsi/be_cmds.c  | 2 +-
 drivers/scsi/be2iscsi/be_cmds.h  | 2 +-
 drivers/scsi/be2iscsi/be_iscsi.c | 2 +-
 drivers/scsi/be2iscsi/be_iscsi.h | 2 +-
 drivers/scsi/be2iscsi/be_main.c  | 2 +-
 drivers/scsi/be2iscsi/be_main.h  | 2 +-
 drivers/scsi/be2iscsi/be_mgmt.c  | 2 +-
 drivers/scsi/be2iscsi/be_mgmt.h  | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be.h b/drivers/scsi/be2iscsi/be.h
index 860f527..81e83a6 100644
--- a/drivers/scsi/be2iscsi/be.h
+++ b/drivers/scsi/be2iscsi/be.h
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 1432ed5..ea4477f 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index 4e8cb61..ccda0b6 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 8616281..e25203e 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_iscsi.h b/drivers/scsi/be2iscsi/be_iscsi.h
index 31ddc84..e0b3b2d 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.h
+++ b/drivers/scsi/be2iscsi/be_iscsi.h
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 56467df..d6465ed 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 9ceab42..0ca9d2d 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index a3e5648..785deb3 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_mgmt.h b/drivers/scsi/be2iscsi/be_mgmt.h
index 24a8fc5..bd81446 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.h
+++ b/drivers/scsi/be2iscsi/be_mgmt.h
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/5] be2iscsi: Update to 10.4.74.0

2014-08-07 Thread Jay Kallickal
From: Jayamohan Kallickal jayamohan.kallic...@emulex.com

 This patchset updates be2iscsi driver to 10.4.74.0

These patches are based on for-next branch of scsi.git.

0001 - Fix the sparse warning  
0002 - Update the copyright year
0003 - Fix updating the boot enteries in sysfs
0004 - Fix processing CQE before freeing connection resources
0005 - Bump the driver version

Thanks
Jay

Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] be2iscsi: Bump the driver version

2014-08-07 Thread Jay Kallickal
From: Jayamohan Kallickal jayamohan.kallic...@emulex.com

 Bump the driver version

Signed-off-by: John Soni Jose sony.joh...@emulex.com
Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
 drivers/scsi/be2iscsi/be_main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 5f8b0fc..3605631 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -36,7 +36,7 @@
 #include scsi/scsi_transport_iscsi.h
 
 #define DRV_NAME   be2iscsi
-#define BUILD_STR  10.2.273.0
+#define BUILD_STR  10.4.74.0
 #define BE_NAMEEmulex OneConnect \
Open-iSCSI Driver version BUILD_STR
 #define DRV_DESC   BE_NAME   Driver
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] be2iscsi: Fix processing CQE before connection resources are freed

2014-08-07 Thread Jay Kallickal
From: Jayamohan Kallickal jayamohan.kallic...@emulex.com

 Driver should process the completion queue entries before a connection
 resources are freed. While running mixed traffic due to latency, driver
 processes the CQE after the connection resources are freed. This fix
 processes all the completion queue before the connection resources are
 freed.

Signed-off-by: John Soni Jose sony.joh...@emulex.com
Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
 drivers/scsi/be2iscsi/be_iscsi.c | 29 +
 drivers/scsi/be2iscsi/be_main.c  | 15 ++-
 drivers/scsi/be2iscsi/be_main.h  |  3 +++
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index e25203e..b7391a3 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -1274,6 +1274,31 @@ int beiscsi_ep_poll(struct iscsi_endpoint *ep, int 
timeout_ms)
 }
 
 /**
+ * beiscsi_flush_cq()- Flush the CQ created.
+ * @phba: ptr device priv structure.
+ *
+ * Before the connection resource are freed flush
+ * all the CQ enteries
+ **/
+static void beiscsi_flush_cq(struct beiscsi_hba *phba)
+{
+   uint16_t i;
+   struct be_eq_obj *pbe_eq;
+   struct hwi_controller *phwi_ctrlr;
+   struct hwi_context_memory *phwi_context;
+
+   phwi_ctrlr = phba-phwi_ctrlr;
+   phwi_context = phwi_ctrlr-phwi_ctxt;
+
+   for (i = 0; i  phba-num_cpus; i++) {
+   pbe_eq = phwi_context-be_eq[i];
+   blk_iopoll_disable(pbe_eq-iopoll);
+   beiscsi_process_cq(pbe_eq);
+   blk_iopoll_enable(pbe_eq-iopoll);
+   }
+}
+
+/**
  * beiscsi_close_conn - Upload the  connection
  * @ep: The iscsi endpoint
  * @flag: The type of connection closure
@@ -1294,6 +1319,10 @@ static int beiscsi_close_conn(struct  beiscsi_endpoint 
*beiscsi_ep, int flag)
}
 
ret = beiscsi_mccq_compl(phba, tag, NULL, NULL);
+
+   /* Flush the CQ entries */
+   beiscsi_flush_cq(phba);
+
return ret;
 }
 
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 8f9f625..cbc9fc2 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -2068,7 +2068,7 @@ static void  beiscsi_process_mcc_isr(struct beiscsi_hba 
*phba)
  * return
  * Number of Completion Entries processed.
  **/
-static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
+unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
 {
struct be_queue_info *cq;
struct sol_cqe *sol;
@@ -2110,6 +2110,18 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj 
*pbe_eq)
 
cri_index = BE_GET_CRI_FROM_CID(cid);
ep = phba-ep_array[cri_index];
+
+   if (ep == NULL) {
+   /* connection has already been freed
+* just move on to next one
+*/
+   beiscsi_log(phba, KERN_WARNING,
+   BEISCSI_LOG_INIT,
+   BM_%d : proc cqe of disconn ep: cid %d\n,
+   cid);
+   goto proc_next_cqe;
+   }
+
beiscsi_ep = ep-dd_data;
beiscsi_conn = beiscsi_ep-conn;
 
@@ -2219,6 +2231,7 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj 
*pbe_eq)
break;
}
 
+proc_next_cqe:
AMAP_SET_BITS(struct amap_sol_cqe, valid, sol, 0);
queue_tail_inc(cq);
sol = queue_tail_node(cq);
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 1e3428a..5f8b0fc 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -840,6 +840,9 @@ void beiscsi_free_mgmt_task_handles(struct beiscsi_conn 
*beiscsi_conn,
 void hwi_ring_cq_db(struct beiscsi_hba *phba,
 unsigned int id, unsigned int num_processed,
 unsigned char rearm, unsigned char event);
+
+unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq);
+
 static inline bool beiscsi_error(struct beiscsi_hba *phba)
 {
return phba-ue_detected || phba-fw_timeout;
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5] be2iscsi: Fix updating the boot enteries in sysfs

2014-08-07 Thread Jay Kallickal
From: Jayamohan Kallickal jayamohan.kallic...@emulex.com

 During port async event driver should check if there is any boot target
 configured on the adapter. Update sysfs enteries with the boot target
 parameters.

Signed-off-by: Minh Tran minhduc.t...@emulex.com
Signed-off-by: John Soni Jose sony.joh...@emulex.com
Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
 drivers/scsi/be2iscsi/be_cmds.c | 38 --
 drivers/scsi/be2iscsi/be_cmds.h |  8 
 drivers/scsi/be2iscsi/be_main.c | 17 +
 drivers/scsi/be2iscsi/be_main.h |  1 +
 4 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index ea4477f..80d97f3 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -275,6 +275,19 @@ bool is_link_state_evt(u32 trailer)
  ASYNC_EVENT_CODE_LINK_STATE);
 }
 
+static bool is_iscsi_evt(u32 trailer)
+{
+   return ((trailer  ASYNC_TRAILER_EVENT_CODE_SHIFT) 
+ ASYNC_TRAILER_EVENT_CODE_MASK) ==
+ ASYNC_EVENT_CODE_ISCSI;
+}
+
+static int iscsi_evt_type(u32 trailer)
+{
+   return (trailer  ASYNC_TRAILER_EVENT_TYPE_SHIFT) 
+ASYNC_TRAILER_EVENT_TYPE_MASK;
+}
+
 static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl)
 {
if (compl-flags != 0) {
@@ -438,7 +451,7 @@ void beiscsi_async_link_state_process(struct beiscsi_hba 
*phba,
} else if ((evt-port_link_status  ASYNC_EVENT_LINK_UP) ||
((evt-port_link_status  ASYNC_EVENT_LOGICAL) 
 (evt-port_fault == BEISCSI_PHY_LINK_FAULT_NONE))) {
-   phba-state = BE_ADAPTER_LINK_UP;
+   phba-state = BE_ADAPTER_LINK_UP | BE_ADAPTER_CHECK_BOOT;
 
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
@@ -461,7 +474,28 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
/* Interpret compl as a async link evt */
beiscsi_async_link_state_process(phba,
   (struct be_async_event_link_state *) compl);
-   else
+   else if (is_iscsi_evt(compl-flags)) {
+   switch (iscsi_evt_type(compl-flags)) {
+   case ASYNC_EVENT_NEW_ISCSI_TGT_DISC:
+   case ASYNC_EVENT_NEW_ISCSI_CONN:
+   case ASYNC_EVENT_NEW_TCP_CONN:
+   phba-state |= BE_ADAPTER_CHECK_BOOT;
+   beiscsi_log(phba, KERN_ERR,
+   BEISCSI_LOG_CONFIG |
+   BEISCSI_LOG_MBOX,
+   BC_%d : Async iscsi Event,
+flags handled = 0x%08x\n,
+   compl-flags);
+   break;
+   default:
+   beiscsi_log(phba, KERN_ERR,
+   BEISCSI_LOG_CONFIG |
+   BEISCSI_LOG_MBOX,
+   BC_%d : Unsupported Async
+Event, flags = 0x%08x\n,
+   compl-flags);
+   }
+   } else
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG |
BEISCSI_LOG_MBOX,
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index ccda0b6..9889743 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -118,6 +118,14 @@ struct be_mcc_compl {
 #define ASYNC_TRAILER_EVENT_CODE_SHIFT 8   /* bits 8 - 15 */
 #define ASYNC_TRAILER_EVENT_CODE_MASK  0xFF
 #define ASYNC_EVENT_CODE_LINK_STATE0x1
+#define ASYNC_EVENT_CODE_ISCSI 0x4
+
+#define ASYNC_TRAILER_EVENT_TYPE_SHIFT 16  /* bits 16 - 23 */
+#define ASYNC_TRAILER_EVENT_TYPE_MASK  0xF
+#define ASYNC_EVENT_NEW_ISCSI_TGT_DISC 0x4
+#define ASYNC_EVENT_NEW_ISCSI_CONN 0x5
+#define ASYNC_EVENT_NEW_TCP_CONN   0x7
+
 struct be_async_event_trailer {
u32 code;
 };
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index d6465ed..8f9f625 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4379,6 +4379,10 @@ static int beiscsi_setup_boot_info(struct beiscsi_hba 
*phba)
 {
struct iscsi_boot_kobj *boot_kobj;
 
+   /* it has been created previously */
+   if (phba-boot_kset)
+ 

[PATCH 4/8] be2iscsi: Fix TCP parameters while connection offloading.

2014-05-05 Thread Jay Kallickal
From: Jayamohan Kallickal jayamohan.kallic...@emulex.com

 SKH-R adapter, TCP Window Size/Scale parameters are passed
 in TCP Connection Offload Mbx Command.

Signed-off-by: Minh Tran minhduc.t...@emulex.com
Signed-off-by: John Soni Jose sony.joh...@emulex.com
Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
 drivers/scsi/be2iscsi/be_cmds.h  | 21 +
 drivers/scsi/be2iscsi/be_iscsi.c | 12 +---
 drivers/scsi/be2iscsi/be_mgmt.c  | 13 ++---
 3 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index cd4410f..cc7405c 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -71,6 +71,7 @@ struct be_mcc_wrb {
 #define BEISCSI_FW_MBX_TIMEOUT 100
 
 /* MBOX Command VER */
+#define MBX_CMD_VER1   0x01
 #define MBX_CMD_VER2   0x02
 
 struct be_mcc_compl {
@@ -1013,6 +1014,26 @@ struct tcp_connect_and_offload_in {
u8 rsvd0[3];
 } __packed;
 
+struct tcp_connect_and_offload_in_v1 {
+   struct be_cmd_req_hdr hdr;
+   struct ip_addr_format ip_address;
+   u16 tcp_port;
+   u16 cid;
+   u16 cq_id;
+   u16 defq_id;
+   struct phys_addr dataout_template_pa;
+   u16 hdr_ring_id;
+   u16 data_ring_id;
+   u8 do_offload;
+   u8 ifd_state;
+   u8 rsvd0[2];
+   u16 tcp_window_size;
+   u8 tcp_window_scale_count;
+   u8 rsvd1;
+   u32 tcp_mss:24;
+   u8 rsvd2;
+} __packed;
+
 struct tcp_connect_and_offload_out {
struct be_cmd_resp_hdr hdr;
u32 connection_handle;
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index a3df433..fd284ff 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -1106,7 +1106,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
struct beiscsi_hba *phba = beiscsi_ep-phba;
struct tcp_connect_and_offload_out *ptcpcnct_out;
struct be_dma_mem nonemb_cmd;
-   unsigned int tag;
+   unsigned int tag, req_memsize;
int ret = -ENOMEM;
 
beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
@@ -1127,8 +1127,14 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
   (beiscsi_ep-ep_cid)] = ep;
 
beiscsi_ep-cid_vld = 0;
+
+   if (is_chip_be2_be3r(phba))
+   req_memsize = sizeof(struct tcp_connect_and_offload_in);
+   else
+   req_memsize = sizeof(struct tcp_connect_and_offload_in_v1);
+
nonemb_cmd.va = pci_alloc_consistent(phba-ctrl.pdev,
-   sizeof(struct tcp_connect_and_offload_in),
+   req_memsize,
nonemb_cmd.dma);
if (nonemb_cmd.va == NULL) {
 
@@ -1139,7 +1145,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
beiscsi_free_ep(beiscsi_ep);
return -ENOMEM;
}
-   nonemb_cmd.size = sizeof(struct tcp_connect_and_offload_in);
+   nonemb_cmd.size = req_memsize;
memset(nonemb_cmd.va, 0, nonemb_cmd.size);
tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep, nonemb_cmd);
if (tag = 0) {
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index 52a36fb..6045aa7 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -712,7 +712,7 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
struct sockaddr_in6 *daddr_in6 = (struct sockaddr_in6 *)dst_addr;
struct be_ctrl_info *ctrl = phba-ctrl;
struct be_mcc_wrb *wrb;
-   struct tcp_connect_and_offload_in *req;
+   struct tcp_connect_and_offload_in_v1 *req;
unsigned short def_hdr_id;
unsigned short def_data_id;
struct phys_addr template_address = { 0, 0 };
@@ -745,10 +745,10 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
memset(req, 0, sizeof(*req));
wrb-tag0 |= tag;
 
-   be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1);
+   be_wrb_hdr_prepare(wrb, nonemb_cmd-size, false, 1);
be_cmd_hdr_prepare(req-hdr, CMD_SUBSYSTEM_ISCSI,
   OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD,
-  sizeof(*req));
+  nonemb_cmd-size);
if (dst_addr-sa_family == PF_INET) {
__be32 s_addr = daddr_in-sin_addr.s_addr;
req-ip_address.ip_type = BE2_IPV4;
@@ -794,6 +794,13 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
sge-pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd-dma));
sge-pa_lo = cpu_to_le32(nonemb_cmd-dma  0x);
sge-len = cpu_to_le32(nonemb_cmd-size);
+
+   if (!is_chip_be2_be3r(phba)) {
+   req-hdr.version = MBX_CMD_VER1;
+   req-tcp_window_size = 0;
+   req-tcp_window_scale_count = 2;
+   }
+
be_mcc_notify(phba);
spin_unlock(ctrl-mbox_lock);
  

[PATCH 3/8] be2iscsi: Fix interrupt Coalescing mechanism.

2014-05-05 Thread Jay Kallickal
From: Jayamohan Kallickal jayamohan.kallic...@emulex.com

Signed-off-by: Minh Tran minhduc.t...@emulex.com
Signed-off-by: John Soni Jose sony.joh...@emulex.com
Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
 drivers/scsi/be2iscsi/be.h  | 11 
 drivers/scsi/be2iscsi/be_cmds.h | 10 ++-
 drivers/scsi/be2iscsi/be_main.c | 58 +++--
 drivers/scsi/be2iscsi/be_main.h |  5 ++--
 drivers/scsi/be2iscsi/be_mgmt.c | 37 ++
 drivers/scsi/be2iscsi/be_mgmt.h |  2 ++
 6 files changed, 118 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be.h b/drivers/scsi/be2iscsi/be.h
index 1bfb0bd..25c2164 100644
--- a/drivers/scsi/be2iscsi/be.h
+++ b/drivers/scsi/be2iscsi/be.h
@@ -83,9 +83,20 @@ static inline void queue_tail_inc(struct be_queue_info *q)
 
 /*ISCSI */
 
+struct be_aic_obj {/* Adaptive interrupt coalescing (AIC) info */
+   bool enable;
+   u32 min_eqd;/* in usecs */
+   u32 max_eqd;/* in usecs */
+   u32 prev_eqd;   /* in usecs */
+   u32 et_eqd; /* configured val when aic is off */
+   ulong jiffs;
+   u64 eq_prev;/* Used to calculate eqe */
+};
+
 struct be_eq_obj {
bool todo_mcc_cq;
bool todo_cq;
+   u32 cq_count;
struct be_queue_info q;
struct beiscsi_hba *phba;
struct be_queue_info *cq;
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index 7cf7f99..cd4410f 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -271,6 +271,12 @@ struct be_cmd_resp_eq_create {
u16 rsvd0;  /* sword */
 } __packed;
 
+struct be_set_eqd {
+   u32 eq_id;
+   u32 phase;
+   u32 delay_multiplier;
+} __packed;
+
 struct mgmt_chap_format {
u32 flags;
u8  intr_chap_name[256];
@@ -622,7 +628,7 @@ struct be_cmd_req_modify_eq_delay {
u32 eq_id;
u32 phase;
u32 delay_multiplier;
-   } delay[8];
+   } delay[MAX_CPUS];
 } __packed;
 
 / Get MAC ADDR ***/
@@ -708,6 +714,8 @@ unsigned int be_cmd_get_port_speed(struct beiscsi_hba 
*phba);
 
 void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag);
 
+int be_cmd_modify_eq_delay(struct beiscsi_hba *phba, struct be_set_eqd *,
+   int num);
 int beiscsi_mccq_compl(struct beiscsi_hba *phba,
uint32_t tag, struct be_mcc_wrb **wrb,
struct be_dma_mem *mbx_cmd_mem);
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index a73af29..9ff8667 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -2271,6 +2271,7 @@ static int be_iopoll(struct blk_iopoll *iop, int budget)
 
pbe_eq = container_of(iop, struct be_eq_obj, iopoll);
ret = beiscsi_process_cq(pbe_eq);
+   pbe_eq-cq_count += ret;
if (ret  budget) {
phba = pbe_eq-phba;
blk_iopoll_complete(iop);
@@ -3825,9 +3826,9 @@ static int hwi_init_port(struct beiscsi_hba *phba)
 
phwi_ctrlr = phba-phwi_ctrlr;
phwi_context = phwi_ctrlr-phwi_ctxt;
-   phwi_context-max_eqd = 0;
+   phwi_context-max_eqd = 128;
phwi_context-min_eqd = 0;
-   phwi_context-cur_eqd = 64;
+   phwi_context-cur_eqd = 0;
be_cmd_fw_initialize(phba-ctrl);
 
status = beiscsi_create_eqs(phba, phwi_context);
@@ -5282,6 +5283,57 @@ static void beiscsi_msix_enable(struct beiscsi_hba *phba)
return;
 }
 
+static void be_eqd_update(struct beiscsi_hba *phba)
+{
+   struct be_set_eqd set_eqd[MAX_CPUS];
+   struct be_aic_obj *aic;
+   struct be_eq_obj *pbe_eq;
+   struct hwi_controller *phwi_ctrlr;
+   struct hwi_context_memory *phwi_context;
+   int eqd, i, num = 0;
+   ulong now;
+   u32 pps, delta;
+   unsigned int tag;
+
+   phwi_ctrlr = phba-phwi_ctrlr;
+   phwi_context = phwi_ctrlr-phwi_ctxt;
+
+   for (i = 0; i = phba-num_cpus; i++) {
+   aic = phba-aic_obj[i];
+   pbe_eq = phwi_context-be_eq[i];
+   now = jiffies;
+   if (!aic-jiffs || time_before(now, aic-jiffs) ||
+   pbe_eq-cq_count  aic-eq_prev) {
+   aic-jiffs = now;
+   aic-eq_prev = pbe_eq-cq_count;
+   continue;
+   }
+   delta = jiffies_to_msecs(now - aic-jiffs);
+   pps = (((u32)(pbe_eq-cq_count - aic-eq_prev) * 1000) / delta);
+   eqd = (pps / 1500)  2;
+
+   if (eqd  8)
+   eqd = 0;
+   eqd = min_t(u32, eqd, phwi_context-max_eqd);
+   eqd = max_t(u32, eqd, phwi_context-min_eqd);
+
+   aic-jiffs = now;
+   aic-eq_prev = pbe_eq-cq_count;
+
+   

[PATCH 1/8] be2iscsi: Fix retrieving MCCQ_WRB in non-embedded Mbox path

2014-05-05 Thread Jay Kallickal
From: Jayamohan Kallickal jayamohan.kallic...@emulex.com

 Getting WRB for MCCQ posting was done before looking if tag is
 available or not. This lead to increase phba-ctrl.mcc_obj.q.used
 variable and the WARN_ON message was coming from wrb_from_mccq().
 Moved getting wrb from mccq after checking for the tag.

 In wrb_from_mccq(), memset is done before returning wrb ptr.
 Removed memset of mccq wrb from all other functions.

Signed-off-by: John Soni Jose sony.joh...@emulex.com
Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
 drivers/scsi/be2iscsi/be_mgmt.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index 088bdf7..712911f 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -447,8 +447,8 @@ unsigned int mgmt_vendor_specific_fw_cmd(struct 
be_ctrl_info *ctrl,
 struct be_dma_mem *nonemb_cmd)
 {
struct be_cmd_resp_hdr *resp;
-   struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
-   struct be_sge *mcc_sge = nonembedded_sgl(wrb);
+   struct be_mcc_wrb *wrb;
+   struct be_sge *mcc_sge;
unsigned int tag = 0;
struct iscsi_bsg_request *bsg_req = job-request;
struct be_bsg_vendor_cmd *req = nonemb_cmd-va;
@@ -465,7 +465,6 @@ unsigned int mgmt_vendor_specific_fw_cmd(struct 
be_ctrl_info *ctrl,
req-sector = sector;
req-offset = offset;
spin_lock(ctrl-mbox_lock);
-   memset(wrb, 0, sizeof(*wrb));
 
switch (bsg_req-rqst_data.h_vendor.vendor_cmd[0]) {
case BEISCSI_WRITE_FLASH:
@@ -495,6 +494,8 @@ unsigned int mgmt_vendor_specific_fw_cmd(struct 
be_ctrl_info *ctrl,
return tag;
}
 
+   wrb = wrb_from_mccq(phba);
+   mcc_sge = nonembedded_sgl(wrb);
be_wrb_hdr_prepare(wrb, nonemb_cmd-size, false,
   job-request_payload.sg_cnt);
mcc_sge-pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd-dma));
@@ -525,7 +526,6 @@ int mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned 
short ulp_num)
int status = 0;
 
spin_lock(ctrl-mbox_lock);
-   memset(wrb, 0, sizeof(*wrb));
 
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
be_cmd_hdr_prepare(req-hdr, CMD_SUBSYSTEM_ISCSI,
@@ -702,7 +702,6 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
return tag;
}
wrb = wrb_from_mccq(phba);
-   memset(wrb, 0, sizeof(*wrb));
sge = nonembedded_sgl(wrb);
 
req = nonemb_cmd-va;
@@ -804,7 +803,7 @@ static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba,
int resp_buf_len)
 {
struct be_ctrl_info *ctrl = phba-ctrl;
-   struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
+   struct be_mcc_wrb *wrb;
struct be_sge *sge;
unsigned int tag;
int rc = 0;
@@ -816,7 +815,8 @@ static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba,
rc = -ENOMEM;
goto free_cmd;
}
-   memset(wrb, 0, sizeof(*wrb));
+
+   wrb = wrb_from_mccq(phba);
wrb-tag0 |= tag;
sge = nonembedded_sgl(wrb);
 
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/8] be2iscsi: Fix exposing Host in sysfs after adapter initialization is complete

2014-05-05 Thread Jay Kallickal
From: Jayamohan Kallickal jayamohan.kallic...@emulex.com

 Before probe for function was completed, iSCSI Daemon had initiated login
 to target while OS was coming up. The targets which had node.startup=automatic,
 login process was initiated.Since function specific initialization was still in
 progress this lead to kernel panic.

 Fixed the issue by moving iscsi_host_add() call after adapter initialization
 is done.

Signed-off-by: John Soni Jose sony.joh...@emulex.com
Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
 drivers/scsi/be2iscsi/be_main.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 0d82229..a73af29 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -599,15 +599,7 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct 
pci_dev *pcidev)
pci_set_drvdata(pcidev, phba);
phba-interface_handle = 0x;
 
-   if (iscsi_host_add(shost, phba-pcidev-dev))
-   goto free_devices;
-
return phba;
-
-free_devices:
-   pci_dev_put(phba-pcidev);
-   iscsi_host_free(phba-shost);
-   return NULL;
 }
 
 static void beiscsi_unmap_pci_function(struct beiscsi_hba *phba)
@@ -5621,6 +5613,9 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
}
hwi_enable_intr(phba);
 
+   if (iscsi_host_add(phba-shost, phba-pcidev-dev))
+   goto free_blkenbld;
+
if (beiscsi_setup_boot_info(phba))
/*
 * log error but continue, because we may not be using
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/8] be2iscsi: Fix processing cqe for cxn whose endpoint is freed

2014-05-05 Thread Jay Kallickal
From: Jayamohan Kallickal jayamohan.kallic...@emulex.com

 During heavy IO in multipath environment with many active sessions
 and port-bouncing happening, there is a race condition because of
 which beiscsi_prcess_cqe() gets called for a connection whose
 endpoint is freed.

 Checking endpoint reference for a connection before processing in
 beiscsi_process_cq().

Signed-off-by: Minh Tran minhduc.t...@emulex.com
Signed-off-by: John Soni Jose sony.joh...@emulex.com
Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
 drivers/scsi/be2iscsi/be_main.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index dccda6c..5a7022f 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -2110,6 +2110,16 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj 
*pbe_eq)
 
cri_index = BE_GET_CRI_FROM_CID(cid);
ep = phba-ep_array[cri_index];
+   if (unlikely(ep == NULL)) {
+   /* connection has already been freed
+* just move on to next one
+*/
+   beiscsi_log(phba, KERN_WARNING,
+   BEISCSI_LOG_INIT,
+   BM_%d : proc cqe of disconn ep: cid %d\n,
+   cid);
+   goto proc_next_cqe;
+   }
beiscsi_ep = ep-dd_data;
beiscsi_conn = beiscsi_ep-conn;
 
@@ -2219,6 +2229,7 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj 
*pbe_eq)
break;
}
 
+proc_next_cqe:
AMAP_SET_BITS(struct amap_sol_cqe, valid, sol, 0);
queue_tail_inc(cq);
sol = queue_tail_node(cq);
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/8] be2iscsi: Bump the driver version

2014-05-05 Thread Jay Kallickal
From: Jayamohan Kallickal jayamohan.kallic...@emulex.com

 Bumping the driver version.

Signed-off-by: John Soni Jose sony.joh...@emulex.com
Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
 drivers/scsi/be2iscsi/be_main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index dc56ea9..9ceab42 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -36,7 +36,7 @@
 #include scsi/scsi_transport_iscsi.h
 
 #define DRV_NAME   be2iscsi
-#define BUILD_STR  10.2.125.0
+#define BUILD_STR  10.2.273.0
 #define BE_NAMEEmulex OneConnect \
Open-iSCSI Driver version BUILD_STR
 #define DRV_DESC   BE_NAME   Driver
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/8] be2iscsi: Fix destroy MCC-CQ before MCC-EQ is destroyed

2014-05-05 Thread Jay Kallickal
From: Jayamohan Kallickal jayamohan.kallic...@emulex.com

 EQ teardown should happen only after all CQ are destroyed.
 In some FW config, adapter goes into a freeze state. This
 fix moves teardown of MCC-Q before the EQ teardown happens.

Signed-off-by: John Soni Jose sony.joh...@emulex.com
Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
 drivers/scsi/be2iscsi/be_main.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index e8bba90..dccda6c 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3685,7 +3685,7 @@ static void hwi_cleanup(struct beiscsi_hba *phba)
struct hwi_controller *phwi_ctrlr;
struct hwi_context_memory *phwi_context;
struct hwi_async_pdu_context *pasync_ctx;
-   int i, eq_num, ulp_num;
+   int i, eq_for_mcc, ulp_num;
 
phwi_ctrlr = phba-phwi_ctrlr;
phwi_context = phwi_ctrlr-phwi_ctxt;
@@ -3722,16 +3722,17 @@ static void hwi_cleanup(struct beiscsi_hba *phba)
if (q-created)
beiscsi_cmd_q_destroy(ctrl, q, QTYPE_CQ);
}
+
+   be_mcc_queues_destroy(phba);
if (phba-msix_enabled)
-   eq_num = 1;
+   eq_for_mcc = 1;
else
-   eq_num = 0;
-   for (i = 0; i  (phba-num_cpus + eq_num); i++) {
+   eq_for_mcc = 0;
+   for (i = 0; i  (phba-num_cpus + eq_for_mcc); i++) {
q = phwi_context-be_eq[i].q;
if (q-created)
beiscsi_cmd_q_destroy(ctrl, q, QTYPE_EQ);
}
-   be_mcc_queues_destroy(phba);
be_cmd_fw_uninit(ctrl);
 }
 
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/8] be2iscsi: update to 10.2.273.0

2014-05-05 Thread Jay Kallickal
From: Jayamohan Kallickal jayamohan.kallic...@emulex.com


 This patchset updates be2iscsi driver to 10.2.273.0.

This patchset supercedes any patches that have been submitted
but not accepted

These patches are based on scsi-misc branch of scsi.git.

0001 - Fix retrieving MCCQ_WRB in non embedded Mbox
0002 - Fix exposing Host in sysfs after adapter init is done
0003 - Fix interrupt Coalescing mechanism
0004 - Fix TCP parameters while connection offloadling
0005 - Fix memory corruption in MBX path
0006 - Fix destroy MCC CQ before MCC EQ is destroy.patch
0007 - Fix processing cqe for cxn whose endpoint is freed 
0008 - Bump the driver version

Thanks
Jay

Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/8] be2iscsi: Fix memory corruption in MBX path

2014-05-05 Thread Jay Kallickal
From: Jayamohan Kallickal jayamohan.kallic...@emulex.com

 From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
 Sent: Friday, March 28, 2014 1:42 AM
 Subject: re: [SCSI] be2iscsi: Fix handling timed out MBX completion from FW

 Hello Jayamohan Kallickal,

 The patch 1957aa7f6246: [SCSI] be2iscsi: Fix handling timed out MBX 
completion from FW from Jan 29, 2014, leads to the following static checker 
warning:

 drivers/scsi/be2iscsi/be_main.c:5581 beiscsi_dev_probe()
 error: memset() 'phba-ctrl.ptag_state[i]-tag_mem_state' too small (24 vs 32)

 drivers/scsi/be2iscsi/be_main.c
 5576  for (i = 0; i  MAX_MCC_CMD; i++) {
 5577  init_waitqueue_head(phba-ctrl.mcc_wait[i + 1]);
 5578  phba-ctrl.mcc_tag[i] = i + 1;
 5579  phba-ctrl.mcc_numtag[i + 1] = 0;
 5580  phba-ctrl.mcc_tag_available++;
 5581  memset(phba-ctrl.ptag_state[i].tag_mem_state, 0,
 5582 sizeof(struct beiscsi_mcc_tag_state));
   
 Probably this this be change to sizeof(struct be_dma_mem struct)?  It looks 
like we are corrupting memory a bit here.

 5583  }

 regards,
 dan carpenter

Reported-by: Dan Carpenter dan.carpen...@oracle.com
Signed-off-by: John Soni Jose sony.joh...@emulex.com
Signed-off-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
 drivers/scsi/be2iscsi/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 9ff8667..e8bba90 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -5625,7 +5625,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
phba-ctrl.mcc_numtag[i + 1] = 0;
phba-ctrl.mcc_tag_available++;
memset(phba-ctrl.ptag_state[i].tag_mem_state, 0,
-  sizeof(struct beiscsi_mcc_tag_state));
+  sizeof(struct be_dma_mem));
}
 
phba-ctrl.mcc_alloc_index = phba-ctrl.mcc_free_index = 0;
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html