diff options
author | Len Brown <len.brown@intel.com> | 2010-08-15 01:06:31 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-08-15 01:06:31 -0400 |
commit | 95ee46aa8698f2000647dfb362400fadbb5807cf (patch) | |
tree | e5a05c7297f997e191c73091934e42e3195c0e40 /drivers/scsi/be2iscsi/be_mgmt.c | |
parent | cfa806f059801dbe7e435745eb2e187c8bfe1e7f (diff) | |
parent | 92fa5bd9a946b6e7aab6764e7312e4e3d9bed295 (diff) |
Merge branch 'linus' into release
Conflicts:
drivers/acpi/debug.c
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/scsi/be2iscsi/be_mgmt.c')
-rw-r--r-- | drivers/scsi/be2iscsi/be_mgmt.c | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c index 350cbeaae160..3f3fab91a7d1 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.c +++ b/drivers/scsi/be2iscsi/be_mgmt.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "be_mgmt.h" | 21 | #include "be_mgmt.h" |
22 | #include "be_iscsi.h" | 22 | #include "be_iscsi.h" |
23 | 23 | ||
24 | unsigned char mgmt_get_fw_config(struct be_ctrl_info *ctrl, | 24 | int mgmt_get_fw_config(struct be_ctrl_info *ctrl, |
25 | struct beiscsi_hba *phba) | 25 | struct beiscsi_hba *phba) |
26 | { | 26 | { |
27 | struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); | 27 | struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); |
@@ -50,7 +50,7 @@ unsigned char mgmt_get_fw_config(struct be_ctrl_info *ctrl, | |||
50 | pfw_cfg->ulp[0].sq_count; | 50 | pfw_cfg->ulp[0].sq_count; |
51 | if (phba->fw_config.iscsi_cid_count > (BE2_MAX_SESSIONS / 2)) { | 51 | if (phba->fw_config.iscsi_cid_count > (BE2_MAX_SESSIONS / 2)) { |
52 | SE_DEBUG(DBG_LVL_8, | 52 | SE_DEBUG(DBG_LVL_8, |
53 | "FW reported MAX CXNS as %d \t" | 53 | "FW reported MAX CXNS as %d\t" |
54 | "Max Supported = %d.\n", | 54 | "Max Supported = %d.\n", |
55 | phba->fw_config.iscsi_cid_count, | 55 | phba->fw_config.iscsi_cid_count, |
56 | BE2_MAX_SESSIONS); | 56 | BE2_MAX_SESSIONS); |
@@ -58,14 +58,14 @@ unsigned char mgmt_get_fw_config(struct be_ctrl_info *ctrl, | |||
58 | } | 58 | } |
59 | } else { | 59 | } else { |
60 | shost_printk(KERN_WARNING, phba->shost, | 60 | shost_printk(KERN_WARNING, phba->shost, |
61 | "Failed in mgmt_get_fw_config \n"); | 61 | "Failed in mgmt_get_fw_config\n"); |
62 | } | 62 | } |
63 | 63 | ||
64 | spin_unlock(&ctrl->mbox_lock); | 64 | spin_unlock(&ctrl->mbox_lock); |
65 | return status; | 65 | return status; |
66 | } | 66 | } |
67 | 67 | ||
68 | unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl, | 68 | int mgmt_check_supported_fw(struct be_ctrl_info *ctrl, |
69 | struct beiscsi_hba *phba) | 69 | struct beiscsi_hba *phba) |
70 | { | 70 | { |
71 | struct be_dma_mem nonemb_cmd; | 71 | struct be_dma_mem nonemb_cmd; |
@@ -81,7 +81,7 @@ unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl, | |||
81 | SE_DEBUG(DBG_LVL_1, | 81 | SE_DEBUG(DBG_LVL_1, |
82 | "Failed to allocate memory for mgmt_check_supported_fw" | 82 | "Failed to allocate memory for mgmt_check_supported_fw" |
83 | "\n"); | 83 | "\n"); |
84 | return -1; | 84 | return -ENOMEM; |
85 | } | 85 | } |
86 | nonemb_cmd.size = sizeof(struct be_mgmt_controller_attributes); | 86 | nonemb_cmd.size = sizeof(struct be_mgmt_controller_attributes); |
87 | req = nonemb_cmd.va; | 87 | req = nonemb_cmd.va; |
@@ -117,8 +117,7 @@ unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl, | |||
117 | return status; | 117 | return status; |
118 | } | 118 | } |
119 | 119 | ||
120 | 120 | int mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute) | |
121 | unsigned char mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute) | ||
122 | { | 121 | { |
123 | struct be_ctrl_info *ctrl = &phba->ctrl; | 122 | struct be_ctrl_info *ctrl = &phba->ctrl; |
124 | struct be_mcc_wrb *wrb = wrb_from_mccq(phba); | 123 | struct be_mcc_wrb *wrb = wrb_from_mccq(phba); |
@@ -144,11 +143,12 @@ unsigned char mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute) | |||
144 | return status; | 143 | return status; |
145 | } | 144 | } |
146 | 145 | ||
147 | unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba, | 146 | unsigned int mgmt_invalidate_icds(struct beiscsi_hba *phba, |
148 | struct invalidate_command_table *inv_tbl, | 147 | struct invalidate_command_table *inv_tbl, |
149 | unsigned int num_invalidate, unsigned int cid) | 148 | unsigned int num_invalidate, unsigned int cid, |
149 | struct be_dma_mem *nonemb_cmd) | ||
150 | |||
150 | { | 151 | { |
151 | struct be_dma_mem nonemb_cmd; | ||
152 | struct be_ctrl_info *ctrl = &phba->ctrl; | 152 | struct be_ctrl_info *ctrl = &phba->ctrl; |
153 | struct be_mcc_wrb *wrb; | 153 | struct be_mcc_wrb *wrb; |
154 | struct be_sge *sge; | 154 | struct be_sge *sge; |
@@ -162,17 +162,7 @@ unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba, | |||
162 | return tag; | 162 | return tag; |
163 | } | 163 | } |
164 | 164 | ||
165 | nonemb_cmd.va = pci_alloc_consistent(ctrl->pdev, | 165 | req = nonemb_cmd->va; |
166 | sizeof(struct invalidate_commands_params_in), | ||
167 | &nonemb_cmd.dma); | ||
168 | if (nonemb_cmd.va == NULL) { | ||
169 | SE_DEBUG(DBG_LVL_1, | ||
170 | "Failed to allocate memory for mgmt_invalidate_icds\n"); | ||
171 | spin_unlock(&ctrl->mbox_lock); | ||
172 | return 0; | ||
173 | } | ||
174 | nonemb_cmd.size = sizeof(struct invalidate_commands_params_in); | ||
175 | req = nonemb_cmd.va; | ||
176 | memset(req, 0, sizeof(*req)); | 166 | memset(req, 0, sizeof(*req)); |
177 | wrb = wrb_from_mccq(phba); | 167 | wrb = wrb_from_mccq(phba); |
178 | sge = nonembedded_sgl(wrb); | 168 | sge = nonembedded_sgl(wrb); |
@@ -190,19 +180,16 @@ unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba, | |||
190 | req->icd_count++; | 180 | req->icd_count++; |
191 | inv_tbl++; | 181 | inv_tbl++; |
192 | } | 182 | } |
193 | sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd.dma)); | 183 | sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma)); |
194 | sge->pa_lo = cpu_to_le32(nonemb_cmd.dma & 0xFFFFFFFF); | 184 | sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF); |
195 | sge->len = cpu_to_le32(nonemb_cmd.size); | 185 | sge->len = cpu_to_le32(nonemb_cmd->size); |
196 | 186 | ||
197 | be_mcc_notify(phba); | 187 | be_mcc_notify(phba); |
198 | spin_unlock(&ctrl->mbox_lock); | 188 | spin_unlock(&ctrl->mbox_lock); |
199 | if (nonemb_cmd.va) | ||
200 | pci_free_consistent(ctrl->pdev, nonemb_cmd.size, | ||
201 | nonemb_cmd.va, nonemb_cmd.dma); | ||
202 | return tag; | 189 | return tag; |
203 | } | 190 | } |
204 | 191 | ||
205 | unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba, | 192 | unsigned int mgmt_invalidate_connection(struct beiscsi_hba *phba, |
206 | struct beiscsi_endpoint *beiscsi_ep, | 193 | struct beiscsi_endpoint *beiscsi_ep, |
207 | unsigned short cid, | 194 | unsigned short cid, |
208 | unsigned short issue_reset, | 195 | unsigned short issue_reset, |
@@ -239,7 +226,7 @@ unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba, | |||
239 | return tag; | 226 | return tag; |
240 | } | 227 | } |
241 | 228 | ||
242 | unsigned char mgmt_upload_connection(struct beiscsi_hba *phba, | 229 | unsigned int mgmt_upload_connection(struct beiscsi_hba *phba, |
243 | unsigned short cid, unsigned int upload_flag) | 230 | unsigned short cid, unsigned int upload_flag) |
244 | { | 231 | { |
245 | struct be_ctrl_info *ctrl = &phba->ctrl; | 232 | struct be_ctrl_info *ctrl = &phba->ctrl; |
@@ -269,7 +256,9 @@ unsigned char mgmt_upload_connection(struct beiscsi_hba *phba, | |||
269 | 256 | ||
270 | int mgmt_open_connection(struct beiscsi_hba *phba, | 257 | int mgmt_open_connection(struct beiscsi_hba *phba, |
271 | struct sockaddr *dst_addr, | 258 | struct sockaddr *dst_addr, |
272 | struct beiscsi_endpoint *beiscsi_ep) | 259 | struct beiscsi_endpoint *beiscsi_ep, |
260 | struct be_dma_mem *nonemb_cmd) | ||
261 | |||
273 | { | 262 | { |
274 | struct hwi_controller *phwi_ctrlr; | 263 | struct hwi_controller *phwi_ctrlr; |
275 | struct hwi_context_memory *phwi_context; | 264 | struct hwi_context_memory *phwi_context; |
@@ -285,6 +274,7 @@ int mgmt_open_connection(struct beiscsi_hba *phba, | |||
285 | unsigned int tag = 0; | 274 | unsigned int tag = 0; |
286 | unsigned int i; | 275 | unsigned int i; |
287 | unsigned short cid = beiscsi_ep->ep_cid; | 276 | unsigned short cid = beiscsi_ep->ep_cid; |
277 | struct be_sge *sge; | ||
288 | 278 | ||
289 | phwi_ctrlr = phba->phwi_ctrlr; | 279 | phwi_ctrlr = phba->phwi_ctrlr; |
290 | phwi_context = phwi_ctrlr->phwi_ctxt; | 280 | phwi_context = phwi_ctrlr->phwi_ctxt; |
@@ -300,10 +290,14 @@ int mgmt_open_connection(struct beiscsi_hba *phba, | |||
300 | return tag; | 290 | return tag; |
301 | } | 291 | } |
302 | wrb = wrb_from_mccq(phba); | 292 | wrb = wrb_from_mccq(phba); |
303 | req = embedded_payload(wrb); | 293 | memset(wrb, 0, sizeof(*wrb)); |
294 | sge = nonembedded_sgl(wrb); | ||
295 | |||
296 | req = nonemb_cmd->va; | ||
297 | memset(req, 0, sizeof(*req)); | ||
304 | wrb->tag0 |= tag; | 298 | wrb->tag0 |= tag; |
305 | 299 | ||
306 | be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); | 300 | be_wrb_hdr_prepare(wrb, sizeof(*req), true, 1); |
307 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI, | 301 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI, |
308 | OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD, | 302 | OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD, |
309 | sizeof(*req)); | 303 | sizeof(*req)); |
@@ -331,6 +325,7 @@ int mgmt_open_connection(struct beiscsi_hba *phba, | |||
331 | shost_printk(KERN_ERR, phba->shost, "unknown addr family %d\n", | 325 | shost_printk(KERN_ERR, phba->shost, "unknown addr family %d\n", |
332 | dst_addr->sa_family); | 326 | dst_addr->sa_family); |
333 | spin_unlock(&ctrl->mbox_lock); | 327 | spin_unlock(&ctrl->mbox_lock); |
328 | free_mcc_tag(&phba->ctrl, tag); | ||
334 | return -EINVAL; | 329 | return -EINVAL; |
335 | 330 | ||
336 | } | 331 | } |
@@ -339,13 +334,16 @@ int mgmt_open_connection(struct beiscsi_hba *phba, | |||
339 | if (phba->nxt_cqid == phba->num_cpus) | 334 | if (phba->nxt_cqid == phba->num_cpus) |
340 | phba->nxt_cqid = 0; | 335 | phba->nxt_cqid = 0; |
341 | req->cq_id = phwi_context->be_cq[i].id; | 336 | req->cq_id = phwi_context->be_cq[i].id; |
342 | SE_DEBUG(DBG_LVL_8, "i=%d cq_id=%d \n", i, req->cq_id); | 337 | SE_DEBUG(DBG_LVL_8, "i=%d cq_id=%d\n", i, req->cq_id); |
343 | req->defq_id = def_hdr_id; | 338 | req->defq_id = def_hdr_id; |
344 | req->hdr_ring_id = def_hdr_id; | 339 | req->hdr_ring_id = def_hdr_id; |
345 | req->data_ring_id = def_data_id; | 340 | req->data_ring_id = def_data_id; |
346 | req->do_offload = 1; | 341 | req->do_offload = 1; |
347 | req->dataout_template_pa.lo = ptemplate_address->lo; | 342 | req->dataout_template_pa.lo = ptemplate_address->lo; |
348 | req->dataout_template_pa.hi = ptemplate_address->hi; | 343 | req->dataout_template_pa.hi = ptemplate_address->hi; |
344 | sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma)); | ||
345 | sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF); | ||
346 | sge->len = cpu_to_le32(nonemb_cmd->size); | ||
349 | be_mcc_notify(phba); | 347 | be_mcc_notify(phba); |
350 | spin_unlock(&ctrl->mbox_lock); | 348 | spin_unlock(&ctrl->mbox_lock); |
351 | return tag; | 349 | return tag; |