aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Soni Jose <sony.john-n@emulex.com>2012-10-19 19:15:40 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-11-26 23:59:41 -0500
commite175defea7b2019613765fee63afcca354e0041d (patch)
treecf66278fcceaf328d3e4b34171455aae3398f88e
parent5faf17b4f46c4c066ccd5eb2aa5b4a100ade2702 (diff)
[SCSI] be2iscsi: Fix for MBX timeout issue
The MBX timeout value set to 100 and if adapter doesn;t return response in that time driver will return from waiting for completion with an error to the caller. In the earlier code driver use to wait until MBX response comes from adapter. Signed-off-by: John Soni Jose <sony.john-n@emulex.com> Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/be2iscsi/be_cmds.c188
-rw-r--r--drivers/scsi/be2iscsi/be_cmds.h10
-rw-r--r--drivers/scsi/be2iscsi/be_iscsi.c101
-rw-r--r--drivers/scsi/be2iscsi/be_main.c49
-rw-r--r--drivers/scsi/be2iscsi/be_main.h6
-rw-r--r--drivers/scsi/be2iscsi/be_mgmt.c100
6 files changed, 260 insertions, 194 deletions
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 977b7532a01e..352fc53e91b8 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -133,6 +133,84 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
133 return tag; 133 return tag;
134} 134}
135 135
136/*
137 * beiscsi_mccq_compl()- Wait for completion of MBX
138 * @phba: Driver private structure
139 * @tag: Tag for the MBX Command
140 * @wrb: the WRB used for the MBX Command
141 * @cmd_hdr: IOCTL Hdr for the MBX Cmd
142 *
143 * Waits for MBX completion with the passed TAG.
144 *
145 * return
146 * Success: 0
147 * Failure: Non-Zero
148 **/
149int beiscsi_mccq_compl(struct beiscsi_hba *phba,
150 uint32_t tag, struct be_mcc_wrb **wrb,
151 void *cmd_hdr)
152{
153 int rc = 0;
154 uint32_t mcc_tag_response;
155 uint16_t status = 0, addl_status = 0, wrb_num = 0;
156 struct be_mcc_wrb *temp_wrb;
157 struct be_cmd_req_hdr *ioctl_hdr;
158 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
159
160 /* wait for the mccq completion */
161 rc = wait_event_interruptible_timeout(
162 phba->ctrl.mcc_wait[tag],
163 phba->ctrl.mcc_numtag[tag],
164 msecs_to_jiffies(
165 BEISCSI_HOST_MBX_TIMEOUT));
166
167 if (rc <= 0) {
168 beiscsi_log(phba, KERN_ERR,
169 BEISCSI_LOG_INIT | BEISCSI_LOG_EH |
170 BEISCSI_LOG_CONFIG,
171 "BC_%d : MBX Cmd Completion timed out\n");
172 rc = -EAGAIN;
173 goto release_mcc_tag;
174 } else
175 rc = 0;
176
177 mcc_tag_response = phba->ctrl.mcc_numtag[tag];
178 status = (mcc_tag_response & CQE_STATUS_MASK);
179 addl_status = ((mcc_tag_response & CQE_STATUS_ADDL_MASK) >>
180 CQE_STATUS_ADDL_SHIFT);
181
182 if (cmd_hdr) {
183 ioctl_hdr = (struct be_cmd_req_hdr *)cmd_hdr;
184 } else {
185 wrb_num = (mcc_tag_response & CQE_STATUS_WRB_MASK) >>
186 CQE_STATUS_WRB_SHIFT;
187 temp_wrb = (struct be_mcc_wrb *)queue_get_wrb(mccq, wrb_num);
188 ioctl_hdr = embedded_payload(temp_wrb);
189
190 if (wrb)
191 *wrb = temp_wrb;
192 }
193
194 if (status || addl_status) {
195 beiscsi_log(phba, KERN_ERR,
196 BEISCSI_LOG_INIT | BEISCSI_LOG_EH |
197 BEISCSI_LOG_CONFIG,
198 "BC_%d : MBX Cmd Failed for "
199 "Subsys : %d Opcode : %d with "
200 "Status : %d and Extd_Status : %d\n",
201 ioctl_hdr->subsystem,
202 ioctl_hdr->opcode,
203 status, addl_status);
204 rc = -EAGAIN;
205 }
206
207release_mcc_tag:
208 /* Release the MCC entry */
209 free_mcc_tag(&phba->ctrl, tag);
210
211 return rc;
212}
213
136void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag) 214void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
137{ 215{
138 spin_lock(&ctrl->mbox_lock); 216 spin_lock(&ctrl->mbox_lock);
@@ -168,11 +246,24 @@ static inline void be_mcc_compl_use(struct be_mcc_compl *compl)
168 compl->flags = 0; 246 compl->flags = 0;
169} 247}
170 248
249/*
250 * be_mcc_compl_process()- Check the MBX comapletion status
251 * @ctrl: Function specific MBX data structure
252 * @compl: Completion status of MBX Command
253 *
254 * Check for the MBX completion status when BMBX method used
255 *
256 * return
257 * Success: Zero
258 * Failure: Non-Zero
259 **/
171static int be_mcc_compl_process(struct be_ctrl_info *ctrl, 260static int be_mcc_compl_process(struct be_ctrl_info *ctrl,
172 struct be_mcc_compl *compl) 261 struct be_mcc_compl *compl)
173{ 262{
174 u16 compl_status, extd_status; 263 u16 compl_status, extd_status;
264 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
175 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); 265 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
266 struct be_cmd_req_hdr *hdr = embedded_payload(wrb);
176 267
177 be_dws_le_to_cpu(compl, 4); 268 be_dws_le_to_cpu(compl, 4);
178 269
@@ -184,7 +275,10 @@ static int be_mcc_compl_process(struct be_ctrl_info *ctrl,
184 275
185 beiscsi_log(phba, KERN_ERR, 276 beiscsi_log(phba, KERN_ERR,
186 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, 277 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
187 "BC_%d : error in cmd completion: status(compl/extd)=%d/%d\n", 278 "BC_%d : error in cmd completion: "
279 "Subsystem : %d Opcode : %d "
280 "status(compl/extd)=%d/%d\n",
281 hdr->subsystem, hdr->opcode,
188 compl_status, extd_status); 282 compl_status, extd_status);
189 283
190 return -EBUSY; 284 return -EBUSY;
@@ -314,11 +408,24 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
314 return status; 408 return status;
315} 409}
316 410
317/* Wait till no more pending mcc requests are present */ 411/*
412 * be_mcc_wait_compl()- Wait for MBX completion
413 * @phba: driver private structure
414 *
415 * Wait till no more pending mcc requests are present
416 *
417 * return
418 * Success: 0
419 * Failure: Non-Zero
420 *
421 **/
318static int be_mcc_wait_compl(struct beiscsi_hba *phba) 422static int be_mcc_wait_compl(struct beiscsi_hba *phba)
319{ 423{
320 int i, status; 424 int i, status;
321 for (i = 0; i < mcc_timeout; i++) { 425 for (i = 0; i < mcc_timeout; i++) {
426 if (phba->fw_timeout)
427 return -EIO;
428
322 status = beiscsi_process_mcc(phba); 429 status = beiscsi_process_mcc(phba);
323 if (status) 430 if (status)
324 return status; 431 return status;
@@ -330,51 +437,80 @@ static int be_mcc_wait_compl(struct beiscsi_hba *phba)
330 if (i == mcc_timeout) { 437 if (i == mcc_timeout) {
331 beiscsi_log(phba, KERN_ERR, 438 beiscsi_log(phba, KERN_ERR,
332 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, 439 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
333 "BC_%d : mccq poll timed out\n"); 440 "BC_%d : FW Timed Out\n");
334 441 phba->fw_timeout = true;
335 return -EBUSY; 442 return -EBUSY;
336 } 443 }
337 return 0; 444 return 0;
338} 445}
339 446
340/* Notify MCC requests and wait for completion */ 447/*
448 * be_mcc_notify_wait()- Notify and wait for Compl
449 * @phba: driver private structure
450 *
451 * Notify MCC requests and wait for completion
452 *
453 * return
454 * Success: 0
455 * Failure: Non-Zero
456 **/
341int be_mcc_notify_wait(struct beiscsi_hba *phba) 457int be_mcc_notify_wait(struct beiscsi_hba *phba)
342{ 458{
343 be_mcc_notify(phba); 459 be_mcc_notify(phba);
344 return be_mcc_wait_compl(phba); 460 return be_mcc_wait_compl(phba);
345} 461}
346 462
463/*
464 * be_mbox_db_ready_wait()- Check ready status
465 * @ctrl: Function specific MBX data structure
466 *
467 * Check for the ready status of FW to send BMBX
468 * commands to adapter.
469 *
470 * return
471 * Success: 0
472 * Failure: Non-Zero
473 **/
347static int be_mbox_db_ready_wait(struct be_ctrl_info *ctrl) 474static int be_mbox_db_ready_wait(struct be_ctrl_info *ctrl)
348{ 475{
349#define long_delay 2000
350 void __iomem *db = ctrl->db + MPU_MAILBOX_DB_OFFSET; 476 void __iomem *db = ctrl->db + MPU_MAILBOX_DB_OFFSET;
351 int cnt = 0, wait = 5; /* in usecs */ 477 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
478 int wait = 0;
352 u32 ready; 479 u32 ready;
353 480
354 do { 481 do {
482 if (phba->fw_timeout)
483 return -EIO;
484
355 ready = ioread32(db) & MPU_MAILBOX_DB_RDY_MASK; 485 ready = ioread32(db) & MPU_MAILBOX_DB_RDY_MASK;
356 if (ready) 486 if (ready)
357 break; 487 break;
358 488
359 if (cnt > 12000000) { 489 if (wait > BEISCSI_HOST_MBX_TIMEOUT) {
360 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
361 beiscsi_log(phba, KERN_ERR, 490 beiscsi_log(phba, KERN_ERR,
362 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, 491 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
363 "BC_%d : mbox_db poll timed out\n"); 492 "BC_%d : FW Timed Out\n");
364 493 phba->fw_timeout = true;
365 return -EBUSY; 494 return -EBUSY;
366 } 495 }
367 496
368 if (cnt > 50) { 497 mdelay(1);
369 wait = long_delay; 498 wait++;
370 mdelay(long_delay / 1000);
371 } else
372 udelay(wait);
373 cnt += wait;
374 } while (true); 499 } while (true);
375 return 0; 500 return 0;
376} 501}
377 502
503/*
504 * be_mbox_notify: Notify adapter of new BMBX command
505 * @ctrl: Function specific MBX data structure
506 *
507 * Ring doorbell to inform adapter of a BMBX command
508 * to process
509 *
510 * return
511 * Success: 0
512 * Failure: Non-Zero
513 **/
378int be_mbox_notify(struct be_ctrl_info *ctrl) 514int be_mbox_notify(struct be_ctrl_info *ctrl)
379{ 515{
380 int status; 516 int status;
@@ -391,13 +527,9 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
391 iowrite32(val, db); 527 iowrite32(val, db);
392 528
393 status = be_mbox_db_ready_wait(ctrl); 529 status = be_mbox_db_ready_wait(ctrl);
394 if (status != 0) { 530 if (status)
395 beiscsi_log(phba, KERN_ERR,
396 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
397 "BC_%d : be_mbox_db_ready_wait failed\n");
398
399 return status; 531 return status;
400 } 532
401 val = 0; 533 val = 0;
402 val &= ~MPU_MAILBOX_DB_RDY_MASK; 534 val &= ~MPU_MAILBOX_DB_RDY_MASK;
403 val &= ~MPU_MAILBOX_DB_HI_MASK; 535 val &= ~MPU_MAILBOX_DB_HI_MASK;
@@ -405,13 +537,9 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
405 iowrite32(val, db); 537 iowrite32(val, db);
406 538
407 status = be_mbox_db_ready_wait(ctrl); 539 status = be_mbox_db_ready_wait(ctrl);
408 if (status != 0) { 540 if (status)
409 beiscsi_log(phba, KERN_ERR,
410 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
411 "BC_%d : be_mbox_db_ready_wait failed\n");
412
413 return status; 541 return status;
414 } 542
415 if (be_mcc_compl_is_new(compl)) { 543 if (be_mcc_compl_is_new(compl)) {
416 status = be_mcc_compl_process(ctrl, &mbox->compl); 544 status = be_mcc_compl_process(ctrl, &mbox->compl);
417 be_mcc_compl_use(compl); 545 be_mcc_compl_use(compl);
@@ -499,7 +627,7 @@ void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr,
499 req_hdr->opcode = opcode; 627 req_hdr->opcode = opcode;
500 req_hdr->subsystem = subsystem; 628 req_hdr->subsystem = subsystem;
501 req_hdr->request_length = cpu_to_le32(cmd_len - sizeof(*req_hdr)); 629 req_hdr->request_length = cpu_to_le32(cmd_len - sizeof(*req_hdr));
502 req_hdr->timeout = 120; 630 req_hdr->timeout = BEISCSI_FW_MBX_TIMEOUT;
503} 631}
504 632
505static void be_cmd_page_addrs_prepare(struct phys_addr *pages, u32 max_pages, 633static void be_cmd_page_addrs_prepare(struct phys_addr *pages, u32 max_pages,
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index 37f2bb5e5e3b..23397d51ac54 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -57,6 +57,13 @@ struct be_mcc_wrb {
57#define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */ 57#define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */
58#define CQE_STATUS_EXTD_MASK 0xFFFF 58#define CQE_STATUS_EXTD_MASK 0xFFFF
59#define CQE_STATUS_EXTD_SHIFT 16 /* bits 0 - 15 */ 59#define CQE_STATUS_EXTD_SHIFT 16 /* bits 0 - 15 */
60#define CQE_STATUS_ADDL_MASK 0xFF00
61#define CQE_STATUS_MASK 0xFF
62#define CQE_STATUS_ADDL_SHIFT 0x08
63#define CQE_STATUS_WRB_MASK 0xFF0000
64#define CQE_STATUS_WRB_SHIFT 16
65#define BEISCSI_HOST_MBX_TIMEOUT (110 * 1000)
66#define BEISCSI_FW_MBX_TIMEOUT 100
60 67
61/* MBOX Command VER */ 68/* MBOX Command VER */
62#define MBX_CMD_VER2 0x02 69#define MBX_CMD_VER2 0x02
@@ -685,6 +692,9 @@ unsigned int be_cmd_get_initname(struct beiscsi_hba *phba);
685unsigned int be_cmd_get_port_speed(struct beiscsi_hba *phba); 692unsigned int be_cmd_get_port_speed(struct beiscsi_hba *phba);
686 693
687void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag); 694void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag);
695
696int beiscsi_mccq_compl(struct beiscsi_hba *phba,
697 uint32_t tag, struct be_mcc_wrb **wrb, void *cmd_va);
688/*ISCSI Functuions */ 698/*ISCSI Functuions */
689int be_cmd_fw_initialize(struct be_ctrl_info *ctrl); 699int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
690 700
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 38dea4315046..214d691adb53 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -690,11 +690,9 @@ int beiscsi_set_param(struct iscsi_cls_conn *cls_conn,
690static int beiscsi_get_initname(char *buf, struct beiscsi_hba *phba) 690static int beiscsi_get_initname(char *buf, struct beiscsi_hba *phba)
691{ 691{
692 int rc; 692 int rc;
693 unsigned int tag, wrb_num; 693 unsigned int tag;
694 unsigned short status, extd_status;
695 struct be_mcc_wrb *wrb; 694 struct be_mcc_wrb *wrb;
696 struct be_cmd_hba_name *resp; 695 struct be_cmd_hba_name *resp;
697 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
698 696
699 tag = be_cmd_get_initname(phba); 697 tag = be_cmd_get_initname(phba);
700 if (!tag) { 698 if (!tag) {
@@ -702,26 +700,16 @@ static int beiscsi_get_initname(char *buf, struct beiscsi_hba *phba)
702 "BS_%d : Getting Initiator Name Failed\n"); 700 "BS_%d : Getting Initiator Name Failed\n");
703 701
704 return -EBUSY; 702 return -EBUSY;
705 } else 703 }
706 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
707 phba->ctrl.mcc_numtag[tag]);
708
709 wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF0000) >> 16;
710 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
711 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
712 704
713 if (status || extd_status) { 705 rc = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
706 if (rc) {
714 beiscsi_log(phba, KERN_ERR, 707 beiscsi_log(phba, KERN_ERR,
715 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, 708 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
716 "BS_%d : MailBox Command Failed with " 709 "BS_%d : Initiator Name MBX Failed\n");
717 "status = %d extd_status = %d\n", 710 return rc;
718 status, extd_status);
719
720 free_mcc_tag(&phba->ctrl, tag);
721 return -EAGAIN;
722 } 711 }
723 wrb = queue_get_wrb(mccq, wrb_num); 712
724 free_mcc_tag(&phba->ctrl, tag);
725 resp = embedded_payload(wrb); 713 resp = embedded_payload(wrb);
726 rc = sprintf(buf, "%s\n", resp->initiator_name); 714 rc = sprintf(buf, "%s\n", resp->initiator_name);
727 return rc; 715 return rc;
@@ -749,13 +737,12 @@ static void beiscsi_get_port_state(struct Scsi_Host *shost)
749 */ 737 */
750static int beiscsi_get_port_speed(struct Scsi_Host *shost) 738static int beiscsi_get_port_speed(struct Scsi_Host *shost)
751{ 739{
752 unsigned int tag, wrb_num; 740 int rc;
753 unsigned short status, extd_status; 741 unsigned int tag;
754 struct be_mcc_wrb *wrb; 742 struct be_mcc_wrb *wrb;
755 struct be_cmd_ntwk_link_status_resp *resp; 743 struct be_cmd_ntwk_link_status_resp *resp;
756 struct beiscsi_hba *phba = iscsi_host_priv(shost); 744 struct beiscsi_hba *phba = iscsi_host_priv(shost);
757 struct iscsi_cls_host *ihost = shost->shost_data; 745 struct iscsi_cls_host *ihost = shost->shost_data;
758 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
759 746
760 tag = be_cmd_get_port_speed(phba); 747 tag = be_cmd_get_port_speed(phba);
761 if (!tag) { 748 if (!tag) {
@@ -763,26 +750,14 @@ static int beiscsi_get_port_speed(struct Scsi_Host *shost)
763 "BS_%d : Getting Port Speed Failed\n"); 750 "BS_%d : Getting Port Speed Failed\n");
764 751
765 return -EBUSY; 752 return -EBUSY;
766 } else 753 }
767 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 754 rc = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
768 phba->ctrl.mcc_numtag[tag]); 755 if (rc) {
769
770 wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF0000) >> 16;
771 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
772 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
773
774 if (status || extd_status) {
775 beiscsi_log(phba, KERN_ERR, 756 beiscsi_log(phba, KERN_ERR,
776 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, 757 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
777 "BS_%d : MailBox Command Failed with " 758 "BS_%d : Port Speed MBX Failed\n");
778 "status = %d extd_status = %d\n", 759 return rc;
779 status, extd_status);
780
781 free_mcc_tag(&phba->ctrl, tag);
782 return -EAGAIN;
783 } 760 }
784 wrb = queue_get_wrb(mccq, wrb_num);
785 free_mcc_tag(&phba->ctrl, tag);
786 resp = embedded_payload(wrb); 761 resp = embedded_payload(wrb);
787 762
788 switch (resp->mac_speed) { 763 switch (resp->mac_speed) {
@@ -1034,12 +1009,10 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
1034{ 1009{
1035 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data; 1010 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
1036 struct beiscsi_hba *phba = beiscsi_ep->phba; 1011 struct beiscsi_hba *phba = beiscsi_ep->phba;
1037 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
1038 struct be_mcc_wrb *wrb; 1012 struct be_mcc_wrb *wrb;
1039 struct tcp_connect_and_offload_out *ptcpcnct_out; 1013 struct tcp_connect_and_offload_out *ptcpcnct_out;
1040 unsigned short status, extd_status;
1041 struct be_dma_mem nonemb_cmd; 1014 struct be_dma_mem nonemb_cmd;
1042 unsigned int tag, wrb_num; 1015 unsigned int tag;
1043 int ret = -ENOMEM; 1016 int ret = -ENOMEM;
1044 1017
1045 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG, 1018 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
@@ -1091,35 +1064,26 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
1091 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 1064 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
1092 nonemb_cmd.va, nonemb_cmd.dma); 1065 nonemb_cmd.va, nonemb_cmd.dma);
1093 return -EAGAIN; 1066 return -EAGAIN;
1094 } else {
1095 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
1096 phba->ctrl.mcc_numtag[tag]);
1097 } 1067 }
1098 wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF0000) >> 16; 1068
1099 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8; 1069 ret = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
1100 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 1070 if (ret) {
1101 if (status || extd_status) {
1102 beiscsi_log(phba, KERN_ERR, 1071 beiscsi_log(phba, KERN_ERR,
1103 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, 1072 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
1104 "BS_%d : mgmt_open_connection Failed" 1073 "BS_%d : mgmt_open_connection Failed");
1105 " status = %d extd_status = %d\n",
1106 status, extd_status);
1107 1074
1108 free_mcc_tag(&phba->ctrl, tag);
1109 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 1075 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
1110 nonemb_cmd.va, nonemb_cmd.dma); 1076 nonemb_cmd.va, nonemb_cmd.dma);
1111 goto free_ep; 1077 goto free_ep;
1112 } else {
1113 wrb = queue_get_wrb(mccq, wrb_num);
1114 free_mcc_tag(&phba->ctrl, tag);
1115
1116 ptcpcnct_out = embedded_payload(wrb);
1117 beiscsi_ep = ep->dd_data;
1118 beiscsi_ep->fw_handle = ptcpcnct_out->connection_handle;
1119 beiscsi_ep->cid_vld = 1;
1120 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1121 "BS_%d : mgmt_open_connection Success\n");
1122 } 1078 }
1079
1080 ptcpcnct_out = embedded_payload(wrb);
1081 beiscsi_ep = ep->dd_data;
1082 beiscsi_ep->fw_handle = ptcpcnct_out->connection_handle;
1083 beiscsi_ep->cid_vld = 1;
1084 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1085 "BS_%d : mgmt_open_connection Success\n");
1086
1123 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 1087 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
1124 nonemb_cmd.va, nonemb_cmd.dma); 1088 nonemb_cmd.va, nonemb_cmd.dma);
1125 return 0; 1089 return 0;
@@ -1223,11 +1187,9 @@ static int beiscsi_close_conn(struct beiscsi_endpoint *beiscsi_ep, int flag)
1223 beiscsi_ep->ep_cid); 1187 beiscsi_ep->ep_cid);
1224 1188
1225 ret = -EAGAIN; 1189 ret = -EAGAIN;
1226 } else {
1227 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
1228 phba->ctrl.mcc_numtag[tag]);
1229 free_mcc_tag(&phba->ctrl, tag);
1230 } 1190 }
1191
1192 ret = beiscsi_mccq_compl(phba, tag, NULL, NULL);
1231 return ret; 1193 return ret;
1232} 1194}
1233 1195
@@ -1288,12 +1250,9 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
1288 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, 1250 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1289 "BS_%d : mgmt_invalidate_connection Failed for cid=%d\n", 1251 "BS_%d : mgmt_invalidate_connection Failed for cid=%d\n",
1290 beiscsi_ep->ep_cid); 1252 beiscsi_ep->ep_cid);
1291 } else {
1292 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
1293 phba->ctrl.mcc_numtag[tag]);
1294 free_mcc_tag(&phba->ctrl, tag);
1295 } 1253 }
1296 1254
1255 beiscsi_mccq_compl(phba, tag, NULL, NULL);
1297 beiscsi_close_conn(beiscsi_ep, tcp_upload_flag); 1256 beiscsi_close_conn(beiscsi_ep, tcp_upload_flag);
1298 beiscsi_free_ep(beiscsi_ep); 1257 beiscsi_free_ep(beiscsi_ep);
1299 beiscsi_unbind_conn_to_cid(phba, beiscsi_ep->ep_cid); 1258 beiscsi_unbind_conn_to_cid(phba, beiscsi_ep->ep_cid);
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index d3632d5cb248..73a29b2c18ba 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -267,11 +267,9 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc)
267 nonemb_cmd.va, nonemb_cmd.dma); 267 nonemb_cmd.va, nonemb_cmd.dma);
268 268
269 return FAILED; 269 return FAILED;
270 } else {
271 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
272 phba->ctrl.mcc_numtag[tag]);
273 free_mcc_tag(&phba->ctrl, tag);
274 } 270 }
271
272 beiscsi_mccq_compl(phba, tag, NULL, nonemb_cmd.va);
275 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 273 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
276 nonemb_cmd.va, nonemb_cmd.dma); 274 nonemb_cmd.va, nonemb_cmd.dma);
277 return iscsi_eh_abort(sc); 275 return iscsi_eh_abort(sc);
@@ -342,11 +340,9 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc)
342 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 340 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
343 nonemb_cmd.va, nonemb_cmd.dma); 341 nonemb_cmd.va, nonemb_cmd.dma);
344 return FAILED; 342 return FAILED;
345 } else {
346 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
347 phba->ctrl.mcc_numtag[tag]);
348 free_mcc_tag(&phba->ctrl, tag);
349 } 343 }
344
345 beiscsi_mccq_compl(phba, tag, NULL, nonemb_cmd.va);
350 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 346 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
351 nonemb_cmd.va, nonemb_cmd.dma); 347 nonemb_cmd.va, nonemb_cmd.dma);
352 return iscsi_eh_device_reset(sc); 348 return iscsi_eh_device_reset(sc);
@@ -3871,12 +3867,9 @@ static void hwi_disable_intr(struct beiscsi_hba *phba)
3871static int beiscsi_get_boot_info(struct beiscsi_hba *phba) 3867static int beiscsi_get_boot_info(struct beiscsi_hba *phba)
3872{ 3868{
3873 struct be_cmd_get_session_resp *session_resp; 3869 struct be_cmd_get_session_resp *session_resp;
3874 struct be_mcc_wrb *wrb;
3875 struct be_dma_mem nonemb_cmd; 3870 struct be_dma_mem nonemb_cmd;
3876 unsigned int tag, wrb_num; 3871 unsigned int tag;
3877 unsigned short status, extd_status;
3878 unsigned int s_handle; 3872 unsigned int s_handle;
3879 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
3880 int ret = -ENOMEM; 3873 int ret = -ENOMEM;
3881 3874
3882 /* Get the session handle of the boot target */ 3875 /* Get the session handle of the boot target */
@@ -3909,25 +3902,16 @@ static int beiscsi_get_boot_info(struct beiscsi_hba *phba)
3909 " Failed\n"); 3902 " Failed\n");
3910 3903
3911 goto boot_freemem; 3904 goto boot_freemem;
3912 } else 3905 }
3913 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
3914 phba->ctrl.mcc_numtag[tag]);
3915 3906
3916 wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF0000) >> 16; 3907 ret = beiscsi_mccq_compl(phba, tag, NULL, nonemb_cmd.va);
3917 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8; 3908 if (ret) {
3918 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
3919 if (status || extd_status) {
3920 beiscsi_log(phba, KERN_ERR, 3909 beiscsi_log(phba, KERN_ERR,
3921 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG, 3910 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
3922 "BM_%d : beiscsi_get_session_info Failed" 3911 "BM_%d : beiscsi_get_session_info Failed");
3923 " status = %d extd_status = %d\n",
3924 status, extd_status);
3925
3926 free_mcc_tag(&phba->ctrl, tag);
3927 goto boot_freemem; 3912 goto boot_freemem;
3928 } 3913 }
3929 wrb = queue_get_wrb(mccq, wrb_num); 3914
3930 free_mcc_tag(&phba->ctrl, tag);
3931 session_resp = nonemb_cmd.va ; 3915 session_resp = nonemb_cmd.va ;
3932 3916
3933 memcpy(&phba->boot_sess, &session_resp->session_info, 3917 memcpy(&phba->boot_sess, &session_resp->session_info,
@@ -4643,9 +4627,13 @@ static int beiscsi_bsg_request(struct bsg_job *job)
4643 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 4627 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
4644 nonemb_cmd.va, nonemb_cmd.dma); 4628 nonemb_cmd.va, nonemb_cmd.dma);
4645 return -EAGAIN; 4629 return -EAGAIN;
4646 } else 4630 }
4647 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 4631
4648 phba->ctrl.mcc_numtag[tag]); 4632 rc = wait_event_interruptible_timeout(
4633 phba->ctrl.mcc_wait[tag],
4634 phba->ctrl.mcc_numtag[tag],
4635 msecs_to_jiffies(
4636 BEISCSI_HOST_MBX_TIMEOUT));
4649 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8; 4637 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
4650 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 4638 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
4651 free_mcc_tag(&phba->ctrl, tag); 4639 free_mcc_tag(&phba->ctrl, tag);
@@ -4807,6 +4795,9 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
4807 /* Initialize Driver configuration Paramters */ 4795 /* Initialize Driver configuration Paramters */
4808 beiscsi_hba_attrs_init(phba); 4796 beiscsi_hba_attrs_init(phba);
4809 4797
4798 phba->fw_timeout = false;
4799
4800
4810 switch (pcidev->device) { 4801 switch (pcidev->device) {
4811 case BE_DEVICE_ID1: 4802 case BE_DEVICE_ID1:
4812 case OC_DEVICE_ID1: 4803 case OC_DEVICE_ID1:
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 5f346d213ac6..033c053d9471 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -279,7 +279,6 @@ struct beiscsi_hba {
279 struct be_bus_address pci_pa; /* CSR */ 279 struct be_bus_address pci_pa; /* CSR */
280 /* PCI representation of our HBA */ 280 /* PCI representation of our HBA */
281 struct pci_dev *pcidev; 281 struct pci_dev *pcidev;
282 unsigned int state;
283 unsigned short asic_revision; 282 unsigned short asic_revision;
284 unsigned int num_cpus; 283 unsigned int num_cpus;
285 unsigned int nxt_cqid; 284 unsigned int nxt_cqid;
@@ -334,6 +333,11 @@ struct beiscsi_hba {
334 spinlock_t cid_lock; 333 spinlock_t cid_lock;
335 } fw_config; 334 } fw_config;
336 335
336 unsigned int state;
337 bool fw_timeout;
338 bool ue_detected;
339 struct delayed_work beiscsi_hw_check_task;
340
337 u8 mac_address[ETH_ALEN]; 341 u8 mac_address[ETH_ALEN];
338 char wq_name[20]; 342 char wq_name[20];
339 struct workqueue_struct *wq; /* The actuak work queue */ 343 struct workqueue_struct *wq; /* The actuak work queue */
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index f18dc3ecdd58..688bf64741e5 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -575,13 +575,20 @@ unsigned int mgmt_get_all_if_id(struct beiscsi_hba *phba)
575 return status; 575 return status;
576} 576}
577 577
578/*
579 * mgmt_exec_nonemb_cmd()- Execute Non Embedded MBX Cmd
580 * @phba: Driver priv structure
581 * @nonemb_cmd: Address of the MBX command issued
582 * @resp_buf: Buffer to copy the MBX cmd response
583 * @resp_buf_len: respone lenght to be copied
584 *
585 **/
578static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba, 586static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba,
579 struct be_dma_mem *nonemb_cmd, void *resp_buf, 587 struct be_dma_mem *nonemb_cmd, void *resp_buf,
580 int resp_buf_len) 588 int resp_buf_len)
581{ 589{
582 struct be_ctrl_info *ctrl = &phba->ctrl; 590 struct be_ctrl_info *ctrl = &phba->ctrl;
583 struct be_mcc_wrb *wrb = wrb_from_mccq(phba); 591 struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
584 unsigned short status, extd_status;
585 struct be_sge *sge; 592 struct be_sge *sge;
586 unsigned int tag; 593 unsigned int tag;
587 int rc = 0; 594 int rc = 0;
@@ -599,31 +606,25 @@ static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba,
599 606
600 be_wrb_hdr_prepare(wrb, nonemb_cmd->size, false, 1); 607 be_wrb_hdr_prepare(wrb, nonemb_cmd->size, false, 1);
601 sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma)); 608 sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma));
602 sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF); 609 sge->pa_lo = cpu_to_le32(lower_32_bits(nonemb_cmd->dma));
603 sge->len = cpu_to_le32(nonemb_cmd->size); 610 sge->len = cpu_to_le32(nonemb_cmd->size);
604 611
605 be_mcc_notify(phba); 612 be_mcc_notify(phba);
606 spin_unlock(&ctrl->mbox_lock); 613 spin_unlock(&ctrl->mbox_lock);
607 614
608 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 615 rc = beiscsi_mccq_compl(phba, tag, NULL, nonemb_cmd->va);
609 phba->ctrl.mcc_numtag[tag]); 616 if (rc) {
610
611 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
612 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
613 if (status || extd_status) {
614 beiscsi_log(phba, KERN_ERR, 617 beiscsi_log(phba, KERN_ERR,
615 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, 618 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
616 "BG_%d : mgmt_exec_nonemb_cmd Failed status = %d" 619 "BG_%d : mgmt_exec_nonemb_cmd Failed status\n");
617 "extd_status = %d\n", status, extd_status); 620
618 rc = -EIO; 621 rc = -EIO;
619 goto free_tag; 622 goto free_cmd;
620 } 623 }
621 624
622 if (resp_buf) 625 if (resp_buf)
623 memcpy(resp_buf, nonemb_cmd->va, resp_buf_len); 626 memcpy(resp_buf, nonemb_cmd->va, resp_buf_len);
624 627
625free_tag:
626 free_mcc_tag(&phba->ctrl, tag);
627free_cmd: 628free_cmd:
628 pci_free_consistent(ctrl->pdev, nonemb_cmd->size, 629 pci_free_consistent(ctrl->pdev, nonemb_cmd->size,
629 nonemb_cmd->va, nonemb_cmd->dma); 630 nonemb_cmd->va, nonemb_cmd->dma);
@@ -1009,10 +1010,9 @@ int be_mgmt_get_boot_shandle(struct beiscsi_hba *phba,
1009{ 1010{
1010 struct be_cmd_get_boot_target_resp *boot_resp; 1011 struct be_cmd_get_boot_target_resp *boot_resp;
1011 struct be_mcc_wrb *wrb; 1012 struct be_mcc_wrb *wrb;
1012 unsigned int tag, wrb_num; 1013 unsigned int tag;
1013 uint8_t boot_retry = 3; 1014 uint8_t boot_retry = 3;
1014 unsigned short status, extd_status; 1015 int rc;
1015 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
1016 1016
1017 do { 1017 do {
1018 /* Get the Boot Target Session Handle and Count*/ 1018 /* Get the Boot Target Session Handle and Count*/
@@ -1022,24 +1022,16 @@ int be_mgmt_get_boot_shandle(struct beiscsi_hba *phba,
1022 BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT, 1022 BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
1023 "BG_%d : Getting Boot Target Info Failed\n"); 1023 "BG_%d : Getting Boot Target Info Failed\n");
1024 return -EAGAIN; 1024 return -EAGAIN;
1025 } else 1025 }
1026 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 1026
1027 phba->ctrl.mcc_numtag[tag]); 1027 rc = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
1028 1028 if (rc) {
1029 wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF0000) >> 16;
1030 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
1031 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
1032 if (status || extd_status) {
1033 beiscsi_log(phba, KERN_ERR, 1029 beiscsi_log(phba, KERN_ERR,
1034 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG, 1030 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
1035 "BG_%d : mgmt_get_boot_target Failed" 1031 "BG_%d : MBX CMD get_boot_target Failed\n");
1036 " status = %d extd_status = %d\n",
1037 status, extd_status);
1038 free_mcc_tag(&phba->ctrl, tag);
1039 return -EBUSY; 1032 return -EBUSY;
1040 } 1033 }
1041 wrb = queue_get_wrb(mccq, wrb_num); 1034
1042 free_mcc_tag(&phba->ctrl, tag);
1043 boot_resp = embedded_payload(wrb); 1035 boot_resp = embedded_payload(wrb);
1044 1036
1045 /* Check if the there are any Boot targets configured */ 1037 /* Check if the there are any Boot targets configured */
@@ -1064,24 +1056,15 @@ int be_mgmt_get_boot_shandle(struct beiscsi_hba *phba,
1064 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG, 1056 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
1065 "BG_%d : mgmt_reopen_session Failed\n"); 1057 "BG_%d : mgmt_reopen_session Failed\n");
1066 return -EAGAIN; 1058 return -EAGAIN;
1067 } else 1059 }
1068 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 1060
1069 phba->ctrl.mcc_numtag[tag]); 1061 rc = beiscsi_mccq_compl(phba, tag, NULL, NULL);
1070 1062 if (rc) {
1071 wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF0000) >> 16;
1072 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
1073 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
1074 if (status || extd_status) {
1075 beiscsi_log(phba, KERN_ERR, 1063 beiscsi_log(phba, KERN_ERR,
1076 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG, 1064 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
1077 "BG_%d : mgmt_reopen_session Failed" 1065 "BG_%d : mgmt_reopen_session Failed");
1078 " status = %d extd_status = %d\n", 1066 return rc;
1079 status, extd_status);
1080 free_mcc_tag(&phba->ctrl, tag);
1081 return -EBUSY;
1082 } 1067 }
1083 free_mcc_tag(&phba->ctrl, tag);
1084
1085 } while (--boot_retry); 1068 } while (--boot_retry);
1086 1069
1087 /* Couldn't log into the boot target */ 1070 /* Couldn't log into the boot target */
@@ -1106,8 +1089,9 @@ int be_mgmt_get_boot_shandle(struct beiscsi_hba *phba,
1106int mgmt_set_vlan(struct beiscsi_hba *phba, 1089int mgmt_set_vlan(struct beiscsi_hba *phba,
1107 uint16_t vlan_tag) 1090 uint16_t vlan_tag)
1108{ 1091{
1109 unsigned int tag, wrb_num; 1092 int rc;
1110 unsigned short status, extd_status; 1093 unsigned int tag;
1094 struct be_mcc_wrb *wrb = NULL;
1111 1095
1112 tag = be_cmd_set_vlan(phba, vlan_tag); 1096 tag = be_cmd_set_vlan(phba, vlan_tag);
1113 if (!tag) { 1097 if (!tag) {
@@ -1115,26 +1099,16 @@ int mgmt_set_vlan(struct beiscsi_hba *phba,
1115 (BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX), 1099 (BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX),
1116 "BG_%d : VLAN Setting Failed\n"); 1100 "BG_%d : VLAN Setting Failed\n");
1117 return -EBUSY; 1101 return -EBUSY;
1118 } else 1102 }
1119 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
1120 phba->ctrl.mcc_numtag[tag]);
1121
1122 wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF0000) >> 16;
1123 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
1124 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
1125 1103
1126 if (status || extd_status) { 1104 rc = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
1105 if (rc) {
1127 beiscsi_log(phba, KERN_ERR, 1106 beiscsi_log(phba, KERN_ERR,
1128 (BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX), 1107 (BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX),
1129 "BS_%d : status : %d extd_status : %d\n", 1108 "BS_%d : VLAN MBX Cmd Failed\n");
1130 status, extd_status); 1109 return rc;
1131
1132 free_mcc_tag(&phba->ctrl, tag);
1133 return -EAGAIN;
1134 } 1110 }
1135 1111 return rc;
1136 free_mcc_tag(&phba->ctrl, tag);
1137 return 0;
1138} 1112}
1139 1113
1140/** 1114/**