diff options
Diffstat (limited to 'drivers/scsi/qla4xxx/ql4_mbx.c')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_mbx.c | 284 |
1 files changed, 191 insertions, 93 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index 09d6d4b76f39..43581ce3a1b6 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c | |||
@@ -172,108 +172,207 @@ mbox_exit: | |||
172 | return status; | 172 | return status; |
173 | } | 173 | } |
174 | 174 | ||
175 | uint8_t | ||
176 | qla4xxx_set_ifcb(struct scsi_qla_host *ha, uint32_t *mbox_cmd, | ||
177 | uint32_t *mbox_sts, dma_addr_t init_fw_cb_dma) | ||
178 | { | ||
179 | memset(mbox_cmd, 0, sizeof(mbox_cmd[0]) * MBOX_REG_COUNT); | ||
180 | memset(mbox_sts, 0, sizeof(mbox_sts[0]) * MBOX_REG_COUNT); | ||
181 | mbox_cmd[0] = MBOX_CMD_INITIALIZE_FIRMWARE; | ||
182 | mbox_cmd[1] = 0; | ||
183 | mbox_cmd[2] = LSDW(init_fw_cb_dma); | ||
184 | mbox_cmd[3] = MSDW(init_fw_cb_dma); | ||
185 | mbox_cmd[4] = sizeof(struct addr_ctrl_blk); | ||
186 | mbox_cmd[5] = (IFCB_VER_MAX << 8) | IFCB_VER_MIN; | ||
187 | |||
188 | if (qla4xxx_mailbox_command(ha, 6, 6, mbox_cmd, mbox_sts) != | ||
189 | QLA_SUCCESS) { | ||
190 | DEBUG2(printk(KERN_WARNING "scsi%ld: %s: " | ||
191 | "MBOX_CMD_INITIALIZE_FIRMWARE" | ||
192 | " failed w/ status %04X\n", | ||
193 | ha->host_no, __func__, mbox_sts[0])); | ||
194 | return QLA_ERROR; | ||
195 | } | ||
196 | return QLA_SUCCESS; | ||
197 | } | ||
198 | |||
199 | uint8_t | ||
200 | qla4xxx_get_ifcb(struct scsi_qla_host *ha, uint32_t *mbox_cmd, | ||
201 | uint32_t *mbox_sts, dma_addr_t init_fw_cb_dma) | ||
202 | { | ||
203 | memset(mbox_cmd, 0, sizeof(mbox_cmd[0]) * MBOX_REG_COUNT); | ||
204 | memset(mbox_sts, 0, sizeof(mbox_sts[0]) * MBOX_REG_COUNT); | ||
205 | mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK; | ||
206 | mbox_cmd[2] = LSDW(init_fw_cb_dma); | ||
207 | mbox_cmd[3] = MSDW(init_fw_cb_dma); | ||
208 | mbox_cmd[4] = sizeof(struct addr_ctrl_blk); | ||
209 | |||
210 | if (qla4xxx_mailbox_command(ha, 5, 5, mbox_cmd, mbox_sts) != | ||
211 | QLA_SUCCESS) { | ||
212 | DEBUG2(printk(KERN_WARNING "scsi%ld: %s: " | ||
213 | "MBOX_CMD_GET_INIT_FW_CTRL_BLOCK" | ||
214 | " failed w/ status %04X\n", | ||
215 | ha->host_no, __func__, mbox_sts[0])); | ||
216 | return QLA_ERROR; | ||
217 | } | ||
218 | return QLA_SUCCESS; | ||
219 | } | ||
220 | |||
221 | void | ||
222 | qla4xxx_update_local_ip(struct scsi_qla_host *ha, | ||
223 | struct addr_ctrl_blk *init_fw_cb) | ||
224 | { | ||
225 | /* Save IPv4 Address Info */ | ||
226 | memcpy(ha->ip_address, init_fw_cb->ipv4_addr, | ||
227 | min(sizeof(ha->ip_address), sizeof(init_fw_cb->ipv4_addr))); | ||
228 | memcpy(ha->subnet_mask, init_fw_cb->ipv4_subnet, | ||
229 | min(sizeof(ha->subnet_mask), sizeof(init_fw_cb->ipv4_subnet))); | ||
230 | memcpy(ha->gateway, init_fw_cb->ipv4_gw_addr, | ||
231 | min(sizeof(ha->gateway), sizeof(init_fw_cb->ipv4_gw_addr))); | ||
232 | |||
233 | if (is_ipv6_enabled(ha)) { | ||
234 | /* Save IPv6 Address */ | ||
235 | ha->ipv6_link_local_state = init_fw_cb->ipv6_lnk_lcl_addr_state; | ||
236 | ha->ipv6_addr0_state = init_fw_cb->ipv6_addr0_state; | ||
237 | ha->ipv6_addr1_state = init_fw_cb->ipv6_addr1_state; | ||
238 | ha->ipv6_default_router_state = init_fw_cb->ipv6_dflt_rtr_state; | ||
239 | ha->ipv6_link_local_addr.in6_u.u6_addr8[0] = 0xFE; | ||
240 | ha->ipv6_link_local_addr.in6_u.u6_addr8[1] = 0x80; | ||
241 | |||
242 | memcpy(&ha->ipv6_link_local_addr.in6_u.u6_addr8[8], | ||
243 | init_fw_cb->ipv6_if_id, | ||
244 | min(sizeof(ha->ipv6_link_local_addr)/2, | ||
245 | sizeof(init_fw_cb->ipv6_if_id))); | ||
246 | memcpy(&ha->ipv6_addr0, init_fw_cb->ipv6_addr0, | ||
247 | min(sizeof(ha->ipv6_addr0), | ||
248 | sizeof(init_fw_cb->ipv6_addr0))); | ||
249 | memcpy(&ha->ipv6_addr1, init_fw_cb->ipv6_addr1, | ||
250 | min(sizeof(ha->ipv6_addr1), | ||
251 | sizeof(init_fw_cb->ipv6_addr1))); | ||
252 | memcpy(&ha->ipv6_default_router_addr, | ||
253 | init_fw_cb->ipv6_dflt_rtr_addr, | ||
254 | min(sizeof(ha->ipv6_default_router_addr), | ||
255 | sizeof(init_fw_cb->ipv6_dflt_rtr_addr))); | ||
256 | } | ||
257 | } | ||
258 | |||
259 | uint8_t | ||
260 | qla4xxx_update_local_ifcb(struct scsi_qla_host *ha, | ||
261 | uint32_t *mbox_cmd, | ||
262 | uint32_t *mbox_sts, | ||
263 | struct addr_ctrl_blk *init_fw_cb, | ||
264 | dma_addr_t init_fw_cb_dma) | ||
265 | { | ||
266 | if (qla4xxx_get_ifcb(ha, mbox_cmd, mbox_sts, init_fw_cb_dma) | ||
267 | != QLA_SUCCESS) { | ||
268 | DEBUG2(printk(KERN_WARNING | ||
269 | "scsi%ld: %s: Failed to get init_fw_ctrl_blk\n", | ||
270 | ha->host_no, __func__)); | ||
271 | return QLA_ERROR; | ||
272 | } | ||
273 | |||
274 | DEBUG2(qla4xxx_dump_buffer(init_fw_cb, sizeof(struct addr_ctrl_blk))); | ||
275 | |||
276 | /* Save some info in adapter structure. */ | ||
277 | ha->acb_version = init_fw_cb->acb_version; | ||
278 | ha->firmware_options = le16_to_cpu(init_fw_cb->fw_options); | ||
279 | ha->tcp_options = le16_to_cpu(init_fw_cb->ipv4_tcp_opts); | ||
280 | ha->ipv4_options = le16_to_cpu(init_fw_cb->ipv4_ip_opts); | ||
281 | ha->ipv4_addr_state = le16_to_cpu(init_fw_cb->ipv4_addr_state); | ||
282 | ha->heartbeat_interval = init_fw_cb->hb_interval; | ||
283 | memcpy(ha->name_string, init_fw_cb->iscsi_name, | ||
284 | min(sizeof(ha->name_string), | ||
285 | sizeof(init_fw_cb->iscsi_name))); | ||
286 | /*memcpy(ha->alias, init_fw_cb->Alias, | ||
287 | min(sizeof(ha->alias), sizeof(init_fw_cb->Alias)));*/ | ||
288 | |||
289 | /* Save Command Line Paramater info */ | ||
290 | ha->port_down_retry_count = le16_to_cpu(init_fw_cb->conn_ka_timeout); | ||
291 | ha->discovery_wait = ql4xdiscoverywait; | ||
292 | |||
293 | if (ha->acb_version == ACB_SUPPORTED) { | ||
294 | ha->ipv6_options = init_fw_cb->ipv6_opts; | ||
295 | ha->ipv6_addl_options = init_fw_cb->ipv6_addtl_opts; | ||
296 | } | ||
297 | qla4xxx_update_local_ip(ha, init_fw_cb); | ||
298 | |||
299 | return QLA_SUCCESS; | ||
300 | } | ||
301 | |||
175 | /** | 302 | /** |
176 | * qla4xxx_initialize_fw_cb - initializes firmware control block. | 303 | * qla4xxx_initialize_fw_cb - initializes firmware control block. |
177 | * @ha: Pointer to host adapter structure. | 304 | * @ha: Pointer to host adapter structure. |
178 | **/ | 305 | **/ |
179 | int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha) | 306 | int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha) |
180 | { | 307 | { |
181 | struct init_fw_ctrl_blk *init_fw_cb; | 308 | struct addr_ctrl_blk *init_fw_cb; |
182 | dma_addr_t init_fw_cb_dma; | 309 | dma_addr_t init_fw_cb_dma; |
183 | uint32_t mbox_cmd[MBOX_REG_COUNT]; | 310 | uint32_t mbox_cmd[MBOX_REG_COUNT]; |
184 | uint32_t mbox_sts[MBOX_REG_COUNT]; | 311 | uint32_t mbox_sts[MBOX_REG_COUNT]; |
185 | int status = QLA_ERROR; | 312 | int status = QLA_ERROR; |
186 | 313 | ||
187 | init_fw_cb = dma_alloc_coherent(&ha->pdev->dev, | 314 | init_fw_cb = dma_alloc_coherent(&ha->pdev->dev, |
188 | sizeof(struct init_fw_ctrl_blk), | 315 | sizeof(struct addr_ctrl_blk), |
189 | &init_fw_cb_dma, GFP_KERNEL); | 316 | &init_fw_cb_dma, GFP_KERNEL); |
190 | if (init_fw_cb == NULL) { | 317 | if (init_fw_cb == NULL) { |
191 | DEBUG2(printk("scsi%ld: %s: Unable to alloc init_cb\n", | 318 | DEBUG2(printk("scsi%ld: %s: Unable to alloc init_cb\n", |
192 | ha->host_no, __func__)); | 319 | ha->host_no, __func__)); |
193 | return 10; | 320 | return 10; |
194 | } | 321 | } |
195 | memset(init_fw_cb, 0, sizeof(struct init_fw_ctrl_blk)); | 322 | memset(init_fw_cb, 0, sizeof(struct addr_ctrl_blk)); |
196 | 323 | ||
197 | /* Get Initialize Firmware Control Block. */ | 324 | /* Get Initialize Firmware Control Block. */ |
198 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | 325 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); |
199 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | 326 | memset(&mbox_sts, 0, sizeof(mbox_sts)); |
200 | 327 | ||
201 | mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK; | 328 | if (qla4xxx_get_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma) != |
202 | mbox_cmd[2] = LSDW(init_fw_cb_dma); | ||
203 | mbox_cmd[3] = MSDW(init_fw_cb_dma); | ||
204 | mbox_cmd[4] = sizeof(struct init_fw_ctrl_blk); | ||
205 | |||
206 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0], &mbox_sts[0]) != | ||
207 | QLA_SUCCESS) { | 329 | QLA_SUCCESS) { |
208 | dma_free_coherent(&ha->pdev->dev, | 330 | dma_free_coherent(&ha->pdev->dev, |
209 | sizeof(struct init_fw_ctrl_blk), | 331 | sizeof(struct addr_ctrl_blk), |
210 | init_fw_cb, init_fw_cb_dma); | 332 | init_fw_cb, init_fw_cb_dma); |
211 | return status; | 333 | goto exit_init_fw_cb; |
212 | } | 334 | } |
213 | 335 | ||
214 | /* Initialize request and response queues. */ | 336 | /* Initialize request and response queues. */ |
215 | qla4xxx_init_rings(ha); | 337 | qla4xxx_init_rings(ha); |
216 | 338 | ||
217 | /* Fill in the request and response queue information. */ | 339 | /* Fill in the request and response queue information. */ |
218 | init_fw_cb->pri.rqq_consumer_idx = cpu_to_le16(ha->request_out); | 340 | init_fw_cb->rqq_consumer_idx = cpu_to_le16(ha->request_out); |
219 | init_fw_cb->pri.compq_producer_idx = cpu_to_le16(ha->response_in); | 341 | init_fw_cb->compq_producer_idx = cpu_to_le16(ha->response_in); |
220 | init_fw_cb->pri.rqq_len = __constant_cpu_to_le16(REQUEST_QUEUE_DEPTH); | 342 | init_fw_cb->rqq_len = __constant_cpu_to_le16(REQUEST_QUEUE_DEPTH); |
221 | init_fw_cb->pri.compq_len = __constant_cpu_to_le16(RESPONSE_QUEUE_DEPTH); | 343 | init_fw_cb->compq_len = __constant_cpu_to_le16(RESPONSE_QUEUE_DEPTH); |
222 | init_fw_cb->pri.rqq_addr_lo = cpu_to_le32(LSDW(ha->request_dma)); | 344 | init_fw_cb->rqq_addr_lo = cpu_to_le32(LSDW(ha->request_dma)); |
223 | init_fw_cb->pri.rqq_addr_hi = cpu_to_le32(MSDW(ha->request_dma)); | 345 | init_fw_cb->rqq_addr_hi = cpu_to_le32(MSDW(ha->request_dma)); |
224 | init_fw_cb->pri.compq_addr_lo = cpu_to_le32(LSDW(ha->response_dma)); | 346 | init_fw_cb->compq_addr_lo = cpu_to_le32(LSDW(ha->response_dma)); |
225 | init_fw_cb->pri.compq_addr_hi = cpu_to_le32(MSDW(ha->response_dma)); | 347 | init_fw_cb->compq_addr_hi = cpu_to_le32(MSDW(ha->response_dma)); |
226 | init_fw_cb->pri.shdwreg_addr_lo = | 348 | init_fw_cb->shdwreg_addr_lo = cpu_to_le32(LSDW(ha->shadow_regs_dma)); |
227 | cpu_to_le32(LSDW(ha->shadow_regs_dma)); | 349 | init_fw_cb->shdwreg_addr_hi = cpu_to_le32(MSDW(ha->shadow_regs_dma)); |
228 | init_fw_cb->pri.shdwreg_addr_hi = | ||
229 | cpu_to_le32(MSDW(ha->shadow_regs_dma)); | ||
230 | 350 | ||
231 | /* Set up required options. */ | 351 | /* Set up required options. */ |
232 | init_fw_cb->pri.fw_options |= | 352 | init_fw_cb->fw_options |= |
233 | __constant_cpu_to_le16(FWOPT_SESSION_MODE | | 353 | __constant_cpu_to_le16(FWOPT_SESSION_MODE | |
234 | FWOPT_INITIATOR_MODE); | 354 | FWOPT_INITIATOR_MODE); |
235 | init_fw_cb->pri.fw_options &= __constant_cpu_to_le16(~FWOPT_TARGET_MODE); | 355 | init_fw_cb->fw_options &= __constant_cpu_to_le16(~FWOPT_TARGET_MODE); |
236 | 356 | ||
237 | /* Save some info in adapter structure. */ | 357 | if (qla4xxx_set_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma) |
238 | ha->firmware_options = le16_to_cpu(init_fw_cb->pri.fw_options); | 358 | != QLA_SUCCESS) { |
239 | ha->tcp_options = le16_to_cpu(init_fw_cb->pri.ipv4_tcp_opts); | 359 | DEBUG2(printk(KERN_WARNING |
240 | ha->heartbeat_interval = init_fw_cb->pri.hb_interval; | 360 | "scsi%ld: %s: Failed to set init_fw_ctrl_blk\n", |
241 | memcpy(ha->ip_address, init_fw_cb->pri.ipv4_addr, | 361 | ha->host_no, __func__)); |
242 | min(sizeof(ha->ip_address), sizeof(init_fw_cb->pri.ipv4_addr))); | 362 | goto exit_init_fw_cb; |
243 | memcpy(ha->subnet_mask, init_fw_cb->pri.ipv4_subnet, | 363 | } |
244 | min(sizeof(ha->subnet_mask), sizeof(init_fw_cb->pri.ipv4_subnet))); | ||
245 | memcpy(ha->gateway, init_fw_cb->pri.ipv4_gw_addr, | ||
246 | min(sizeof(ha->gateway), sizeof(init_fw_cb->pri.ipv4_gw_addr))); | ||
247 | memcpy(ha->name_string, init_fw_cb->pri.iscsi_name, | ||
248 | min(sizeof(ha->name_string), | ||
249 | sizeof(init_fw_cb->pri.iscsi_name))); | ||
250 | /*memcpy(ha->alias, init_fw_cb->Alias, | ||
251 | min(sizeof(ha->alias), sizeof(init_fw_cb->Alias)));*/ | ||
252 | |||
253 | /* Save Command Line Paramater info */ | ||
254 | ha->port_down_retry_count = le16_to_cpu(init_fw_cb->pri.conn_ka_timeout); | ||
255 | ha->discovery_wait = ql4xdiscoverywait; | ||
256 | |||
257 | /* Send Initialize Firmware Control Block. */ | ||
258 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | ||
259 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | ||
260 | |||
261 | mbox_cmd[0] = MBOX_CMD_INITIALIZE_FIRMWARE; | ||
262 | mbox_cmd[1] = 0; | ||
263 | mbox_cmd[2] = LSDW(init_fw_cb_dma); | ||
264 | mbox_cmd[3] = MSDW(init_fw_cb_dma); | ||
265 | mbox_cmd[4] = sizeof(struct init_fw_ctrl_blk); | ||
266 | 364 | ||
267 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0], &mbox_sts[0]) == | 365 | if (qla4xxx_update_local_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], |
268 | QLA_SUCCESS) | 366 | init_fw_cb, init_fw_cb_dma) != QLA_SUCCESS) { |
269 | status = QLA_SUCCESS; | 367 | DEBUG2(printk("scsi%ld: %s: Failed to update local ifcb\n", |
270 | else { | 368 | ha->host_no, __func__)); |
271 | DEBUG2(printk("scsi%ld: %s: MBOX_CMD_INITIALIZE_FIRMWARE " | 369 | goto exit_init_fw_cb; |
272 | "failed w/ status %04X\n", ha->host_no, __func__, | ||
273 | mbox_sts[0])); | ||
274 | } | 370 | } |
275 | dma_free_coherent(&ha->pdev->dev, sizeof(struct init_fw_ctrl_blk), | 371 | status = QLA_SUCCESS; |
276 | init_fw_cb, init_fw_cb_dma); | 372 | |
373 | exit_init_fw_cb: | ||
374 | dma_free_coherent(&ha->pdev->dev, sizeof(struct addr_ctrl_blk), | ||
375 | init_fw_cb, init_fw_cb_dma); | ||
277 | 376 | ||
278 | return status; | 377 | return status; |
279 | } | 378 | } |
@@ -284,13 +383,13 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha) | |||
284 | **/ | 383 | **/ |
285 | int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host * ha) | 384 | int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host * ha) |
286 | { | 385 | { |
287 | struct init_fw_ctrl_blk *init_fw_cb; | 386 | struct addr_ctrl_blk *init_fw_cb; |
288 | dma_addr_t init_fw_cb_dma; | 387 | dma_addr_t init_fw_cb_dma; |
289 | uint32_t mbox_cmd[MBOX_REG_COUNT]; | 388 | uint32_t mbox_cmd[MBOX_REG_COUNT]; |
290 | uint32_t mbox_sts[MBOX_REG_COUNT]; | 389 | uint32_t mbox_sts[MBOX_REG_COUNT]; |
291 | 390 | ||
292 | init_fw_cb = dma_alloc_coherent(&ha->pdev->dev, | 391 | init_fw_cb = dma_alloc_coherent(&ha->pdev->dev, |
293 | sizeof(struct init_fw_ctrl_blk), | 392 | sizeof(struct addr_ctrl_blk), |
294 | &init_fw_cb_dma, GFP_KERNEL); | 393 | &init_fw_cb_dma, GFP_KERNEL); |
295 | if (init_fw_cb == NULL) { | 394 | if (init_fw_cb == NULL) { |
296 | printk("scsi%ld: %s: Unable to alloc init_cb\n", ha->host_no, | 395 | printk("scsi%ld: %s: Unable to alloc init_cb\n", ha->host_no, |
@@ -299,35 +398,21 @@ int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host * ha) | |||
299 | } | 398 | } |
300 | 399 | ||
301 | /* Get Initialize Firmware Control Block. */ | 400 | /* Get Initialize Firmware Control Block. */ |
302 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | 401 | memset(init_fw_cb, 0, sizeof(struct addr_ctrl_blk)); |
303 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | 402 | if (qla4xxx_get_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma) != |
304 | |||
305 | memset(init_fw_cb, 0, sizeof(struct init_fw_ctrl_blk)); | ||
306 | mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK; | ||
307 | mbox_cmd[2] = LSDW(init_fw_cb_dma); | ||
308 | mbox_cmd[3] = MSDW(init_fw_cb_dma); | ||
309 | mbox_cmd[4] = sizeof(struct init_fw_ctrl_blk); | ||
310 | |||
311 | if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0], &mbox_sts[0]) != | ||
312 | QLA_SUCCESS) { | 403 | QLA_SUCCESS) { |
313 | DEBUG2(printk("scsi%ld: %s: Failed to get init_fw_ctrl_blk\n", | 404 | DEBUG2(printk("scsi%ld: %s: Failed to get init_fw_ctrl_blk\n", |
314 | ha->host_no, __func__)); | 405 | ha->host_no, __func__)); |
315 | dma_free_coherent(&ha->pdev->dev, | 406 | dma_free_coherent(&ha->pdev->dev, |
316 | sizeof(struct init_fw_ctrl_blk), | 407 | sizeof(struct addr_ctrl_blk), |
317 | init_fw_cb, init_fw_cb_dma); | 408 | init_fw_cb, init_fw_cb_dma); |
318 | return QLA_ERROR; | 409 | return QLA_ERROR; |
319 | } | 410 | } |
320 | 411 | ||
321 | /* Save IP Address. */ | 412 | /* Save IP Address. */ |
322 | memcpy(ha->ip_address, init_fw_cb->pri.ipv4_addr, | 413 | qla4xxx_update_local_ip(ha, init_fw_cb); |
323 | min(sizeof(ha->ip_address), sizeof(init_fw_cb->pri.ipv4_addr))); | 414 | dma_free_coherent(&ha->pdev->dev, sizeof(struct addr_ctrl_blk), |
324 | memcpy(ha->subnet_mask, init_fw_cb->pri.ipv4_subnet, | 415 | init_fw_cb, init_fw_cb_dma); |
325 | min(sizeof(ha->subnet_mask), sizeof(init_fw_cb->pri.ipv4_subnet))); | ||
326 | memcpy(ha->gateway, init_fw_cb->pri.ipv4_gw_addr, | ||
327 | min(sizeof(ha->gateway), sizeof(init_fw_cb->pri.ipv4_gw_addr))); | ||
328 | |||
329 | dma_free_coherent(&ha->pdev->dev, sizeof(struct init_fw_ctrl_blk), | ||
330 | init_fw_cb, init_fw_cb_dma); | ||
331 | 416 | ||
332 | return QLA_SUCCESS; | 417 | return QLA_SUCCESS; |
333 | } | 418 | } |
@@ -409,6 +494,7 @@ int qla4xxx_get_fwddb_entry(struct scsi_qla_host *ha, | |||
409 | uint16_t *connection_id) | 494 | uint16_t *connection_id) |
410 | { | 495 | { |
411 | int status = QLA_ERROR; | 496 | int status = QLA_ERROR; |
497 | uint16_t options; | ||
412 | uint32_t mbox_cmd[MBOX_REG_COUNT]; | 498 | uint32_t mbox_cmd[MBOX_REG_COUNT]; |
413 | uint32_t mbox_sts[MBOX_REG_COUNT]; | 499 | uint32_t mbox_sts[MBOX_REG_COUNT]; |
414 | 500 | ||
@@ -441,14 +527,26 @@ int qla4xxx_get_fwddb_entry(struct scsi_qla_host *ha, | |||
441 | goto exit_get_fwddb; | 527 | goto exit_get_fwddb; |
442 | } | 528 | } |
443 | if (fw_ddb_entry) { | 529 | if (fw_ddb_entry) { |
444 | dev_info(&ha->pdev->dev, "DDB[%d] MB0 %04x Tot %d Next %d " | 530 | options = le16_to_cpu(fw_ddb_entry->options); |
445 | "State %04x ConnErr %08x %d.%d.%d.%d:%04d \"%s\"\n", | 531 | if (options & DDB_OPT_IPV6_DEVICE) { |
446 | fw_ddb_index, mbox_sts[0], mbox_sts[2], mbox_sts[3], | 532 | dev_info(&ha->pdev->dev, "%s: DDB[%d] MB0 %04x Tot %d " |
447 | mbox_sts[4], mbox_sts[5], fw_ddb_entry->ip_addr[0], | 533 | "Next %d State %04x ConnErr %08x %pI6 " |
448 | fw_ddb_entry->ip_addr[1], fw_ddb_entry->ip_addr[2], | 534 | ":%04d \"%s\"\n", __func__, fw_ddb_index, |
449 | fw_ddb_entry->ip_addr[3], | 535 | mbox_sts[0], mbox_sts[2], mbox_sts[3], |
450 | le16_to_cpu(fw_ddb_entry->port), | 536 | mbox_sts[4], mbox_sts[5], |
451 | fw_ddb_entry->iscsi_name); | 537 | fw_ddb_entry->ip_addr, |
538 | le16_to_cpu(fw_ddb_entry->port), | ||
539 | fw_ddb_entry->iscsi_name); | ||
540 | } else { | ||
541 | dev_info(&ha->pdev->dev, "%s: DDB[%d] MB0 %04x Tot %d " | ||
542 | "Next %d State %04x ConnErr %08x %pI4 " | ||
543 | ":%04d \"%s\"\n", __func__, fw_ddb_index, | ||
544 | mbox_sts[0], mbox_sts[2], mbox_sts[3], | ||
545 | mbox_sts[4], mbox_sts[5], | ||
546 | fw_ddb_entry->ip_addr, | ||
547 | le16_to_cpu(fw_ddb_entry->port), | ||
548 | fw_ddb_entry->iscsi_name); | ||
549 | } | ||
452 | } | 550 | } |
453 | if (num_valid_ddb_entries) | 551 | if (num_valid_ddb_entries) |
454 | *num_valid_ddb_entries = mbox_sts[2]; | 552 | *num_valid_ddb_entries = mbox_sts[2]; |