Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (C) 2005 - 2009 ServerEngines |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License version 2 |
| 7 | * as published by the Free Software Foundation. The full GNU General |
| 8 | * Public License is included in this distribution in the file called COPYING. |
| 9 | * |
| 10 | * Written by: Jayamohan Kallickal (jayamohank@serverengines.com) |
| 11 | * |
| 12 | * Contact Information: |
| 13 | * linux-drivers@serverengines.com |
| 14 | * |
| 15 | * ServerEngines |
| 16 | * 209 N. Fair Oaks Ave |
| 17 | * Sunnyvale, CA 94085 |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #include "be_mgmt.h" |
| 22 | #include "be_iscsi.h" |
| 23 | |
| 24 | unsigned char mgmt_get_fw_config(struct be_ctrl_info *ctrl, |
| 25 | struct beiscsi_hba *phba) |
| 26 | { |
| 27 | struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); |
| 28 | struct be_fw_cfg *req = embedded_payload(wrb); |
| 29 | int status = 0; |
| 30 | |
| 31 | spin_lock(&ctrl->mbox_lock); |
| 32 | memset(wrb, 0, sizeof(*wrb)); |
| 33 | |
| 34 | be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); |
| 35 | |
| 36 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, |
| 37 | OPCODE_COMMON_QUERY_FIRMWARE_CONFIG, sizeof(*req)); |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 38 | status = be_mbox_notify(ctrl); |
| 39 | if (!status) { |
| 40 | struct be_fw_cfg *pfw_cfg; |
| 41 | pfw_cfg = req; |
| 42 | phba->fw_config.phys_port = pfw_cfg->phys_port; |
| 43 | phba->fw_config.iscsi_icd_start = |
| 44 | pfw_cfg->ulp[0].icd_base; |
| 45 | phba->fw_config.iscsi_icd_count = |
| 46 | pfw_cfg->ulp[0].icd_count; |
| 47 | phba->fw_config.iscsi_cid_start = |
| 48 | pfw_cfg->ulp[0].sq_base; |
| 49 | phba->fw_config.iscsi_cid_count = |
| 50 | pfw_cfg->ulp[0].sq_count; |
Jayamohan Kallickal | 7da5087 | 2010-01-05 05:04:12 +0530 | [diff] [blame] | 51 | if (phba->fw_config.iscsi_cid_count > (BE2_MAX_SESSIONS / 2)) { |
| 52 | status = 1; |
| 53 | shost_printk(KERN_WARNING, phba->shost, |
| 54 | "FW reported MAX CXNS as %d \t" |
| 55 | "Max Supported = %d. Failing to load \n", |
| 56 | phba->fw_config.iscsi_cid_count, |
| 57 | BE2_MAX_SESSIONS); |
| 58 | } |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 59 | } else { |
| 60 | shost_printk(KERN_WARNING, phba->shost, |
| 61 | "Failed in mgmt_get_fw_config \n"); |
| 62 | } |
| 63 | |
| 64 | spin_unlock(&ctrl->mbox_lock); |
| 65 | return status; |
| 66 | } |
| 67 | |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 68 | unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl, |
| 69 | struct beiscsi_hba *phba) |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 70 | { |
| 71 | struct be_dma_mem nonemb_cmd; |
| 72 | struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); |
| 73 | struct be_mgmt_controller_attributes *req; |
| 74 | struct be_sge *sge = nonembedded_sgl(wrb); |
| 75 | int status = 0; |
| 76 | |
| 77 | nonemb_cmd.va = pci_alloc_consistent(ctrl->pdev, |
| 78 | sizeof(struct be_mgmt_controller_attributes), |
| 79 | &nonemb_cmd.dma); |
| 80 | if (nonemb_cmd.va == NULL) { |
| 81 | SE_DEBUG(DBG_LVL_1, |
| 82 | "Failed to allocate memory for mgmt_check_supported_fw" |
| 83 | "\n"); |
| 84 | return -1; |
| 85 | } |
| 86 | nonemb_cmd.size = sizeof(struct be_mgmt_controller_attributes); |
| 87 | req = nonemb_cmd.va; |
| 88 | spin_lock(&ctrl->mbox_lock); |
| 89 | memset(wrb, 0, sizeof(*wrb)); |
| 90 | be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1); |
| 91 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, |
| 92 | OPCODE_COMMON_GET_CNTL_ATTRIBUTES, sizeof(*req)); |
| 93 | sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd.dma)); |
| 94 | sge->pa_lo = cpu_to_le32(nonemb_cmd.dma & 0xFFFFFFFF); |
| 95 | sge->len = cpu_to_le32(nonemb_cmd.size); |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 96 | status = be_mbox_notify(ctrl); |
| 97 | if (!status) { |
| 98 | struct be_mgmt_controller_attributes_resp *resp = nonemb_cmd.va; |
| 99 | SE_DEBUG(DBG_LVL_8, "Firmware version of CMD: %s\n", |
| 100 | resp->params.hba_attribs.flashrom_version_string); |
| 101 | SE_DEBUG(DBG_LVL_8, "Firmware version is : %s\n", |
| 102 | resp->params.hba_attribs.firmware_version_string); |
| 103 | SE_DEBUG(DBG_LVL_8, |
| 104 | "Developer Build, not performing version check...\n"); |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 105 | phba->fw_config.iscsi_features = |
| 106 | resp->params.hba_attribs.iscsi_features; |
| 107 | SE_DEBUG(DBG_LVL_8, " phba->fw_config.iscsi_features = %d\n", |
| 108 | phba->fw_config.iscsi_features); |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 109 | } else |
| 110 | SE_DEBUG(DBG_LVL_1, " Failed in mgmt_check_supported_fw\n"); |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 111 | spin_unlock(&ctrl->mbox_lock); |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 112 | if (nonemb_cmd.va) |
| 113 | pci_free_consistent(ctrl->pdev, nonemb_cmd.size, |
| 114 | nonemb_cmd.va, nonemb_cmd.dma); |
| 115 | |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 116 | return status; |
| 117 | } |
| 118 | |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 119 | |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 120 | unsigned char mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute) |
| 121 | { |
| 122 | struct be_ctrl_info *ctrl = &phba->ctrl; |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 123 | struct be_mcc_wrb *wrb = wrb_from_mccq(phba); |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 124 | struct iscsi_cleanup_req *req = embedded_payload(wrb); |
| 125 | int status = 0; |
| 126 | |
| 127 | spin_lock(&ctrl->mbox_lock); |
| 128 | memset(wrb, 0, sizeof(*wrb)); |
| 129 | |
| 130 | be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); |
| 131 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI, |
| 132 | OPCODE_COMMON_ISCSI_CLEANUP, sizeof(*req)); |
| 133 | |
| 134 | req->chute = chute; |
| 135 | req->hdr_ring_id = 0; |
| 136 | req->data_ring_id = 0; |
| 137 | |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 138 | status = be_mcc_notify_wait(phba); |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 139 | if (status) |
| 140 | shost_printk(KERN_WARNING, phba->shost, |
| 141 | " mgmt_epfw_cleanup , FAILED\n"); |
| 142 | spin_unlock(&ctrl->mbox_lock); |
| 143 | return status; |
| 144 | } |
| 145 | |
| 146 | unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba, |
| 147 | unsigned int icd, unsigned int cid) |
| 148 | { |
| 149 | struct be_dma_mem nonemb_cmd; |
| 150 | struct be_ctrl_info *ctrl = &phba->ctrl; |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 151 | struct be_mcc_wrb *wrb; |
| 152 | struct be_sge *sge; |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 153 | struct invalidate_commands_params_in *req; |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 154 | unsigned int tag = 0; |
| 155 | |
| 156 | spin_lock(&ctrl->mbox_lock); |
| 157 | tag = alloc_mcc_tag(phba); |
| 158 | if (!tag) { |
| 159 | spin_unlock(&ctrl->mbox_lock); |
| 160 | return tag; |
| 161 | } |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 162 | |
| 163 | nonemb_cmd.va = pci_alloc_consistent(ctrl->pdev, |
| 164 | sizeof(struct invalidate_commands_params_in), |
| 165 | &nonemb_cmd.dma); |
| 166 | if (nonemb_cmd.va == NULL) { |
| 167 | SE_DEBUG(DBG_LVL_1, |
| 168 | "Failed to allocate memory for" |
| 169 | "mgmt_invalidate_icds \n"); |
| 170 | return -1; |
| 171 | } |
| 172 | nonemb_cmd.size = sizeof(struct invalidate_commands_params_in); |
| 173 | req = nonemb_cmd.va; |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 174 | wrb = wrb_from_mccq(phba); |
| 175 | sge = nonembedded_sgl(wrb); |
| 176 | wrb->tag0 |= tag; |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 177 | |
| 178 | be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1); |
| 179 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI, |
| 180 | OPCODE_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS, |
| 181 | sizeof(*req)); |
| 182 | req->ref_handle = 0; |
| 183 | req->cleanup_type = CMD_ISCSI_COMMAND_INVALIDATE; |
| 184 | req->icd_count = 0; |
| 185 | req->table[req->icd_count].icd = icd; |
| 186 | req->table[req->icd_count].cid = cid; |
| 187 | sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd.dma)); |
| 188 | sge->pa_lo = cpu_to_le32(nonemb_cmd.dma & 0xFFFFFFFF); |
| 189 | sge->len = cpu_to_le32(nonemb_cmd.size); |
| 190 | |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 191 | be_mcc_notify(phba); |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 192 | spin_unlock(&ctrl->mbox_lock); |
| 193 | if (nonemb_cmd.va) |
| 194 | pci_free_consistent(ctrl->pdev, nonemb_cmd.size, |
| 195 | nonemb_cmd.va, nonemb_cmd.dma); |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 196 | return tag; |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba, |
| 200 | struct beiscsi_endpoint *beiscsi_ep, |
| 201 | unsigned short cid, |
| 202 | unsigned short issue_reset, |
| 203 | unsigned short savecfg_flag) |
| 204 | { |
| 205 | struct be_ctrl_info *ctrl = &phba->ctrl; |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 206 | struct be_mcc_wrb *wrb; |
| 207 | struct iscsi_invalidate_connection_params_in *req; |
| 208 | unsigned int tag = 0; |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 209 | |
| 210 | spin_lock(&ctrl->mbox_lock); |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 211 | tag = alloc_mcc_tag(phba); |
| 212 | if (!tag) { |
| 213 | spin_unlock(&ctrl->mbox_lock); |
| 214 | return tag; |
| 215 | } |
| 216 | wrb = wrb_from_mccq(phba); |
| 217 | wrb->tag0 |= tag; |
| 218 | req = embedded_payload(wrb); |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 219 | |
| 220 | be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); |
| 221 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI, |
| 222 | OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION, |
| 223 | sizeof(*req)); |
| 224 | req->session_handle = beiscsi_ep->fw_handle; |
| 225 | req->cid = cid; |
| 226 | if (issue_reset) |
| 227 | req->cleanup_type = CMD_ISCSI_CONNECTION_ISSUE_TCP_RST; |
| 228 | else |
| 229 | req->cleanup_type = CMD_ISCSI_CONNECTION_INVALIDATE; |
| 230 | req->save_cfg = savecfg_flag; |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 231 | be_mcc_notify(phba); |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 232 | spin_unlock(&ctrl->mbox_lock); |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 233 | return tag; |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | unsigned char mgmt_upload_connection(struct beiscsi_hba *phba, |
| 237 | unsigned short cid, unsigned int upload_flag) |
| 238 | { |
| 239 | struct be_ctrl_info *ctrl = &phba->ctrl; |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 240 | struct be_mcc_wrb *wrb; |
| 241 | struct tcp_upload_params_in *req; |
| 242 | unsigned int tag = 0; |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 243 | |
| 244 | spin_lock(&ctrl->mbox_lock); |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 245 | tag = alloc_mcc_tag(phba); |
| 246 | if (!tag) { |
| 247 | spin_unlock(&ctrl->mbox_lock); |
| 248 | return tag; |
| 249 | } |
| 250 | wrb = wrb_from_mccq(phba); |
| 251 | req = embedded_payload(wrb); |
| 252 | wrb->tag0 |= tag; |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 253 | |
| 254 | be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); |
| 255 | be_cmd_hdr_prepare(&req->hdr, CMD_COMMON_TCP_UPLOAD, |
| 256 | OPCODE_COMMON_TCP_UPLOAD, sizeof(*req)); |
| 257 | req->id = (unsigned short)cid; |
| 258 | req->upload_type = (unsigned char)upload_flag; |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 259 | be_mcc_notify(phba); |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 260 | spin_unlock(&ctrl->mbox_lock); |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 261 | return tag; |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | int mgmt_open_connection(struct beiscsi_hba *phba, |
| 265 | struct sockaddr *dst_addr, |
| 266 | struct beiscsi_endpoint *beiscsi_ep) |
| 267 | { |
| 268 | struct hwi_controller *phwi_ctrlr; |
| 269 | struct hwi_context_memory *phwi_context; |
| 270 | struct sockaddr_in *daddr_in = (struct sockaddr_in *)dst_addr; |
| 271 | struct sockaddr_in6 *daddr_in6 = (struct sockaddr_in6 *)dst_addr; |
| 272 | struct be_ctrl_info *ctrl = &phba->ctrl; |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 273 | struct be_mcc_wrb *wrb; |
| 274 | struct tcp_connect_and_offload_in *req; |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 275 | unsigned short def_hdr_id; |
| 276 | unsigned short def_data_id; |
| 277 | struct phys_addr template_address = { 0, 0 }; |
| 278 | struct phys_addr *ptemplate_address; |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 279 | unsigned int tag = 0; |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 280 | unsigned int i; |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 281 | unsigned short cid = beiscsi_ep->ep_cid; |
| 282 | |
| 283 | phwi_ctrlr = phba->phwi_ctrlr; |
| 284 | phwi_context = phwi_ctrlr->phwi_ctxt; |
| 285 | def_hdr_id = (unsigned short)HWI_GET_DEF_HDRQ_ID(phba); |
| 286 | def_data_id = (unsigned short)HWI_GET_DEF_BUFQ_ID(phba); |
| 287 | |
| 288 | ptemplate_address = &template_address; |
| 289 | ISCSI_GET_PDU_TEMPLATE_ADDRESS(phba, ptemplate_address); |
| 290 | spin_lock(&ctrl->mbox_lock); |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 291 | tag = alloc_mcc_tag(phba); |
| 292 | if (!tag) { |
| 293 | spin_unlock(&ctrl->mbox_lock); |
| 294 | return tag; |
| 295 | } |
| 296 | wrb = wrb_from_mccq(phba); |
| 297 | req = embedded_payload(wrb); |
| 298 | wrb->tag0 |= tag; |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 299 | |
| 300 | be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); |
| 301 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI, |
| 302 | OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD, |
| 303 | sizeof(*req)); |
| 304 | if (dst_addr->sa_family == PF_INET) { |
| 305 | __be32 s_addr = daddr_in->sin_addr.s_addr; |
| 306 | req->ip_address.ip_type = BE2_IPV4; |
| 307 | req->ip_address.ip_address[0] = s_addr & 0x000000ff; |
| 308 | req->ip_address.ip_address[1] = (s_addr & 0x0000ff00) >> 8; |
| 309 | req->ip_address.ip_address[2] = (s_addr & 0x00ff0000) >> 16; |
| 310 | req->ip_address.ip_address[3] = (s_addr & 0xff000000) >> 24; |
| 311 | req->tcp_port = ntohs(daddr_in->sin_port); |
| 312 | beiscsi_ep->dst_addr = daddr_in->sin_addr.s_addr; |
| 313 | beiscsi_ep->dst_tcpport = ntohs(daddr_in->sin_port); |
| 314 | beiscsi_ep->ip_type = BE2_IPV4; |
| 315 | } else if (dst_addr->sa_family == PF_INET6) { |
| 316 | req->ip_address.ip_type = BE2_IPV6; |
| 317 | memcpy(&req->ip_address.ip_address, |
| 318 | &daddr_in6->sin6_addr.in6_u.u6_addr8, 16); |
| 319 | req->tcp_port = ntohs(daddr_in6->sin6_port); |
| 320 | beiscsi_ep->dst_tcpport = ntohs(daddr_in6->sin6_port); |
| 321 | memcpy(&beiscsi_ep->dst6_addr, |
| 322 | &daddr_in6->sin6_addr.in6_u.u6_addr8, 16); |
| 323 | beiscsi_ep->ip_type = BE2_IPV6; |
| 324 | } else{ |
| 325 | shost_printk(KERN_ERR, phba->shost, "unknown addr family %d\n", |
| 326 | dst_addr->sa_family); |
| 327 | spin_unlock(&ctrl->mbox_lock); |
| 328 | return -EINVAL; |
| 329 | |
| 330 | } |
| 331 | req->cid = cid; |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 332 | i = phba->nxt_cqid++; |
| 333 | if (phba->nxt_cqid == phba->num_cpus) |
| 334 | phba->nxt_cqid = 0; |
| 335 | req->cq_id = phwi_context->be_cq[i].id; |
| 336 | SE_DEBUG(DBG_LVL_8, "i=%d cq_id=%d \n", i, req->cq_id); |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 337 | req->defq_id = def_hdr_id; |
| 338 | req->hdr_ring_id = def_hdr_id; |
| 339 | req->data_ring_id = def_data_id; |
| 340 | req->do_offload = 1; |
| 341 | req->dataout_template_pa.lo = ptemplate_address->lo; |
| 342 | req->dataout_template_pa.hi = ptemplate_address->hi; |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 343 | be_mcc_notify(phba); |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 344 | spin_unlock(&ctrl->mbox_lock); |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 345 | return tag; |
Jayamohan Kallickal | 6733b39 | 2009-09-05 07:36:35 +0530 | [diff] [blame] | 346 | } |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 347 | |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 348 | unsigned int be_cmd_get_mac_addr(struct beiscsi_hba *phba) |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 349 | { |
| 350 | struct be_ctrl_info *ctrl = &phba->ctrl; |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 351 | struct be_mcc_wrb *wrb; |
| 352 | struct be_cmd_req_get_mac_addr *req; |
| 353 | unsigned int tag = 0; |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 354 | |
| 355 | SE_DEBUG(DBG_LVL_8, "In be_cmd_get_mac_addr\n"); |
| 356 | spin_lock(&ctrl->mbox_lock); |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 357 | tag = alloc_mcc_tag(phba); |
| 358 | if (!tag) { |
| 359 | spin_unlock(&ctrl->mbox_lock); |
| 360 | return tag; |
| 361 | } |
| 362 | |
| 363 | wrb = wrb_from_mccq(phba); |
| 364 | req = embedded_payload(wrb); |
| 365 | wrb->tag0 |= tag; |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 366 | be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); |
| 367 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI, |
| 368 | OPCODE_COMMON_ISCSI_NTWK_GET_NIC_CONFIG, |
| 369 | sizeof(*req)); |
| 370 | |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 371 | be_mcc_notify(phba); |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 372 | spin_unlock(&ctrl->mbox_lock); |
Jayamohan Kallickal | 756d29c | 2010-01-05 05:10:46 +0530 | [diff] [blame^] | 373 | return tag; |
Jayamohan Kallickal | bfead3b | 2009-10-23 11:52:33 +0530 | [diff] [blame] | 374 | } |
| 375 | |