Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

be2iscsi : Logout of FW Boot Session

Once be2iscsi driver is loaded and operational close Boot
session established by FW.

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Odin.com>

authored by

John Soni Jose and committed by
James Bottomley
3f4134c1 eb1c4692

+87
+12
drivers/scsi/be2iscsi/be_cmds.h
··· 304 304 struct mgmt_chap_format chap; 305 305 } __packed; 306 306 307 + struct be_cmd_req_logout_fw_sess { 308 + struct be_cmd_req_hdr hdr; /* dw[4] */ 309 + uint32_t session_handle; 310 + } __packed; 311 + 312 + struct be_cmd_resp_logout_fw_sess { 313 + struct be_cmd_resp_hdr hdr; /* dw[4] */ 314 + #define BEISCSI_MGMT_SESSION_CLOSE 0x20 315 + uint32_t session_status; 316 + } __packed; 317 + 307 318 struct mgmt_conn_login_options { 308 319 u8 flags; 309 320 u8 header_digest; ··· 1147 1136 #define OPCODE_ISCSI_INI_CFG_GET_HBA_NAME 6 1148 1137 #define OPCODE_ISCSI_INI_CFG_SET_HBA_NAME 7 1149 1138 #define OPCODE_ISCSI_INI_SESSION_GET_A_SESSION 14 1139 + #define OPCODE_ISCSI_INI_SESSION_LOGOUT_TARGET 24 1150 1140 #define OPCODE_ISCSI_INI_DRIVER_REOPEN_ALL_SESSIONS 36 1151 1141 #define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41 1152 1142 #define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42
+3
drivers/scsi/be2iscsi/be_main.c
··· 4400 4400 4401 4401 memcpy(&phba->boot_sess, &session_resp->session_info, 4402 4402 sizeof(struct mgmt_session_info)); 4403 + 4404 + beiscsi_logout_fw_sess(phba, 4405 + phba->boot_sess.session_handle); 4403 4406 ret = 0; 4404 4407 4405 4408 boot_freemem:
+69
drivers/scsi/be2iscsi/be_mgmt.c
··· 1707 1707 (params->dw[offsetof(struct amap_beiscsi_offload_params, 1708 1708 exp_statsn) / 32] + 1)); 1709 1709 } 1710 + 1711 + /** 1712 + * beiscsi_logout_fw_sess()- Firmware Session Logout 1713 + * @phba: Device priv structure instance 1714 + * @fw_sess_handle: FW session handle 1715 + * 1716 + * Logout from the FW established sessions. 1717 + * returns 1718 + * Success: 0 1719 + * Failure: Non-Zero Value 1720 + * 1721 + */ 1722 + int beiscsi_logout_fw_sess(struct beiscsi_hba *phba, 1723 + uint32_t fw_sess_handle) 1724 + { 1725 + struct be_ctrl_info *ctrl = &phba->ctrl; 1726 + struct be_mcc_wrb *wrb; 1727 + struct be_cmd_req_logout_fw_sess *req; 1728 + struct be_cmd_resp_logout_fw_sess *resp; 1729 + unsigned int tag; 1730 + int rc; 1731 + 1732 + beiscsi_log(phba, KERN_INFO, 1733 + BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, 1734 + "BG_%d : In bescsi_logout_fwboot_sess\n"); 1735 + 1736 + spin_lock(&ctrl->mbox_lock); 1737 + tag = alloc_mcc_tag(phba); 1738 + if (!tag) { 1739 + spin_unlock(&ctrl->mbox_lock); 1740 + beiscsi_log(phba, KERN_INFO, 1741 + BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, 1742 + "BG_%d : MBX Tag Failure\n"); 1743 + return -EINVAL; 1744 + } 1745 + 1746 + wrb = wrb_from_mccq(phba); 1747 + req = embedded_payload(wrb); 1748 + wrb->tag0 |= tag; 1749 + be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); 1750 + be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI, 1751 + OPCODE_ISCSI_INI_SESSION_LOGOUT_TARGET, 1752 + sizeof(struct be_cmd_req_logout_fw_sess)); 1753 + 1754 + /* Set the session handle */ 1755 + req->session_handle = fw_sess_handle; 1756 + be_mcc_notify(phba); 1757 + spin_unlock(&ctrl->mbox_lock); 1758 + 1759 + rc = beiscsi_mccq_compl(phba, tag, &wrb, NULL); 1760 + if (rc) { 1761 + beiscsi_log(phba, KERN_ERR, 1762 + BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG, 1763 + "BG_%d : MBX CMD FW_SESSION_LOGOUT_TARGET Failed\n"); 1764 + return -EBUSY; 1765 + } 1766 + 1767 + resp = embedded_payload(wrb); 1768 + if (resp->session_status != 1769 + BEISCSI_MGMT_SESSION_CLOSE) { 1770 + beiscsi_log(phba, KERN_ERR, 1771 + BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG, 1772 + "BG_%d : FW_SESSION_LOGOUT_TARGET resp : 0x%x\n", 1773 + resp->session_status); 1774 + rc = -EINVAL; 1775 + } 1776 + 1777 + return rc; 1778 + }
+3
drivers/scsi/be2iscsi/be_mgmt.h
··· 338 338 int be_cmd_modify_eq_delay(struct beiscsi_hba *phba, 339 339 struct be_set_eqd *, int num); 340 340 341 + int beiscsi_logout_fw_sess(struct beiscsi_hba *phba, 342 + uint32_t fw_sess_handle); 343 + 341 344 #endif