aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi
diff options
context:
space:
mode:
authorJohn Soni Jose <sony.john-n@emulex.com>2012-08-20 13:30:18 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-09-14 12:59:27 -0400
commit99bc5d55c06cbf9ac2d8ab7fb8348c4abce5fbaf (patch)
treefbee8df63f7a62916e93fcbae5f3e0cc9d103735 /drivers/scsi/be2iscsi
parent9aef4200ee25636edd77b022f996b6f5870ce567 (diff)
[SCSI] be2iscsi: Added Logging mechanism for the driver.
Added new log level mechanism for different events. These log levels can be set at driver load time/run time. The log level is set for each Scsi_host. Fixed few multi-line print warning to get over the new checkpatch.pl warnings on multi-line strings. Signed-off-by: John Soni Jose <sony.john-n@emulex.com> Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/be2iscsi')
-rw-r--r--drivers/scsi/be2iscsi/be_cmds.c118
-rw-r--r--drivers/scsi/be2iscsi/be_iscsi.c261
-rw-r--r--drivers/scsi/be2iscsi/be_main.c824
-rw-r--r--drivers/scsi/be2iscsi/be_main.h37
-rw-r--r--drivers/scsi/be2iscsi/be_mgmt.c157
5 files changed, 886 insertions, 511 deletions
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index d2e9e933f7a3..d0058e38bc62 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -48,7 +48,8 @@ int beiscsi_pci_soft_reset(struct beiscsi_hba *phba)
48 } 48 }
49 49
50 if (sreset & BE2_SET_RESET) { 50 if (sreset & BE2_SET_RESET) {
51 printk(KERN_ERR "Soft Reset did not deassert\n"); 51 printk(KERN_ERR DRV_NAME
52 " Soft Reset did not deassert\n");
52 return -EIO; 53 return -EIO;
53 } 54 }
54 pconline1 = BE2_MPU_IRAM_ONLINE; 55 pconline1 = BE2_MPU_IRAM_ONLINE;
@@ -67,7 +68,8 @@ int beiscsi_pci_soft_reset(struct beiscsi_hba *phba)
67 i++; 68 i++;
68 } 69 }
69 if (sreset & BE2_SET_RESET) { 70 if (sreset & BE2_SET_RESET) {
70 printk(KERN_ERR "MPU Online Soft Reset did not deassert\n"); 71 printk(KERN_ERR DRV_NAME
72 " MPU Online Soft Reset did not deassert\n");
71 return -EIO; 73 return -EIO;
72 } 74 }
73 return 0; 75 return 0;
@@ -93,8 +95,9 @@ int be_chk_reset_complete(struct beiscsi_hba *phba)
93 } 95 }
94 96
95 if ((status & 0x80000000) || (!num_loop)) { 97 if ((status & 0x80000000) || (!num_loop)) {
96 printk(KERN_ERR "Failed in be_chk_reset_complete" 98 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
97 "status = 0x%x\n", status); 99 "BC_%d : Failed in be_chk_reset_complete"
100 "status = 0x%x\n", status);
98 return -EIO; 101 return -EIO;
99 } 102 }
100 103
@@ -169,6 +172,7 @@ static int be_mcc_compl_process(struct be_ctrl_info *ctrl,
169 struct be_mcc_compl *compl) 172 struct be_mcc_compl *compl)
170{ 173{
171 u16 compl_status, extd_status; 174 u16 compl_status, extd_status;
175 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
172 176
173 be_dws_le_to_cpu(compl, 4); 177 be_dws_le_to_cpu(compl, 4);
174 178
@@ -177,9 +181,12 @@ static int be_mcc_compl_process(struct be_ctrl_info *ctrl,
177 if (compl_status != MCC_STATUS_SUCCESS) { 181 if (compl_status != MCC_STATUS_SUCCESS) {
178 extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) & 182 extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
179 CQE_STATUS_EXTD_MASK; 183 CQE_STATUS_EXTD_MASK;
180 dev_err(&ctrl->pdev->dev, 184
181 "error in cmd completion: status(compl/extd)=%d/%d\n", 185 beiscsi_log(phba, KERN_ERR,
182 compl_status, extd_status); 186 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
187 "BC_%d : error in cmd completion: status(compl/extd)=%d/%d\n",
188 compl_status, extd_status);
189
183 return -EBUSY; 190 return -EBUSY;
184 } 191 }
185 return 0; 192 return 0;
@@ -233,22 +240,29 @@ void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
233{ 240{
234 switch (evt->port_link_status) { 241 switch (evt->port_link_status) {
235 case ASYNC_EVENT_LINK_DOWN: 242 case ASYNC_EVENT_LINK_DOWN:
236 SE_DEBUG(DBG_LVL_1, "Link Down on Physical Port %d\n", 243 beiscsi_log(phba, KERN_ERR,
237 evt->physical_port); 244 BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
245 "BC_%d : Link Down on Physical Port %d\n",
246 evt->physical_port);
247
238 phba->state |= BE_ADAPTER_LINK_DOWN; 248 phba->state |= BE_ADAPTER_LINK_DOWN;
239 iscsi_host_for_each_session(phba->shost, 249 iscsi_host_for_each_session(phba->shost,
240 be2iscsi_fail_session); 250 be2iscsi_fail_session);
241 break; 251 break;
242 case ASYNC_EVENT_LINK_UP: 252 case ASYNC_EVENT_LINK_UP:
243 phba->state = BE_ADAPTER_UP; 253 phba->state = BE_ADAPTER_UP;
244 SE_DEBUG(DBG_LVL_1, "Link UP on Physical Port %d\n", 254 beiscsi_log(phba, KERN_ERR,
245 evt->physical_port); 255 BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
256 "BC_%d : Link UP on Physical Port %d\n",
257 evt->physical_port);
246 break; 258 break;
247 default: 259 default:
248 SE_DEBUG(DBG_LVL_1, "Unexpected Async Notification %d on" 260 beiscsi_log(phba, KERN_ERR,
249 "Physical Port %d\n", 261 BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
250 evt->port_link_status, 262 "BC_%d : Unexpected Async Notification %d on"
251 evt->physical_port); 263 "Physical Port %d\n",
264 evt->port_link_status,
265 evt->physical_port);
252 } 266 }
253} 267}
254 268
@@ -279,9 +293,11 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
279 beiscsi_async_link_state_process(phba, 293 beiscsi_async_link_state_process(phba,
280 (struct be_async_event_link_state *) compl); 294 (struct be_async_event_link_state *) compl);
281 else 295 else
282 SE_DEBUG(DBG_LVL_1, 296 beiscsi_log(phba, KERN_ERR,
283 " Unsupported Async Event, flags" 297 BEISCSI_LOG_CONFIG |
284 " = 0x%08x\n", compl->flags); 298 BEISCSI_LOG_MBOX,
299 "BC_%d : Unsupported Async Event, flags"
300 " = 0x%08x\n", compl->flags);
285 301
286 } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) { 302 } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) {
287 status = be_mcc_compl_process(ctrl, compl); 303 status = be_mcc_compl_process(ctrl, compl);
@@ -312,7 +328,10 @@ static int be_mcc_wait_compl(struct beiscsi_hba *phba)
312 udelay(100); 328 udelay(100);
313 } 329 }
314 if (i == mcc_timeout) { 330 if (i == mcc_timeout) {
315 dev_err(&phba->pcidev->dev, "mccq poll timed out\n"); 331 beiscsi_log(phba, KERN_ERR,
332 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
333 "BC_%d : mccq poll timed out\n");
334
316 return -EBUSY; 335 return -EBUSY;
317 } 336 }
318 return 0; 337 return 0;
@@ -338,7 +357,11 @@ static int be_mbox_db_ready_wait(struct be_ctrl_info *ctrl)
338 break; 357 break;
339 358
340 if (cnt > 12000000) { 359 if (cnt > 12000000) {
341 dev_err(&ctrl->pdev->dev, "mbox_db poll timed out\n"); 360 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
361 beiscsi_log(phba, KERN_ERR,
362 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
363 "BC_%d : mbox_db poll timed out\n");
364
342 return -EBUSY; 365 return -EBUSY;
343 } 366 }
344 367
@@ -360,6 +383,7 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
360 struct be_dma_mem *mbox_mem = &ctrl->mbox_mem; 383 struct be_dma_mem *mbox_mem = &ctrl->mbox_mem;
361 struct be_mcc_mailbox *mbox = mbox_mem->va; 384 struct be_mcc_mailbox *mbox = mbox_mem->va;
362 struct be_mcc_compl *compl = &mbox->compl; 385 struct be_mcc_compl *compl = &mbox->compl;
386 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
363 387
364 val &= ~MPU_MAILBOX_DB_RDY_MASK; 388 val &= ~MPU_MAILBOX_DB_RDY_MASK;
365 val |= MPU_MAILBOX_DB_HI_MASK; 389 val |= MPU_MAILBOX_DB_HI_MASK;
@@ -368,7 +392,10 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
368 392
369 status = be_mbox_db_ready_wait(ctrl); 393 status = be_mbox_db_ready_wait(ctrl);
370 if (status != 0) { 394 if (status != 0) {
371 SE_DEBUG(DBG_LVL_1, " be_mbox_db_ready_wait failed\n"); 395 beiscsi_log(phba, KERN_ERR,
396 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
397 "BC_%d : be_mbox_db_ready_wait failed\n");
398
372 return status; 399 return status;
373 } 400 }
374 val = 0; 401 val = 0;
@@ -379,18 +406,27 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
379 406
380 status = be_mbox_db_ready_wait(ctrl); 407 status = be_mbox_db_ready_wait(ctrl);
381 if (status != 0) { 408 if (status != 0) {
382 SE_DEBUG(DBG_LVL_1, " be_mbox_db_ready_wait failed\n"); 409 beiscsi_log(phba, KERN_ERR,
410 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
411 "BC_%d : be_mbox_db_ready_wait failed\n");
412
383 return status; 413 return status;
384 } 414 }
385 if (be_mcc_compl_is_new(compl)) { 415 if (be_mcc_compl_is_new(compl)) {
386 status = be_mcc_compl_process(ctrl, &mbox->compl); 416 status = be_mcc_compl_process(ctrl, &mbox->compl);
387 be_mcc_compl_use(compl); 417 be_mcc_compl_use(compl);
388 if (status) { 418 if (status) {
389 SE_DEBUG(DBG_LVL_1, "After be_mcc_compl_process\n"); 419 beiscsi_log(phba, KERN_ERR,
420 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
421 "BC_%d : After be_mcc_compl_process\n");
422
390 return status; 423 return status;
391 } 424 }
392 } else { 425 } else {
393 dev_err(&ctrl->pdev->dev, "invalid mailbox completion\n"); 426 beiscsi_log(phba, KERN_ERR,
427 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
428 "BC_%d : Invalid Mailbox Completion\n");
429
394 return -EBUSY; 430 return -EBUSY;
395 } 431 }
396 return 0; 432 return 0;
@@ -436,7 +472,10 @@ static int be_mbox_notify_wait(struct beiscsi_hba *phba)
436 if (status) 472 if (status)
437 return status; 473 return status;
438 } else { 474 } else {
439 dev_err(&phba->pcidev->dev, "invalid mailbox completion\n"); 475 beiscsi_log(phba, KERN_ERR,
476 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
477 "BC_%d : invalid mailbox completion\n");
478
440 return -EBUSY; 479 return -EBUSY;
441 } 480 }
442 return 0; 481 return 0;
@@ -528,7 +567,6 @@ int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
528 struct be_dma_mem *q_mem = &eq->dma_mem; 567 struct be_dma_mem *q_mem = &eq->dma_mem;
529 int status; 568 int status;
530 569
531 SE_DEBUG(DBG_LVL_8, "In beiscsi_cmd_eq_create\n");
532 spin_lock(&ctrl->mbox_lock); 570 spin_lock(&ctrl->mbox_lock);
533 memset(wrb, 0, sizeof(*wrb)); 571 memset(wrb, 0, sizeof(*wrb));
534 572
@@ -563,10 +601,10 @@ int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
563int be_cmd_fw_initialize(struct be_ctrl_info *ctrl) 601int be_cmd_fw_initialize(struct be_ctrl_info *ctrl)
564{ 602{
565 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); 603 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
604 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
566 int status; 605 int status;
567 u8 *endian_check; 606 u8 *endian_check;
568 607
569 SE_DEBUG(DBG_LVL_8, "In be_cmd_fw_initialize\n");
570 spin_lock(&ctrl->mbox_lock); 608 spin_lock(&ctrl->mbox_lock);
571 memset(wrb, 0, sizeof(*wrb)); 609 memset(wrb, 0, sizeof(*wrb));
572 610
@@ -583,7 +621,8 @@ int be_cmd_fw_initialize(struct be_ctrl_info *ctrl)
583 621
584 status = be_mbox_notify(ctrl); 622 status = be_mbox_notify(ctrl);
585 if (status) 623 if (status)
586 SE_DEBUG(DBG_LVL_1, "be_cmd_fw_initialize Failed\n"); 624 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
625 "BC_%d : be_cmd_fw_initialize Failed\n");
587 626
588 spin_unlock(&ctrl->mbox_lock); 627 spin_unlock(&ctrl->mbox_lock);
589 return status; 628 return status;
@@ -596,11 +635,11 @@ int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl,
596 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); 635 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
597 struct be_cmd_req_cq_create *req = embedded_payload(wrb); 636 struct be_cmd_req_cq_create *req = embedded_payload(wrb);
598 struct be_cmd_resp_cq_create *resp = embedded_payload(wrb); 637 struct be_cmd_resp_cq_create *resp = embedded_payload(wrb);
638 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
599 struct be_dma_mem *q_mem = &cq->dma_mem; 639 struct be_dma_mem *q_mem = &cq->dma_mem;
600 void *ctxt = &req->context; 640 void *ctxt = &req->context;
601 int status; 641 int status;
602 642
603 SE_DEBUG(DBG_LVL_8, "In beiscsi_cmd_cq_create\n");
604 spin_lock(&ctrl->mbox_lock); 643 spin_lock(&ctrl->mbox_lock);
605 memset(wrb, 0, sizeof(*wrb)); 644 memset(wrb, 0, sizeof(*wrb));
606 645
@@ -608,8 +647,6 @@ int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl,
608 647
609 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, 648 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
610 OPCODE_COMMON_CQ_CREATE, sizeof(*req)); 649 OPCODE_COMMON_CQ_CREATE, sizeof(*req));
611 if (!q_mem->va)
612 SE_DEBUG(DBG_LVL_1, "uninitialized q_mem->va\n");
613 650
614 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); 651 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size));
615 652
@@ -633,8 +670,10 @@ int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl,
633 cq->id = le16_to_cpu(resp->cq_id); 670 cq->id = le16_to_cpu(resp->cq_id);
634 cq->created = true; 671 cq->created = true;
635 } else 672 } else
636 SE_DEBUG(DBG_LVL_1, "In be_cmd_cq_create, status=ox%08x\n", 673 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
637 status); 674 "BC_%d : In be_cmd_cq_create, status=ox%08x\n",
675 status);
676
638 spin_unlock(&ctrl->mbox_lock); 677 spin_unlock(&ctrl->mbox_lock);
639 678
640 return status; 679 return status;
@@ -700,10 +739,14 @@ int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q,
700{ 739{
701 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); 740 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
702 struct be_cmd_req_q_destroy *req = embedded_payload(wrb); 741 struct be_cmd_req_q_destroy *req = embedded_payload(wrb);
742 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
703 u8 subsys = 0, opcode = 0; 743 u8 subsys = 0, opcode = 0;
704 int status; 744 int status;
705 745
706 SE_DEBUG(DBG_LVL_8, "In beiscsi_cmd_q_destroy\n"); 746 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
747 "BC_%d : In beiscsi_cmd_q_destroy "
748 "queue_type : %d\n", queue_type);
749
707 spin_lock(&ctrl->mbox_lock); 750 spin_lock(&ctrl->mbox_lock);
708 memset(wrb, 0, sizeof(*wrb)); 751 memset(wrb, 0, sizeof(*wrb));
709 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 752 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
@@ -759,7 +802,6 @@ int be_cmd_create_default_pdu_queue(struct be_ctrl_info *ctrl,
759 void *ctxt = &req->context; 802 void *ctxt = &req->context;
760 int status; 803 int status;
761 804
762 SE_DEBUG(DBG_LVL_8, "In be_cmd_create_default_pdu_queue\n");
763 spin_lock(&ctrl->mbox_lock); 805 spin_lock(&ctrl->mbox_lock);
764 memset(wrb, 0, sizeof(*wrb)); 806 memset(wrb, 0, sizeof(*wrb));
765 807
@@ -830,6 +872,7 @@ int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl,
830{ 872{
831 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); 873 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
832 struct be_post_sgl_pages_req *req = embedded_payload(wrb); 874 struct be_post_sgl_pages_req *req = embedded_payload(wrb);
875 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
833 int status; 876 int status;
834 unsigned int curr_pages; 877 unsigned int curr_pages;
835 u32 internal_page_offset = 0; 878 u32 internal_page_offset = 0;
@@ -860,8 +903,9 @@ int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl,
860 903
861 status = be_mbox_notify(ctrl); 904 status = be_mbox_notify(ctrl);
862 if (status) { 905 if (status) {
863 SE_DEBUG(DBG_LVL_1, 906 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
864 "FW CMD to map iscsi frags failed.\n"); 907 "BC_%d : FW CMD to map iscsi frags failed.\n");
908
865 goto error; 909 goto error;
866 } 910 }
867 } while (num_pages > 0); 911 } while (num_pages > 0);
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 43f35034585d..41b1fb70dd3b 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -50,21 +50,27 @@ struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep,
50 struct beiscsi_session *beiscsi_sess; 50 struct beiscsi_session *beiscsi_sess;
51 struct beiscsi_io_task *io_task; 51 struct beiscsi_io_task *io_task;
52 52
53 SE_DEBUG(DBG_LVL_8, "In beiscsi_session_create\n");
54 53
55 if (!ep) { 54 if (!ep) {
56 SE_DEBUG(DBG_LVL_1, "beiscsi_session_create: invalid ep\n"); 55 printk(KERN_ERR
56 "beiscsi_session_create: invalid ep\n");
57 return NULL; 57 return NULL;
58 } 58 }
59 beiscsi_ep = ep->dd_data; 59 beiscsi_ep = ep->dd_data;
60 phba = beiscsi_ep->phba; 60 phba = beiscsi_ep->phba;
61 shost = phba->shost; 61 shost = phba->shost;
62
63 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
64 "BS_%d : In beiscsi_session_create\n");
65
62 if (cmds_max > beiscsi_ep->phba->params.wrbs_per_cxn) { 66 if (cmds_max > beiscsi_ep->phba->params.wrbs_per_cxn) {
63 shost_printk(KERN_ERR, shost, "Cannot handle %d cmds." 67 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
64 "Max cmds per session supported is %d. Using %d. " 68 "BS_%d : Cannot handle %d cmds."
65 "\n", cmds_max, 69 "Max cmds per session supported is %d. Using %d."
66 beiscsi_ep->phba->params.wrbs_per_cxn, 70 "\n", cmds_max,
67 beiscsi_ep->phba->params.wrbs_per_cxn); 71 beiscsi_ep->phba->params.wrbs_per_cxn,
72 beiscsi_ep->phba->params.wrbs_per_cxn);
73
68 cmds_max = beiscsi_ep->phba->params.wrbs_per_cxn; 74 cmds_max = beiscsi_ep->phba->params.wrbs_per_cxn;
69 } 75 }
70 76
@@ -102,7 +108,7 @@ void beiscsi_session_destroy(struct iscsi_cls_session *cls_session)
102 struct iscsi_session *sess = cls_session->dd_data; 108 struct iscsi_session *sess = cls_session->dd_data;
103 struct beiscsi_session *beiscsi_sess = sess->dd_data; 109 struct beiscsi_session *beiscsi_sess = sess->dd_data;
104 110
105 SE_DEBUG(DBG_LVL_8, "In beiscsi_session_destroy\n"); 111 printk(KERN_INFO "In beiscsi_session_destroy\n");
106 pci_pool_destroy(beiscsi_sess->bhs_pool); 112 pci_pool_destroy(beiscsi_sess->bhs_pool);
107 iscsi_session_teardown(cls_session); 113 iscsi_session_teardown(cls_session);
108} 114}
@@ -123,11 +129,13 @@ beiscsi_conn_create(struct iscsi_cls_session *cls_session, u32 cid)
123 struct iscsi_session *sess; 129 struct iscsi_session *sess;
124 struct beiscsi_session *beiscsi_sess; 130 struct beiscsi_session *beiscsi_sess;
125 131
126 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_create ,cid"
127 "from iscsi layer=%d\n", cid);
128 shost = iscsi_session_to_shost(cls_session); 132 shost = iscsi_session_to_shost(cls_session);
129 phba = iscsi_host_priv(shost); 133 phba = iscsi_host_priv(shost);
130 134
135 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
136 "BS_%d : In beiscsi_conn_create ,cid"
137 "from iscsi layer=%d\n", cid);
138
131 cls_conn = iscsi_conn_setup(cls_session, sizeof(*beiscsi_conn), cid); 139 cls_conn = iscsi_conn_setup(cls_session, sizeof(*beiscsi_conn), cid);
132 if (!cls_conn) 140 if (!cls_conn)
133 return NULL; 141 return NULL;
@@ -154,12 +162,15 @@ static int beiscsi_bindconn_cid(struct beiscsi_hba *phba,
154 unsigned int cid) 162 unsigned int cid)
155{ 163{
156 if (phba->conn_table[cid]) { 164 if (phba->conn_table[cid]) {
157 SE_DEBUG(DBG_LVL_1, 165 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
158 "Connection table already occupied. Detected clash\n"); 166 "BS_%d : Connection table already occupied. Detected clash\n");
167
159 return -EINVAL; 168 return -EINVAL;
160 } else { 169 } else {
161 SE_DEBUG(DBG_LVL_8, "phba->conn_table[%d]=%p(beiscsi_conn)\n", 170 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
162 cid, beiscsi_conn); 171 "BS_%d : phba->conn_table[%d]=%p(beiscsi_conn)\n",
172 cid, beiscsi_conn);
173
163 phba->conn_table[cid] = beiscsi_conn; 174 phba->conn_table[cid] = beiscsi_conn;
164 } 175 }
165 return 0; 176 return 0;
@@ -184,7 +195,6 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session,
184 struct beiscsi_endpoint *beiscsi_ep; 195 struct beiscsi_endpoint *beiscsi_ep;
185 struct iscsi_endpoint *ep; 196 struct iscsi_endpoint *ep;
186 197
187 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_bind\n");
188 ep = iscsi_lookup_endpoint(transport_fd); 198 ep = iscsi_lookup_endpoint(transport_fd);
189 if (!ep) 199 if (!ep)
190 return -EINVAL; 200 return -EINVAL;
@@ -195,17 +205,21 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session,
195 return -EINVAL; 205 return -EINVAL;
196 206
197 if (beiscsi_ep->phba != phba) { 207 if (beiscsi_ep->phba != phba) {
198 SE_DEBUG(DBG_LVL_8, 208 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
199 "beiscsi_ep->hba=%p not equal to phba=%p\n", 209 "BS_%d : beiscsi_ep->hba=%p not equal to phba=%p\n",
200 beiscsi_ep->phba, phba); 210 beiscsi_ep->phba, phba);
211
201 return -EEXIST; 212 return -EEXIST;
202 } 213 }
203 214
204 beiscsi_conn->beiscsi_conn_cid = beiscsi_ep->ep_cid; 215 beiscsi_conn->beiscsi_conn_cid = beiscsi_ep->ep_cid;
205 beiscsi_conn->ep = beiscsi_ep; 216 beiscsi_conn->ep = beiscsi_ep;
206 beiscsi_ep->conn = beiscsi_conn; 217 beiscsi_ep->conn = beiscsi_conn;
207 SE_DEBUG(DBG_LVL_8, "beiscsi_conn=%p conn=%p ep_cid=%d\n", 218
208 beiscsi_conn, conn, beiscsi_ep->ep_cid); 219 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
220 "BS_%d : beiscsi_conn=%p conn=%p ep_cid=%d\n",
221 beiscsi_conn, conn, beiscsi_ep->ep_cid);
222
209 return beiscsi_bindconn_cid(phba, beiscsi_conn, beiscsi_ep->ep_cid); 223 return beiscsi_bindconn_cid(phba, beiscsi_conn, beiscsi_ep->ep_cid);
210} 224}
211 225
@@ -219,8 +233,9 @@ static int beiscsi_create_ipv4_iface(struct beiscsi_hba *phba)
219 ISCSI_IFACE_TYPE_IPV4, 233 ISCSI_IFACE_TYPE_IPV4,
220 0, 0); 234 0, 0);
221 if (!phba->ipv4_iface) { 235 if (!phba->ipv4_iface) {
222 shost_printk(KERN_ERR, phba->shost, "Could not " 236 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
223 "create default IPv4 address.\n"); 237 "BS_%d : Could not "
238 "create default IPv4 address.\n");
224 return -ENODEV; 239 return -ENODEV;
225 } 240 }
226 241
@@ -237,8 +252,9 @@ static int beiscsi_create_ipv6_iface(struct beiscsi_hba *phba)
237 ISCSI_IFACE_TYPE_IPV6, 252 ISCSI_IFACE_TYPE_IPV6,
238 0, 0); 253 0, 0);
239 if (!phba->ipv6_iface) { 254 if (!phba->ipv6_iface) {
240 shost_printk(KERN_ERR, phba->shost, "Could not " 255 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
241 "create default IPv6 address.\n"); 256 "BS_%d : Could not "
257 "create default IPv6 address.\n");
242 return -ENODEV; 258 return -ENODEV;
243 } 259 }
244 260
@@ -299,12 +315,14 @@ beiscsi_set_static_ip(struct Scsi_Host *shost,
299 iface_ip = nla_data(nla); 315 iface_ip = nla_data(nla);
300 break; 316 break;
301 default: 317 default:
302 shost_printk(KERN_ERR, shost, "Unsupported param %d\n", 318 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
303 iface_param->param); 319 "BS_%d : Unsupported param %d\n",
320 iface_param->param);
304 } 321 }
305 322
306 if (!iface_ip || !iface_subnet) { 323 if (!iface_ip || !iface_subnet) {
307 shost_printk(KERN_ERR, shost, "IP and Subnet Mask required\n"); 324 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
325 "BS_%d : IP and Subnet Mask required\n");
308 return -EINVAL; 326 return -EINVAL;
309 } 327 }
310 328
@@ -335,8 +353,9 @@ beiscsi_set_ipv4(struct Scsi_Host *shost,
335 ret = beiscsi_set_static_ip(shost, iface_param, 353 ret = beiscsi_set_static_ip(shost, iface_param,
336 data, dt_len); 354 data, dt_len);
337 else 355 else
338 shost_printk(KERN_ERR, shost, "Invalid BOOTPROTO: %d\n", 356 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
339 iface_param->value[0]); 357 "BS_%d : Invalid BOOTPROTO: %d\n",
358 iface_param->value[0]);
340 break; 359 break;
341 case ISCSI_NET_PARAM_IFACE_ENABLE: 360 case ISCSI_NET_PARAM_IFACE_ENABLE:
342 if (iface_param->value[0] == ISCSI_IFACE_ENABLE) 361 if (iface_param->value[0] == ISCSI_IFACE_ENABLE)
@@ -350,8 +369,9 @@ beiscsi_set_ipv4(struct Scsi_Host *shost,
350 data, dt_len); 369 data, dt_len);
351 break; 370 break;
352 default: 371 default:
353 shost_printk(KERN_ERR, shost, "Param %d not supported\n", 372 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
354 iface_param->param); 373 "BS_%d : Param %d not supported\n",
374 iface_param->param);
355 } 375 }
356 376
357 return ret; 377 return ret;
@@ -379,8 +399,9 @@ beiscsi_set_ipv6(struct Scsi_Host *shost,
379 ISCSI_BOOTPROTO_STATIC); 399 ISCSI_BOOTPROTO_STATIC);
380 break; 400 break;
381 default: 401 default:
382 shost_printk(KERN_ERR, shost, "Param %d not supported\n", 402 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
383 iface_param->param); 403 "BS_%d : Param %d not supported\n",
404 iface_param->param);
384 } 405 }
385 406
386 return ret; 407 return ret;
@@ -390,6 +411,7 @@ int be2iscsi_iface_set_param(struct Scsi_Host *shost,
390 void *data, uint32_t dt_len) 411 void *data, uint32_t dt_len)
391{ 412{
392 struct iscsi_iface_param_info *iface_param = NULL; 413 struct iscsi_iface_param_info *iface_param = NULL;
414 struct beiscsi_hba *phba = iscsi_host_priv(shost);
393 struct nlattr *attrib; 415 struct nlattr *attrib;
394 uint32_t rm_len = dt_len; 416 uint32_t rm_len = dt_len;
395 int ret = 0 ; 417 int ret = 0 ;
@@ -404,9 +426,11 @@ int be2iscsi_iface_set_param(struct Scsi_Host *shost,
404 * BE2ISCSI only supports 1 interface 426 * BE2ISCSI only supports 1 interface
405 */ 427 */
406 if (iface_param->iface_num) { 428 if (iface_param->iface_num) {
407 shost_printk(KERN_ERR, shost, "Invalid iface_num %d." 429 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
408 "Only iface_num 0 is supported.\n", 430 "BS_%d : Invalid iface_num %d."
409 iface_param->iface_num); 431 "Only iface_num 0 is supported.\n",
432 iface_param->iface_num);
433
410 return -EINVAL; 434 return -EINVAL;
411 } 435 }
412 436
@@ -420,9 +444,9 @@ int be2iscsi_iface_set_param(struct Scsi_Host *shost,
420 data, dt_len); 444 data, dt_len);
421 break; 445 break;
422 default: 446 default:
423 shost_printk(KERN_ERR, shost, 447 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
424 "Invalid iface type :%d passed\n", 448 "BS_%d : Invalid iface type :%d passed\n",
425 iface_param->iface_type); 449 iface_param->iface_type);
426 break; 450 break;
427 } 451 }
428 452
@@ -518,7 +542,10 @@ int beiscsi_ep_get_param(struct iscsi_endpoint *ep,
518 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data; 542 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
519 int len = 0; 543 int len = 0;
520 544
521 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_get_param, param= %d\n", param); 545 beiscsi_log(beiscsi_ep->phba, KERN_INFO,
546 BEISCSI_LOG_CONFIG,
547 "BS_%d : In beiscsi_ep_get_param,"
548 " param= %d\n", param);
522 549
523 switch (param) { 550 switch (param) {
524 case ISCSI_PARAM_CONN_PORT: 551 case ISCSI_PARAM_CONN_PORT:
@@ -541,9 +568,14 @@ int beiscsi_set_param(struct iscsi_cls_conn *cls_conn,
541{ 568{
542 struct iscsi_conn *conn = cls_conn->dd_data; 569 struct iscsi_conn *conn = cls_conn->dd_data;
543 struct iscsi_session *session = conn->session; 570 struct iscsi_session *session = conn->session;
571 struct beiscsi_hba *phba = NULL;
544 int ret; 572 int ret;
545 573
546 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_set_param, param= %d\n", param); 574 phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
575 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
576 "BS_%d : In beiscsi_conn_set_param,"
577 " param= %d\n", param);
578
547 ret = iscsi_set_param(cls_conn, param, buf, buflen); 579 ret = iscsi_set_param(cls_conn, param, buf, buflen);
548 if (ret) 580 if (ret)
549 return ret; 581 return ret;
@@ -593,7 +625,9 @@ static int beiscsi_get_initname(char *buf, struct beiscsi_hba *phba)
593 625
594 tag = be_cmd_get_initname(phba); 626 tag = be_cmd_get_initname(phba);
595 if (!tag) { 627 if (!tag) {
596 SE_DEBUG(DBG_LVL_1, "Getting Initiator Name Failed\n"); 628 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
629 "BS_%d : Getting Initiator Name Failed\n");
630
597 return -EBUSY; 631 return -EBUSY;
598 } else 632 } else
599 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 633 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
@@ -604,9 +638,12 @@ static int beiscsi_get_initname(char *buf, struct beiscsi_hba *phba)
604 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 638 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
605 639
606 if (status || extd_status) { 640 if (status || extd_status) {
607 SE_DEBUG(DBG_LVL_1, "MailBox Command Failed with " 641 beiscsi_log(phba, KERN_ERR,
608 "status = %d extd_status = %d\n", 642 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
609 status, extd_status); 643 "BS_%d : MailBox Command Failed with "
644 "status = %d extd_status = %d\n",
645 status, extd_status);
646
610 free_mcc_tag(&phba->ctrl, tag); 647 free_mcc_tag(&phba->ctrl, tag);
611 return -EAGAIN; 648 return -EAGAIN;
612 } 649 }
@@ -650,7 +687,9 @@ static int beiscsi_get_port_speed(struct Scsi_Host *shost)
650 687
651 tag = be_cmd_get_port_speed(phba); 688 tag = be_cmd_get_port_speed(phba);
652 if (!tag) { 689 if (!tag) {
653 SE_DEBUG(DBG_LVL_1, "Getting Port Speed Failed\n"); 690 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
691 "BS_%d : Getting Port Speed Failed\n");
692
654 return -EBUSY; 693 return -EBUSY;
655 } else 694 } else
656 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 695 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
@@ -661,9 +700,12 @@ static int beiscsi_get_port_speed(struct Scsi_Host *shost)
661 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 700 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
662 701
663 if (status || extd_status) { 702 if (status || extd_status) {
664 SE_DEBUG(DBG_LVL_1, "MailBox Command Failed with " 703 beiscsi_log(phba, KERN_ERR,
665 "status = %d extd_status = %d\n", 704 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
666 status, extd_status); 705 "BS_%d : MailBox Command Failed with "
706 "status = %d extd_status = %d\n",
707 status, extd_status);
708
667 free_mcc_tag(&phba->ctrl, tag); 709 free_mcc_tag(&phba->ctrl, tag);
668 return -EAGAIN; 710 return -EAGAIN;
669 } 711 }
@@ -704,20 +746,24 @@ int beiscsi_get_host_param(struct Scsi_Host *shost,
704 struct beiscsi_hba *phba = iscsi_host_priv(shost); 746 struct beiscsi_hba *phba = iscsi_host_priv(shost);
705 int status = 0; 747 int status = 0;
706 748
707 SE_DEBUG(DBG_LVL_8, "In beiscsi_get_host_param, param= %d\n", param); 749 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
750 "BS_%d : In beiscsi_get_host_param,"
751 " param= %d\n", param);
752
708 switch (param) { 753 switch (param) {
709 case ISCSI_HOST_PARAM_HWADDRESS: 754 case ISCSI_HOST_PARAM_HWADDRESS:
710 status = beiscsi_get_macaddr(buf, phba); 755 status = beiscsi_get_macaddr(buf, phba);
711 if (status < 0) { 756 if (status < 0) {
712 SE_DEBUG(DBG_LVL_1, "beiscsi_get_macaddr Failed\n"); 757 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
758 "BS_%d : beiscsi_get_macaddr Failed\n");
713 return status; 759 return status;
714 } 760 }
715 break; 761 break;
716 case ISCSI_HOST_PARAM_INITIATOR_NAME: 762 case ISCSI_HOST_PARAM_INITIATOR_NAME:
717 status = beiscsi_get_initname(buf, phba); 763 status = beiscsi_get_initname(buf, phba);
718 if (status < 0) { 764 if (status < 0) {
719 SE_DEBUG(DBG_LVL_1, 765 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
720 "Retreiving Initiator Name Failed\n"); 766 "BS_%d : Retreiving Initiator Name Failed\n");
721 return status; 767 return status;
722 } 768 }
723 break; 769 break;
@@ -728,8 +774,8 @@ int beiscsi_get_host_param(struct Scsi_Host *shost,
728 case ISCSI_HOST_PARAM_PORT_SPEED: 774 case ISCSI_HOST_PARAM_PORT_SPEED:
729 status = beiscsi_get_port_speed(shost); 775 status = beiscsi_get_port_speed(shost);
730 if (status) { 776 if (status) {
731 SE_DEBUG(DBG_LVL_1, 777 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
732 "Retreiving Port Speed Failed\n"); 778 "BS_%d : Retreiving Port Speed Failed\n");
733 return status; 779 return status;
734 } 780 }
735 status = sprintf(buf, "%s\n", iscsi_get_port_speed_name(shost)); 781 status = sprintf(buf, "%s\n", iscsi_get_port_speed_name(shost));
@@ -768,8 +814,12 @@ void beiscsi_conn_get_stats(struct iscsi_cls_conn *cls_conn,
768 struct iscsi_stats *stats) 814 struct iscsi_stats *stats)
769{ 815{
770 struct iscsi_conn *conn = cls_conn->dd_data; 816 struct iscsi_conn *conn = cls_conn->dd_data;
817 struct beiscsi_hba *phba = NULL;
818
819 phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
820 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
821 "BS_%d : In beiscsi_conn_get_stats\n");
771 822
772 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_get_stats\n");
773 stats->txdata_octets = conn->txdata_octets; 823 stats->txdata_octets = conn->txdata_octets;
774 stats->rxdata_octets = conn->rxdata_octets; 824 stats->rxdata_octets = conn->rxdata_octets;
775 stats->dataout_pdus = conn->dataout_pdus_cnt; 825 stats->dataout_pdus = conn->dataout_pdus_cnt;
@@ -829,11 +879,16 @@ int beiscsi_conn_start(struct iscsi_cls_conn *cls_conn)
829 struct beiscsi_endpoint *beiscsi_ep; 879 struct beiscsi_endpoint *beiscsi_ep;
830 struct beiscsi_offload_params params; 880 struct beiscsi_offload_params params;
831 881
832 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_start\n"); 882 beiscsi_log(beiscsi_conn->phba, KERN_INFO,
883 BEISCSI_LOG_CONFIG,
884 "BS_%d : In beiscsi_conn_start\n");
885
833 memset(&params, 0, sizeof(struct beiscsi_offload_params)); 886 memset(&params, 0, sizeof(struct beiscsi_offload_params));
834 beiscsi_ep = beiscsi_conn->ep; 887 beiscsi_ep = beiscsi_conn->ep;
835 if (!beiscsi_ep) 888 if (!beiscsi_ep)
836 SE_DEBUG(DBG_LVL_1, "In beiscsi_conn_start , no beiscsi_ep\n"); 889 beiscsi_log(beiscsi_conn->phba, KERN_ERR,
890 BEISCSI_LOG_CONFIG,
891 "BS_%d : In beiscsi_conn_start , no beiscsi_ep\n");
837 892
838 beiscsi_conn->login_in_progress = 0; 893 beiscsi_conn->login_in_progress = 0;
839 beiscsi_set_params_for_offld(beiscsi_conn, &params); 894 beiscsi_set_params_for_offld(beiscsi_conn, &params);
@@ -907,19 +962,27 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
907 unsigned int tag, wrb_num; 962 unsigned int tag, wrb_num;
908 int ret = -ENOMEM; 963 int ret = -ENOMEM;
909 964
910 SE_DEBUG(DBG_LVL_8, "In beiscsi_open_conn\n"); 965 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
966 "BS_%d : In beiscsi_open_conn\n");
967
911 beiscsi_ep->ep_cid = beiscsi_get_cid(phba); 968 beiscsi_ep->ep_cid = beiscsi_get_cid(phba);
912 if (beiscsi_ep->ep_cid == 0xFFFF) { 969 if (beiscsi_ep->ep_cid == 0xFFFF) {
913 SE_DEBUG(DBG_LVL_1, "No free cid available\n"); 970 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
971 "BS_%d : No free cid available\n");
914 return ret; 972 return ret;
915 } 973 }
916 SE_DEBUG(DBG_LVL_8, "In beiscsi_open_conn, ep_cid=%d\n", 974
917 beiscsi_ep->ep_cid); 975 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
976 "BS_%d : In beiscsi_open_conn, ep_cid=%d\n",
977 beiscsi_ep->ep_cid);
978
918 phba->ep_array[beiscsi_ep->ep_cid - 979 phba->ep_array[beiscsi_ep->ep_cid -
919 phba->fw_config.iscsi_cid_start] = ep; 980 phba->fw_config.iscsi_cid_start] = ep;
920 if (beiscsi_ep->ep_cid > (phba->fw_config.iscsi_cid_start + 981 if (beiscsi_ep->ep_cid > (phba->fw_config.iscsi_cid_start +
921 phba->params.cxns_per_ctrl * 2)) { 982 phba->params.cxns_per_ctrl * 2)) {
922 SE_DEBUG(DBG_LVL_1, "Failed in allocate iscsi cid\n"); 983
984 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
985 "BS_%d : Failed in allocate iscsi cid\n");
923 goto free_ep; 986 goto free_ep;
924 } 987 }
925 988
@@ -928,9 +991,11 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
928 sizeof(struct tcp_connect_and_offload_in), 991 sizeof(struct tcp_connect_and_offload_in),
929 &nonemb_cmd.dma); 992 &nonemb_cmd.dma);
930 if (nonemb_cmd.va == NULL) { 993 if (nonemb_cmd.va == NULL) {
931 SE_DEBUG(DBG_LVL_1, 994
932 "Failed to allocate memory for mgmt_open_connection" 995 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
933 "\n"); 996 "BS_%d : Failed to allocate memory for"
997 " mgmt_open_connection\n");
998
934 beiscsi_put_cid(phba, beiscsi_ep->ep_cid); 999 beiscsi_put_cid(phba, beiscsi_ep->ep_cid);
935 return -ENOMEM; 1000 return -ENOMEM;
936 } 1001 }
@@ -938,9 +1003,10 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
938 memset(nonemb_cmd.va, 0, nonemb_cmd.size); 1003 memset(nonemb_cmd.va, 0, nonemb_cmd.size);
939 tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep, &nonemb_cmd); 1004 tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep, &nonemb_cmd);
940 if (!tag) { 1005 if (!tag) {
941 SE_DEBUG(DBG_LVL_1, 1006 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
942 "mgmt_open_connection Failed for cid=%d\n", 1007 "BS_%d : mgmt_open_connection Failed for cid=%d\n",
943 beiscsi_ep->ep_cid); 1008 beiscsi_ep->ep_cid);
1009
944 beiscsi_put_cid(phba, beiscsi_ep->ep_cid); 1010 beiscsi_put_cid(phba, beiscsi_ep->ep_cid);
945 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 1011 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
946 nonemb_cmd.va, nonemb_cmd.dma); 1012 nonemb_cmd.va, nonemb_cmd.dma);
@@ -953,9 +1019,12 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
953 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8; 1019 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
954 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 1020 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
955 if (status || extd_status) { 1021 if (status || extd_status) {
956 SE_DEBUG(DBG_LVL_1, "mgmt_open_connection Failed" 1022 beiscsi_log(phba, KERN_ERR,
957 " status = %d extd_status = %d\n", 1023 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
958 status, extd_status); 1024 "BS_%d : mgmt_open_connection Failed"
1025 " status = %d extd_status = %d\n",
1026 status, extd_status);
1027
959 free_mcc_tag(&phba->ctrl, tag); 1028 free_mcc_tag(&phba->ctrl, tag);
960 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 1029 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
961 nonemb_cmd.va, nonemb_cmd.dma); 1030 nonemb_cmd.va, nonemb_cmd.dma);
@@ -968,7 +1037,8 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
968 beiscsi_ep = ep->dd_data; 1037 beiscsi_ep = ep->dd_data;
969 beiscsi_ep->fw_handle = ptcpcnct_out->connection_handle; 1038 beiscsi_ep->fw_handle = ptcpcnct_out->connection_handle;
970 beiscsi_ep->cid_vld = 1; 1039 beiscsi_ep->cid_vld = 1;
971 SE_DEBUG(DBG_LVL_8, "mgmt_open_connection Success\n"); 1040 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1041 "BS_%d : mgmt_open_connection Success\n");
972 } 1042 }
973 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 1043 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
974 nonemb_cmd.va, nonemb_cmd.dma); 1044 nonemb_cmd.va, nonemb_cmd.dma);
@@ -996,18 +1066,19 @@ beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
996 struct iscsi_endpoint *ep; 1066 struct iscsi_endpoint *ep;
997 int ret; 1067 int ret;
998 1068
999 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_connect\n");
1000 if (shost) 1069 if (shost)
1001 phba = iscsi_host_priv(shost); 1070 phba = iscsi_host_priv(shost);
1002 else { 1071 else {
1003 ret = -ENXIO; 1072 ret = -ENXIO;
1004 SE_DEBUG(DBG_LVL_1, "shost is NULL\n"); 1073 printk(KERN_ERR
1074 "beiscsi_ep_connect shost is NULL\n");
1005 return ERR_PTR(ret); 1075 return ERR_PTR(ret);
1006 } 1076 }
1007 1077
1008 if (phba->state != BE_ADAPTER_UP) { 1078 if (phba->state != BE_ADAPTER_UP) {
1009 ret = -EBUSY; 1079 ret = -EBUSY;
1010 SE_DEBUG(DBG_LVL_1, "The Adapter state is Not UP\n"); 1080 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1081 "BS_%d : The Adapter state is Not UP\n");
1011 return ERR_PTR(ret); 1082 return ERR_PTR(ret);
1012 } 1083 }
1013 1084
@@ -1022,7 +1093,8 @@ beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
1022 beiscsi_ep->openiscsi_ep = ep; 1093 beiscsi_ep->openiscsi_ep = ep;
1023 ret = beiscsi_open_conn(ep, NULL, dst_addr, non_blocking); 1094 ret = beiscsi_open_conn(ep, NULL, dst_addr, non_blocking);
1024 if (ret) { 1095 if (ret) {
1025 SE_DEBUG(DBG_LVL_1, "Failed in beiscsi_open_conn\n"); 1096 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1097 "BS_%d : Failed in beiscsi_open_conn\n");
1026 goto free_ep; 1098 goto free_ep;
1027 } 1099 }
1028 1100
@@ -1044,7 +1116,9 @@ int beiscsi_ep_poll(struct iscsi_endpoint *ep, int timeout_ms)
1044{ 1116{
1045 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data; 1117 struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
1046 1118
1047 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_poll\n"); 1119 beiscsi_log(beiscsi_ep->phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1120 "BS_%d : In beiscsi_ep_poll\n");
1121
1048 if (beiscsi_ep->cid_vld == 1) 1122 if (beiscsi_ep->cid_vld == 1)
1049 return 1; 1123 return 1;
1050 else 1124 else
@@ -1064,8 +1138,10 @@ static int beiscsi_close_conn(struct beiscsi_endpoint *beiscsi_ep, int flag)
1064 1138
1065 tag = mgmt_upload_connection(phba, beiscsi_ep->ep_cid, flag); 1139 tag = mgmt_upload_connection(phba, beiscsi_ep->ep_cid, flag);
1066 if (!tag) { 1140 if (!tag) {
1067 SE_DEBUG(DBG_LVL_8, "upload failed for cid 0x%x\n", 1141 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1068 beiscsi_ep->ep_cid); 1142 "BS_%d : upload failed for cid 0x%x\n",
1143 beiscsi_ep->ep_cid);
1144
1069 ret = -EAGAIN; 1145 ret = -EAGAIN;
1070 } else { 1146 } else {
1071 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 1147 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
@@ -1086,7 +1162,8 @@ static int beiscsi_unbind_conn_to_cid(struct beiscsi_hba *phba,
1086 if (phba->conn_table[cid]) 1162 if (phba->conn_table[cid])
1087 phba->conn_table[cid] = NULL; 1163 phba->conn_table[cid] = NULL;
1088 else { 1164 else {
1089 SE_DEBUG(DBG_LVL_8, "Connection table Not occupied.\n"); 1165 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1166 "BS_%d : Connection table Not occupied.\n");
1090 return -EINVAL; 1167 return -EINVAL;
1091 } 1168 }
1092 return 0; 1169 return 0;
@@ -1108,27 +1185,31 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
1108 1185
1109 beiscsi_ep = ep->dd_data; 1186 beiscsi_ep = ep->dd_data;
1110 phba = beiscsi_ep->phba; 1187 phba = beiscsi_ep->phba;
1111 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_disconnect for ep_cid = %d\n", 1188 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1112 beiscsi_ep->ep_cid); 1189 "BS_%d : In beiscsi_ep_disconnect for ep_cid = %d\n",
1190 beiscsi_ep->ep_cid);
1113 1191
1114 if (!beiscsi_ep->conn) { 1192 if (!beiscsi_ep->conn) {
1115 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_disconnect, no " 1193 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1116 "beiscsi_ep\n"); 1194 "BS_%d : In beiscsi_ep_disconnect, no "
1195 "beiscsi_ep\n");
1117 return; 1196 return;
1118 } 1197 }
1119 beiscsi_conn = beiscsi_ep->conn; 1198 beiscsi_conn = beiscsi_ep->conn;
1120 iscsi_suspend_queue(beiscsi_conn->conn); 1199 iscsi_suspend_queue(beiscsi_conn->conn);
1121 1200
1122 SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_disconnect ep_cid = %d\n", 1201 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1123 beiscsi_ep->ep_cid); 1202 "BS_%d : In beiscsi_ep_disconnect ep_cid = %d\n",
1203 beiscsi_ep->ep_cid);
1124 1204
1125 tag = mgmt_invalidate_connection(phba, beiscsi_ep, 1205 tag = mgmt_invalidate_connection(phba, beiscsi_ep,
1126 beiscsi_ep->ep_cid, 1, 1206 beiscsi_ep->ep_cid, 1,
1127 savecfg_flag); 1207 savecfg_flag);
1128 if (!tag) { 1208 if (!tag) {
1129 SE_DEBUG(DBG_LVL_1, 1209 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
1130 "mgmt_invalidate_connection Failed for cid=%d\n", 1210 "BS_%d : mgmt_invalidate_connection"
1131 beiscsi_ep->ep_cid); 1211 " Failed for cid=%d\n",
1212 beiscsi_ep->ep_cid);
1132 } else { 1213 } else {
1133 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 1214 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
1134 phba->ctrl.mcc_numtag[tag]); 1215 phba->ctrl.mcc_numtag[tag]);
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 4b283a25d025..56370587be91 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -57,9 +57,105 @@ MODULE_LICENSE("GPL");
57module_param(be_iopoll_budget, int, 0); 57module_param(be_iopoll_budget, int, 0);
58module_param(enable_msix, int, 0); 58module_param(enable_msix, int, 0);
59module_param(be_max_phys_size, uint, S_IRUGO); 59module_param(be_max_phys_size, uint, S_IRUGO);
60MODULE_PARM_DESC(be_max_phys_size, "Maximum Size (In Kilobytes) of physically" 60MODULE_PARM_DESC(be_max_phys_size,
61 "contiguous memory that can be allocated." 61 "Maximum Size (In Kilobytes) of physically contiguous "
62 "Range is 16 - 128"); 62 "memory that can be allocated. Range is 16 - 128");
63
64#define beiscsi_disp_param(_name)\
65ssize_t \
66beiscsi_##_name##_disp(struct device *dev,\
67 struct device_attribute *attrib, char *buf) \
68{ \
69 struct Scsi_Host *shost = class_to_shost(dev);\
70 struct beiscsi_hba *phba = iscsi_host_priv(shost); \
71 uint32_t param_val = 0; \
72 param_val = phba->attr_##_name;\
73 return snprintf(buf, PAGE_SIZE, "%d\n",\
74 phba->attr_##_name);\
75}
76
77#define beiscsi_change_param(_name, _minval, _maxval, _defaval)\
78int \
79beiscsi_##_name##_change(struct beiscsi_hba *phba, uint32_t val)\
80{\
81 if (val >= _minval && val <= _maxval) {\
82 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,\
83 "BA_%d : beiscsi_"#_name" updated "\
84 "from 0x%x ==> 0x%x\n",\
85 phba->attr_##_name, val); \
86 phba->attr_##_name = val;\
87 return 0;\
88 } \
89 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, \
90 "BA_%d beiscsi_"#_name" attribute "\
91 "cannot be updated to 0x%x, "\
92 "range allowed is ["#_minval" - "#_maxval"]\n", val);\
93 return -EINVAL;\
94}
95
96#define beiscsi_store_param(_name) \
97ssize_t \
98beiscsi_##_name##_store(struct device *dev,\
99 struct device_attribute *attr, const char *buf,\
100 size_t count) \
101{ \
102 struct Scsi_Host *shost = class_to_shost(dev);\
103 struct beiscsi_hba *phba = iscsi_host_priv(shost);\
104 uint32_t param_val = 0;\
105 if (!isdigit(buf[0]))\
106 return -EINVAL;\
107 if (sscanf(buf, "%i", &param_val) != 1)\
108 return -EINVAL;\
109 if (beiscsi_##_name##_change(phba, param_val) == 0) \
110 return strlen(buf);\
111 else \
112 return -EINVAL;\
113}
114
115#define beiscsi_init_param(_name, _minval, _maxval, _defval) \
116int \
117beiscsi_##_name##_init(struct beiscsi_hba *phba, uint32_t val) \
118{ \
119 if (val >= _minval && val <= _maxval) {\
120 phba->attr_##_name = val;\
121 return 0;\
122 } \
123 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,\
124 "BA_%d beiscsi_"#_name" attribute " \
125 "cannot be updated to 0x%x, "\
126 "range allowed is ["#_minval" - "#_maxval"]\n", val);\
127 phba->attr_##_name = _defval;\
128 return -EINVAL;\
129}
130
131#define BEISCSI_RW_ATTR(_name, _minval, _maxval, _defval, _descp) \
132static uint beiscsi_##_name = _defval;\
133module_param(beiscsi_##_name, uint, S_IRUGO);\
134MODULE_PARM_DESC(beiscsi_##_name, _descp);\
135beiscsi_disp_param(_name)\
136beiscsi_change_param(_name, _minval, _maxval, _defval)\
137beiscsi_store_param(_name)\
138beiscsi_init_param(_name, _minval, _maxval, _defval)\
139DEVICE_ATTR(beiscsi_##_name, S_IRUGO | S_IWUSR,\
140 beiscsi_##_name##_disp, beiscsi_##_name##_store)
141
142/*
143 * When new log level added update the
144 * the MAX allowed value for log_enable
145 */
146BEISCSI_RW_ATTR(log_enable, 0x00,
147 0xFF, 0x00, "Enable logging Bit Mask\n"
148 "\t\t\t\tInitialization Events : 0x01\n"
149 "\t\t\t\tMailbox Events : 0x02\n"
150 "\t\t\t\tMiscellaneous Events : 0x04\n"
151 "\t\t\t\tError Handling : 0x08\n"
152 "\t\t\t\tIO Path Events : 0x10\n"
153 "\t\t\t\tConfiguration Path : 0x20\n");
154
155struct device_attribute *beiscsi_attrs[] = {
156 &dev_attr_beiscsi_log_enable,
157 NULL,
158};
63 159
64static int beiscsi_slave_configure(struct scsi_device *sdev) 160static int beiscsi_slave_configure(struct scsi_device *sdev)
65{ 161{
@@ -112,9 +208,9 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc)
112 sizeof(struct invalidate_commands_params_in), 208 sizeof(struct invalidate_commands_params_in),
113 &nonemb_cmd.dma); 209 &nonemb_cmd.dma);
114 if (nonemb_cmd.va == NULL) { 210 if (nonemb_cmd.va == NULL) {
115 SE_DEBUG(DBG_LVL_1, 211 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_EH,
116 "Failed to allocate memory for" 212 "BM_%d : Failed to allocate memory for"
117 "mgmt_invalidate_icds\n"); 213 "mgmt_invalidate_icds\n");
118 return FAILED; 214 return FAILED;
119 } 215 }
120 nonemb_cmd.size = sizeof(struct invalidate_commands_params_in); 216 nonemb_cmd.size = sizeof(struct invalidate_commands_params_in);
@@ -122,9 +218,9 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc)
122 tag = mgmt_invalidate_icds(phba, inv_tbl, num_invalidate, 218 tag = mgmt_invalidate_icds(phba, inv_tbl, num_invalidate,
123 cid, &nonemb_cmd); 219 cid, &nonemb_cmd);
124 if (!tag) { 220 if (!tag) {
125 shost_printk(KERN_WARNING, phba->shost, 221 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_EH,
126 "mgmt_invalidate_icds could not be" 222 "BM_%d : mgmt_invalidate_icds could not be"
127 " submitted\n"); 223 "submitted\n");
128 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 224 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
129 nonemb_cmd.va, nonemb_cmd.dma); 225 nonemb_cmd.va, nonemb_cmd.dma);
130 226
@@ -188,9 +284,9 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc)
188 sizeof(struct invalidate_commands_params_in), 284 sizeof(struct invalidate_commands_params_in),
189 &nonemb_cmd.dma); 285 &nonemb_cmd.dma);
190 if (nonemb_cmd.va == NULL) { 286 if (nonemb_cmd.va == NULL) {
191 SE_DEBUG(DBG_LVL_1, 287 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_EH,
192 "Failed to allocate memory for" 288 "BM_%d : Failed to allocate memory for"
193 "mgmt_invalidate_icds\n"); 289 "mgmt_invalidate_icds\n");
194 return FAILED; 290 return FAILED;
195 } 291 }
196 nonemb_cmd.size = sizeof(struct invalidate_commands_params_in); 292 nonemb_cmd.size = sizeof(struct invalidate_commands_params_in);
@@ -198,9 +294,9 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc)
198 tag = mgmt_invalidate_icds(phba, inv_tbl, num_invalidate, 294 tag = mgmt_invalidate_icds(phba, inv_tbl, num_invalidate,
199 cid, &nonemb_cmd); 295 cid, &nonemb_cmd);
200 if (!tag) { 296 if (!tag) {
201 shost_printk(KERN_WARNING, phba->shost, 297 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_EH,
202 "mgmt_invalidate_icds could not be" 298 "BM_%d : mgmt_invalidate_icds could not be"
203 " submitted\n"); 299 " submitted\n");
204 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 300 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
205 nonemb_cmd.va, nonemb_cmd.dma); 301 nonemb_cmd.va, nonemb_cmd.dma);
206 return FAILED; 302 return FAILED;
@@ -389,6 +485,7 @@ static DEFINE_PCI_DEVICE_TABLE(beiscsi_pci_id_table) = {
389}; 485};
390MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table); 486MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table);
391 487
488
392static struct scsi_host_template beiscsi_sht = { 489static struct scsi_host_template beiscsi_sht = {
393 .module = THIS_MODULE, 490 .module = THIS_MODULE,
394 .name = "Emulex 10Gbe open-iscsi Initiator Driver", 491 .name = "Emulex 10Gbe open-iscsi Initiator Driver",
@@ -400,6 +497,7 @@ static struct scsi_host_template beiscsi_sht = {
400 .eh_abort_handler = beiscsi_eh_abort, 497 .eh_abort_handler = beiscsi_eh_abort,
401 .eh_device_reset_handler = beiscsi_eh_device_reset, 498 .eh_device_reset_handler = beiscsi_eh_device_reset,
402 .eh_target_reset_handler = iscsi_eh_session_reset, 499 .eh_target_reset_handler = iscsi_eh_session_reset,
500 .shost_attrs = beiscsi_attrs,
403 .sg_tablesize = BEISCSI_SGLIST_ELEMENTS, 501 .sg_tablesize = BEISCSI_SGLIST_ELEMENTS,
404 .can_queue = BE2_IO_DEPTH, 502 .can_queue = BE2_IO_DEPTH,
405 .this_id = -1, 503 .this_id = -1,
@@ -419,8 +517,8 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev)
419 517
420 shost = iscsi_host_alloc(&beiscsi_sht, sizeof(*phba), 0); 518 shost = iscsi_host_alloc(&beiscsi_sht, sizeof(*phba), 0);
421 if (!shost) { 519 if (!shost) {
422 dev_err(&pcidev->dev, "beiscsi_hba_alloc -" 520 dev_err(&pcidev->dev,
423 "iscsi_host_alloc failed\n"); 521 "beiscsi_hba_alloc - iscsi_host_alloc failed\n");
424 return NULL; 522 return NULL;
425 } 523 }
426 shost->dma_boundary = pcidev->dma_mask; 524 shost->dma_boundary = pcidev->dma_mask;
@@ -510,8 +608,8 @@ static int beiscsi_enable_pci(struct pci_dev *pcidev)
510 608
511 ret = pci_enable_device(pcidev); 609 ret = pci_enable_device(pcidev);
512 if (ret) { 610 if (ret) {
513 dev_err(&pcidev->dev, "beiscsi_enable_pci - enable device " 611 dev_err(&pcidev->dev,
514 "failed. Returning -ENODEV\n"); 612 "beiscsi_enable_pci - enable device failed\n");
515 return ret; 613 return ret;
516 } 614 }
517 615
@@ -576,8 +674,9 @@ static void beiscsi_get_params(struct beiscsi_hba *phba)
576 + BE2_TMFS) / 512) + 1) * 512; 674 + BE2_TMFS) / 512) + 1) * 512;
577 phba->params.num_eq_entries = (phba->params.num_eq_entries < 1024) 675 phba->params.num_eq_entries = (phba->params.num_eq_entries < 1024)
578 ? 1024 : phba->params.num_eq_entries; 676 ? 1024 : phba->params.num_eq_entries;
579 SE_DEBUG(DBG_LVL_8, "phba->params.num_eq_entries=%d\n", 677 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
580 phba->params.num_eq_entries); 678 "BM_%d : phba->params.num_eq_entries=%d\n",
679 phba->params.num_eq_entries);
581 phba->params.num_cq_entries = 680 phba->params.num_cq_entries =
582 (((BE2_CMDS_PER_CXN * 2 + phba->fw_config.iscsi_cid_count * 2 681 (((BE2_CMDS_PER_CXN * 2 + phba->fw_config.iscsi_cid_count * 2
583 + BE2_TMFS) / 512) + 1) * 512; 682 + BE2_TMFS) / 512) + 1) * 512;
@@ -621,8 +720,6 @@ static irqreturn_t be_isr_mcc(int irq, void *dev_id)
621 phba = pbe_eq->phba; 720 phba = pbe_eq->phba;
622 mcc = &phba->ctrl.mcc_obj.cq; 721 mcc = &phba->ctrl.mcc_obj.cq;
623 eqe = queue_tail_node(eq); 722 eqe = queue_tail_node(eq);
624 if (!eqe)
625 SE_DEBUG(DBG_LVL_1, "eqe is NULL\n");
626 723
627 num_eq_processed = 0; 724 num_eq_processed = 0;
628 725
@@ -667,8 +764,6 @@ static irqreturn_t be_isr_msix(int irq, void *dev_id)
667 eq = &pbe_eq->q; 764 eq = &pbe_eq->q;
668 cq = pbe_eq->cq; 765 cq = pbe_eq->cq;
669 eqe = queue_tail_node(eq); 766 eqe = queue_tail_node(eq);
670 if (!eqe)
671 SE_DEBUG(DBG_LVL_1, "eqe is NULL\n");
672 767
673 phba = pbe_eq->phba; 768 phba = pbe_eq->phba;
674 num_eq_processed = 0; 769 num_eq_processed = 0;
@@ -743,8 +838,6 @@ static irqreturn_t be_isr(int irq, void *dev_id)
743 mcc = &phba->ctrl.mcc_obj.cq; 838 mcc = &phba->ctrl.mcc_obj.cq;
744 index = 0; 839 index = 0;
745 eqe = queue_tail_node(eq); 840 eqe = queue_tail_node(eq);
746 if (!eqe)
747 SE_DEBUG(DBG_LVL_1, "eqe is NULL\n");
748 841
749 num_ioeq_processed = 0; 842 num_ioeq_processed = 0;
750 num_mcceq_processed = 0; 843 num_mcceq_processed = 0;
@@ -842,9 +935,10 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
842 phba->msi_name[i], 935 phba->msi_name[i],
843 &phwi_context->be_eq[i]); 936 &phwi_context->be_eq[i]);
844 if (ret) { 937 if (ret) {
845 shost_printk(KERN_ERR, phba->shost, 938 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
846 "beiscsi_init_irqs-Failed to" 939 "BM_%d : beiscsi_init_irqs-Failed to"
847 "register msix for i = %d\n", i); 940 "register msix for i = %d\n",
941 i);
848 kfree(phba->msi_name[i]); 942 kfree(phba->msi_name[i]);
849 goto free_msix_irqs; 943 goto free_msix_irqs;
850 } 944 }
@@ -860,8 +954,9 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
860 ret = request_irq(msix_vec, be_isr_mcc, 0, phba->msi_name[i], 954 ret = request_irq(msix_vec, be_isr_mcc, 0, phba->msi_name[i],
861 &phwi_context->be_eq[i]); 955 &phwi_context->be_eq[i]);
862 if (ret) { 956 if (ret) {
863 shost_printk(KERN_ERR, phba->shost, "beiscsi_init_irqs-" 957 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT ,
864 "Failed to register beiscsi_msix_mcc\n"); 958 "BM_%d : beiscsi_init_irqs-"
959 "Failed to register beiscsi_msix_mcc\n");
865 kfree(phba->msi_name[i]); 960 kfree(phba->msi_name[i]);
866 goto free_msix_irqs; 961 goto free_msix_irqs;
867 } 962 }
@@ -870,8 +965,9 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
870 ret = request_irq(pcidev->irq, be_isr, IRQF_SHARED, 965 ret = request_irq(pcidev->irq, be_isr, IRQF_SHARED,
871 "beiscsi", phba); 966 "beiscsi", phba);
872 if (ret) { 967 if (ret) {
873 shost_printk(KERN_ERR, phba->shost, "beiscsi_init_irqs-" 968 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
874 "Failed to register irq\\n"); 969 "BM_%d : beiscsi_init_irqs-"
970 "Failed to register irq\\n");
875 return ret; 971 return ret;
876 } 972 }
877 } 973 }
@@ -922,7 +1018,9 @@ beiscsi_process_async_pdu(struct beiscsi_conn *beiscsi_conn,
922 case ISCSI_OP_REJECT: 1018 case ISCSI_OP_REJECT:
923 WARN_ON(!pbuffer); 1019 WARN_ON(!pbuffer);
924 WARN_ON(!(buf_len == 48)); 1020 WARN_ON(!(buf_len == 48));
925 SE_DEBUG(DBG_LVL_1, "In ISCSI_OP_REJECT\n"); 1021 beiscsi_log(phba, KERN_ERR,
1022 BEISCSI_LOG_CONFIG | BEISCSI_LOG_IO,
1023 "BM_%d : In ISCSI_OP_REJECT\n");
926 break; 1024 break;
927 case ISCSI_OP_LOGIN_RSP: 1025 case ISCSI_OP_LOGIN_RSP:
928 case ISCSI_OP_TEXT_RSP: 1026 case ISCSI_OP_TEXT_RSP:
@@ -932,11 +1030,12 @@ beiscsi_process_async_pdu(struct beiscsi_conn *beiscsi_conn,
932 login_hdr->itt = io_task->libiscsi_itt; 1030 login_hdr->itt = io_task->libiscsi_itt;
933 break; 1031 break;
934 default: 1032 default:
935 shost_printk(KERN_WARNING, phba->shost, 1033 beiscsi_log(phba, KERN_WARNING,
936 "Unrecognized opcode 0x%x in async msg\n", 1034 BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
937 (ppdu-> 1035 "BM_%d : Unrecognized opcode 0x%x in async msg\n",
1036 (ppdu->
938 dw[offsetof(struct amap_pdu_base, opcode) / 32] 1037 dw[offsetof(struct amap_pdu_base, opcode) / 32]
939 & PDUBASE_OPCODE_MASK)); 1038 & PDUBASE_OPCODE_MASK));
940 return 1; 1039 return 1;
941 } 1040 }
942 1041
@@ -951,9 +1050,11 @@ static struct sgl_handle *alloc_io_sgl_handle(struct beiscsi_hba *phba)
951 struct sgl_handle *psgl_handle; 1050 struct sgl_handle *psgl_handle;
952 1051
953 if (phba->io_sgl_hndl_avbl) { 1052 if (phba->io_sgl_hndl_avbl) {
954 SE_DEBUG(DBG_LVL_8, 1053 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_IO,
955 "In alloc_io_sgl_handle,io_sgl_alloc_index=%d\n", 1054 "BM_%d : In alloc_io_sgl_handle,"
956 phba->io_sgl_alloc_index); 1055 " io_sgl_alloc_index=%d\n",
1056 phba->io_sgl_alloc_index);
1057
957 psgl_handle = phba->io_sgl_hndl_base[phba-> 1058 psgl_handle = phba->io_sgl_hndl_base[phba->
958 io_sgl_alloc_index]; 1059 io_sgl_alloc_index];
959 phba->io_sgl_hndl_base[phba->io_sgl_alloc_index] = NULL; 1060 phba->io_sgl_hndl_base[phba->io_sgl_alloc_index] = NULL;
@@ -971,17 +1072,20 @@ static struct sgl_handle *alloc_io_sgl_handle(struct beiscsi_hba *phba)
971static void 1072static void
972free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) 1073free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
973{ 1074{
974 SE_DEBUG(DBG_LVL_8, "In free_,io_sgl_free_index=%d\n", 1075 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_IO,
975 phba->io_sgl_free_index); 1076 "BM_%d : In free_,io_sgl_free_index=%d\n",
1077 phba->io_sgl_free_index);
1078
976 if (phba->io_sgl_hndl_base[phba->io_sgl_free_index]) { 1079 if (phba->io_sgl_hndl_base[phba->io_sgl_free_index]) {
977 /* 1080 /*
978 * this can happen if clean_task is called on a task that 1081 * this can happen if clean_task is called on a task that
979 * failed in xmit_task or alloc_pdu. 1082 * failed in xmit_task or alloc_pdu.
980 */ 1083 */
981 SE_DEBUG(DBG_LVL_8, 1084 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_IO,
982 "Double Free in IO SGL io_sgl_free_index=%d," 1085 "BM_%d : Double Free in IO SGL io_sgl_free_index=%d,"
983 "value there=%p\n", phba->io_sgl_free_index, 1086 "value there=%p\n", phba->io_sgl_free_index,
984 phba->io_sgl_hndl_base[phba->io_sgl_free_index]); 1087 phba->io_sgl_hndl_base
1088 [phba->io_sgl_free_index]);
985 return; 1089 return;
986 } 1090 }
987 phba->io_sgl_hndl_base[phba->io_sgl_free_index] = psgl_handle; 1091 phba->io_sgl_hndl_base[phba->io_sgl_free_index] = psgl_handle;
@@ -1043,11 +1147,12 @@ free_wrb_handle(struct beiscsi_hba *phba, struct hwi_wrb_context *pwrb_context,
1043 else 1147 else
1044 pwrb_context->free_index++; 1148 pwrb_context->free_index++;
1045 1149
1046 SE_DEBUG(DBG_LVL_8, 1150 beiscsi_log(phba, KERN_INFO,
1047 "FREE WRB: pwrb_handle=%p free_index=0x%x" 1151 BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
1048 "wrb_handles_available=%d\n", 1152 "BM_%d : FREE WRB: pwrb_handle=%p free_index=0x%x"
1049 pwrb_handle, pwrb_context->free_index, 1153 "wrb_handles_available=%d\n",
1050 pwrb_context->wrb_handles_available); 1154 pwrb_handle, pwrb_context->free_index,
1155 pwrb_context->wrb_handles_available);
1051} 1156}
1052 1157
1053static struct sgl_handle *alloc_mgmt_sgl_handle(struct beiscsi_hba *phba) 1158static struct sgl_handle *alloc_mgmt_sgl_handle(struct beiscsi_hba *phba)
@@ -1057,8 +1162,11 @@ static struct sgl_handle *alloc_mgmt_sgl_handle(struct beiscsi_hba *phba)
1057 if (phba->eh_sgl_hndl_avbl) { 1162 if (phba->eh_sgl_hndl_avbl) {
1058 psgl_handle = phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index]; 1163 psgl_handle = phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index];
1059 phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index] = NULL; 1164 phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index] = NULL;
1060 SE_DEBUG(DBG_LVL_8, "mgmt_sgl_alloc_index=%d=0x%x\n", 1165 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1061 phba->eh_sgl_alloc_index, phba->eh_sgl_alloc_index); 1166 "BM_%d : mgmt_sgl_alloc_index=%d=0x%x\n",
1167 phba->eh_sgl_alloc_index,
1168 phba->eh_sgl_alloc_index);
1169
1062 phba->eh_sgl_hndl_avbl--; 1170 phba->eh_sgl_hndl_avbl--;
1063 if (phba->eh_sgl_alloc_index == 1171 if (phba->eh_sgl_alloc_index ==
1064 (phba->params.icds_per_ctrl - phba->params.ios_per_ctrl - 1172 (phba->params.icds_per_ctrl - phba->params.ios_per_ctrl -
@@ -1075,16 +1183,20 @@ void
1075free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) 1183free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
1076{ 1184{
1077 1185
1078 SE_DEBUG(DBG_LVL_8, "In free_mgmt_sgl_handle,eh_sgl_free_index=%d\n", 1186 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
1079 phba->eh_sgl_free_index); 1187 "BM_%d : In free_mgmt_sgl_handle,"
1188 "eh_sgl_free_index=%d\n",
1189 phba->eh_sgl_free_index);
1190
1080 if (phba->eh_sgl_hndl_base[phba->eh_sgl_free_index]) { 1191 if (phba->eh_sgl_hndl_base[phba->eh_sgl_free_index]) {
1081 /* 1192 /*
1082 * this can happen if clean_task is called on a task that 1193 * this can happen if clean_task is called on a task that
1083 * failed in xmit_task or alloc_pdu. 1194 * failed in xmit_task or alloc_pdu.
1084 */ 1195 */
1085 SE_DEBUG(DBG_LVL_8, 1196 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
1086 "Double Free in eh SGL ,eh_sgl_free_index=%d\n", 1197 "BM_%d : Double Free in eh SGL ,"
1087 phba->eh_sgl_free_index); 1198 "eh_sgl_free_index=%d\n",
1199 phba->eh_sgl_free_index);
1088 return; 1200 return;
1089 } 1201 }
1090 phba->eh_sgl_hndl_base[phba->eh_sgl_free_index] = psgl_handle; 1202 phba->eh_sgl_hndl_base[phba->eh_sgl_free_index] = psgl_handle;
@@ -1326,9 +1438,10 @@ static void hwi_complete_cmd(struct beiscsi_conn *beiscsi_conn,
1326 break; 1438 break;
1327 1439
1328 case HWH_TYPE_LOGIN: 1440 case HWH_TYPE_LOGIN:
1329 SE_DEBUG(DBG_LVL_1, 1441 beiscsi_log(phba, KERN_ERR,
1330 "\t\t No HWH_TYPE_LOGIN Expected in hwi_complete_cmd" 1442 BEISCSI_LOG_CONFIG | BEISCSI_LOG_IO,
1331 "- Solicited path\n"); 1443 "BM_%d :\t\t No HWH_TYPE_LOGIN Expected in"
1444 " hwi_complete_cmd- Solicited path\n");
1332 break; 1445 break;
1333 1446
1334 case HWH_TYPE_NOP: 1447 case HWH_TYPE_NOP:
@@ -1336,13 +1449,14 @@ static void hwi_complete_cmd(struct beiscsi_conn *beiscsi_conn,
1336 break; 1449 break;
1337 1450
1338 default: 1451 default:
1339 shost_printk(KERN_WARNING, phba->shost, 1452 beiscsi_log(phba, KERN_WARNING,
1340 "In hwi_complete_cmd, unknown type = %d" 1453 BEISCSI_LOG_CONFIG | BEISCSI_LOG_IO,
1341 "wrb_index 0x%x CID 0x%x\n", type, 1454 "BM_%d : In hwi_complete_cmd, unknown type = %d"
1342 ((psol->dw[offsetof(struct amap_iscsi_wrb, 1455 "wrb_index 0x%x CID 0x%x\n", type,
1343 type) / 32] & SOL_WRB_INDEX_MASK) >> 16), 1456 ((psol->dw[offsetof(struct amap_iscsi_wrb,
1344 ((psol->dw[offsetof(struct amap_sol_cqe, 1457 type) / 32] & SOL_WRB_INDEX_MASK) >> 16),
1345 cid) / 32] & SOL_CID_MASK) >> 6)); 1458 ((psol->dw[offsetof(struct amap_sol_cqe,
1459 cid) / 32] & SOL_CID_MASK) >> 6));
1346 break; 1460 break;
1347 } 1461 }
1348 1462
@@ -1397,10 +1511,11 @@ hwi_get_async_handle(struct beiscsi_hba *phba,
1397 break; 1511 break;
1398 default: 1512 default:
1399 pbusy_list = NULL; 1513 pbusy_list = NULL;
1400 shost_printk(KERN_WARNING, phba->shost, 1514 beiscsi_log(phba, KERN_WARNING,
1401 "Unexpected code=%d\n", 1515 BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
1402 pdpdu_cqe->dw[offsetof(struct amap_i_t_dpdu_cqe, 1516 "BM_%d : Unexpected code=%d\n",
1403 code) / 32] & PDUCQE_CODE_MASK); 1517 pdpdu_cqe->dw[offsetof(struct amap_i_t_dpdu_cqe,
1518 code) / 32] & PDUCQE_CODE_MASK);
1404 return NULL; 1519 return NULL;
1405 } 1520 }
1406 1521
@@ -1425,8 +1540,9 @@ hwi_get_async_handle(struct beiscsi_hba *phba,
1425} 1540}
1426 1541
1427static unsigned int 1542static unsigned int
1428hwi_update_async_writables(struct hwi_async_pdu_context *pasync_ctx, 1543hwi_update_async_writables(struct beiscsi_hba *phba,
1429 unsigned int is_header, unsigned int cq_index) 1544 struct hwi_async_pdu_context *pasync_ctx,
1545 unsigned int is_header, unsigned int cq_index)
1430{ 1546{
1431 struct list_head *pbusy_list; 1547 struct list_head *pbusy_list;
1432 struct async_pdu_handle *pasync_handle; 1548 struct async_pdu_handle *pasync_handle;
@@ -1463,9 +1579,10 @@ hwi_update_async_writables(struct hwi_async_pdu_context *pasync_ctx,
1463 } 1579 }
1464 1580
1465 if (!writables) { 1581 if (!writables) {
1466 SE_DEBUG(DBG_LVL_1, 1582 beiscsi_log(phba, KERN_ERR,
1467 "Duplicate notification received - index 0x%x!!\n", 1583 BEISCSI_LOG_CONFIG | BEISCSI_LOG_IO,
1468 cq_index); 1584 "BM_%d : Duplicate notification received - index 0x%x!!\n",
1585 cq_index);
1469 WARN_ON(1); 1586 WARN_ON(1);
1470 } 1587 }
1471 1588
@@ -1616,8 +1733,8 @@ static void hwi_flush_default_pdu_buffer(struct beiscsi_hba *phba,
1616 pdpdu_cqe, &cq_index); 1733 pdpdu_cqe, &cq_index);
1617 BUG_ON(pasync_handle->is_header != 0); 1734 BUG_ON(pasync_handle->is_header != 0);
1618 if (pasync_handle->consumed == 0) 1735 if (pasync_handle->consumed == 0)
1619 hwi_update_async_writables(pasync_ctx, pasync_handle->is_header, 1736 hwi_update_async_writables(phba, pasync_ctx,
1620 cq_index); 1737 pasync_handle->is_header, cq_index);
1621 1738
1622 hwi_free_async_msg(phba, pasync_handle->cri); 1739 hwi_free_async_msg(phba, pasync_handle->cri);
1623 hwi_post_async_buffers(phba, pasync_handle->is_header); 1740 hwi_post_async_buffers(phba, pasync_handle->is_header);
@@ -1745,8 +1862,9 @@ static void hwi_process_default_pdu_ring(struct beiscsi_conn *beiscsi_conn,
1745 pdpdu_cqe, &cq_index); 1862 pdpdu_cqe, &cq_index);
1746 1863
1747 if (pasync_handle->consumed == 0) 1864 if (pasync_handle->consumed == 0)
1748 hwi_update_async_writables(pasync_ctx, pasync_handle->is_header, 1865 hwi_update_async_writables(phba, pasync_ctx,
1749 cq_index); 1866 pasync_handle->is_header, cq_index);
1867
1750 hwi_gather_async_pdu(beiscsi_conn, phba, pasync_handle); 1868 hwi_gather_async_pdu(beiscsi_conn, phba, pasync_handle);
1751 hwi_post_async_buffers(phba, pasync_handle->is_header); 1869 hwi_post_async_buffers(phba, pasync_handle->is_header);
1752} 1870}
@@ -1774,9 +1892,10 @@ static void beiscsi_process_mcc_isr(struct beiscsi_hba *phba)
1774 beiscsi_async_link_state_process(phba, 1892 beiscsi_async_link_state_process(phba,
1775 (struct be_async_event_link_state *) mcc_compl); 1893 (struct be_async_event_link_state *) mcc_compl);
1776 else 1894 else
1777 SE_DEBUG(DBG_LVL_1, 1895 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_MBOX,
1778 " Unsupported Async Event, flags" 1896 "BM_%d : Unsupported Async Event, flags"
1779 " = 0x%08x\n", mcc_compl->flags); 1897 " = 0x%08x\n",
1898 mcc_compl->flags);
1780 } else if (mcc_compl->flags & CQE_FLAGS_COMPLETED_MASK) { 1899 } else if (mcc_compl->flags & CQE_FLAGS_COMPLETED_MASK) {
1781 be_mcc_compl_process_isr(&phba->ctrl, mcc_compl); 1900 be_mcc_compl_process_isr(&phba->ctrl, mcc_compl);
1782 atomic_dec(&phba->ctrl.mcc_obj.q.used); 1901 atomic_dec(&phba->ctrl.mcc_obj.q.used);
@@ -1835,26 +1954,36 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
1835 hwi_complete_cmd(beiscsi_conn, phba, sol); 1954 hwi_complete_cmd(beiscsi_conn, phba, sol);
1836 break; 1955 break;
1837 case DRIVERMSG_NOTIFY: 1956 case DRIVERMSG_NOTIFY:
1838 SE_DEBUG(DBG_LVL_8, "Received DRIVERMSG_NOTIFY\n"); 1957 beiscsi_log(phba, KERN_INFO,
1958 BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
1959 "BM_%d : Received DRIVERMSG_NOTIFY\n");
1960
1839 dmsg = (struct dmsg_cqe *)sol; 1961 dmsg = (struct dmsg_cqe *)sol;
1840 hwi_complete_drvr_msgs(beiscsi_conn, phba, sol); 1962 hwi_complete_drvr_msgs(beiscsi_conn, phba, sol);
1841 break; 1963 break;
1842 case UNSOL_HDR_NOTIFY: 1964 case UNSOL_HDR_NOTIFY:
1843 SE_DEBUG(DBG_LVL_8, "Received UNSOL_HDR_ NOTIFY\n"); 1965 beiscsi_log(phba, KERN_INFO,
1966 BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
1967 "BM_%d : Received UNSOL_HDR_ NOTIFY\n");
1968
1844 hwi_process_default_pdu_ring(beiscsi_conn, phba, 1969 hwi_process_default_pdu_ring(beiscsi_conn, phba,
1845 (struct i_t_dpdu_cqe *)sol); 1970 (struct i_t_dpdu_cqe *)sol);
1846 break; 1971 break;
1847 case UNSOL_DATA_NOTIFY: 1972 case UNSOL_DATA_NOTIFY:
1848 SE_DEBUG(DBG_LVL_8, "Received UNSOL_DATA_NOTIFY\n"); 1973 beiscsi_log(phba, KERN_INFO,
1974 BEISCSI_LOG_CONFIG | BEISCSI_LOG_IO,
1975 "BM_%d : Received UNSOL_DATA_NOTIFY\n");
1976
1849 hwi_process_default_pdu_ring(beiscsi_conn, phba, 1977 hwi_process_default_pdu_ring(beiscsi_conn, phba,
1850 (struct i_t_dpdu_cqe *)sol); 1978 (struct i_t_dpdu_cqe *)sol);
1851 break; 1979 break;
1852 case CXN_INVALIDATE_INDEX_NOTIFY: 1980 case CXN_INVALIDATE_INDEX_NOTIFY:
1853 case CMD_INVALIDATED_NOTIFY: 1981 case CMD_INVALIDATED_NOTIFY:
1854 case CXN_INVALIDATE_NOTIFY: 1982 case CXN_INVALIDATE_NOTIFY:
1855 SE_DEBUG(DBG_LVL_1, 1983 beiscsi_log(phba, KERN_ERR,
1856 "Ignoring CQ Error notification for cmd/cxn" 1984 BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
1857 "invalidate\n"); 1985 "BM_%d : Ignoring CQ Error notification for"
1986 " cmd/cxn invalidate\n");
1858 break; 1987 break;
1859 case SOL_CMD_KILLED_DATA_DIGEST_ERR: 1988 case SOL_CMD_KILLED_DATA_DIGEST_ERR:
1860 case CMD_KILLED_INVALID_STATSN_RCVD: 1989 case CMD_KILLED_INVALID_STATSN_RCVD:
@@ -1864,17 +1993,20 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
1864 case CMD_CXN_KILLED_ITT_INVALID: 1993 case CMD_CXN_KILLED_ITT_INVALID:
1865 case CMD_CXN_KILLED_SEQ_OUTOFORDER: 1994 case CMD_CXN_KILLED_SEQ_OUTOFORDER:
1866 case CMD_CXN_KILLED_INVALID_DATASN_RCVD: 1995 case CMD_CXN_KILLED_INVALID_DATASN_RCVD:
1867 SE_DEBUG(DBG_LVL_1, 1996 beiscsi_log(phba, KERN_ERR,
1868 "CQ Error notification for cmd.. " 1997 BEISCSI_LOG_CONFIG | BEISCSI_LOG_IO,
1869 "code %d cid 0x%x\n", 1998 "BM_%d : CQ Error notification for cmd.. "
1870 sol->dw[offsetof(struct amap_sol_cqe, code) / 1999 "code %d cid 0x%x\n",
1871 32] & CQE_CODE_MASK, 2000 sol->dw[offsetof(struct amap_sol_cqe,
1872 (sol->dw[offsetof(struct amap_sol_cqe, cid) / 2001 code) / 32] & CQE_CODE_MASK,
1873 32] & SOL_CID_MASK)); 2002 sol->dw[offsetof(struct amap_sol_cqe,
2003 cid) / 32] & SOL_CID_MASK);
1874 break; 2004 break;
1875 case UNSOL_DATA_DIGEST_ERROR_NOTIFY: 2005 case UNSOL_DATA_DIGEST_ERROR_NOTIFY:
1876 SE_DEBUG(DBG_LVL_1, 2006 beiscsi_log(phba, KERN_ERR,
1877 "Digest error on def pdu ring, dropping..\n"); 2007 BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
2008 "BM_%d : Digest error on def pdu ring,"
2009 " dropping..\n");
1878 hwi_flush_default_pdu_buffer(phba, beiscsi_conn, 2010 hwi_flush_default_pdu_buffer(phba, beiscsi_conn,
1879 (struct i_t_dpdu_cqe *) sol); 2011 (struct i_t_dpdu_cqe *) sol);
1880 break; 2012 break;
@@ -1892,33 +2024,38 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
1892 case CXN_KILLED_OVER_RUN_RESIDUAL: 2024 case CXN_KILLED_OVER_RUN_RESIDUAL:
1893 case CXN_KILLED_UNDER_RUN_RESIDUAL: 2025 case CXN_KILLED_UNDER_RUN_RESIDUAL:
1894 case CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN: 2026 case CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN:
1895 SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset CID " 2027 beiscsi_log(phba, KERN_ERR,
1896 "0x%x...\n", 2028 BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
1897 sol->dw[offsetof(struct amap_sol_cqe, code) / 2029 "BM_%d : CQ Error %d, reset CID 0x%x...\n",
1898 32] & CQE_CODE_MASK, 2030 sol->dw[offsetof(struct amap_sol_cqe,
1899 (sol->dw[offsetof(struct amap_sol_cqe, cid) / 2031 code) / 32] & CQE_CODE_MASK,
1900 32] & CQE_CID_MASK)); 2032 sol->dw[offsetof(struct amap_sol_cqe,
2033 cid) / 32] & CQE_CID_MASK);
1901 iscsi_conn_failure(beiscsi_conn->conn, 2034 iscsi_conn_failure(beiscsi_conn->conn,
1902 ISCSI_ERR_CONN_FAILED); 2035 ISCSI_ERR_CONN_FAILED);
1903 break; 2036 break;
1904 case CXN_KILLED_RST_SENT: 2037 case CXN_KILLED_RST_SENT:
1905 case CXN_KILLED_RST_RCVD: 2038 case CXN_KILLED_RST_RCVD:
1906 SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset" 2039 beiscsi_log(phba, KERN_ERR,
1907 "received/sent on CID 0x%x...\n", 2040 BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
1908 sol->dw[offsetof(struct amap_sol_cqe, code) / 2041 "BM_%d : CQ Error %d, reset"
1909 32] & CQE_CODE_MASK, 2042 "received/sent on CID 0x%x...\n",
1910 (sol->dw[offsetof(struct amap_sol_cqe, cid) / 2043 sol->dw[offsetof(struct amap_sol_cqe,
1911 32] & CQE_CID_MASK)); 2044 code) / 32] & CQE_CODE_MASK,
2045 sol->dw[offsetof(struct amap_sol_cqe,
2046 cid) / 32] & CQE_CID_MASK);
1912 iscsi_conn_failure(beiscsi_conn->conn, 2047 iscsi_conn_failure(beiscsi_conn->conn,
1913 ISCSI_ERR_CONN_FAILED); 2048 ISCSI_ERR_CONN_FAILED);
1914 break; 2049 break;
1915 default: 2050 default:
1916 SE_DEBUG(DBG_LVL_1, "CQ Error Invalid code= %d " 2051 beiscsi_log(phba, KERN_ERR,
1917 "received on CID 0x%x...\n", 2052 BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
1918 sol->dw[offsetof(struct amap_sol_cqe, code) / 2053 "BM_%d : CQ Error Invalid code= %d "
1919 32] & CQE_CODE_MASK, 2054 "received on CID 0x%x...\n",
1920 (sol->dw[offsetof(struct amap_sol_cqe, cid) / 2055 sol->dw[offsetof(struct amap_sol_cqe,
1921 32] & CQE_CID_MASK)); 2056 code) / 32] & CQE_CODE_MASK,
2057 sol->dw[offsetof(struct amap_sol_cqe,
2058 cid) / 32] & CQE_CID_MASK);
1922 break; 2059 break;
1923 } 2060 }
1924 2061
@@ -1977,7 +2114,10 @@ static int be_iopoll(struct blk_iopoll *iop, int budget)
1977 if (ret < budget) { 2114 if (ret < budget) {
1978 phba = pbe_eq->phba; 2115 phba = pbe_eq->phba;
1979 blk_iopoll_complete(iop); 2116 blk_iopoll_complete(iop);
1980 SE_DEBUG(DBG_LVL_8, "rearm pbe_eq->q.id =%d\n", pbe_eq->q.id); 2117 beiscsi_log(phba, KERN_INFO,
2118 BEISCSI_LOG_CONFIG | BEISCSI_LOG_IO,
2119 "BM_%d : rearm pbe_eq->q.id =%d\n",
2120 pbe_eq->q.id);
1981 hwi_ring_eq_db(phba, pbe_eq->q.id, 0, 0, 1, 1); 2121 hwi_ring_eq_db(phba, pbe_eq->q.id, 0, 0, 1, 1);
1982 } 2122 }
1983 return ret; 2123 return ret;
@@ -2348,16 +2488,16 @@ static int beiscsi_init_wrb_handle(struct beiscsi_hba *phba)
2348 kzalloc(sizeof(struct wrb_handle *) * 2488 kzalloc(sizeof(struct wrb_handle *) *
2349 phba->params.wrbs_per_cxn, GFP_KERNEL); 2489 phba->params.wrbs_per_cxn, GFP_KERNEL);
2350 if (!pwrb_context->pwrb_handle_base) { 2490 if (!pwrb_context->pwrb_handle_base) {
2351 shost_printk(KERN_ERR, phba->shost, 2491 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2352 "Mem Alloc Failed. Failing to load\n"); 2492 "BM_%d : Mem Alloc Failed. Failing to load\n");
2353 goto init_wrb_hndl_failed; 2493 goto init_wrb_hndl_failed;
2354 } 2494 }
2355 pwrb_context->pwrb_handle_basestd = 2495 pwrb_context->pwrb_handle_basestd =
2356 kzalloc(sizeof(struct wrb_handle *) * 2496 kzalloc(sizeof(struct wrb_handle *) *
2357 phba->params.wrbs_per_cxn, GFP_KERNEL); 2497 phba->params.wrbs_per_cxn, GFP_KERNEL);
2358 if (!pwrb_context->pwrb_handle_basestd) { 2498 if (!pwrb_context->pwrb_handle_basestd) {
2359 shost_printk(KERN_ERR, phba->shost, 2499 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2360 "Mem Alloc Failed. Failing to load\n"); 2500 "BM_%d : Mem Alloc Failed. Failing to load\n");
2361 goto init_wrb_hndl_failed; 2501 goto init_wrb_hndl_failed;
2362 } 2502 }
2363 if (!num_cxn_wrbh) { 2503 if (!num_cxn_wrbh) {
@@ -2438,12 +2578,13 @@ static void hwi_init_async_pdu_ctx(struct beiscsi_hba *phba)
2438 mem_descr = (struct be_mem_descriptor *)phba->init_mem; 2578 mem_descr = (struct be_mem_descriptor *)phba->init_mem;
2439 mem_descr += HWI_MEM_ASYNC_HEADER_BUF; 2579 mem_descr += HWI_MEM_ASYNC_HEADER_BUF;
2440 if (mem_descr->mem_array[0].virtual_address) { 2580 if (mem_descr->mem_array[0].virtual_address) {
2441 SE_DEBUG(DBG_LVL_8, 2581 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
2442 "hwi_init_async_pdu_ctx HWI_MEM_ASYNC_HEADER_BUF" 2582 "BM_%d : hwi_init_async_pdu_ctx"
2443 "va=%p\n", mem_descr->mem_array[0].virtual_address); 2583 " HWI_MEM_ASYNC_HEADER_BUF va=%p\n",
2584 mem_descr->mem_array[0].virtual_address);
2444 } else 2585 } else
2445 shost_printk(KERN_WARNING, phba->shost, 2586 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
2446 "No Virtual address\n"); 2587 "BM_%d : No Virtual address\n");
2447 2588
2448 pasync_ctx->async_header.va_base = 2589 pasync_ctx->async_header.va_base =
2449 mem_descr->mem_array[0].virtual_address; 2590 mem_descr->mem_array[0].virtual_address;
@@ -2454,24 +2595,27 @@ static void hwi_init_async_pdu_ctx(struct beiscsi_hba *phba)
2454 mem_descr = (struct be_mem_descriptor *)phba->init_mem; 2595 mem_descr = (struct be_mem_descriptor *)phba->init_mem;
2455 mem_descr += HWI_MEM_ASYNC_HEADER_RING; 2596 mem_descr += HWI_MEM_ASYNC_HEADER_RING;
2456 if (mem_descr->mem_array[0].virtual_address) { 2597 if (mem_descr->mem_array[0].virtual_address) {
2457 SE_DEBUG(DBG_LVL_8, 2598 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
2458 "hwi_init_async_pdu_ctx HWI_MEM_ASYNC_HEADER_RING" 2599 "BM_%d : hwi_init_async_pdu_ctx"
2459 "va=%p\n", mem_descr->mem_array[0].virtual_address); 2600 " HWI_MEM_ASYNC_HEADER_RING va=%p\n",
2601 mem_descr->mem_array[0].virtual_address);
2460 } else 2602 } else
2461 shost_printk(KERN_WARNING, phba->shost, 2603 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
2462 "No Virtual address\n"); 2604 "BM_%d : No Virtual address\n");
2605
2463 pasync_ctx->async_header.ring_base = 2606 pasync_ctx->async_header.ring_base =
2464 mem_descr->mem_array[0].virtual_address; 2607 mem_descr->mem_array[0].virtual_address;
2465 2608
2466 mem_descr = (struct be_mem_descriptor *)phba->init_mem; 2609 mem_descr = (struct be_mem_descriptor *)phba->init_mem;
2467 mem_descr += HWI_MEM_ASYNC_HEADER_HANDLE; 2610 mem_descr += HWI_MEM_ASYNC_HEADER_HANDLE;
2468 if (mem_descr->mem_array[0].virtual_address) { 2611 if (mem_descr->mem_array[0].virtual_address) {
2469 SE_DEBUG(DBG_LVL_8, 2612 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
2470 "hwi_init_async_pdu_ctx HWI_MEM_ASYNC_HEADER_HANDLE" 2613 "BM_%d : hwi_init_async_pdu_ctx"
2471 "va=%p\n", mem_descr->mem_array[0].virtual_address); 2614 " HWI_MEM_ASYNC_HEADER_HANDLE va=%p\n",
2615 mem_descr->mem_array[0].virtual_address);
2472 } else 2616 } else
2473 shost_printk(KERN_WARNING, phba->shost, 2617 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
2474 "No Virtual address\n"); 2618 "BM_%d : No Virtual address\n");
2475 2619
2476 pasync_ctx->async_header.handle_base = 2620 pasync_ctx->async_header.handle_base =
2477 mem_descr->mem_array[0].virtual_address; 2621 mem_descr->mem_array[0].virtual_address;
@@ -2482,12 +2626,13 @@ static void hwi_init_async_pdu_ctx(struct beiscsi_hba *phba)
2482 mem_descr = (struct be_mem_descriptor *)phba->init_mem; 2626 mem_descr = (struct be_mem_descriptor *)phba->init_mem;
2483 mem_descr += HWI_MEM_ASYNC_DATA_RING; 2627 mem_descr += HWI_MEM_ASYNC_DATA_RING;
2484 if (mem_descr->mem_array[0].virtual_address) { 2628 if (mem_descr->mem_array[0].virtual_address) {
2485 SE_DEBUG(DBG_LVL_8, 2629 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
2486 "hwi_init_async_pdu_ctx HWI_MEM_ASYNC_DATA_RING" 2630 "BM_%d : hwi_init_async_pdu_ctx"
2487 "va=%p\n", mem_descr->mem_array[0].virtual_address); 2631 " HWI_MEM_ASYNC_DATA_RING va=%p\n",
2632 mem_descr->mem_array[0].virtual_address);
2488 } else 2633 } else
2489 shost_printk(KERN_WARNING, phba->shost, 2634 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
2490 "No Virtual address\n"); 2635 "BM_%d : No Virtual address\n");
2491 2636
2492 pasync_ctx->async_data.ring_base = 2637 pasync_ctx->async_data.ring_base =
2493 mem_descr->mem_array[0].virtual_address; 2638 mem_descr->mem_array[0].virtual_address;
@@ -2495,8 +2640,8 @@ static void hwi_init_async_pdu_ctx(struct beiscsi_hba *phba)
2495 mem_descr = (struct be_mem_descriptor *)phba->init_mem; 2640 mem_descr = (struct be_mem_descriptor *)phba->init_mem;
2496 mem_descr += HWI_MEM_ASYNC_DATA_HANDLE; 2641 mem_descr += HWI_MEM_ASYNC_DATA_HANDLE;
2497 if (!mem_descr->mem_array[0].virtual_address) 2642 if (!mem_descr->mem_array[0].virtual_address)
2498 shost_printk(KERN_WARNING, phba->shost, 2643 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
2499 "No Virtual address\n"); 2644 "BM_%d : No Virtual address\n");
2500 2645
2501 pasync_ctx->async_data.handle_base = 2646 pasync_ctx->async_data.handle_base =
2502 mem_descr->mem_array[0].virtual_address; 2647 mem_descr->mem_array[0].virtual_address;
@@ -2511,12 +2656,14 @@ static void hwi_init_async_pdu_ctx(struct beiscsi_hba *phba)
2511 mem_descr = (struct be_mem_descriptor *)phba->init_mem; 2656 mem_descr = (struct be_mem_descriptor *)phba->init_mem;
2512 mem_descr += HWI_MEM_ASYNC_DATA_BUF; 2657 mem_descr += HWI_MEM_ASYNC_DATA_BUF;
2513 if (mem_descr->mem_array[0].virtual_address) { 2658 if (mem_descr->mem_array[0].virtual_address) {
2514 SE_DEBUG(DBG_LVL_8, 2659 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
2515 "hwi_init_async_pdu_ctx HWI_MEM_ASYNC_DATA_BUF" 2660 "BM_%d : hwi_init_async_pdu_ctx"
2516 "va=%p\n", mem_descr->mem_array[0].virtual_address); 2661 " HWI_MEM_ASYNC_DATA_BUF va=%p\n",
2662 mem_descr->mem_array[0].virtual_address);
2517 } else 2663 } else
2518 shost_printk(KERN_WARNING, phba->shost, 2664 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
2519 "No Virtual address\n"); 2665 "BM_%d : No Virtual address\n");
2666
2520 idx = 0; 2667 idx = 0;
2521 pasync_ctx->async_data.va_base = 2668 pasync_ctx->async_data.va_base =
2522 mem_descr->mem_array[idx].virtual_address; 2669 mem_descr->mem_array[idx].virtual_address;
@@ -2657,7 +2804,7 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba,
2657 struct hwi_context_memory *phwi_context) 2804 struct hwi_context_memory *phwi_context)
2658{ 2805{
2659 unsigned int i, num_eq_pages; 2806 unsigned int i, num_eq_pages;
2660 int ret, eq_for_mcc; 2807 int ret = 0, eq_for_mcc;
2661 struct be_queue_info *eq; 2808 struct be_queue_info *eq;
2662 struct be_dma_mem *mem; 2809 struct be_dma_mem *mem;
2663 void *eq_vaddress; 2810 void *eq_vaddress;
@@ -2684,8 +2831,8 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba,
2684 ret = be_fill_queue(eq, phba->params.num_eq_entries, 2831 ret = be_fill_queue(eq, phba->params.num_eq_entries,
2685 sizeof(struct be_eq_entry), eq_vaddress); 2832 sizeof(struct be_eq_entry), eq_vaddress);
2686 if (ret) { 2833 if (ret) {
2687 shost_printk(KERN_ERR, phba->shost, 2834 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2688 "be_fill_queue Failed for EQ\n"); 2835 "BM_%d : be_fill_queue Failed for EQ\n");
2689 goto create_eq_error; 2836 goto create_eq_error;
2690 } 2837 }
2691 2838
@@ -2693,12 +2840,15 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba,
2693 ret = beiscsi_cmd_eq_create(&phba->ctrl, eq, 2840 ret = beiscsi_cmd_eq_create(&phba->ctrl, eq,
2694 phwi_context->cur_eqd); 2841 phwi_context->cur_eqd);
2695 if (ret) { 2842 if (ret) {
2696 shost_printk(KERN_ERR, phba->shost, 2843 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2697 "beiscsi_cmd_eq_create" 2844 "BM_%d : beiscsi_cmd_eq_create"
2698 "Failedfor EQ\n"); 2845 "Failed for EQ\n");
2699 goto create_eq_error; 2846 goto create_eq_error;
2700 } 2847 }
2701 SE_DEBUG(DBG_LVL_8, "eqid = %d\n", phwi_context->be_eq[i].q.id); 2848
2849 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
2850 "BM_%d : eqid = %d\n",
2851 phwi_context->be_eq[i].q.id);
2702 } 2852 }
2703 return 0; 2853 return 0;
2704create_eq_error: 2854create_eq_error:
@@ -2717,7 +2867,7 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba,
2717 struct hwi_context_memory *phwi_context) 2867 struct hwi_context_memory *phwi_context)
2718{ 2868{
2719 unsigned int i, num_cq_pages; 2869 unsigned int i, num_cq_pages;
2720 int ret; 2870 int ret = 0;
2721 struct be_queue_info *cq, *eq; 2871 struct be_queue_info *cq, *eq;
2722 struct be_dma_mem *mem; 2872 struct be_dma_mem *mem;
2723 struct be_eq_obj *pbe_eq; 2873 struct be_eq_obj *pbe_eq;
@@ -2742,8 +2892,9 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba,
2742 ret = be_fill_queue(cq, phba->params.num_cq_entries, 2892 ret = be_fill_queue(cq, phba->params.num_cq_entries,
2743 sizeof(struct sol_cqe), cq_vaddress); 2893 sizeof(struct sol_cqe), cq_vaddress);
2744 if (ret) { 2894 if (ret) {
2745 shost_printk(KERN_ERR, phba->shost, 2895 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2746 "be_fill_queue Failed for ISCSI CQ\n"); 2896 "BM_%d : be_fill_queue Failed "
2897 "for ISCSI CQ\n");
2747 goto create_cq_error; 2898 goto create_cq_error;
2748 } 2899 }
2749 2900
@@ -2751,14 +2902,14 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba,
2751 ret = beiscsi_cmd_cq_create(&phba->ctrl, cq, eq, false, 2902 ret = beiscsi_cmd_cq_create(&phba->ctrl, cq, eq, false,
2752 false, 0); 2903 false, 0);
2753 if (ret) { 2904 if (ret) {
2754 shost_printk(KERN_ERR, phba->shost, 2905 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2755 "beiscsi_cmd_eq_create" 2906 "BM_%d : beiscsi_cmd_eq_create"
2756 "Failed for ISCSI CQ\n"); 2907 "Failed for ISCSI CQ\n");
2757 goto create_cq_error; 2908 goto create_cq_error;
2758 } 2909 }
2759 SE_DEBUG(DBG_LVL_8, "iscsi cq_id is %d for eq_id %d\n", 2910 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
2760 cq->id, eq->id); 2911 "BM_%d : iscsi cq_id is %d for eq_id %d\n"
2761 SE_DEBUG(DBG_LVL_8, "ISCSI CQ CREATED\n"); 2912 "iSCSI CQ CREATED\n", cq->id, eq->id);
2762 } 2913 }
2763 return 0; 2914 return 0;
2764 2915
@@ -2799,8 +2950,8 @@ beiscsi_create_def_hdr(struct beiscsi_hba *phba,
2799 sizeof(struct phys_addr), 2950 sizeof(struct phys_addr),
2800 sizeof(struct phys_addr), dq_vaddress); 2951 sizeof(struct phys_addr), dq_vaddress);
2801 if (ret) { 2952 if (ret) {
2802 shost_printk(KERN_ERR, phba->shost, 2953 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2803 "be_fill_queue Failed for DEF PDU HDR\n"); 2954 "BM_%d : be_fill_queue Failed for DEF PDU HDR\n");
2804 return ret; 2955 return ret;
2805 } 2956 }
2806 mem->dma = (unsigned long)mem_descr->mem_array[idx]. 2957 mem->dma = (unsigned long)mem_descr->mem_array[idx].
@@ -2809,13 +2960,15 @@ beiscsi_create_def_hdr(struct beiscsi_hba *phba,
2809 def_pdu_ring_sz, 2960 def_pdu_ring_sz,
2810 phba->params.defpdu_hdr_sz); 2961 phba->params.defpdu_hdr_sz);
2811 if (ret) { 2962 if (ret) {
2812 shost_printk(KERN_ERR, phba->shost, 2963 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2813 "be_cmd_create_default_pdu_queue Failed DEFHDR\n"); 2964 "BM_%d : be_cmd_create_default_pdu_queue Failed DEFHDR\n");
2814 return ret; 2965 return ret;
2815 } 2966 }
2816 phwi_ctrlr->default_pdu_hdr.id = phwi_context->be_def_hdrq.id; 2967 phwi_ctrlr->default_pdu_hdr.id = phwi_context->be_def_hdrq.id;
2817 SE_DEBUG(DBG_LVL_8, "iscsi def pdu id is %d\n", 2968 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
2818 phwi_context->be_def_hdrq.id); 2969 "BM_%d : iscsi def pdu id is %d\n",
2970 phwi_context->be_def_hdrq.id);
2971
2819 hwi_post_async_buffers(phba, 1); 2972 hwi_post_async_buffers(phba, 1);
2820 return 0; 2973 return 0;
2821} 2974}
@@ -2844,8 +2997,8 @@ beiscsi_create_def_data(struct beiscsi_hba *phba,
2844 sizeof(struct phys_addr), 2997 sizeof(struct phys_addr),
2845 sizeof(struct phys_addr), dq_vaddress); 2998 sizeof(struct phys_addr), dq_vaddress);
2846 if (ret) { 2999 if (ret) {
2847 shost_printk(KERN_ERR, phba->shost, 3000 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2848 "be_fill_queue Failed for DEF PDU DATA\n"); 3001 "BM_%d : be_fill_queue Failed for DEF PDU DATA\n");
2849 return ret; 3002 return ret;
2850 } 3003 }
2851 mem->dma = (unsigned long)mem_descr->mem_array[idx]. 3004 mem->dma = (unsigned long)mem_descr->mem_array[idx].
@@ -2854,16 +3007,20 @@ beiscsi_create_def_data(struct beiscsi_hba *phba,
2854 def_pdu_ring_sz, 3007 def_pdu_ring_sz,
2855 phba->params.defpdu_data_sz); 3008 phba->params.defpdu_data_sz);
2856 if (ret) { 3009 if (ret) {
2857 shost_printk(KERN_ERR, phba->shost, 3010 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2858 "be_cmd_create_default_pdu_queue Failed" 3011 "BM_%d be_cmd_create_default_pdu_queue"
2859 " for DEF PDU DATA\n"); 3012 " Failed for DEF PDU DATA\n");
2860 return ret; 3013 return ret;
2861 } 3014 }
2862 phwi_ctrlr->default_pdu_data.id = phwi_context->be_def_dataq.id; 3015 phwi_ctrlr->default_pdu_data.id = phwi_context->be_def_dataq.id;
2863 SE_DEBUG(DBG_LVL_8, "iscsi def data id is %d\n", 3016 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
2864 phwi_context->be_def_dataq.id); 3017 "BM_%d : iscsi def data id is %d\n",
3018 phwi_context->be_def_dataq.id);
3019
2865 hwi_post_async_buffers(phba, 0); 3020 hwi_post_async_buffers(phba, 0);
2866 SE_DEBUG(DBG_LVL_8, "DEFAULT PDU DATA RING CREATED\n"); 3021 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
3022 "BM_%d : DEFAULT PDU DATA RING CREATED\n");
3023
2867 return 0; 3024 return 0;
2868} 3025}
2869 3026
@@ -2889,13 +3046,14 @@ beiscsi_post_pages(struct beiscsi_hba *phba)
2889 (pm_arr->size / PAGE_SIZE)); 3046 (pm_arr->size / PAGE_SIZE));
2890 page_offset += pm_arr->size / PAGE_SIZE; 3047 page_offset += pm_arr->size / PAGE_SIZE;
2891 if (status != 0) { 3048 if (status != 0) {
2892 shost_printk(KERN_ERR, phba->shost, 3049 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2893 "post sgl failed.\n"); 3050 "BM_%d : post sgl failed.\n");
2894 return status; 3051 return status;
2895 } 3052 }
2896 pm_arr++; 3053 pm_arr++;
2897 } 3054 }
2898 SE_DEBUG(DBG_LVL_8, "POSTED PAGES\n"); 3055 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
3056 "BM_%d : POSTED PAGES\n");
2899 return 0; 3057 return 0;
2900} 3058}
2901 3059
@@ -2945,8 +3103,8 @@ beiscsi_create_wrb_rings(struct beiscsi_hba *phba,
2945 pwrb_arr = kmalloc(sizeof(*pwrb_arr) * phba->params.cxns_per_ctrl, 3103 pwrb_arr = kmalloc(sizeof(*pwrb_arr) * phba->params.cxns_per_ctrl,
2946 GFP_KERNEL); 3104 GFP_KERNEL);
2947 if (!pwrb_arr) { 3105 if (!pwrb_arr) {
2948 shost_printk(KERN_ERR, phba->shost, 3106 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2949 "Memory alloc failed in create wrb ring.\n"); 3107 "BM_%d : Memory alloc failed in create wrb ring.\n");
2950 return -ENOMEM; 3108 return -ENOMEM;
2951 } 3109 }
2952 wrb_vaddr = mem_descr->mem_array[idx].virtual_address; 3110 wrb_vaddr = mem_descr->mem_array[idx].virtual_address;
@@ -2990,8 +3148,8 @@ beiscsi_create_wrb_rings(struct beiscsi_hba *phba,
2990 status = be_cmd_wrbq_create(&phba->ctrl, &sgl, 3148 status = be_cmd_wrbq_create(&phba->ctrl, &sgl,
2991 &phwi_context->be_wrbq[i]); 3149 &phwi_context->be_wrbq[i]);
2992 if (status != 0) { 3150 if (status != 0) {
2993 shost_printk(KERN_ERR, phba->shost, 3151 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2994 "wrbq create failed."); 3152 "BM_%d : wrbq create failed.");
2995 kfree(pwrb_arr); 3153 kfree(pwrb_arr);
2996 return status; 3154 return status;
2997 } 3155 }
@@ -3127,7 +3285,6 @@ static int find_num_cpus(void)
3127 if (num_cpus >= MAX_CPUS) 3285 if (num_cpus >= MAX_CPUS)
3128 num_cpus = MAX_CPUS - 1; 3286 num_cpus = MAX_CPUS - 1;
3129 3287
3130 SE_DEBUG(DBG_LVL_8, "num_cpus = %d\n", num_cpus);
3131 return num_cpus; 3288 return num_cpus;
3132} 3289}
3133 3290
@@ -3150,7 +3307,8 @@ static int hwi_init_port(struct beiscsi_hba *phba)
3150 3307
3151 status = beiscsi_create_eqs(phba, phwi_context); 3308 status = beiscsi_create_eqs(phba, phwi_context);
3152 if (status != 0) { 3309 if (status != 0) {
3153 shost_printk(KERN_ERR, phba->shost, "EQ not created\n"); 3310 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3311 "BM_%d : EQ not created\n");
3154 goto error; 3312 goto error;
3155 } 3313 }
3156 3314
@@ -3160,51 +3318,55 @@ static int hwi_init_port(struct beiscsi_hba *phba)
3160 3318
3161 status = mgmt_check_supported_fw(ctrl, phba); 3319 status = mgmt_check_supported_fw(ctrl, phba);
3162 if (status != 0) { 3320 if (status != 0) {
3163 shost_printk(KERN_ERR, phba->shost, 3321 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3164 "Unsupported fw version\n"); 3322 "BM_%d : Unsupported fw version\n");
3165 goto error; 3323 goto error;
3166 } 3324 }
3167 3325
3168 status = beiscsi_create_cqs(phba, phwi_context); 3326 status = beiscsi_create_cqs(phba, phwi_context);
3169 if (status != 0) { 3327 if (status != 0) {
3170 shost_printk(KERN_ERR, phba->shost, "CQ not created\n"); 3328 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3329 "BM_%d : CQ not created\n");
3171 goto error; 3330 goto error;
3172 } 3331 }
3173 3332
3174 status = beiscsi_create_def_hdr(phba, phwi_context, phwi_ctrlr, 3333 status = beiscsi_create_def_hdr(phba, phwi_context, phwi_ctrlr,
3175 def_pdu_ring_sz); 3334 def_pdu_ring_sz);
3176 if (status != 0) { 3335 if (status != 0) {
3177 shost_printk(KERN_ERR, phba->shost, 3336 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3178 "Default Header not created\n"); 3337 "BM_%d : Default Header not created\n");
3179 goto error; 3338 goto error;
3180 } 3339 }
3181 3340
3182 status = beiscsi_create_def_data(phba, phwi_context, 3341 status = beiscsi_create_def_data(phba, phwi_context,
3183 phwi_ctrlr, def_pdu_ring_sz); 3342 phwi_ctrlr, def_pdu_ring_sz);
3184 if (status != 0) { 3343 if (status != 0) {
3185 shost_printk(KERN_ERR, phba->shost, 3344 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3186 "Default Data not created\n"); 3345 "BM_%d : Default Data not created\n");
3187 goto error; 3346 goto error;
3188 } 3347 }
3189 3348
3190 status = beiscsi_post_pages(phba); 3349 status = beiscsi_post_pages(phba);
3191 if (status != 0) { 3350 if (status != 0) {
3192 shost_printk(KERN_ERR, phba->shost, "Post SGL Pages Failed\n"); 3351 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3352 "BM_%d : Post SGL Pages Failed\n");
3193 goto error; 3353 goto error;
3194 } 3354 }
3195 3355
3196 status = beiscsi_create_wrb_rings(phba, phwi_context, phwi_ctrlr); 3356 status = beiscsi_create_wrb_rings(phba, phwi_context, phwi_ctrlr);
3197 if (status != 0) { 3357 if (status != 0) {
3198 shost_printk(KERN_ERR, phba->shost, 3358 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3199 "WRB Rings not created\n"); 3359 "BM_%d : WRB Rings not created\n");
3200 goto error; 3360 goto error;
3201 } 3361 }
3202 3362
3203 SE_DEBUG(DBG_LVL_8, "hwi_init_port success\n"); 3363 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
3364 "BM_%d : hwi_init_port success\n");
3204 return 0; 3365 return 0;
3205 3366
3206error: 3367error:
3207 shost_printk(KERN_ERR, phba->shost, "hwi_init_port failed"); 3368 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3369 "BM_%d : hwi_init_port failed");
3208 hwi_cleanup(phba); 3370 hwi_cleanup(phba);
3209 return status; 3371 return status;
3210} 3372}
@@ -3217,12 +3379,13 @@ static int hwi_init_controller(struct beiscsi_hba *phba)
3217 if (1 == phba->init_mem[HWI_MEM_ADDN_CONTEXT].num_elements) { 3379 if (1 == phba->init_mem[HWI_MEM_ADDN_CONTEXT].num_elements) {
3218 phwi_ctrlr->phwi_ctxt = (struct hwi_context_memory *)phba-> 3380 phwi_ctrlr->phwi_ctxt = (struct hwi_context_memory *)phba->
3219 init_mem[HWI_MEM_ADDN_CONTEXT].mem_array[0].virtual_address; 3381 init_mem[HWI_MEM_ADDN_CONTEXT].mem_array[0].virtual_address;
3220 SE_DEBUG(DBG_LVL_8, " phwi_ctrlr->phwi_ctxt=%p\n", 3382 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
3221 phwi_ctrlr->phwi_ctxt); 3383 "BM_%d : phwi_ctrlr->phwi_ctxt=%p\n",
3384 phwi_ctrlr->phwi_ctxt);
3222 } else { 3385 } else {
3223 shost_printk(KERN_ERR, phba->shost, 3386 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3224 "HWI_MEM_ADDN_CONTEXT is more than one element." 3387 "BM_%d : HWI_MEM_ADDN_CONTEXT is more "
3225 "Failing to load\n"); 3388 "than one element.Failing to load\n");
3226 return -ENOMEM; 3389 return -ENOMEM;
3227 } 3390 }
3228 3391
@@ -3232,8 +3395,9 @@ static int hwi_init_controller(struct beiscsi_hba *phba)
3232 3395
3233 hwi_init_async_pdu_ctx(phba); 3396 hwi_init_async_pdu_ctx(phba);
3234 if (hwi_init_port(phba) != 0) { 3397 if (hwi_init_port(phba) != 0) {
3235 shost_printk(KERN_ERR, phba->shost, 3398 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3236 "hwi_init_controller failed\n"); 3399 "BM_%d : hwi_init_controller failed\n");
3400
3237 return -ENOMEM; 3401 return -ENOMEM;
3238 } 3402 }
3239 return 0; 3403 return 0;
@@ -3268,15 +3432,18 @@ static int beiscsi_init_controller(struct beiscsi_hba *phba)
3268 3432
3269 ret = beiscsi_get_memory(phba); 3433 ret = beiscsi_get_memory(phba);
3270 if (ret < 0) { 3434 if (ret < 0) {
3271 shost_printk(KERN_ERR, phba->shost, "beiscsi_dev_probe -" 3435 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3272 "Failed in beiscsi_alloc_memory\n"); 3436 "BM_%d : beiscsi_dev_probe -"
3437 "Failed in beiscsi_alloc_memory\n");
3273 return ret; 3438 return ret;
3274 } 3439 }
3275 3440
3276 ret = hwi_init_controller(phba); 3441 ret = hwi_init_controller(phba);
3277 if (ret) 3442 if (ret)
3278 goto free_init; 3443 goto free_init;
3279 SE_DEBUG(DBG_LVL_8, "Return success from beiscsi_init_controller"); 3444 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
3445 "BM_%d : Return success from beiscsi_init_controller");
3446
3280 return 0; 3447 return 0;
3281 3448
3282free_init: 3449free_init:
@@ -3301,8 +3468,8 @@ static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba)
3301 phba->params.ios_per_ctrl, 3468 phba->params.ios_per_ctrl,
3302 GFP_KERNEL); 3469 GFP_KERNEL);
3303 if (!phba->io_sgl_hndl_base) { 3470 if (!phba->io_sgl_hndl_base) {
3304 shost_printk(KERN_ERR, phba->shost, 3471 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3305 "Mem Alloc Failed. Failing to load\n"); 3472 "BM_%d : Mem Alloc Failed. Failing to load\n");
3306 return -ENOMEM; 3473 return -ENOMEM;
3307 } 3474 }
3308 phba->eh_sgl_hndl_base = kzalloc(sizeof(struct sgl_handle *) * 3475 phba->eh_sgl_hndl_base = kzalloc(sizeof(struct sgl_handle *) *
@@ -3311,14 +3478,14 @@ static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba)
3311 GFP_KERNEL); 3478 GFP_KERNEL);
3312 if (!phba->eh_sgl_hndl_base) { 3479 if (!phba->eh_sgl_hndl_base) {
3313 kfree(phba->io_sgl_hndl_base); 3480 kfree(phba->io_sgl_hndl_base);
3314 shost_printk(KERN_ERR, phba->shost, 3481 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3315 "Mem Alloc Failed. Failing to load\n"); 3482 "BM_%d : Mem Alloc Failed. Failing to load\n");
3316 return -ENOMEM; 3483 return -ENOMEM;
3317 } 3484 }
3318 } else { 3485 } else {
3319 shost_printk(KERN_ERR, phba->shost, 3486 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3320 "HWI_MEM_SGLH is more than one element." 3487 "BM_%d : HWI_MEM_SGLH is more than one element."
3321 "Failing to load\n"); 3488 "Failing to load\n");
3322 return -ENOMEM; 3489 return -ENOMEM;
3323 } 3490 }
3324 3491
@@ -3344,15 +3511,18 @@ static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba)
3344 } 3511 }
3345 idx++; 3512 idx++;
3346 } 3513 }
3347 SE_DEBUG(DBG_LVL_8, 3514 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
3348 "phba->io_sgl_hndl_avbl=%d" 3515 "BM_%d : phba->io_sgl_hndl_avbl=%d"
3349 "phba->eh_sgl_hndl_avbl=%d\n", 3516 "phba->eh_sgl_hndl_avbl=%d\n",
3350 phba->io_sgl_hndl_avbl, 3517 phba->io_sgl_hndl_avbl,
3351 phba->eh_sgl_hndl_avbl); 3518 phba->eh_sgl_hndl_avbl);
3519
3352 mem_descr_sg = phba->init_mem; 3520 mem_descr_sg = phba->init_mem;
3353 mem_descr_sg += HWI_MEM_SGE; 3521 mem_descr_sg += HWI_MEM_SGE;
3354 SE_DEBUG(DBG_LVL_8, "\n mem_descr_sg->num_elements=%d\n", 3522 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
3355 mem_descr_sg->num_elements); 3523 "\n BM_%d : mem_descr_sg->num_elements=%d\n",
3524 mem_descr_sg->num_elements);
3525
3356 arr_index = 0; 3526 arr_index = 0;
3357 idx = 0; 3527 idx = 0;
3358 while (idx < mem_descr_sg->num_elements) { 3528 while (idx < mem_descr_sg->num_elements) {
@@ -3390,17 +3560,17 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba)
3390 phba->cid_array = kzalloc(sizeof(void *) * phba->params.cxns_per_ctrl, 3560 phba->cid_array = kzalloc(sizeof(void *) * phba->params.cxns_per_ctrl,
3391 GFP_KERNEL); 3561 GFP_KERNEL);
3392 if (!phba->cid_array) { 3562 if (!phba->cid_array) {
3393 shost_printk(KERN_ERR, phba->shost, 3563 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3394 "Failed to allocate memory in " 3564 "BM_%d : Failed to allocate memory in "
3395 "hba_setup_cid_tbls\n"); 3565 "hba_setup_cid_tbls\n");
3396 return -ENOMEM; 3566 return -ENOMEM;
3397 } 3567 }
3398 phba->ep_array = kzalloc(sizeof(struct iscsi_endpoint *) * 3568 phba->ep_array = kzalloc(sizeof(struct iscsi_endpoint *) *
3399 phba->params.cxns_per_ctrl * 2, GFP_KERNEL); 3569 phba->params.cxns_per_ctrl * 2, GFP_KERNEL);
3400 if (!phba->ep_array) { 3570 if (!phba->ep_array) {
3401 shost_printk(KERN_ERR, phba->shost, 3571 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3402 "Failed to allocate memory in " 3572 "BM_%d : Failed to allocate memory in "
3403 "hba_setup_cid_tbls\n"); 3573 "hba_setup_cid_tbls\n");
3404 kfree(phba->cid_array); 3574 kfree(phba->cid_array);
3405 return -ENOMEM; 3575 return -ENOMEM;
3406 } 3576 }
@@ -3433,18 +3603,22 @@ static void hwi_enable_intr(struct beiscsi_hba *phba)
3433 enabled = reg & MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK; 3603 enabled = reg & MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK;
3434 if (!enabled) { 3604 if (!enabled) {
3435 reg |= MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK; 3605 reg |= MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK;
3436 SE_DEBUG(DBG_LVL_8, "reg =x%08x addr=%p\n", reg, addr); 3606 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
3607 "BM_%d : reg =x%08x addr=%p\n", reg, addr);
3437 iowrite32(reg, addr); 3608 iowrite32(reg, addr);
3438 } 3609 }
3439 3610
3440 if (!phba->msix_enabled) { 3611 if (!phba->msix_enabled) {
3441 eq = &phwi_context->be_eq[0].q; 3612 eq = &phwi_context->be_eq[0].q;
3442 SE_DEBUG(DBG_LVL_8, "eq->id=%d\n", eq->id); 3613 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
3614 "BM_%d : eq->id=%d\n", eq->id);
3615
3443 hwi_ring_eq_db(phba, eq->id, 0, 0, 1, 1); 3616 hwi_ring_eq_db(phba, eq->id, 0, 0, 1, 1);
3444 } else { 3617 } else {
3445 for (i = 0; i <= phba->num_cpus; i++) { 3618 for (i = 0; i <= phba->num_cpus; i++) {
3446 eq = &phwi_context->be_eq[i].q; 3619 eq = &phwi_context->be_eq[i].q;
3447 SE_DEBUG(DBG_LVL_8, "eq->id=%d\n", eq->id); 3620 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
3621 "BM_%d : eq->id=%d\n", eq->id);
3448 hwi_ring_eq_db(phba, eq->id, 0, 0, 1, 1); 3622 hwi_ring_eq_db(phba, eq->id, 0, 0, 1, 1);
3449 } 3623 }
3450 } 3624 }
@@ -3462,8 +3636,8 @@ static void hwi_disable_intr(struct beiscsi_hba *phba)
3462 reg &= ~MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK; 3636 reg &= ~MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK;
3463 iowrite32(reg, addr); 3637 iowrite32(reg, addr);
3464 } else 3638 } else
3465 shost_printk(KERN_WARNING, phba->shost, 3639 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
3466 "In hwi_disable_intr, Already Disabled\n"); 3640 "BM_%d : In hwi_disable_intr, Already Disabled\n");
3467} 3641}
3468 3642
3469/** 3643/**
@@ -3490,16 +3664,20 @@ static int beiscsi_get_boot_info(struct beiscsi_hba *phba)
3490 /* Get the session handle of the boot target */ 3664 /* Get the session handle of the boot target */
3491 ret = be_mgmt_get_boot_shandle(phba, &s_handle); 3665 ret = be_mgmt_get_boot_shandle(phba, &s_handle);
3492 if (ret) { 3666 if (ret) {
3493 SE_DEBUG(DBG_LVL_1, "No boot session\n"); 3667 beiscsi_log(phba, KERN_ERR,
3668 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
3669 "BM_%d : No boot session\n");
3494 return ret; 3670 return ret;
3495 } 3671 }
3496 nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev, 3672 nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev,
3497 sizeof(*session_resp), 3673 sizeof(*session_resp),
3498 &nonemb_cmd.dma); 3674 &nonemb_cmd.dma);
3499 if (nonemb_cmd.va == NULL) { 3675 if (nonemb_cmd.va == NULL) {
3500 SE_DEBUG(DBG_LVL_1, 3676 beiscsi_log(phba, KERN_ERR,
3501 "Failed to allocate memory for" 3677 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
3502 "beiscsi_get_session_info\n"); 3678 "BM_%d : Failed to allocate memory for"
3679 "beiscsi_get_session_info\n");
3680
3503 return -ENOMEM; 3681 return -ENOMEM;
3504 } 3682 }
3505 3683
@@ -3507,8 +3685,11 @@ static int beiscsi_get_boot_info(struct beiscsi_hba *phba)
3507 tag = mgmt_get_session_info(phba, s_handle, 3685 tag = mgmt_get_session_info(phba, s_handle,
3508 &nonemb_cmd); 3686 &nonemb_cmd);
3509 if (!tag) { 3687 if (!tag) {
3510 SE_DEBUG(DBG_LVL_1, "beiscsi_get_session_info" 3688 beiscsi_log(phba, KERN_ERR,
3511 " Failed\n"); 3689 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
3690 "BM_%d : beiscsi_get_session_info"
3691 " Failed\n");
3692
3512 goto boot_freemem; 3693 goto boot_freemem;
3513 } else 3694 } else
3514 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 3695 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
@@ -3518,9 +3699,12 @@ static int beiscsi_get_boot_info(struct beiscsi_hba *phba)
3518 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8; 3699 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
3519 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 3700 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
3520 if (status || extd_status) { 3701 if (status || extd_status) {
3521 SE_DEBUG(DBG_LVL_1, "beiscsi_get_session_info Failed" 3702 beiscsi_log(phba, KERN_ERR,
3522 " status = %d extd_status = %d\n", 3703 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
3523 status, extd_status); 3704 "BM_%d : beiscsi_get_session_info Failed"
3705 " status = %d extd_status = %d\n",
3706 status, extd_status);
3707
3524 free_mcc_tag(&phba->ctrl, tag); 3708 free_mcc_tag(&phba->ctrl, tag);
3525 goto boot_freemem; 3709 goto boot_freemem;
3526 } 3710 }
@@ -3600,22 +3784,22 @@ static int beiscsi_init_port(struct beiscsi_hba *phba)
3600 3784
3601 ret = beiscsi_init_controller(phba); 3785 ret = beiscsi_init_controller(phba);
3602 if (ret < 0) { 3786 if (ret < 0) {
3603 shost_printk(KERN_ERR, phba->shost, 3787 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3604 "beiscsi_dev_probe - Failed in" 3788 "BM_%d : beiscsi_dev_probe - Failed in"
3605 "beiscsi_init_controller\n"); 3789 "beiscsi_init_controller\n");
3606 return ret; 3790 return ret;
3607 } 3791 }
3608 ret = beiscsi_init_sgl_handle(phba); 3792 ret = beiscsi_init_sgl_handle(phba);
3609 if (ret < 0) { 3793 if (ret < 0) {
3610 shost_printk(KERN_ERR, phba->shost, 3794 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3611 "beiscsi_dev_probe - Failed in" 3795 "BM_%d : beiscsi_dev_probe - Failed in"
3612 "beiscsi_init_sgl_handle\n"); 3796 "beiscsi_init_sgl_handle\n");
3613 goto do_cleanup_ctrlr; 3797 goto do_cleanup_ctrlr;
3614 } 3798 }
3615 3799
3616 if (hba_setup_cid_tbls(phba)) { 3800 if (hba_setup_cid_tbls(phba)) {
3617 shost_printk(KERN_ERR, phba->shost, 3801 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3618 "Failed in hba_setup_cid_tbls\n"); 3802 "BM_%d : Failed in hba_setup_cid_tbls\n");
3619 kfree(phba->io_sgl_hndl_base); 3803 kfree(phba->io_sgl_hndl_base);
3620 kfree(phba->eh_sgl_hndl_base); 3804 kfree(phba->eh_sgl_hndl_base);
3621 goto do_cleanup_ctrlr; 3805 goto do_cleanup_ctrlr;
@@ -3667,8 +3851,8 @@ static void beiscsi_clean_port(struct beiscsi_hba *phba)
3667 3851
3668 mgmt_status = mgmt_epfw_cleanup(phba, CMD_CONNECTION_CHUTE_0); 3852 mgmt_status = mgmt_epfw_cleanup(phba, CMD_CONNECTION_CHUTE_0);
3669 if (mgmt_status) 3853 if (mgmt_status)
3670 shost_printk(KERN_WARNING, phba->shost, 3854 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
3671 "mgmt_epfw_cleanup FAILED\n"); 3855 "BM_%d : mgmt_epfw_cleanup FAILED\n");
3672 3856
3673 hwi_purge_eq(phba); 3857 hwi_purge_eq(phba);
3674 hwi_cleanup(phba); 3858 hwi_cleanup(phba);
@@ -3949,7 +4133,9 @@ free_hndls:
3949 pci_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs, 4133 pci_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs,
3950 io_task->bhs_pa.u.a64.address); 4134 io_task->bhs_pa.u.a64.address);
3951 io_task->cmd_bhs = NULL; 4135 io_task->cmd_bhs = NULL;
3952 SE_DEBUG(DBG_LVL_1, "Alloc of SGL_ICD Failed\n"); 4136 beiscsi_log(phba, KERN_ERR,
4137 BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
4138 "BM_%d : Alloc of SGL_ICD Failed\n");
3953 return -ENOMEM; 4139 return -ENOMEM;
3954} 4140}
3955 4141
@@ -4067,8 +4253,10 @@ static int beiscsi_mtask(struct iscsi_task *task)
4067 break; 4253 break;
4068 4254
4069 default: 4255 default:
4070 SE_DEBUG(DBG_LVL_1, "opcode =%d Not supported\n", 4256 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
4071 task->hdr->opcode & ISCSI_OPCODE_MASK); 4257 "BM_%d : opcode =%d Not supported\n",
4258 task->hdr->opcode & ISCSI_OPCODE_MASK);
4259
4072 return -EINVAL; 4260 return -EINVAL;
4073 } 4261 }
4074 4262
@@ -4100,17 +4288,22 @@ static int beiscsi_task_xmit(struct iscsi_task *task)
4100 io_task->scsi_cmnd = sc; 4288 io_task->scsi_cmnd = sc;
4101 num_sg = scsi_dma_map(sc); 4289 num_sg = scsi_dma_map(sc);
4102 if (num_sg < 0) { 4290 if (num_sg < 0) {
4103 SE_DEBUG(DBG_LVL_1, " scsi_dma_map Failed\n") 4291 struct iscsi_conn *conn = task->conn;
4292 struct beiscsi_hba *phba = NULL;
4293
4294 phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
4295 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_IO,
4296 "BM_%d : scsi_dma_map Failed\n");
4297
4104 return num_sg; 4298 return num_sg;
4105 } 4299 }
4106 xferlen = scsi_bufflen(sc); 4300 xferlen = scsi_bufflen(sc);
4107 sg = scsi_sglist(sc); 4301 sg = scsi_sglist(sc);
4108 if (sc->sc_data_direction == DMA_TO_DEVICE) { 4302 if (sc->sc_data_direction == DMA_TO_DEVICE)
4109 writedir = 1; 4303 writedir = 1;
4110 SE_DEBUG(DBG_LVL_4, "task->imm_count=0x%08x\n", 4304 else
4111 task->imm_count);
4112 } else
4113 writedir = 0; 4305 writedir = 0;
4306
4114 return beiscsi_iotask(task, sg, num_sg, xferlen, writedir); 4307 return beiscsi_iotask(task, sg, num_sg, xferlen, writedir);
4115} 4308}
4116 4309
@@ -4139,14 +4332,17 @@ static int beiscsi_bsg_request(struct bsg_job *job)
4139 job->request_payload.payload_len, 4332 job->request_payload.payload_len,
4140 &nonemb_cmd.dma); 4333 &nonemb_cmd.dma);
4141 if (nonemb_cmd.va == NULL) { 4334 if (nonemb_cmd.va == NULL) {
4142 SE_DEBUG(DBG_LVL_1, "Failed to allocate memory for " 4335 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
4143 "beiscsi_bsg_request\n"); 4336 "BM_%d : Failed to allocate memory for "
4337 "beiscsi_bsg_request\n");
4144 return -EIO; 4338 return -EIO;
4145 } 4339 }
4146 tag = mgmt_vendor_specific_fw_cmd(&phba->ctrl, phba, job, 4340 tag = mgmt_vendor_specific_fw_cmd(&phba->ctrl, phba, job,
4147 &nonemb_cmd); 4341 &nonemb_cmd);
4148 if (!tag) { 4342 if (!tag) {
4149 SE_DEBUG(DBG_LVL_1, "be_cmd_get_mac_addr Failed\n"); 4343 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
4344 "BM_%d : be_cmd_get_mac_addr Failed\n");
4345
4150 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 4346 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
4151 nonemb_cmd.va, nonemb_cmd.dma); 4347 nonemb_cmd.va, nonemb_cmd.dma);
4152 return -EAGAIN; 4348 return -EAGAIN;
@@ -4168,22 +4364,31 @@ static int beiscsi_bsg_request(struct bsg_job *job)
4168 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, 4364 pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
4169 nonemb_cmd.va, nonemb_cmd.dma); 4365 nonemb_cmd.va, nonemb_cmd.dma);
4170 if (status || extd_status) { 4366 if (status || extd_status) {
4171 SE_DEBUG(DBG_LVL_1, "be_cmd_get_mac_addr Failed" 4367 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
4172 " status = %d extd_status = %d\n", 4368 "BM_%d : be_cmd_get_mac_addr Failed"
4173 status, extd_status); 4369 " status = %d extd_status = %d\n",
4370 status, extd_status);
4371
4174 return -EIO; 4372 return -EIO;
4175 } 4373 }
4176 break; 4374 break;
4177 4375
4178 default: 4376 default:
4179 SE_DEBUG(DBG_LVL_1, "Unsupported bsg command: 0x%x\n", 4377 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
4180 bsg_req->msgcode); 4378 "BM_%d : Unsupported bsg command: 0x%x\n",
4379 bsg_req->msgcode);
4181 break; 4380 break;
4182 } 4381 }
4183 4382
4184 return rc; 4383 return rc;
4185} 4384}
4186 4385
4386void beiscsi_hba_attrs_init(struct beiscsi_hba *phba)
4387{
4388 /* Set the logging parameter */
4389 beiscsi_log_enable_init(phba, beiscsi_log_enable);
4390}
4391
4187static void beiscsi_quiesce(struct beiscsi_hba *phba) 4392static void beiscsi_quiesce(struct beiscsi_hba *phba)
4188{ 4393{
4189 struct hwi_controller *phwi_ctrlr; 4394 struct hwi_controller *phwi_ctrlr;
@@ -4293,18 +4498,21 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
4293 4498
4294 ret = beiscsi_enable_pci(pcidev); 4499 ret = beiscsi_enable_pci(pcidev);
4295 if (ret < 0) { 4500 if (ret < 0) {
4296 dev_err(&pcidev->dev, "beiscsi_dev_probe-" 4501 dev_err(&pcidev->dev,
4297 " Failed to enable pci device\n"); 4502 "beiscsi_dev_probe - Failed to enable pci device\n");
4298 return ret; 4503 return ret;
4299 } 4504 }
4300 4505
4301 phba = beiscsi_hba_alloc(pcidev); 4506 phba = beiscsi_hba_alloc(pcidev);
4302 if (!phba) { 4507 if (!phba) {
4303 dev_err(&pcidev->dev, "beiscsi_dev_probe-" 4508 dev_err(&pcidev->dev,
4304 " Failed in beiscsi_hba_alloc\n"); 4509 "beiscsi_dev_probe - Failed in beiscsi_hba_alloc\n");
4305 goto disable_pci; 4510 goto disable_pci;
4306 } 4511 }
4307 4512
4513 /* Initialize Driver configuration Paramters */
4514 beiscsi_hba_attrs_init(phba);
4515
4308 switch (pcidev->device) { 4516 switch (pcidev->device) {
4309 case BE_DEVICE_ID1: 4517 case BE_DEVICE_ID1:
4310 case OC_DEVICE_ID1: 4518 case OC_DEVICE_ID1:
@@ -4324,7 +4532,9 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
4324 else 4532 else
4325 num_cpus = 1; 4533 num_cpus = 1;
4326 phba->num_cpus = num_cpus; 4534 phba->num_cpus = num_cpus;
4327 SE_DEBUG(DBG_LVL_8, "num_cpus = %d\n", phba->num_cpus); 4535 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
4536 "BM_%d : num_cpus = %d\n",
4537 phba->num_cpus);
4328 4538
4329 if (enable_msix) { 4539 if (enable_msix) {
4330 beiscsi_msix_enable(phba); 4540 beiscsi_msix_enable(phba);
@@ -4333,8 +4543,9 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
4333 } 4543 }
4334 ret = be_ctrl_init(phba, pcidev); 4544 ret = be_ctrl_init(phba, pcidev);
4335 if (ret) { 4545 if (ret) {
4336 shost_printk(KERN_ERR, phba->shost, "beiscsi_dev_probe-" 4546 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
4337 "Failed in be_ctrl_init\n"); 4547 "BM_%d : beiscsi_dev_probe-"
4548 "Failed in be_ctrl_init\n");
4338 goto hba_free; 4549 goto hba_free;
4339 } 4550 }
4340 4551
@@ -4343,19 +4554,19 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
4343 value = readl((void *)real_offset); 4554 value = readl((void *)real_offset);
4344 if (value & 0x00010000) { 4555 if (value & 0x00010000) {
4345 gcrashmode++; 4556 gcrashmode++;
4346 shost_printk(KERN_ERR, phba->shost, 4557 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
4347 "Loading Driver in crashdump mode\n"); 4558 "BM_%d : Loading Driver in crashdump mode\n");
4348 ret = beiscsi_cmd_reset_function(phba); 4559 ret = beiscsi_cmd_reset_function(phba);
4349 if (ret) { 4560 if (ret) {
4350 shost_printk(KERN_ERR, phba->shost, 4561 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
4351 "Reset Failed. Aborting Crashdump\n"); 4562 "BM_%d : Reset Failed. Aborting Crashdump\n");
4352 goto hba_free; 4563 goto hba_free;
4353 } 4564 }
4354 ret = be_chk_reset_complete(phba); 4565 ret = be_chk_reset_complete(phba);
4355 if (ret) { 4566 if (ret) {
4356 shost_printk(KERN_ERR, phba->shost, 4567 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
4357 "Failed to get out of reset." 4568 "BM_%d : Failed to get out of reset."
4358 "Aborting Crashdump\n"); 4569 "Aborting Crashdump\n");
4359 goto hba_free; 4570 goto hba_free;
4360 } 4571 }
4361 } else { 4572 } else {
@@ -4370,8 +4581,8 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
4370 spin_lock_init(&phba->isr_lock); 4581 spin_lock_init(&phba->isr_lock);
4371 ret = mgmt_get_fw_config(&phba->ctrl, phba); 4582 ret = mgmt_get_fw_config(&phba->ctrl, phba);
4372 if (ret != 0) { 4583 if (ret != 0) {
4373 shost_printk(KERN_ERR, phba->shost, 4584 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
4374 "Error getting fw config\n"); 4585 "BM_%d : Error getting fw config\n");
4375 goto free_port; 4586 goto free_port;
4376 } 4587 }
4377 phba->shost->max_id = phba->fw_config.iscsi_cid_count; 4588 phba->shost->max_id = phba->fw_config.iscsi_cid_count;
@@ -4379,8 +4590,9 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
4379 phba->shost->can_queue = phba->params.ios_per_ctrl; 4590 phba->shost->can_queue = phba->params.ios_per_ctrl;
4380 ret = beiscsi_init_port(phba); 4591 ret = beiscsi_init_port(phba);
4381 if (ret < 0) { 4592 if (ret < 0) {
4382 shost_printk(KERN_ERR, phba->shost, "beiscsi_dev_probe-" 4593 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
4383 "Failed in beiscsi_init_port\n"); 4594 "BM_%d : beiscsi_dev_probe-"
4595 "Failed in beiscsi_init_port\n");
4384 goto free_port; 4596 goto free_port;
4385 } 4597 }
4386 4598
@@ -4397,8 +4609,9 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
4397 phba->shost->host_no); 4609 phba->shost->host_no);
4398 phba->wq = alloc_workqueue(phba->wq_name, WQ_MEM_RECLAIM, 1); 4610 phba->wq = alloc_workqueue(phba->wq_name, WQ_MEM_RECLAIM, 1);
4399 if (!phba->wq) { 4611 if (!phba->wq) {
4400 shost_printk(KERN_ERR, phba->shost, "beiscsi_dev_probe-" 4612 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
4401 "Failed to allocate work queue\n"); 4613 "BM_%d : beiscsi_dev_probe-"
4614 "Failed to allocate work queue\n");
4402 goto free_twq; 4615 goto free_twq;
4403 } 4616 }
4404 4617
@@ -4416,8 +4629,9 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
4416 } 4629 }
4417 ret = beiscsi_init_irqs(phba); 4630 ret = beiscsi_init_irqs(phba);
4418 if (ret < 0) { 4631 if (ret < 0) {
4419 shost_printk(KERN_ERR, phba->shost, "beiscsi_dev_probe-" 4632 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
4420 "Failed to beiscsi_init_irqs\n"); 4633 "BM_%d : beiscsi_dev_probe-"
4634 "Failed to beiscsi_init_irqs\n");
4421 goto free_blkenbld; 4635 goto free_blkenbld;
4422 } 4636 }
4423 hwi_enable_intr(phba); 4637 hwi_enable_intr(phba);
@@ -4427,11 +4641,13 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
4427 * log error but continue, because we may not be using 4641 * log error but continue, because we may not be using
4428 * iscsi boot. 4642 * iscsi boot.
4429 */ 4643 */
4430 shost_printk(KERN_ERR, phba->shost, "Could not set up " 4644 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
4431 "iSCSI boot info.\n"); 4645 "BM_%d : Could not set up "
4646 "iSCSI boot info.\n");
4432 4647
4433 beiscsi_create_def_ifaces(phba); 4648 beiscsi_create_def_ifaces(phba);
4434 SE_DEBUG(DBG_LVL_8, "\n\n\n SUCCESS - DRIVER LOADED\n\n\n"); 4649 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
4650 "\n\n\n BM_%d : SUCCESS - DRIVER LOADED\n\n\n");
4435 return 0; 4651 return 0;
4436 4652
4437free_blkenbld: 4653free_blkenbld:
@@ -4519,19 +4735,17 @@ static int __init beiscsi_module_init(void)
4519 beiscsi_scsi_transport = 4735 beiscsi_scsi_transport =
4520 iscsi_register_transport(&beiscsi_iscsi_transport); 4736 iscsi_register_transport(&beiscsi_iscsi_transport);
4521 if (!beiscsi_scsi_transport) { 4737 if (!beiscsi_scsi_transport) {
4522 SE_DEBUG(DBG_LVL_1, 4738 printk(KERN_ERR
4523 "beiscsi_module_init - Unable to register beiscsi" 4739 "beiscsi_module_init - Unable to register beiscsi transport.\n");
4524 "transport.\n");
4525 return -ENOMEM; 4740 return -ENOMEM;
4526 } 4741 }
4527 SE_DEBUG(DBG_LVL_8, "In beiscsi_module_init, tt=%p\n", 4742 printk(KERN_INFO "In beiscsi_module_init, tt=%p\n",
4528 &beiscsi_iscsi_transport); 4743 &beiscsi_iscsi_transport);
4529 4744
4530 ret = pci_register_driver(&beiscsi_pci_driver); 4745 ret = pci_register_driver(&beiscsi_pci_driver);
4531 if (ret) { 4746 if (ret) {
4532 SE_DEBUG(DBG_LVL_1, 4747 printk(KERN_ERR
4533 "beiscsi_module_init - Unable to register" 4748 "beiscsi_module_init - Unable to register beiscsi pci driver.\n");
4534 "beiscsi pci driver.\n");
4535 goto unregister_iscsi_transport; 4749 goto unregister_iscsi_transport;
4536 } 4750 }
4537 return 0; 4751 return 0;
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 8b2ce610b06d..084386cc5672 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -24,6 +24,8 @@
24#include <linux/pci.h> 24#include <linux/pci.h>
25#include <linux/if_ether.h> 25#include <linux/if_ether.h>
26#include <linux/in.h> 26#include <linux/in.h>
27#include <linux/ctype.h>
28#include <linux/module.h>
27#include <scsi/scsi.h> 29#include <scsi/scsi.h>
28#include <scsi/scsi_cmnd.h> 30#include <scsi/scsi_cmnd.h>
29#include <scsi/scsi_device.h> 31#include <scsi/scsi_device.h>
@@ -85,23 +87,6 @@
85#define IIOC_SCSI_DATA 0x05 /* Write Operation */ 87#define IIOC_SCSI_DATA 0x05 /* Write Operation */
86 88
87#define INVALID_SESS_HANDLE 0xFFFFFFFF 89#define INVALID_SESS_HANDLE 0xFFFFFFFF
88#define DBG_LVL 0x00000001
89#define DBG_LVL_1 0x00000001
90#define DBG_LVL_2 0x00000002
91#define DBG_LVL_3 0x00000004
92#define DBG_LVL_4 0x00000008
93#define DBG_LVL_5 0x00000010
94#define DBG_LVL_6 0x00000020
95#define DBG_LVL_7 0x00000040
96#define DBG_LVL_8 0x00000080
97
98#define SE_DEBUG(debug_mask, fmt, args...) \
99do { \
100 if (debug_mask & DBG_LVL) { \
101 printk(KERN_ERR "(%s():%d):", __func__, __LINE__);\
102 printk(fmt, ##args); \
103 } \
104} while (0);
105 90
106#define BE_ADAPTER_UP 0x00000000 91#define BE_ADAPTER_UP 0x00000000
107#define BE_ADAPTER_LINK_DOWN 0x00000001 92#define BE_ADAPTER_LINK_DOWN 0x00000001
@@ -352,6 +337,8 @@ struct beiscsi_hba {
352 struct mgmt_session_info boot_sess; 337 struct mgmt_session_info boot_sess;
353 struct invalidate_command_table inv_tbl[128]; 338 struct invalidate_command_table inv_tbl[128];
354 339
340 unsigned int attr_log_enable;
341
355}; 342};
356 343
357struct beiscsi_session { 344struct beiscsi_session {
@@ -861,4 +848,20 @@ struct hwi_context_memory {
861 struct hwi_async_pdu_context *pasync_ctx; 848 struct hwi_async_pdu_context *pasync_ctx;
862}; 849};
863 850
851/* Logging related definitions */
852#define BEISCSI_LOG_INIT 0x0001 /* Initialization events */
853#define BEISCSI_LOG_MBOX 0x0002 /* Mailbox Events */
854#define BEISCSI_LOG_MISC 0x0004 /* Miscllaneous Events */
855#define BEISCSI_LOG_EH 0x0008 /* Error Handler */
856#define BEISCSI_LOG_IO 0x0010 /* IO Code Path */
857#define BEISCSI_LOG_CONFIG 0x0020 /* CONFIG Code Path */
858
859#define beiscsi_log(phba, level, mask, fmt, arg...) \
860do { \
861 uint32_t log_value = phba->attr_log_enable; \
862 if (((mask) & log_value) || (level[1] <= '3')) \
863 shost_printk(level, phba->shost, \
864 fmt, __LINE__, ##arg); \
865} while (0)
866
864#endif 867#endif
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index e294b0ae324f..3dca332acce2 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -42,7 +42,10 @@ unsigned int mgmt_reopen_session(struct beiscsi_hba *phba,
42 struct be_cmd_reopen_session_req *req; 42 struct be_cmd_reopen_session_req *req;
43 unsigned int tag = 0; 43 unsigned int tag = 0;
44 44
45 SE_DEBUG(DBG_LVL_8, "In bescsi_get_boot_target\n"); 45 beiscsi_log(phba, KERN_INFO,
46 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
47 "BG_%d : In bescsi_get_boot_target\n");
48
46 spin_lock(&ctrl->mbox_lock); 49 spin_lock(&ctrl->mbox_lock);
47 tag = alloc_mcc_tag(phba); 50 tag = alloc_mcc_tag(phba);
48 if (!tag) { 51 if (!tag) {
@@ -74,7 +77,10 @@ unsigned int mgmt_get_boot_target(struct beiscsi_hba *phba)
74 struct be_cmd_get_boot_target_req *req; 77 struct be_cmd_get_boot_target_req *req;
75 unsigned int tag = 0; 78 unsigned int tag = 0;
76 79
77 SE_DEBUG(DBG_LVL_8, "In bescsi_get_boot_target\n"); 80 beiscsi_log(phba, KERN_INFO,
81 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
82 "BG_%d : In bescsi_get_boot_target\n");
83
78 spin_lock(&ctrl->mbox_lock); 84 spin_lock(&ctrl->mbox_lock);
79 tag = alloc_mcc_tag(phba); 85 tag = alloc_mcc_tag(phba);
80 if (!tag) { 86 if (!tag) {
@@ -106,7 +112,10 @@ unsigned int mgmt_get_session_info(struct beiscsi_hba *phba,
106 struct be_cmd_get_session_resp *resp; 112 struct be_cmd_get_session_resp *resp;
107 struct be_sge *sge; 113 struct be_sge *sge;
108 114
109 SE_DEBUG(DBG_LVL_8, "In beiscsi_get_session_info\n"); 115 beiscsi_log(phba, KERN_INFO,
116 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
117 "BG_%d : In beiscsi_get_session_info\n");
118
110 spin_lock(&ctrl->mbox_lock); 119 spin_lock(&ctrl->mbox_lock);
111 tag = alloc_mcc_tag(phba); 120 tag = alloc_mcc_tag(phba);
112 if (!tag) { 121 if (!tag) {
@@ -165,16 +174,16 @@ int mgmt_get_fw_config(struct be_ctrl_info *ctrl,
165 phba->fw_config.iscsi_cid_count = 174 phba->fw_config.iscsi_cid_count =
166 pfw_cfg->ulp[0].sq_count; 175 pfw_cfg->ulp[0].sq_count;
167 if (phba->fw_config.iscsi_cid_count > (BE2_MAX_SESSIONS / 2)) { 176 if (phba->fw_config.iscsi_cid_count > (BE2_MAX_SESSIONS / 2)) {
168 SE_DEBUG(DBG_LVL_8, 177 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
169 "FW reported MAX CXNS as %d\t" 178 "BG_%d : FW reported MAX CXNS as %d\t"
170 "Max Supported = %d.\n", 179 "Max Supported = %d.\n",
171 phba->fw_config.iscsi_cid_count, 180 phba->fw_config.iscsi_cid_count,
172 BE2_MAX_SESSIONS); 181 BE2_MAX_SESSIONS);
173 phba->fw_config.iscsi_cid_count = BE2_MAX_SESSIONS / 2; 182 phba->fw_config.iscsi_cid_count = BE2_MAX_SESSIONS / 2;
174 } 183 }
175 } else { 184 } else {
176 shost_printk(KERN_WARNING, phba->shost, 185 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
177 "Failed in mgmt_get_fw_config\n"); 186 "BG_%d : Failed in mgmt_get_fw_config\n");
178 } 187 }
179 188
180 spin_unlock(&ctrl->mbox_lock); 189 spin_unlock(&ctrl->mbox_lock);
@@ -194,9 +203,9 @@ int mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
194 sizeof(struct be_mgmt_controller_attributes), 203 sizeof(struct be_mgmt_controller_attributes),
195 &nonemb_cmd.dma); 204 &nonemb_cmd.dma);
196 if (nonemb_cmd.va == NULL) { 205 if (nonemb_cmd.va == NULL) {
197 SE_DEBUG(DBG_LVL_1, 206 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
198 "Failed to allocate memory for mgmt_check_supported_fw" 207 "BG_%d : Failed to allocate memory for "
199 "\n"); 208 "mgmt_check_supported_fw\n");
200 return -ENOMEM; 209 return -ENOMEM;
201 } 210 }
202 nonemb_cmd.size = sizeof(struct be_mgmt_controller_attributes); 211 nonemb_cmd.size = sizeof(struct be_mgmt_controller_attributes);
@@ -213,18 +222,23 @@ int mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
213 status = be_mbox_notify(ctrl); 222 status = be_mbox_notify(ctrl);
214 if (!status) { 223 if (!status) {
215 struct be_mgmt_controller_attributes_resp *resp = nonemb_cmd.va; 224 struct be_mgmt_controller_attributes_resp *resp = nonemb_cmd.va;
216 SE_DEBUG(DBG_LVL_8, "Firmware version of CMD: %s\n", 225 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
217 resp->params.hba_attribs.flashrom_version_string); 226 "BG_%d : Firmware Version of CMD : %s\n"
218 SE_DEBUG(DBG_LVL_8, "Firmware version is : %s\n", 227 "Firmware Version is : %s\n"
219 resp->params.hba_attribs.firmware_version_string); 228 "Developer Build, not performing version check...\n",
220 SE_DEBUG(DBG_LVL_8, 229 resp->params.hba_attribs
221 "Developer Build, not performing version check...\n"); 230 .flashrom_version_string,
231 resp->params.hba_attribs.
232 firmware_version_string);
233
222 phba->fw_config.iscsi_features = 234 phba->fw_config.iscsi_features =
223 resp->params.hba_attribs.iscsi_features; 235 resp->params.hba_attribs.iscsi_features;
224 SE_DEBUG(DBG_LVL_8, " phba->fw_config.iscsi_features = %d\n", 236 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
225 phba->fw_config.iscsi_features); 237 "BM_%d : phba->fw_config.iscsi_features = %d\n",
238 phba->fw_config.iscsi_features);
226 } else 239 } else
227 SE_DEBUG(DBG_LVL_1, " Failed in mgmt_check_supported_fw\n"); 240 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
241 "BG_%d : Failed in mgmt_check_supported_fw\n");
228 spin_unlock(&ctrl->mbox_lock); 242 spin_unlock(&ctrl->mbox_lock);
229 if (nonemb_cmd.va) 243 if (nonemb_cmd.va)
230 pci_free_consistent(ctrl->pdev, nonemb_cmd.size, 244 pci_free_consistent(ctrl->pdev, nonemb_cmd.size,
@@ -273,9 +287,10 @@ unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl,
273 OPCODE_COMMON_READ_FLASH, sizeof(*req)); 287 OPCODE_COMMON_READ_FLASH, sizeof(*req));
274 break; 288 break;
275 default: 289 default:
276 shost_printk(KERN_WARNING, phba->shost, 290 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
277 "Unsupported cmd = 0x%x\n\n", bsg_req->rqst_data. 291 "BG_%d : Unsupported cmd = 0x%x\n\n",
278 h_vendor.vendor_cmd[0]); 292 bsg_req->rqst_data.h_vendor.vendor_cmd[0]);
293
279 spin_unlock(&ctrl->mbox_lock); 294 spin_unlock(&ctrl->mbox_lock);
280 return -ENOSYS; 295 return -ENOSYS;
281 } 296 }
@@ -319,8 +334,8 @@ int mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute)
319 334
320 status = be_mcc_notify_wait(phba); 335 status = be_mcc_notify_wait(phba);
321 if (status) 336 if (status)
322 shost_printk(KERN_WARNING, phba->shost, 337 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
323 " mgmt_epfw_cleanup , FAILED\n"); 338 "BG_%d : mgmt_epfw_cleanup , FAILED\n");
324 spin_unlock(&ctrl->mbox_lock); 339 spin_unlock(&ctrl->mbox_lock);
325 return status; 340 return status;
326} 341}
@@ -503,8 +518,9 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
503 &daddr_in6->sin6_addr.in6_u.u6_addr8, 16); 518 &daddr_in6->sin6_addr.in6_u.u6_addr8, 16);
504 beiscsi_ep->ip_type = BE2_IPV6; 519 beiscsi_ep->ip_type = BE2_IPV6;
505 } else{ 520 } else{
506 shost_printk(KERN_ERR, phba->shost, "unknown addr family %d\n", 521 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
507 dst_addr->sa_family); 522 "BG_%d : unknown addr family %d\n",
523 dst_addr->sa_family);
508 spin_unlock(&ctrl->mbox_lock); 524 spin_unlock(&ctrl->mbox_lock);
509 free_mcc_tag(&phba->ctrl, tag); 525 free_mcc_tag(&phba->ctrl, tag);
510 return -EINVAL; 526 return -EINVAL;
@@ -515,7 +531,8 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
515 if (phba->nxt_cqid == phba->num_cpus) 531 if (phba->nxt_cqid == phba->num_cpus)
516 phba->nxt_cqid = 0; 532 phba->nxt_cqid = 0;
517 req->cq_id = phwi_context->be_cq[i].id; 533 req->cq_id = phwi_context->be_cq[i].id;
518 SE_DEBUG(DBG_LVL_8, "i=%d cq_id=%d\n", i, req->cq_id); 534 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
535 "BG_%d : i=%d cq_id=%d\n", i, req->cq_id);
519 req->defq_id = def_hdr_id; 536 req->defq_id = def_hdr_id;
520 req->hdr_ring_id = def_hdr_id; 537 req->hdr_ring_id = def_hdr_id;
521 req->data_ring_id = def_data_id; 538 req->data_ring_id = def_data_id;
@@ -550,8 +567,8 @@ unsigned int mgmt_get_all_if_id(struct beiscsi_hba *phba)
550 if (!status) 567 if (!status)
551 phba->interface_handle = pbe_allid->if_hndl_list[0]; 568 phba->interface_handle = pbe_allid->if_hndl_list[0];
552 else { 569 else {
553 shost_printk(KERN_WARNING, phba->shost, 570 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
554 "Failed in mgmt_get_all_if_id\n"); 571 "BG_%d : Failed in mgmt_get_all_if_id\n");
555 } 572 }
556 spin_unlock(&ctrl->mbox_lock); 573 spin_unlock(&ctrl->mbox_lock);
557 574
@@ -594,9 +611,10 @@ static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba,
594 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8; 611 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
595 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 612 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
596 if (status || extd_status) { 613 if (status || extd_status) {
597 SE_DEBUG(DBG_LVL_1, 614 beiscsi_log(phba, KERN_ERR,
598 "mgmt_exec_nonemb_cmd Failed status = %d" 615 BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
599 "extd_status = %d\n", status, extd_status); 616 "BG_%d : mgmt_exec_nonemb_cmd Failed status = %d"
617 "extd_status = %d\n", status, extd_status);
600 rc = -EIO; 618 rc = -EIO;
601 goto free_tag; 619 goto free_tag;
602 } 620 }
@@ -617,7 +635,8 @@ static int mgmt_alloc_cmd_data(struct beiscsi_hba *phba, struct be_dma_mem *cmd,
617{ 635{
618 cmd->va = pci_alloc_consistent(phba->ctrl.pdev, size, &cmd->dma); 636 cmd->va = pci_alloc_consistent(phba->ctrl.pdev, size, &cmd->dma);
619 if (!cmd->va) { 637 if (!cmd->va) {
620 SE_DEBUG(DBG_LVL_1, "Failed to allocate memory for if info\n"); 638 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
639 "BG_%d : Failed to allocate memory for if info\n");
621 return -ENOMEM; 640 return -ENOMEM;
622 } 641 }
623 memset(cmd->va, 0, size); 642 memset(cmd->va, 0, size);
@@ -673,8 +692,8 @@ mgmt_static_ip_modify(struct beiscsi_hba *phba,
673 692
674 rc = mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, NULL, 0); 693 rc = mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, NULL, 0);
675 if (rc < 0) 694 if (rc < 0)
676 shost_printk(KERN_WARNING, phba->shost, 695 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
677 "Failed to Modify existing IP Address\n"); 696 "BG_%d : Failed to Modify existing IP Address\n");
678 return rc; 697 return rc;
679} 698}
680 699
@@ -728,8 +747,8 @@ int mgmt_set_ip(struct beiscsi_hba *phba,
728 747
729 if (boot_proto == ISCSI_BOOTPROTO_DHCP) { 748 if (boot_proto == ISCSI_BOOTPROTO_DHCP) {
730 if (if_info.dhcp_state) { 749 if (if_info.dhcp_state) {
731 shost_printk(KERN_WARNING, phba->shost, 750 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
732 "DHCP Already Enabled\n"); 751 "BG_%d : DHCP Already Enabled\n");
733 return 0; 752 return 0;
734 } 753 }
735 /* The ip_param->len is 1 in DHCP case. Setting 754 /* The ip_param->len is 1 in DHCP case. Setting
@@ -756,8 +775,9 @@ int mgmt_set_ip(struct beiscsi_hba *phba,
756 775
757 rc = mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, NULL, 0); 776 rc = mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, NULL, 0);
758 if (rc < 0) { 777 if (rc < 0) {
759 shost_printk(KERN_WARNING, phba->shost, 778 beiscsi_log(phba, KERN_WARNING,
760 "Failed to Delete existing dhcp\n"); 779 BEISCSI_LOG_CONFIG,
780 "BG_%d : Failed to Delete existing dhcp\n");
761 return rc; 781 return rc;
762 } 782 }
763 } 783 }
@@ -776,8 +796,8 @@ int mgmt_set_ip(struct beiscsi_hba *phba,
776 memset(&gtway_addr_set, 0, sizeof(gtway_addr_set)); 796 memset(&gtway_addr_set, 0, sizeof(gtway_addr_set));
777 rc = mgmt_get_gateway(phba, BE2_IPV4, &gtway_addr_set); 797 rc = mgmt_get_gateway(phba, BE2_IPV4, &gtway_addr_set);
778 if (rc) { 798 if (rc) {
779 shost_printk(KERN_WARNING, phba->shost, 799 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
780 "Failed to Get Gateway Addr\n"); 800 "BG_%d : Failed to Get Gateway Addr\n");
781 return rc; 801 return rc;
782 } 802 }
783 803
@@ -787,8 +807,9 @@ int mgmt_set_ip(struct beiscsi_hba *phba,
787 IP_ACTION_DEL, IP_V4_LEN); 807 IP_ACTION_DEL, IP_V4_LEN);
788 808
789 if (rc) { 809 if (rc) {
790 shost_printk(KERN_WARNING, phba->shost, 810 beiscsi_log(phba, KERN_WARNING,
791 "Failed to clear Gateway Addr Set\n"); 811 BEISCSI_LOG_CONFIG,
812 "BG_%d : Failed to clear Gateway Addr Set\n");
792 return rc; 813 return rc;
793 } 814 }
794 } 815 }
@@ -827,8 +848,8 @@ int mgmt_set_gateway(struct beiscsi_hba *phba,
827 memset(&gtway_addr_set, 0, sizeof(gtway_addr_set)); 848 memset(&gtway_addr_set, 0, sizeof(gtway_addr_set));
828 rt_val = mgmt_get_gateway(phba, BE2_IPV4, &gtway_addr_set); 849 rt_val = mgmt_get_gateway(phba, BE2_IPV4, &gtway_addr_set);
829 if (rt_val) { 850 if (rt_val) {
830 shost_printk(KERN_WARNING, phba->shost, 851 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
831 "Failed to Get Gateway Addr\n"); 852 "BG_%d : Failed to Get Gateway Addr\n");
832 return rt_val; 853 return rt_val;
833 } 854 }
834 855
@@ -837,8 +858,8 @@ int mgmt_set_gateway(struct beiscsi_hba *phba,
837 rt_val = mgmt_modify_gateway(phba, gtway_addr, IP_ACTION_DEL, 858 rt_val = mgmt_modify_gateway(phba, gtway_addr, IP_ACTION_DEL,
838 gateway_param->len); 859 gateway_param->len);
839 if (rt_val) { 860 if (rt_val) {
840 shost_printk(KERN_WARNING, phba->shost, 861 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
841 "Failed to clear Gateway Addr Set\n"); 862 "BG_%d : Failed to clear Gateway Addr Set\n");
842 return rt_val; 863 return rt_val;
843 } 864 }
844 } 865 }
@@ -848,8 +869,8 @@ int mgmt_set_gateway(struct beiscsi_hba *phba,
848 gateway_param->len); 869 gateway_param->len);
849 870
850 if (rt_val) 871 if (rt_val)
851 shost_printk(KERN_WARNING, phba->shost, 872 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
852 "Failed to Set Gateway Addr\n"); 873 "BG_%d : Failed to Set Gateway Addr\n");
853 874
854 return rt_val; 875 return rt_val;
855} 876}
@@ -997,7 +1018,9 @@ int be_mgmt_get_boot_shandle(struct beiscsi_hba *phba,
997 /* Get the Boot Target Session Handle and Count*/ 1018 /* Get the Boot Target Session Handle and Count*/
998 tag = mgmt_get_boot_target(phba); 1019 tag = mgmt_get_boot_target(phba);
999 if (!tag) { 1020 if (!tag) {
1000 SE_DEBUG(DBG_LVL_1, "mgmt_get_boot_target Failed\n"); 1021 beiscsi_log(phba, KERN_ERR,
1022 BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
1023 "BG_%d : Getting Boot Target Info Failed\n");
1001 return -EAGAIN; 1024 return -EAGAIN;
1002 } else 1025 } else
1003 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 1026 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
@@ -1007,9 +1030,11 @@ int be_mgmt_get_boot_shandle(struct beiscsi_hba *phba,
1007 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8; 1030 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
1008 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 1031 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
1009 if (status || extd_status) { 1032 if (status || extd_status) {
1010 SE_DEBUG(DBG_LVL_1, "mgmt_get_boot_target Failed" 1033 beiscsi_log(phba, KERN_ERR,
1011 " status = %d extd_status = %d\n", 1034 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
1012 status, extd_status); 1035 "BG_%d : mgmt_get_boot_target Failed"
1036 " status = %d extd_status = %d\n",
1037 status, extd_status);
1013 free_mcc_tag(&phba->ctrl, tag); 1038 free_mcc_tag(&phba->ctrl, tag);
1014 return -EBUSY; 1039 return -EBUSY;
1015 } 1040 }
@@ -1019,7 +1044,9 @@ int be_mgmt_get_boot_shandle(struct beiscsi_hba *phba,
1019 1044
1020 /* Check if the there are any Boot targets configured */ 1045 /* Check if the there are any Boot targets configured */
1021 if (!boot_resp->boot_session_count) { 1046 if (!boot_resp->boot_session_count) {
1022 SE_DEBUG(DBG_LVL_8, "No boot targets configured\n"); 1047 beiscsi_log(phba, KERN_INFO,
1048 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
1049 "BG_%d ;No boot targets configured\n");
1023 return -ENXIO; 1050 return -ENXIO;
1024 } 1051 }
1025 1052
@@ -1033,7 +1060,9 @@ int be_mgmt_get_boot_shandle(struct beiscsi_hba *phba,
1033 tag = mgmt_reopen_session(phba, BE_REOPEN_BOOT_SESSIONS, 1060 tag = mgmt_reopen_session(phba, BE_REOPEN_BOOT_SESSIONS,
1034 INVALID_SESS_HANDLE); 1061 INVALID_SESS_HANDLE);
1035 if (!tag) { 1062 if (!tag) {
1036 SE_DEBUG(DBG_LVL_1, "mgmt_reopen_session Failed\n"); 1063 beiscsi_log(phba, KERN_ERR,
1064 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
1065 "BG_%d : mgmt_reopen_session Failed\n");
1037 return -EAGAIN; 1066 return -EAGAIN;
1038 } else 1067 } else
1039 wait_event_interruptible(phba->ctrl.mcc_wait[tag], 1068 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
@@ -1043,9 +1072,11 @@ int be_mgmt_get_boot_shandle(struct beiscsi_hba *phba,
1043 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8; 1072 extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
1044 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF; 1073 status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
1045 if (status || extd_status) { 1074 if (status || extd_status) {
1046 SE_DEBUG(DBG_LVL_1, "mgmt_reopen_session Failed" 1075 beiscsi_log(phba, KERN_ERR,
1047 " status = %d extd_status = %d\n", 1076 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
1048 status, extd_status); 1077 "BG_%d : mgmt_reopen_session Failed"
1078 " status = %d extd_status = %d\n",
1079 status, extd_status);
1049 free_mcc_tag(&phba->ctrl, tag); 1080 free_mcc_tag(&phba->ctrl, tag);
1050 return -EBUSY; 1081 return -EBUSY;
1051 } 1082 }
@@ -1054,6 +1085,8 @@ int be_mgmt_get_boot_shandle(struct beiscsi_hba *phba,
1054 } while (--boot_retry); 1085 } while (--boot_retry);
1055 1086
1056 /* Couldn't log into the boot target */ 1087 /* Couldn't log into the boot target */
1057 SE_DEBUG(DBG_LVL_1, "Login to Boot Target Failed\n"); 1088 beiscsi_log(phba, KERN_ERR,
1089 BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
1090 "BG_%d : Login to Boot Target Failed\n");
1058 return -ENXIO; 1091 return -ENXIO;
1059} 1092}