Skip to contentSkip to conversation

be2iscsi: Enable async mode for mcc rings

PATCH In review Jayamohan Kallickal 1 participant 1 message Dec 4, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 11/15 be2iscsi: Enable async mode for mcc rings

This patches enables async mode for mcc rings so that
multiple requests can be queued.

---
 drivers/scsi/be2iscsi/be.h       |   16 ++++-
 drivers/scsi/be2iscsi/be_cmds.c  |   82 +++++++++++++++++++++---
 drivers/scsi/be2iscsi/be_cmds.h  |   10 +++-
 drivers/scsi/be2iscsi/be_iscsi.c |  100 ++++++++++++++++++++++++++----
 drivers/scsi/be2iscsi/be_main.c  |   83 ++++++++++++++++++++++---
 drivers/scsi/be2iscsi/be_main.h  |    2 +
 drivers/scsi/be2iscsi/be_mgmt.c  |  128 ++++++++++++++++++++-----------------
 drivers/scsi/be2iscsi/be_mgmt.h  |    3 -
 8 files changed, 328 insertions(+), 96 deletions(-)
drivers/scsi/be2iscsi/be.h +13 -3
index a93a504..3861cf4 100644
@@ -24,6 +24,7 @@
 #define FW_VER_LEN	32
 #define MCC_Q_LEN	128
 #define MCC_CQ_LEN	256
+#define MAX_MCC_CMD	16
 
 struct be_dma_mem {
 	void *va;
@@ -57,6 +58,11 @@ static inline void *queue_head_node(struct be_queue_info *q)
 	return q->dma_mem.va + q->head * q->entry_size;
 }
 
+static inline void *queue_get_wrb(struct be_queue_info *q, unsigned int wrb_num)
+{
+	return q->dma_mem.va + wrb_num * q->entry_size;
+}
+
 static inline void *queue_tail_node(struct be_queue_info *q)
 {
 	return q->dma_mem.va + q->tail * q->entry_size;
@@ -104,15 +110,19 @@ struct be_ctrl_info {
 	spinlock_t mcc_lock;	/* For serializing mcc cmds to BE card */
 	spinlock_t mcc_cq_lock;
 
-	/* MCC Async callback */
-	void (*async_cb) (void *adapter, bool link_up);
-	void *adapter_ctxt;
+	wait_queue_head_t mcc_wait[MAX_MCC_CMD + 1];
+	unsigned int mcc_tag[MAX_MCC_CMD];
+	unsigned int mcc_numtag[MAX_MCC_CMD + 1];
+	unsigned short mcc_alloc_index;
+	unsigned short mcc_free_index;
+	unsigned int mcc_tag_available;
 };
 
 #include "be_cmds.h"
 
 #define PAGE_SHIFT_4K 12
 #define PAGE_SIZE_4K (1 << PAGE_SHIFT_4K)
+#define mcc_timeout		120000 /* 5s timeout */
 
 /* Returns number of pages spanned by the data starting at the given addr */
 #define PAGES_4K_SPANNED(_address, size) 				\
drivers/scsi/be2iscsi/be_cmds.c +73 -9

121 lines not on this page · raw message

drivers/scsi/be2iscsi/be_cmds.h +8 -2
index 5de8acb..9b9f78a 100644
@@ -425,14 +425,20 @@ int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba,
 int be_poll_mcc(struct be_ctrl_info *ctrl);
 unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
 				      struct beiscsi_hba *phba);
-int be_cmd_get_mac_addr(struct beiscsi_hba *phba, u8 *mac_addr);
-
+unsigned int be_cmd_get_mac_addr(struct beiscsi_hba *phba);
+void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag);
 /*ISCSI Functuions */
 int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
 
 struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
 struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba);
 int be_mcc_notify_wait(struct beiscsi_hba *phba);
+void be_mcc_notify(struct beiscsi_hba *phba);
+unsigned int alloc_mcc_tag(struct beiscsi_hba *phba);
+void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
+		struct be_async_event_link_state *evt);
+int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl,
+				    struct be_mcc_compl *compl);
 
 int be_mbox_notify(struct be_ctrl_info *ctrl);
 
drivers/scsi/be2iscsi/be_iscsi.c +88 -12

190 lines not on this page · raw message

drivers/scsi/be2iscsi/be_main.c +75 -8

182 lines not on this page · raw message

drivers/scsi/be2iscsi/be_main.h +2 -0
index 388bd58..a40f575 100644
@@ -656,6 +656,8 @@ struct wrb_handle *alloc_wrb_handle(struct beiscsi_hba *phba, unsigned int cid);
 void
 free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle);
 
+void beiscsi_process_all_cqs(struct work_struct *work);
+
 struct pdu_nop_out {
 	u32 dw[12];
 };
drivers/scsi/be2iscsi/be_mgmt.c +69 -59

216 lines not on this page · raw message

drivers/scsi/be2iscsi/be_mgmt.h +0 -3
index 6bc59e8..f873a66 100644
@@ -250,7 +250,4 @@ unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba,
 					 unsigned short issue_reset,
 					 unsigned short savecfg_flag);
 
-unsigned char mgmt_fw_cmd(struct be_ctrl_info *ctrl,
-			  struct beiscsi_hba *phba,
-			  char *buf, unsigned int len);
 #endif
Signature · 1 line
1.6.4