diff options
Diffstat (limited to 'drivers/scsi/be2iscsi/be_mgmt.c')
| -rw-r--r-- | drivers/scsi/be2iscsi/be_mgmt.c | 392 |
1 files changed, 220 insertions, 172 deletions
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c index c73775368d09..4e899ec1477d 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.c +++ b/drivers/scsi/be2iscsi/be_mgmt.c @@ -1,11 +1,22 @@ /* - * Copyright 2017 Broadcom. All Rights Reserved. - * The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries. + * This file is part of the Emulex Linux Device Driver for Enterprise iSCSI + * Host Bus Adapters. Refer to the README file included with this package + * for driver version and adapter compatibility. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation. The full GNU General - * Public License is included in this distribution in the file called COPYING. + * Copyright (c) 2018 Broadcom. All Rights Reserved. + * The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful. ALL EXPRESS + * OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY + * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH + * DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. + * See the GNU General Public License for more details, a copy of which + * can be found in the file COPYING included with this package. * * Contact Information: * linux-drivers@broadcom.com @@ -19,43 +30,6 @@ #include "be_iscsi.h" #include "be_main.h" -int beiscsi_modify_eq_delay(struct beiscsi_hba *phba, - struct be_set_eqd *set_eqd, - int num) -{ - struct be_ctrl_info *ctrl = &phba->ctrl; - struct be_mcc_wrb *wrb; - struct be_cmd_req_modify_eq_delay *req; - unsigned int tag; - int i; - - mutex_lock(&ctrl->mbox_lock); - wrb = alloc_mcc_wrb(phba, &tag); - if (!wrb) { - mutex_unlock(&ctrl->mbox_lock); - return 0; - } - - req = embedded_payload(wrb); - be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); - be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, - OPCODE_COMMON_MODIFY_EQ_DELAY, sizeof(*req)); - - req->num_eq = cpu_to_le32(num); - for (i = 0; i < num; i++) { - req->delay[i].eq_id = cpu_to_le32(set_eqd[i].eq_id); - req->delay[i].phase = 0; - req->delay[i].delay_multiplier = - cpu_to_le32(set_eqd[i].delay_multiplier); - } - - /* ignore the completion of this mbox command */ - set_bit(MCC_TAG_STATE_IGNORE, &ctrl->ptag_state[tag].tag_state); - be_mcc_notify(phba, tag); - mutex_unlock(&ctrl->mbox_lock); - return tag; -} - unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl, struct beiscsi_hba *phba, struct bsg_job *job, @@ -123,6 +97,7 @@ unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl, /** * mgmt_open_connection()- Establish a TCP CXN + * @phba: driver priv structure * @dst_addr: Destination Address * @beiscsi_ep: ptr to device endpoint struct * @nonemb_cmd: ptr to memory allocated for command @@ -156,7 +131,7 @@ int mgmt_open_connection(struct beiscsi_hba *phba, beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, "BG_%d : unknown addr family %d\n", dst_addr->sa_family); - return -EINVAL; + return 0; } phwi_ctrlr = phba->phwi_ctrlr; @@ -235,17 +210,20 @@ int mgmt_open_connection(struct beiscsi_hba *phba, return tag; } -/* - * mgmt_exec_nonemb_cmd()- Execute Non Embedded MBX Cmd - * @phba: Driver priv structure - * @nonemb_cmd: Address of the MBX command issued - * @resp_buf: Buffer to copy the MBX cmd response - * @resp_buf_len: respone lenght to be copied +/** + * beiscsi_exec_nemb_cmd()- execute non-embedded MBX cmd + * @phba: driver priv structure + * @nonemb_cmd: DMA address of the MBX command to be issued + * @cbfn: callback func on MCC completion + * @resp_buf: buffer to copy the MBX cmd response + * @resp_buf_len: response length to be copied * **/ -static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba, - struct be_dma_mem *nonemb_cmd, void *resp_buf, - int resp_buf_len) +static int beiscsi_exec_nemb_cmd(struct beiscsi_hba *phba, + struct be_dma_mem *nonemb_cmd, + void (*cbfn)(struct beiscsi_hba *, + unsigned int), + void *resp_buf, u32 resp_buf_len) { struct be_ctrl_info *ctrl = &phba->ctrl; struct be_mcc_wrb *wrb; @@ -257,8 +235,7 @@ static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba, wrb = alloc_mcc_wrb(phba, &tag); if (!wrb) { mutex_unlock(&ctrl->mbox_lock); - rc = -ENOMEM; - goto free_cmd; + return -ENOMEM; } sge = nonembedded_sgl(wrb); @@ -267,51 +244,147 @@ static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba, sge->pa_lo = cpu_to_le32(lower_32_bits(nonemb_cmd->dma)); sge->len = cpu_to_le32(nonemb_cmd->size); + if (cbfn) { + struct be_dma_mem *tag_mem; + + set_bit(MCC_TAG_STATE_ASYNC, &ctrl->ptag_state[tag].tag_state); + ctrl->ptag_state[tag].cbfn = cbfn; + tag_mem = &phba->ctrl.ptag_state[tag].tag_mem_state; + + /* store DMA mem to be freed in callback */ + tag_mem->size = nonemb_cmd->size; + tag_mem->va = nonemb_cmd->va; + tag_mem->dma = nonemb_cmd->dma; + } be_mcc_notify(phba, tag); mutex_unlock(&ctrl->mbox_lock); + /* with cbfn set, its async cmd, don't wait */ + if (cbfn) + return 0; + rc = beiscsi_mccq_compl_wait(phba, tag, NULL, nonemb_cmd); + /* copy the response, if any */ if (resp_buf) memcpy(resp_buf, nonemb_cmd->va, resp_buf_len); - - if (rc) { - /* Check if the MBX Cmd needs to be re-issued */ - if (rc == -EAGAIN) - return rc; - - beiscsi_log(phba, KERN_WARNING, - BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, - "BG_%d : mgmt_exec_nonemb_cmd Failed status\n"); - - if (rc != -EBUSY) - goto free_cmd; - else - return rc; - } -free_cmd: - pci_free_consistent(ctrl->pdev, nonemb_cmd->size, - nonemb_cmd->va, nonemb_cmd->dma); return rc; } -static int mgmt_alloc_cmd_data(struct beiscsi_hba *phba, struct be_dma_mem *cmd, - int iscsi_cmd, int size) +static int beiscsi_prep_nemb_cmd(struct beiscsi_hba *phba, + struct be_dma_mem *cmd, + u8 subsystem, u8 opcode, u32 size) { - cmd->va = pci_zalloc_consistent(phba->ctrl.pdev, size, &cmd->dma); + cmd->va = dma_alloc_coherent(&phba->ctrl.pdev->dev, size, &cmd->dma, + GFP_KERNEL); if (!cmd->va) { beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, "BG_%d : Failed to allocate memory for if info\n"); return -ENOMEM; } cmd->size = size; - be_cmd_hdr_prepare(cmd->va, CMD_SUBSYSTEM_ISCSI, iscsi_cmd, size); + be_cmd_hdr_prepare(cmd->va, subsystem, opcode, size); beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG, - "BG_%d : subsystem iSCSI cmd %d size %d\n", - iscsi_cmd, size); + "BG_%d : subsystem %u cmd %u size %u\n", + subsystem, opcode, size); return 0; } +static void beiscsi_free_nemb_cmd(struct beiscsi_hba *phba, + struct be_dma_mem *cmd, int rc) +{ + /* + * If FW is busy the DMA buffer is saved with the tag. When the cmd + * completes this buffer is freed. + */ + if (rc == -EBUSY) + return; + + dma_free_coherent(&phba->ctrl.pdev->dev, cmd->size, cmd->va, cmd->dma); +} + +static void __beiscsi_eq_delay_compl(struct beiscsi_hba *phba, unsigned int tag) +{ + struct be_dma_mem *tag_mem; + + /* status is ignored */ + __beiscsi_mcc_compl_status(phba, tag, NULL, NULL); + tag_mem = &phba->ctrl.ptag_state[tag].tag_mem_state; + if (tag_mem->size) { + dma_free_coherent(&phba->pcidev->dev, tag_mem->size, + tag_mem->va, tag_mem->dma); + tag_mem->size = 0; + } +} + +int beiscsi_modify_eq_delay(struct beiscsi_hba *phba, + struct be_set_eqd *set_eqd, int num) +{ + struct be_cmd_req_modify_eq_delay *req; + struct be_dma_mem nonemb_cmd; + int i, rc; + + rc = beiscsi_prep_nemb_cmd(phba, &nonemb_cmd, CMD_SUBSYSTEM_COMMON, + OPCODE_COMMON_MODIFY_EQ_DELAY, sizeof(*req)); + if (rc) + return rc; + + req = nonemb_cmd.va; + req->num_eq = cpu_to_le32(num); + for (i = 0; i < num; i++) { + req->delay[i].eq_id = cpu_to_le32(set_eqd[i].eq_id); + req->delay[i].phase = 0; + req->delay[i].delay_multiplier = + cpu_to_le32(set_eqd[i].delay_multiplier); + } + + rc = beiscsi_exec_nemb_cmd(phba, &nonemb_cmd, __beiscsi_eq_delay_compl, + NULL, 0); + if (rc) { + /* + * Only free on failure. Async cmds are handled like -EBUSY + * where it's handled for us. + */ + beiscsi_free_nemb_cmd(phba, &nonemb_cmd, rc); + } + return rc; +} + +/** + * beiscsi_get_initiator_name - read initiator name from flash + * @phba: device priv structure + * @name: buffer pointer + * @cfg: fetch user configured + * + */ +int beiscsi_get_initiator_name(struct beiscsi_hba *phba, char *name, bool cfg) +{ + struct be_dma_mem nonemb_cmd; + struct be_cmd_hba_name resp; + struct be_cmd_hba_name *req; + int rc; + + rc = beiscsi_prep_nemb_cmd(phba, &nonemb_cmd, CMD_SUBSYSTEM_ISCSI_INI, + OPCODE_ISCSI_INI_CFG_GET_HBA_NAME, sizeof(resp)); + if (rc) + return rc; + + req = nonemb_cmd.va; + if (cfg) + req->hdr.version = 1; + rc = beiscsi_exec_nemb_cmd(phba, &nonemb_cmd, NULL, + &resp, sizeof(resp)); + beiscsi_free_nemb_cmd(phba, &nonemb_cmd, rc); + if (rc) { + beiscsi_log(phba, KERN_ERR, + BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, + "BS_%d : Initiator Name MBX Failed\n"); + return rc; + } + rc = sprintf(name, "%s\n", resp.initiator_name); + return rc; +} + unsigned int beiscsi_if_get_handle(struct beiscsi_hba *phba) { struct be_ctrl_info *ctrl = &phba->ctrl; @@ -368,9 +441,9 @@ static int beiscsi_if_mod_gw(struct beiscsi_hba *phba, struct be_dma_mem nonemb_cmd; int rt_val; - rt_val = mgmt_alloc_cmd_data(phba, &nonemb_cmd, - OPCODE_COMMON_ISCSI_NTWK_MODIFY_DEFAULT_GATEWAY, - sizeof(*req)); + rt_val = beiscsi_prep_nemb_cmd(phba, &nonemb_cmd, CMD_SUBSYSTEM_ISCSI, + OPCODE_COMMON_ISCSI_NTWK_MODIFY_DEFAULT_GATEWAY, + sizeof(*req)); if (rt_val) return rt_val; @@ -379,7 +452,9 @@ static int beiscsi_if_mod_gw(struct beiscsi_hba *phba, req->ip_addr.ip_type = ip_type; memcpy(req->ip_addr.addr, gw, (ip_type < BEISCSI_IP_TYPE_V6) ? IP_V4_LEN : IP_V6_LEN); - return mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, NULL, 0); + rt_val = beiscsi_exec_nemb_cmd(phba, &nonemb_cmd, NULL, NULL, 0); + beiscsi_free_nemb_cmd(phba, &nonemb_cmd, rt_val); + return rt_val; } int beiscsi_if_set_gw(struct beiscsi_hba *phba, u32 ip_type, u8 *gw) @@ -420,17 +495,19 @@ int beiscsi_if_get_gw(struct beiscsi_hba *phba, u32 ip_type, struct be_dma_mem nonemb_cmd; int rc; - rc = mgmt_alloc_cmd_data(phba, &nonemb_cmd, - OPCODE_COMMON_ISCSI_NTWK_GET_DEFAULT_GATEWAY, - sizeof(*resp)); + rc = beiscsi_prep_nemb_cmd(phba, &nonemb_cmd, CMD_SUBSYSTEM_ISCSI, + OPCODE_COMMON_ISCSI_NTWK_GET_DEFAULT_GATEWAY, + sizeof(*resp)); if (rc) return rc; req = nonemb_cmd.va; req->ip_type = ip_type; - return mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, resp, - sizeof(*resp)); + rc = beiscsi_exec_nemb_cmd(phba, &nonemb_cmd, NULL, resp, + sizeof(*resp)); + beiscsi_free_nemb_cmd(phba, &nonemb_cmd, rc); + return rc; } static int @@ -441,9 +518,9 @@ beiscsi_if_clr_ip(struct beiscsi_hba *phba, struct be_dma_mem nonemb_cmd; int rc; - rc = mgmt_alloc_cmd_data(phba, &nonemb_cmd, - OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR, - sizeof(*req)); + rc = beiscsi_prep_nemb_cmd(phba, &nonemb_cmd, CMD_SUBSYSTEM_ISCSI, + OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR, + sizeof(*req)); if (rc) return rc; @@ -461,12 +538,13 @@ beiscsi_if_clr_ip(struct beiscsi_hba *phba, memcpy(req->ip_params.ip_record.ip_addr.subnet_mask, if_info->ip_addr.subnet_mask, sizeof(if_info->ip_addr.subnet_mask)); - rc = mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, NULL, 0); + rc = beiscsi_exec_nemb_cmd(phba, &nonemb_cmd, NULL, NULL, 0); if (rc < 0 || req->ip_params.ip_record.status) { beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG, "BG_%d : failed to clear IP: rc %d status %d\n", rc, req->ip_params.ip_record.status); } + beiscsi_free_nemb_cmd(phba, &nonemb_cmd, rc); return rc; } @@ -479,9 +557,9 @@ beiscsi_if_set_ip(struct beiscsi_hba *phba, u8 *ip, uint32_t ip_len; int rc; - rc = mgmt_alloc_cmd_data(phba, &nonemb_cmd, - OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR, - sizeof(*req)); + rc = beiscsi_prep_nemb_cmd(phba, &nonemb_cmd, CMD_SUBSYSTEM_ISCSI, + OPCODE_COMMON_ISCSI_NTWK_MODIFY_IP_ADDR, + sizeof(*req)); if (rc) return rc; @@ -499,7 +577,7 @@ beiscsi_if_set_ip(struct beiscsi_hba *phba, u8 *ip, memcpy(req->ip_params.ip_record.ip_addr.subnet_mask, subnet, ip_len); - rc = mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, NULL, 0); + rc = beiscsi_exec_nemb_cmd(phba, &nonemb_cmd, NULL, NULL, 0); /** * In some cases, host needs to look into individual record status * even though FW reported success for that IOCTL. @@ -511,6 +589,7 @@ beiscsi_if_set_ip(struct beiscsi_hba *phba, u8 *ip, if (req->ip_params.ip_record.status) rc = -EINVAL; } + beiscsi_free_nemb_cmd(phba, &nonemb_cmd, rc); return rc; } @@ -527,7 +606,8 @@ int beiscsi_if_en_static(struct beiscsi_hba *phba, u32 ip_type, return rc; if (if_info->dhcp_state) { - rc = mgmt_alloc_cmd_data(phba, &nonemb_cmd, + rc = beiscsi_prep_nemb_cmd(phba, &nonemb_cmd, + CMD_SUBSYSTEM_ISCSI, OPCODE_COMMON_ISCSI_NTWK_REL_STATELESS_IP_ADDR, sizeof(*reldhcp)); if (rc) @@ -536,7 +616,8 @@ int beiscsi_if_en_static(struct beiscsi_hba *phba, u32 ip_type, reldhcp = nonemb_cmd.va; reldhcp->interface_hndl = phba->interface_handle; reldhcp->ip_type = ip_type; - rc = mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, NULL, 0); + rc = beiscsi_exec_nemb_cmd(phba, &nonemb_cmd, NULL, NULL, 0); + beiscsi_free_nemb_cmd(phba, &nonemb_cmd, rc); if (rc < 0) { beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG, "BG_%d : failed to release existing DHCP: %d\n", @@ -606,7 +687,7 @@ int beiscsi_if_en_dhcp(struct beiscsi_hba *phba, u32 ip_type) } } - rc = mgmt_alloc_cmd_data(phba, &nonemb_cmd, + rc = beiscsi_prep_nemb_cmd(phba, &nonemb_cmd, CMD_SUBSYSTEM_ISCSI, OPCODE_COMMON_ISCSI_NTWK_CONFIG_STATELESS_IP_ADDR, sizeof(*dhcpreq)); if (rc) @@ -617,8 +698,8 @@ int beiscsi_if_en_dhcp(struct beiscsi_hba *phba, u32 ip_type) dhcpreq->retry_count = 1; dhcpreq->interface_hndl = phba->interface_handle; dhcpreq->ip_type = ip_type; - rc = mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, NULL, 0); - + rc = beiscsi_exec_nemb_cmd(phba, &nonemb_cmd, NULL, NULL, 0); + beiscsi_free_nemb_cmd(phba, &nonemb_cmd, rc); exit: kfree(if_info); return rc; @@ -673,9 +754,10 @@ int beiscsi_if_get_info(struct beiscsi_hba *phba, int ip_type, return rc; do { - rc = mgmt_alloc_cmd_data(phba, &nonemb_cmd, - OPCODE_COMMON_ISCSI_NTWK_GET_IF_INFO, - ioctl_size); + rc = beiscsi_prep_nemb_cmd(phba, &nonemb_cmd, + CMD_SUBSYSTEM_ISCSI, + OPCODE_COMMON_ISCSI_NTWK_GET_IF_INFO, + ioctl_size); if (rc) return rc; @@ -690,16 +772,13 @@ int beiscsi_if_get_info(struct beiscsi_hba *phba, int ip_type, BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG, "BG_%d : Memory Allocation Failure\n"); - /* Free the DMA memory for the IOCTL issuing */ - pci_free_consistent(phba->ctrl.pdev, - nonemb_cmd.size, - nonemb_cmd.va, - nonemb_cmd.dma); + beiscsi_free_nemb_cmd(phba, &nonemb_cmd, + -ENOMEM); return -ENOMEM; } - rc = mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, *if_info, - ioctl_size); + rc = beiscsi_exec_nemb_cmd(phba, &nonemb_cmd, NULL, *if_info, + ioctl_size); /* Check if the error is because of Insufficent_Buffer */ if (rc == -EAGAIN) { @@ -709,15 +788,13 @@ int beiscsi_if_get_info(struct beiscsi_hba *phba, int ip_type, nonemb_cmd.va)->actual_resp_len; ioctl_size += sizeof(struct be_cmd_req_hdr); - /* Free the previous allocated DMA memory */ - pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, - nonemb_cmd.va, - nonemb_cmd.dma); - + beiscsi_free_nemb_cmd(phba, &nonemb_cmd, rc); /* Free the virtual memory */ kfree(*if_info); - } else + } else { + beiscsi_free_nemb_cmd(phba, &nonemb_cmd, rc); break; + } } while (true); return rc; } @@ -728,41 +805,15 @@ int mgmt_get_nic_conf(struct beiscsi_hba *phba, struct be_dma_mem nonemb_cmd; int rc; - rc = mgmt_alloc_cmd_data(phba, &nonemb_cmd, - OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG, - sizeof(*nic)); + rc = beiscsi_prep_nemb_cmd(phba, &nonemb_cmd, CMD_SUBSYSTEM_ISCSI, + OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG, + sizeof(*nic)); if (rc) return rc; - return mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, nic, sizeof(*nic)); -} - - - -unsigned int be_cmd_get_initname(struct beiscsi_hba *phba) -{ - unsigned int tag; - struct be_mcc_wrb *wrb; - struct be_cmd_hba_name *req; - struct be_ctrl_info *ctrl = &phba->ctrl; - - if (mutex_lock_interruptible(&ctrl->mbox_lock)) - return 0; - wrb = alloc_mcc_wrb(phba, &tag); - if (!wrb) { - mutex_unlock(&ctrl->mbox_lock); - return 0; - } - - req = embedded_payload(wrb); - be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); - be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI, - OPCODE_ISCSI_INI_CFG_GET_HBA_NAME, - sizeof(*req)); - - be_mcc_notify(phba, tag); - mutex_unlock(&ctrl->mbox_lock); - return tag; + rc = beiscsi_exec_nemb_cmd(phba, &nonemb_cmd, NULL, nic, sizeof(*nic)); + beiscsi_free_nemb_cmd(phba, &nonemb_cmd, rc); + return rc; } static void beiscsi_boot_process_compl(struct beiscsi_hba *phba, @@ -826,7 +877,7 @@ static void beiscsi_boot_process_compl(struct beiscsi_hba *phba, status); boot_work = 0; } - pci_free_consistent(phba->ctrl.pdev, bs->nonemb_cmd.size, + dma_free_coherent(&phba->ctrl.pdev->dev, bs->nonemb_cmd.size, bs->nonemb_cmd.va, bs->nonemb_cmd.dma); bs->nonemb_cmd.va = NULL; break; @@ -969,9 +1020,10 @@ unsigned int beiscsi_boot_get_sinfo(struct beiscsi_hba *phba) nonemb_cmd = &phba->boot_struct.nonemb_cmd; nonemb_cmd->size = sizeof(struct be_cmd_get_session_resp); - nonemb_cmd->va = pci_alloc_consistent(phba->ctrl.pdev, + nonemb_cmd->va = dma_alloc_coherent(&phba->ctrl.pdev->dev, nonemb_cmd->size, - &nonemb_cmd->dma); + &nonemb_cmd->dma, + GFP_KERNEL); if (!nonemb_cmd->va) { mutex_unlock(&ctrl->mbox_lock); return 0; @@ -1133,12 +1185,12 @@ beiscsi_active_session_disp(struct device *dev, struct device_attribute *attr, if (test_bit(ulp_num, (void *)&phba->fw_config.ulp_supported)) { avlbl_cids = BEISCSI_ULP_AVLBL_CID(phba, ulp_num); total_cids = BEISCSI_GET_CID_COUNT(phba, ulp_num); - len += snprintf(buf+len, PAGE_SIZE - len, - "ULP%d : %d\n", ulp_num, - (total_cids - avlbl_cids)); + len += scnprintf(buf+len, PAGE_SIZE - len, + "ULP%d : %d\n", ulp_num, + (total_cids - avlbl_cids)); } else - len += snprintf(buf+len, PAGE_SIZE - len, - "ULP%d : %d\n", ulp_num, 0); + len += scnprintf(buf+len, PAGE_SIZE - len, + "ULP%d : %d\n", ulp_num, 0); } return len; @@ -1163,12 +1215,12 @@ beiscsi_free_session_disp(struct device *dev, struct device_attribute *attr, for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++) { if (test_bit(ulp_num, (void *)&phba->fw_config.ulp_supported)) - len += snprintf(buf+len, PAGE_SIZE - len, - "ULP%d : %d\n", ulp_num, - BEISCSI_ULP_AVLBL_CID(phba, ulp_num)); + len += scnprintf(buf+len, PAGE_SIZE - len, + "ULP%d : %d\n", ulp_num, + BEISCSI_ULP_AVLBL_CID(phba, ulp_num)); else - len += snprintf(buf+len, PAGE_SIZE - len, - "ULP%d : %d\n", ulp_num, 0); + len += scnprintf(buf+len, PAGE_SIZE - len, + "ULP%d : %d\n", ulp_num, 0); } return len; @@ -1198,23 +1250,19 @@ beiscsi_adap_family_disp(struct device *dev, struct device_attribute *attr, case OC_DEVICE_ID2: return snprintf(buf, PAGE_SIZE, "Obsolete/Unsupported BE2 Adapter Family\n"); - break; case BE_DEVICE_ID2: case OC_DEVICE_ID3: return snprintf(buf, PAGE_SIZE, "BE3-R Adapter Family\n"); - break; case OC_SKH_ID1: return snprintf(buf, PAGE_SIZE, "Skyhawk-R Adapter Family\n"); - break; default: return snprintf(buf, PAGE_SIZE, "Unknown Adapter Family: 0x%x\n", dev_id); - break; } } /** - * beiscsi_phys_port()- Display Physical Port Identifier + * beiscsi_phys_port_disp()- Display Physical Port Identifier * @dev: ptr to device not used. * @attr: device attribute, not used. * @buf: contains formatted text port identifier @@ -1465,9 +1513,9 @@ int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba, return -EINVAL; nonemb_cmd.size = sizeof(union be_invldt_cmds_params); - nonemb_cmd.va = pci_zalloc_consistent(phba->ctrl.pdev, - nonemb_cmd.size, - &nonemb_cmd.dma); + nonemb_cmd.va = dma_alloc_coherent(&phba->ctrl.pdev->dev, + nonemb_cmd.size, &nonemb_cmd.dma, + GFP_KERNEL); if (!nonemb_cmd.va) { beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_EH, "BM_%d : invldt_cmds_params alloc failed\n"); @@ -1478,7 +1526,7 @@ int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba, wrb = alloc_mcc_wrb(phba, &tag); if (!wrb) { mutex_unlock(&ctrl->mbox_lock); - pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, + dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size, nonemb_cmd.va, nonemb_cmd.dma); return -ENOMEM; } @@ -1505,7 +1553,7 @@ int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba, rc = beiscsi_mccq_compl_wait(phba, tag, NULL, &nonemb_cmd); if (rc != -EBUSY) - pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, + dma_free_coherent(&phba->ctrl.pdev->dev, nonemb_cmd.size, nonemb_cmd.va, nonemb_cmd.dma); return rc; } |
