aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi/be_cmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/be2iscsi/be_cmds.c')
-rw-r--r--drivers/scsi/be2iscsi/be_cmds.c160
1 files changed, 123 insertions, 37 deletions
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index d2e9e933f7a3..07d2cb126d93 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);
@@ -890,3 +934,45 @@ int beiscsi_cmd_reset_function(struct beiscsi_hba *phba)
890 spin_unlock(&ctrl->mbox_lock); 934 spin_unlock(&ctrl->mbox_lock);
891 return status; 935 return status;
892} 936}
937
938/**
939 * be_cmd_set_vlan()- Configure VLAN paramters on the adapter
940 * @phba: device priv structure instance
941 * @vlan_tag: TAG to be set
942 *
943 * Set the VLAN_TAG for the adapter or Disable VLAN on adapter
944 *
945 * returns
946 * TAG for the MBX Cmd
947 * **/
948int be_cmd_set_vlan(struct beiscsi_hba *phba,
949 uint16_t vlan_tag)
950{
951 unsigned int tag = 0;
952 struct be_mcc_wrb *wrb;
953 struct be_cmd_set_vlan_req *req;
954 struct be_ctrl_info *ctrl = &phba->ctrl;
955
956 spin_lock(&ctrl->mbox_lock);
957 tag = alloc_mcc_tag(phba);
958 if (!tag) {
959 spin_unlock(&ctrl->mbox_lock);
960 return tag;
961 }
962
963 wrb = wrb_from_mccq(phba);
964 req = embedded_payload(wrb);
965 wrb->tag0 |= tag;
966 be_wrb_hdr_prepare(wrb, sizeof(*wrb), true, 0);
967 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
968 OPCODE_COMMON_ISCSI_NTWK_SET_VLAN,
969 sizeof(*req));
970
971 req->interface_hndl = phba->interface_handle;
972 req->vlan_priority = vlan_tag;
973
974 be_mcc_notify(phba);
975 spin_unlock(&ctrl->mbox_lock);
976
977 return tag;
978}