diff options
author | Saurav Kashyap <saurav.kashyap@qlogic.com> | 2011-07-14 21:00:13 +0200 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-07-27 12:16:17 +0200 |
commit | 7c3df1320e5e875478775e78d01a09aee96b8abe (patch) | |
tree | 215326b999b3db03f4a2268a79c3848803daaf7d /drivers/scsi/qla2xxx/qla_bsg.c | |
parent | [SCSI] qla2xxx: Basic infrastructure for dynamic logging. (diff) | |
download | linux-7c3df1320e5e875478775e78d01a09aee96b8abe.tar.xz linux-7c3df1320e5e875478775e78d01a09aee96b8abe.zip |
[SCSI] qla2xxx: Code changes to support new dynamic logging infrastructure.
The code is changed to support the new dynamic logging infrastructure.
Following are the levels added.
Default is 0 - no logging. 0x40000000 - Module Init & Probe.
0x20000000 - Mailbox Cmnds. 0x10000000 - Device Discovery.
0x08000000 - IO tracing. 0x04000000 - DPC Thread.
0x02000000 - Async events. 0x01000000 - Timer routines.
0x00800000 - User space. 0x00400000 - Task Management.
0x00200000 - AER/EEH. 0x00100000 - Multi Q.
0x00080000 - P3P Specific. 0x00040000 - Virtual Port.
0x00020000 - Buffer Dump. 0x00010000 - Misc.
0x7fffffff - For enabling all logs, can be too many logs.
Setting ql2xextended_error_logging module parameter to any of the above
value, will enable the debug for that particular level.
Do LOGICAL OR of the value to enable more than one level.
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_bsg.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_bsg.c | 441 |
1 files changed, 238 insertions, 203 deletions
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c index 8c10e2c4928e..07d1767cd26b 100644 --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c @@ -36,7 +36,8 @@ done: } int -qla24xx_fcp_prio_cfg_valid(struct qla_fcp_prio_cfg *pri_cfg, uint8_t flag) +qla24xx_fcp_prio_cfg_valid(scsi_qla_host_t *vha, + struct qla_fcp_prio_cfg *pri_cfg, uint8_t flag) { int i, ret, num_valid; uint8_t *bcode; @@ -51,18 +52,17 @@ qla24xx_fcp_prio_cfg_valid(struct qla_fcp_prio_cfg *pri_cfg, uint8_t flag) if (bcode_val == 0xFFFFFFFF) { /* No FCP Priority config data in flash */ - DEBUG2(printk(KERN_INFO - "%s: No FCP priority config data.\n", - __func__)); + ql_dbg(ql_dbg_user, vha, 0x7051, + "No FCP Priority config data.\n"); return 0; } if (bcode[0] != 'H' || bcode[1] != 'Q' || bcode[2] != 'O' || bcode[3] != 'S') { /* Invalid FCP priority data header*/ - DEBUG2(printk(KERN_ERR - "%s: Invalid FCP Priority data header. bcode=0x%x\n", - __func__, bcode_val)); + ql_dbg(ql_dbg_user, vha, 0x7052, + "Invalid FCP Priority data header. bcode=0x%x.\n", + bcode_val); return 0; } if (flag != 1) @@ -77,15 +77,14 @@ qla24xx_fcp_prio_cfg_valid(struct qla_fcp_prio_cfg *pri_cfg, uint8_t flag) if (num_valid == 0) { /* No valid FCP priority data entries */ - DEBUG2(printk(KERN_ERR - "%s: No valid FCP Priority data entries.\n", - __func__)); + ql_dbg(ql_dbg_user, vha, 0x7053, + "No valid FCP Priority data entries.\n"); ret = 0; } else { /* FCP priority data is valid */ - DEBUG2(printk(KERN_INFO - "%s: Valid FCP priority data. num entries = %d\n", - __func__, num_valid)); + ql_dbg(ql_dbg_user, vha, 0x7054, + "Valid FCP priority data. num entries = %d.\n", + num_valid); } return ret; @@ -182,10 +181,9 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job) if (!ha->fcp_prio_cfg) { ha->fcp_prio_cfg = vmalloc(FCP_PRIO_CFG_SIZE); if (!ha->fcp_prio_cfg) { - qla_printk(KERN_WARNING, ha, - "Unable to allocate memory " - "for fcp prio config data (%x).\n", - FCP_PRIO_CFG_SIZE); + ql_log(ql_log_warn, vha, 0x7050, + "Unable to allocate memory for fcp prio " + "config data (%x).\n", FCP_PRIO_CFG_SIZE); bsg_job->reply->result = (DID_ERROR << 16); ret = -ENOMEM; goto exit_fcp_prio_cfg; @@ -198,9 +196,9 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job) FCP_PRIO_CFG_SIZE); /* validate fcp priority data */ - if (!qla24xx_fcp_prio_cfg_valid( - (struct qla_fcp_prio_cfg *) - ha->fcp_prio_cfg, 1)) { + + if (!qla24xx_fcp_prio_cfg_valid(vha, + (struct qla_fcp_prio_cfg *) ha->fcp_prio_cfg, 1)) { bsg_job->reply->result = (DID_ERROR << 16); ret = -EINVAL; /* If buffer was invalidatic int @@ -256,9 +254,8 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job) /* pass through is supported only for ISP 4Gb or higher */ if (!IS_FWI2_CAPABLE(ha)) { - DEBUG2(qla_printk(KERN_INFO, ha, - "scsi(%ld):ELS passthru not supported for ISP23xx based " - "adapters\n", vha->host_no)); + ql_dbg(ql_dbg_user, vha, 0x7001, + "ELS passthru not supported for ISP23xx based adapters.\n"); rval = -EPERM; goto done; } @@ -266,11 +263,11 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job) /* Multiple SG's are not supported for ELS requests */ if (bsg_job->request_payload.sg_cnt > 1 || bsg_job->reply_payload.sg_cnt > 1) { - DEBUG2(printk(KERN_INFO - "multiple SG's are not supported for ELS requests" - " [request_sg_cnt: %x reply_sg_cnt: %x]\n", - bsg_job->request_payload.sg_cnt, - bsg_job->reply_payload.sg_cnt)); + ql_dbg(ql_dbg_user, vha, 0x7002, + "Multiple SG's are not suppored for ELS requests, " + "request_sg_cnt=%x reply_sg_cnt=%x.\n", + bsg_job->request_payload.sg_cnt, + bsg_job->reply_payload.sg_cnt); rval = -EPERM; goto done; } @@ -281,9 +278,9 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job) * if not perform fabric login */ if (qla2x00_fabric_login(vha, fcport, &nextlid)) { - DEBUG2(qla_printk(KERN_WARNING, ha, - "failed to login port %06X for ELS passthru\n", - fcport->d_id.b24)); + ql_dbg(ql_dbg_user, vha, 0x7003, + "Failed to login port %06X for ELS passthru.\n", + fcport->d_id.b24); rval = -EIO; goto done; } @@ -314,8 +311,7 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job) } if (!vha->flags.online) { - DEBUG2(qla_printk(KERN_WARNING, ha, - "host not online\n")); + ql_log(ql_log_warn, vha, 0x7005, "Host not online.\n"); rval = -EIO; goto done; } @@ -337,12 +333,11 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job) if ((req_sg_cnt != bsg_job->request_payload.sg_cnt) || (rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) { - DEBUG2(printk(KERN_INFO - "dma mapping resulted in different sg counts \ - [request_sg_cnt: %x dma_request_sg_cnt: %x\ - reply_sg_cnt: %x dma_reply_sg_cnt: %x]\n", - bsg_job->request_payload.sg_cnt, req_sg_cnt, - bsg_job->reply_payload.sg_cnt, rsp_sg_cnt)); + ql_log(ql_log_warn, vha, 0x7008, + "dma mapping resulted in different sg counts, " + "request_sg_cnt: %x dma_request_sg_cnt:%x reply_sg_cnt:%x " + "dma_reply_sg_cnt:%x.\n", bsg_job->request_payload.sg_cnt, + req_sg_cnt, bsg_job->reply_payload.sg_cnt, rsp_sg_cnt); rval = -EAGAIN; goto done_unmap_sg; } @@ -363,15 +358,16 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job) "bsg_els_rpt" : "bsg_els_hst"); els->u.bsg_job = bsg_job; - DEBUG2(qla_printk(KERN_INFO, ha, - "scsi(%ld:%x): bsg rqst type: %s els type: %x - loop-id=%x " - "portid=%02x%02x%02x.\n", vha->host_no, sp->handle, type, - bsg_job->request->rqst_data.h_els.command_code, - fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, - fcport->d_id.b.al_pa)); + ql_dbg(ql_dbg_user, vha, 0x700a, + "bsg rqst type: %s els type: %x - loop-id=%x " + "portid=%-2x%02x%02x.\n", type, + bsg_job->request->rqst_data.h_els.command_code, fcport->loop_id, + fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { + ql_log(ql_log_warn, vha, 0x700e, + "qla2x00_start_sp failed = %d\n", rval); kfree(sp->ctx); mempool_free(sp, ha->srb_mempool); rval = -EIO; @@ -411,6 +407,8 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job) dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); if (!req_sg_cnt) { + ql_log(ql_log_warn, vha, 0x700f, + "dma_map_sg return %d for request\n", req_sg_cnt); rval = -ENOMEM; goto done; } @@ -418,24 +416,25 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job) rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); if (!rsp_sg_cnt) { + ql_log(ql_log_warn, vha, 0x7010, + "dma_map_sg return %d for reply\n", rsp_sg_cnt); rval = -ENOMEM; goto done; } if ((req_sg_cnt != bsg_job->request_payload.sg_cnt) || (rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) { - DEBUG2(qla_printk(KERN_WARNING, ha, - "[request_sg_cnt: %x dma_request_sg_cnt: %x\ - reply_sg_cnt: %x dma_reply_sg_cnt: %x]\n", - bsg_job->request_payload.sg_cnt, req_sg_cnt, - bsg_job->reply_payload.sg_cnt, rsp_sg_cnt)); + ql_log(ql_log_warn, vha, 0x7011, + "request_sg_cnt: %x dma_request_sg_cnt: %x reply_sg_cnt:%x " + "dma_reply_sg_cnt: %x\n", bsg_job->request_payload.sg_cnt, + req_sg_cnt, bsg_job->reply_payload.sg_cnt, rsp_sg_cnt); rval = -EAGAIN; goto done_unmap_sg; } if (!vha->flags.online) { - DEBUG2(qla_printk(KERN_WARNING, ha, - "host not online\n")); + ql_log(ql_log_warn, vha, 0x7012, + "Host is not online.\n"); rval = -EIO; goto done_unmap_sg; } @@ -451,8 +450,8 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job) loop_id = vha->mgmt_svr_loop_id; break; default: - DEBUG2(qla_printk(KERN_INFO, ha, - "Unknown loop id: %x\n", loop_id)); + ql_dbg(ql_dbg_user, vha, 0x7013, + "Unknown loop id: %x.\n", loop_id); rval = -EINVAL; goto done_unmap_sg; } @@ -464,6 +463,8 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job) */ fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL); if (!fcport) { + ql_log(ql_log_warn, vha, 0x7014, + "Failed to allocate fcport.\n"); rval = -ENOMEM; goto done_unmap_sg; } @@ -479,6 +480,8 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job) /* Alloc SRB structure */ sp = qla2x00_get_ctx_bsg_sp(vha, fcport, sizeof(struct srb_ctx)); if (!sp) { + ql_log(ql_log_warn, vha, 0x7015, + "qla2x00_get_ctx_bsg_sp failed.\n"); rval = -ENOMEM; goto done_free_fcport; } @@ -488,15 +491,17 @@ qla2x00_process_ct(struct fc_bsg_job *bsg_job) ct->name = "bsg_ct"; ct->u.bsg_job = bsg_job; - DEBUG2(qla_printk(KERN_INFO, ha, - "scsi(%ld:%x): bsg rqst type: %s els type: %x - loop-id=%x " - "portid=%02x%02x%02x.\n", vha->host_no, sp->handle, type, - (bsg_job->request->rqst_data.h_ct.preamble_word2 >> 16), - fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, - fcport->d_id.b.al_pa)); + ql_dbg(ql_dbg_user, vha, 0x7016, + "bsg rqst type: %s else type: %x - " + "loop-id=%x portid=%02x%02x%02x.\n", type, + (bsg_job->request->rqst_data.h_ct.preamble_word2 >> 16), + fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, + fcport->d_id.b.al_pa); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { + ql_log(ql_log_warn, vha, 0x7017, + "qla2x00_start_sp failed=%d.\n", rval); kfree(sp->ctx); mempool_free(sp, ha->srb_mempool); rval = -EIO; @@ -535,9 +540,8 @@ qla81xx_set_internal_loopback(scsi_qla_host_t *vha, uint16_t *config, ha->notify_dcbx_comp = 1; ret = qla81xx_set_port_config(vha, new_config); if (ret != QLA_SUCCESS) { - DEBUG2(printk(KERN_ERR - "%s(%lu): Set port config failed\n", - __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x7021, + "set port config failed.\n"); ha->notify_dcbx_comp = 0; rval = -EINVAL; goto done_set_internal; @@ -545,11 +549,11 @@ qla81xx_set_internal_loopback(scsi_qla_host_t *vha, uint16_t *config, /* Wait for DCBX complete event */ if (!wait_for_completion_timeout(&ha->dcbx_comp, (20 * HZ))) { - DEBUG2(qla_printk(KERN_WARNING, ha, - "State change notificaition not received.\n")); + ql_dbg(ql_dbg_user, vha, 0x7022, + "State change notification not received.\n"); } else - DEBUG2(qla_printk(KERN_INFO, ha, - "State change RECEIVED\n")); + ql_dbg(ql_dbg_user, vha, 0x7023, + "State change received.\n"); ha->notify_dcbx_comp = 0; @@ -581,9 +585,8 @@ qla81xx_reset_internal_loopback(scsi_qla_host_t *vha, uint16_t *config, ha->notify_dcbx_comp = wait; ret = qla81xx_set_port_config(vha, new_config); if (ret != QLA_SUCCESS) { - DEBUG2(printk(KERN_ERR - "%s(%lu): Set port config failed\n", - __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x7025, + "Set port config failed.\n"); ha->notify_dcbx_comp = 0; rval = -EINVAL; goto done_reset_internal; @@ -592,14 +595,14 @@ qla81xx_reset_internal_loopback(scsi_qla_host_t *vha, uint16_t *config, /* Wait for DCBX complete event */ if (wait && !wait_for_completion_timeout(&ha->dcbx_comp, (20 * HZ))) { - DEBUG2(qla_printk(KERN_WARNING, ha, - "State change notificaition not received.\n")); + ql_dbg(ql_dbg_user, vha, 0x7026, + "State change notification not received.\n"); ha->notify_dcbx_comp = 0; rval = -EINVAL; goto done_reset_internal; } else - DEBUG2(qla_printk(KERN_INFO, ha, - "State change RECEIVED\n")); + ql_dbg(ql_dbg_user, vha, 0x7027, + "State change received.\n"); ha->notify_dcbx_comp = 0; } @@ -629,11 +632,13 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || - test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) + test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { + ql_log(ql_log_warn, vha, 0x7018, "Abort active or needed.\n"); return -EBUSY; + } if (!vha->flags.online) { - DEBUG2(qla_printk(KERN_WARNING, ha, "host not online\n")); + ql_log(ql_log_warn, vha, 0x7019, "Host is not online.\n"); return -EIO; } @@ -641,26 +646,31 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); - if (!elreq.req_sg_cnt) + if (!elreq.req_sg_cnt) { + ql_log(ql_log_warn, vha, 0x701a, + "dma_map_sg returned %d for request.\n", elreq.req_sg_cnt); return -ENOMEM; + } elreq.rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); if (!elreq.rsp_sg_cnt) { + ql_log(ql_log_warn, vha, 0x701b, + "dma_map_sg returned %d for reply.\n", elreq.rsp_sg_cnt); rval = -ENOMEM; goto done_unmap_req_sg; } if ((elreq.req_sg_cnt != bsg_job->request_payload.sg_cnt) || (elreq.rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) { - DEBUG2(printk(KERN_INFO - "dma mapping resulted in different sg counts " - "[request_sg_cnt: %x dma_request_sg_cnt: %x " - "reply_sg_cnt: %x dma_reply_sg_cnt: %x]\n", - bsg_job->request_payload.sg_cnt, elreq.req_sg_cnt, - bsg_job->reply_payload.sg_cnt, elreq.rsp_sg_cnt)); + ql_log(ql_log_warn, vha, 0x701c, + "dma mapping resulted in different sg counts, " + "request_sg_cnt: %x dma_request_sg_cnt: %x " + "reply_sg_cnt: %x dma_reply_sg_cnt: %x.\n", + bsg_job->request_payload.sg_cnt, elreq.req_sg_cnt, + bsg_job->reply_payload.sg_cnt, elreq.rsp_sg_cnt); rval = -EAGAIN; goto done_unmap_sg; } @@ -668,8 +678,8 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) req_data = dma_alloc_coherent(&ha->pdev->dev, req_data_len, &req_data_dma, GFP_KERNEL); if (!req_data) { - DEBUG2(printk(KERN_ERR "%s: dma alloc for req_data " - "failed for host=%lu\n", __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x701d, + "dma alloc failed for req_data.\n"); rval = -ENOMEM; goto done_unmap_sg; } @@ -677,8 +687,8 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) rsp_data = dma_alloc_coherent(&ha->pdev->dev, rsp_data_len, &rsp_data_dma, GFP_KERNEL); if (!rsp_data) { - DEBUG2(printk(KERN_ERR "%s: dma alloc for rsp_data " - "failed for host=%lu\n", __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x7004, + "dma alloc failed for rsp_data.\n"); rval = -ENOMEM; goto done_free_dma_req; } @@ -699,8 +709,8 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) && req_data_len == MAX_ELS_FRAME_PAYLOAD)) && elreq.options == EXTERNAL_LOOPBACK) { type = "FC_BSG_HST_VENDOR_ECHO_DIAG"; - DEBUG2(qla_printk(KERN_INFO, ha, - "scsi(%ld) bsg rqst type: %s\n", vha->host_no, type)); + ql_dbg(ql_dbg_user, vha, 0x701e, + "BSG request type: %s.\n", type); command_sent = INT_DEF_LB_ECHO_CMD; rval = qla2x00_echo_test(vha, &elreq, response); } else { @@ -708,9 +718,8 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) memset(config, 0, sizeof(config)); memset(new_config, 0, sizeof(new_config)); if (qla81xx_get_port_config(vha, config)) { - DEBUG2(printk(KERN_ERR - "%s(%lu): Get port config failed\n", - __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x701f, + "Get port config failed.\n"); bsg_job->reply->reply_payload_rcv_len = 0; bsg_job->reply->result = (DID_ERROR << 16); rval = -EPERM; @@ -718,11 +727,13 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) } if (elreq.options != EXTERNAL_LOOPBACK) { - DEBUG2(qla_printk(KERN_INFO, ha, - "Internal: current port config = %x\n", - config[0])); + ql_dbg(ql_dbg_user, vha, 0x7020, + "Internal: curent port config = %x\n", + config[0]); if (qla81xx_set_internal_loopback(vha, config, new_config)) { + ql_log(ql_log_warn, vha, 0x7024, + "Internal loopback failed.\n"); bsg_job->reply->reply_payload_rcv_len = 0; bsg_job->reply->result = @@ -746,9 +757,8 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) } type = "FC_BSG_HST_VENDOR_LOOPBACK"; - DEBUG2(qla_printk(KERN_INFO, ha, - "scsi(%ld) bsg rqst type: %s\n", - vha->host_no, type)); + ql_dbg(ql_dbg_user, vha, 0x7028, + "BSG request type: %s.\n", type); command_sent = INT_DEF_LB_LOOPBACK_CMD; rval = qla2x00_loopback_test(vha, &elreq, response); @@ -763,17 +773,16 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) if (response[0] == MBS_COMMAND_ERROR && response[1] == MBS_LB_RESET) { - DEBUG2(printk(KERN_ERR "%s(%ld): ABORTing " - "ISP\n", __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x7029, + "MBX command error, Aborting ISP.\n"); set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); qla2xxx_wake_dpc(vha); qla2x00_wait_for_chip_reset(vha); /* Also reset the MPI */ if (qla81xx_restart_mpi_firmware(vha) != QLA_SUCCESS) { - qla_printk(KERN_INFO, ha, - "MPI reset failed for host%ld.\n", - vha->host_no); + ql_log(ql_log_warn, vha, 0x702a, + "MPI reset failed.\n"); } bsg_job->reply->reply_payload_rcv_len = 0; @@ -783,17 +792,16 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) } } else { type = "FC_BSG_HST_VENDOR_LOOPBACK"; - DEBUG2(qla_printk(KERN_INFO, ha, - "scsi(%ld) bsg rqst type: %s\n", - vha->host_no, type)); + ql_dbg(ql_dbg_user, vha, 0x702b, + "BSG request type: %s.\n", type); command_sent = INT_DEF_LB_LOOPBACK_CMD; rval = qla2x00_loopback_test(vha, &elreq, response); } } if (rval) { - DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor " - "request %s failed\n", vha->host_no, type)); + ql_log(ql_log_warn, vha, 0x702c, + "Vendor request %s failed.\n", type); fw_sts_ptr = ((uint8_t *)bsg_job->req->sense) + sizeof(struct fc_bsg_reply); @@ -805,8 +813,8 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) bsg_job->reply->reply_payload_rcv_len = 0; bsg_job->reply->result = (DID_ERROR << 16); } else { - DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor " - "request %s completed\n", vha->host_no, type)); + ql_dbg(ql_dbg_user, vha, 0x702d, + "Vendor request %s completed.\n", type); bsg_job->reply_len = sizeof(struct fc_bsg_reply) + sizeof(response) + sizeof(uint8_t); @@ -851,12 +859,13 @@ qla84xx_reset(struct fc_bsg_job *bsg_job) if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || - test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) + test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { + ql_log(ql_log_warn, vha, 0x702e, "Abort active or needed.\n"); return -EBUSY; + } if (!IS_QLA84XX(ha)) { - DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld): Not 84xx, " - "exiting.\n", vha->host_no)); + ql_dbg(ql_dbg_user, vha, 0x702f, "Not 84xx, exiting.\n"); return -EINVAL; } @@ -865,14 +874,14 @@ qla84xx_reset(struct fc_bsg_job *bsg_job) rval = qla84xx_reset_chip(vha, flag == A84_ISSUE_RESET_DIAG_FW); if (rval) { - DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor " - "request 84xx reset failed\n", vha->host_no)); + ql_log(ql_log_warn, vha, 0x7030, + "Vendor request 84xx reset failed.\n"); rval = bsg_job->reply->reply_payload_rcv_len = 0; bsg_job->reply->result = (DID_ERROR << 16); } else { - DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor " - "request 84xx reset completed\n", vha->host_no)); + ql_dbg(ql_dbg_user, vha, 0x7031, + "Vendor request 84xx reset completed.\n"); bsg_job->reply->result = DID_OK; } @@ -902,21 +911,24 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job) return -EBUSY; if (!IS_QLA84XX(ha)) { - DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld): Not 84xx, " - "exiting.\n", vha->host_no)); + ql_dbg(ql_dbg_user, vha, 0x7032, + "Not 84xx, exiting.\n"); return -EINVAL; } sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); - if (!sg_cnt) + if (!sg_cnt) { + ql_log(ql_log_warn, vha, 0x7033, + "dma_map_sg returned %d for request.\n", sg_cnt); return -ENOMEM; + } if (sg_cnt != bsg_job->request_payload.sg_cnt) { - DEBUG2(printk(KERN_INFO - "dma mapping resulted in different sg counts " - "request_sg_cnt: %x dma_request_sg_cnt: %x ", - bsg_job->request_payload.sg_cnt, sg_cnt)); + ql_log(ql_log_warn, vha, 0x7034, + "DMA mapping resulted in different sg counts, " + "request_sg_cnt: %x dma_request_sg_cnt: %x.\n", + bsg_job->request_payload.sg_cnt, sg_cnt); rval = -EAGAIN; goto done_unmap_sg; } @@ -925,8 +937,8 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job) fw_buf = dma_alloc_coherent(&ha->pdev->dev, data_len, &fw_dma, GFP_KERNEL); if (!fw_buf) { - DEBUG2(printk(KERN_ERR "%s: dma alloc for fw_buf " - "failed for host=%lu\n", __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x7035, + "DMA alloc failed for fw_buf.\n"); rval = -ENOMEM; goto done_unmap_sg; } @@ -936,8 +948,8 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job) mn = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &mn_dma); if (!mn) { - DEBUG2(printk(KERN_ERR "%s: dma alloc for fw buffer " - "failed for host=%lu\n", __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x7036, + "DMA alloc failed for fw buffer.\n"); rval = -ENOMEM; goto done_free_fw_buf; } @@ -965,15 +977,15 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job) rval = qla2x00_issue_iocb_timeout(vha, mn, mn_dma, 0, 120); if (rval) { - DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor " - "request 84xx updatefw failed\n", vha->host_no)); + ql_log(ql_log_warn, vha, 0x7037, + "Vendor request 84xx updatefw failed.\n"); rval = bsg_job->reply->reply_payload_rcv_len = 0; bsg_job->reply->result = (DID_ERROR << 16); } else { - DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor " - "request 84xx updatefw completed\n", vha->host_no)); + ql_dbg(ql_dbg_user, vha, 0x7038, + "Vendor request 84xx updatefw completed.\n"); bsg_job->reply_len = sizeof(struct fc_bsg_reply); bsg_job->reply->result = DID_OK; @@ -1009,27 +1021,30 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || - test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) + test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { + ql_log(ql_log_warn, vha, 0x7039, + "Abort active or needed.\n"); return -EBUSY; + } if (!IS_QLA84XX(ha)) { - DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld): Not 84xx, " - "exiting.\n", vha->host_no)); + ql_log(ql_log_warn, vha, 0x703a, + "Not 84xx, exiting.\n"); return -EINVAL; } ql84_mgmt = (struct qla_bsg_a84_mgmt *)((char *)bsg_job->request + sizeof(struct fc_bsg_request)); if (!ql84_mgmt) { - DEBUG2(printk("%s(%ld): mgmt header not provided, exiting.\n", - __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x703b, + "MGMT header not provided, exiting.\n"); return -EINVAL; } mn = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &mn_dma); if (!mn) { - DEBUG2(printk(KERN_ERR "%s: dma alloc for fw buffer " - "failed for host=%lu\n", __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x703c, + "DMA alloc failed for fw buffer.\n"); return -ENOMEM; } @@ -1044,6 +1059,8 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); if (!sg_cnt) { + ql_log(ql_log_warn, vha, 0x703d, + "dma_map_sg returned %d for reply.\n", sg_cnt); rval = -ENOMEM; goto exit_mgmt; } @@ -1051,10 +1068,10 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) dma_direction = DMA_FROM_DEVICE; if (sg_cnt != bsg_job->reply_payload.sg_cnt) { - DEBUG2(printk(KERN_INFO - "dma mapping resulted in different sg counts " - "reply_sg_cnt: %x dma_reply_sg_cnt: %x\n", - bsg_job->reply_payload.sg_cnt, sg_cnt)); + ql_log(ql_log_warn, vha, 0x703e, + "DMA mapping resulted in different sg counts, " + "reply_sg_cnt: %x dma_reply_sg_cnt: %x.\n", + bsg_job->reply_payload.sg_cnt, sg_cnt); rval = -EAGAIN; goto done_unmap_sg; } @@ -1064,9 +1081,8 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) mgmt_b = dma_alloc_coherent(&ha->pdev->dev, data_len, &mgmt_dma, GFP_KERNEL); if (!mgmt_b) { - DEBUG2(printk(KERN_ERR "%s: dma alloc for mgmt_b " - "failed for host=%lu\n", - __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x703f, + "DMA alloc failed for mgmt_b.\n"); rval = -ENOMEM; goto done_unmap_sg; } @@ -1094,6 +1110,8 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); if (!sg_cnt) { + ql_log(ql_log_warn, vha, 0x7040, + "dma_map_sg returned %d.\n", sg_cnt); rval = -ENOMEM; goto exit_mgmt; } @@ -1101,10 +1119,10 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) dma_direction = DMA_TO_DEVICE; if (sg_cnt != bsg_job->request_payload.sg_cnt) { - DEBUG2(printk(KERN_INFO - "dma mapping resulted in different sg counts " - "request_sg_cnt: %x dma_request_sg_cnt: %x ", - bsg_job->request_payload.sg_cnt, sg_cnt)); + ql_log(ql_log_warn, vha, 0x7041, + "DMA mapping resulted in different sg counts, " + "request_sg_cnt: %x dma_request_sg_cnt: %x.\n", + bsg_job->request_payload.sg_cnt, sg_cnt); rval = -EAGAIN; goto done_unmap_sg; } @@ -1113,9 +1131,8 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) mgmt_b = dma_alloc_coherent(&ha->pdev->dev, data_len, &mgmt_dma, GFP_KERNEL); if (!mgmt_b) { - DEBUG2(printk(KERN_ERR "%s: dma alloc for mgmt_b " - "failed for host=%lu\n", - __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x7042, + "DMA alloc failed for mgmt_b.\n"); rval = -ENOMEM; goto done_unmap_sg; } @@ -1156,15 +1173,15 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) rval = qla2x00_issue_iocb(vha, mn, mn_dma, 0); if (rval) { - DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor " - "request 84xx mgmt failed\n", vha->host_no)); + ql_log(ql_log_warn, vha, 0x7043, + "Vendor request 84xx mgmt failed.\n"); rval = bsg_job->reply->reply_payload_rcv_len = 0; bsg_job->reply->result = (DID_ERROR << 16); } else { - DEBUG2(qla_printk(KERN_WARNING, ha, "scsi(%ld) Vendor " - "request 84xx mgmt completed\n", vha->host_no)); + ql_dbg(ql_dbg_user, vha, 0x7044, + "Vendor request 84xx mgmt completed.\n"); bsg_job->reply_len = sizeof(struct fc_bsg_reply); bsg_job->reply->result = DID_OK; @@ -1204,7 +1221,6 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); - struct qla_hw_data *ha = vha->hw; int rval = 0; struct qla_port_param *port_param = NULL; fc_port_t *fcport = NULL; @@ -1215,26 +1231,27 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job) if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || - test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) + test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { + ql_log(ql_log_warn, vha, 0x7045, "abort active or needed.\n"); return -EBUSY; + } if (!IS_IIDMA_CAPABLE(vha->hw)) { - DEBUG2(qla_printk(KERN_WARNING, ha, "%s(%lu): iiDMA not " - "supported\n", __func__, vha->host_no)); + ql_log(ql_log_info, vha, 0x7046, "iiDMA not supported.\n"); return -EINVAL; } port_param = (struct qla_port_param *)((char *)bsg_job->request + sizeof(struct fc_bsg_request)); if (!port_param) { - DEBUG2(printk("%s(%ld): port_param header not provided, " - "exiting.\n", __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x7047, + "port_param header not provided.\n"); return -EINVAL; } if (port_param->fc_scsi_addr.dest_type != EXT_DEF_TYPE_WWPN) { - DEBUG2(printk(KERN_ERR "%s(%ld): Invalid destination type\n", - __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x7048, + "Invalid destination type.\n"); return -EINVAL; } @@ -1249,21 +1266,20 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job) } if (!fcport) { - DEBUG2(printk(KERN_ERR "%s(%ld): Failed to find port\n", - __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x7049, + "Failed to find port.\n"); return -EINVAL; } if (atomic_read(&fcport->state) != FCS_ONLINE) { - DEBUG2(printk(KERN_ERR "%s(%ld): Port not online\n", - __func__, vha->host_no)); + ql_log(ql_log_warn, vha, 0x704a, + "Port is not online.\n"); return -EINVAL; } if (fcport->flags & FCF_LOGIN_NEEDED) { - DEBUG2(printk(KERN_ERR "%s(%ld): Remote port not logged in, " - "flags = 0x%x\n", - __func__, vha->host_no, fcport->flags)); + ql_log(ql_log_warn, vha, 0x704b, + "Remote port not logged in flags = 0x%x.\n", fcport->flags); return -EINVAL; } @@ -1275,15 +1291,13 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job) &port_param->speed, mb); if (rval) { - DEBUG16(printk(KERN_ERR "scsi(%ld): iIDMA cmd failed for " - "%02x%02x%02x%02x%02x%02x%02x%02x -- " - "%04x %x %04x %04x.\n", - vha->host_no, fcport->port_name[0], - fcport->port_name[1], - fcport->port_name[2], fcport->port_name[3], - fcport->port_name[4], fcport->port_name[5], - fcport->port_name[6], fcport->port_name[7], rval, - fcport->fp_speed, mb[0], mb[1])); + ql_log(ql_log_warn, vha, 0x704c, + "iIDMA cmd failed for %02x%02x%02x%02x%02x%02x%02x%02x -- " + "%04x %x %04x %04x.\n", fcport->port_name[0], + fcport->port_name[1], fcport->port_name[2], + fcport->port_name[3], fcport->port_name[4], + fcport->port_name[5], fcport->port_name[6], + fcport->port_name[7], rval, fcport->fp_speed, mb[0], mb[1]); rval = 0; bsg_job->reply->result = (DID_ERROR << 16); @@ -1307,11 +1321,12 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job) } static int -qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, struct qla_hw_data *ha, +qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, scsi_qla_host_t *vha, uint8_t is_update) { uint32_t start = 0; int valid = 0; + struct qla_hw_data *ha = vha->hw; bsg_job->reply->reply_payload_rcv_len = 0; @@ -1319,14 +1334,20 @@ qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, struct qla_hw_data *ha, return -EINVAL; start = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; - if (start > ha->optrom_size) + if (start > ha->optrom_size) { + ql_log(ql_log_warn, vha, 0x7055, + "start %d > optrom_size %d.\n", start, ha->optrom_size); return -EINVAL; + } - if (ha->optrom_state != QLA_SWAITING) + if (ha->optrom_state != QLA_SWAITING) { + ql_log(ql_log_info, vha, 0x7056, + "optrom_state %d.\n", ha->optrom_state); return -EBUSY; + } ha->optrom_region_start = start; - + ql_dbg(ql_dbg_user, vha, 0x7057, "is_update=%d.\n", is_update); if (is_update) { if (ha->optrom_size == OPTROM_SIZE_2300 && start == 0) valid = 1; @@ -1337,9 +1358,9 @@ qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, struct qla_hw_data *ha, IS_QLA8XXX_TYPE(ha)) valid = 1; if (!valid) { - qla_printk(KERN_WARNING, ha, - "Invalid start region 0x%x/0x%x.\n", - start, bsg_job->request_payload.payload_len); + ql_log(ql_log_warn, vha, 0x7058, + "Invalid start region 0x%x/0x%x.\n", start, + bsg_job->request_payload.payload_len); return -EINVAL; } @@ -1358,9 +1379,9 @@ qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, struct qla_hw_data *ha, ha->optrom_buffer = vmalloc(ha->optrom_region_size); if (!ha->optrom_buffer) { - qla_printk(KERN_WARNING, ha, + ql_log(ql_log_warn, vha, 0x7059, "Read: Unable to allocate memory for optrom retrieval " - "(%x).\n", ha->optrom_region_size); + "(%x)\n", ha->optrom_region_size); ha->optrom_state = QLA_SWAITING; return -ENOMEM; @@ -1378,7 +1399,7 @@ qla2x00_read_optrom(struct fc_bsg_job *bsg_job) struct qla_hw_data *ha = vha->hw; int rval = 0; - rval = qla2x00_optrom_setup(bsg_job, ha, 0); + rval = qla2x00_optrom_setup(bsg_job, vha, 0); if (rval) return rval; @@ -1406,7 +1427,7 @@ qla2x00_update_optrom(struct fc_bsg_job *bsg_job) struct qla_hw_data *ha = vha->hw; int rval = 0; - rval = qla2x00_optrom_setup(bsg_job, ha, 1); + rval = qla2x00_optrom_setup(bsg_job, vha, 1); if (rval) return rval; @@ -1464,6 +1485,23 @@ int qla24xx_bsg_request(struct fc_bsg_job *bsg_job) { int ret = -EINVAL; + struct fc_rport *rport; + fc_port_t *fcport = NULL; + struct Scsi_Host *host; + scsi_qla_host_t *vha; + + if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) { + rport = bsg_job->rport; + fcport = *(fc_port_t **) rport->dd_data; + host = rport_to_shost(rport); + vha = shost_priv(host); + } else { + host = bsg_job->shost; + vha = shost_priv(host); + } + + ql_dbg(ql_dbg_user, vha, 0x7000, + "Entered %s msgcode=%d.\n", __func__, bsg_job->request->msgcode); switch (bsg_job->request->msgcode) { case FC_BSG_RPT_ELS: @@ -1480,7 +1518,7 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job) case FC_BSG_HST_DEL_RPORT: case FC_BSG_RPT_CT: default: - DEBUG2(printk("qla2xxx: unsupported BSG request\n")); + ql_log(ql_log_warn, vha, 0x705a, "Unsupported BSG request.\n"); break; } return ret; @@ -1514,17 +1552,15 @@ qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job) && (sp_bsg->u.bsg_job == bsg_job)) { spin_unlock_irqrestore(&ha->hardware_lock, flags); if (ha->isp_ops->abort_command(sp)) { - DEBUG2(qla_printk(KERN_INFO, ha, - "scsi(%ld): mbx " - "abort_command failed\n", - vha->host_no)); + ql_log(ql_log_warn, vha, 0x7089, + "mbx abort_command " + "failed.\n"); bsg_job->req->errors = bsg_job->reply->result = -EIO; } else { - DEBUG2(qla_printk(KERN_INFO, ha, - "scsi(%ld): mbx " - "abort_command success\n", - vha->host_no)); + ql_dbg(ql_dbg_user, vha, 0x708a, + "mbx abort_command " + "success.\n"); bsg_job->req->errors = bsg_job->reply->result = 0; } @@ -1535,8 +1571,7 @@ qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job) } } spin_unlock_irqrestore(&ha->hardware_lock, flags); - DEBUG2(qla_printk(KERN_INFO, ha, - "scsi(%ld) SRB not found to abort\n", vha->host_no)); + ql_log(ql_log_info, vha, 0x708b, "SRB not found to abort.\n"); bsg_job->req->errors = bsg_job->reply->result = -ENXIO; return 0; |