Lines Matching defs:vha
20 qla2x00_vp_stop_timer(scsi_qla_host_t *vha)
22 if (vha->vp_idx && vha->timer_active) {
23 del_timer_sync(&vha->timer);
24 vha->timer_active = 0;
29 qla24xx_allocate_vp_id(scsi_qla_host_t *vha)
32 struct qla_hw_data *ha = vha->hw;
39 ql_dbg(ql_dbg_vport, vha, 0xa000,
48 vha->vp_idx = vp_id;
51 list_add_tail(&vha->list, &ha->vp_list);
55 qlt_update_vp_map(vha, SET_VP_IDX);
63 qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)
66 struct qla_hw_data *ha = vha->hw;
79 if (wait_event_timeout(vha->vref_waitq,
80 !atomic_read(&vha->vref_count), HZ) > 0)
85 if (atomic_read(&vha->vref_count)) {
86 ql_dbg(ql_dbg_vport, vha, 0xfffa,
87 "vha->vref_count=%u timeout\n", vha->vref_count.counter);
88 vha->vref_count = (atomic_t)ATOMIC_INIT(0);
90 list_del(&vha->list);
91 qlt_update_vp_map(vha, RESET_VP_IDX);
94 vp_id = vha->vp_idx;
104 scsi_qla_host_t *vha;
110 list_for_each_entry_safe(vha, tvha, &ha->vp_list, list) {
111 if (!memcmp(port_name, vha->port_name, WWN_SIZE)) {
113 return vha;
134 qla2x00_mark_vp_devices_dead(scsi_qla_host_t *vha)
144 list_for_each_entry(fcport, &vha->vp_fcports, list) {
145 ql_dbg(ql_dbg_vport, vha, 0xa001,
147 fcport->loop_id, fcport->vha->vp_idx);
149 qla2x00_mark_device_lost(vha, fcport, 0);
155 qla24xx_disable_vp(scsi_qla_host_t *vha)
161 if (vha->hw->flags.fw_started)
162 ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL);
164 atomic_set(&vha->loop_state, LOOP_DOWN);
165 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
166 list_for_each_entry(fcport, &vha->vp_fcports, list)
169 qla2x00_mark_all_devices_lost(vha);
172 spin_lock_irqsave(&vha->hw->hardware_lock, flags);
173 qlt_update_vp_map(vha, RESET_AL_PA);
174 spin_unlock_irqrestore(&vha->hw->hardware_lock, flags);
176 qla2x00_mark_vp_devices_dead(vha);
177 atomic_set(&vha->vp_state, VP_FAILED);
178 vha->flags.management_server_logged_in = 0;
180 fc_vport_set_state(vha->fc_vport, FC_VPORT_DISABLED);
182 fc_vport_set_state(vha->fc_vport, FC_VPORT_FAILED);
189 qla24xx_enable_vp(scsi_qla_host_t *vha)
192 struct qla_hw_data *ha = vha->hw;
199 vha->vp_err_state = VP_ERR_PORTDWN;
200 fc_vport_set_state(vha->fc_vport, FC_VPORT_LINKDOWN);
201 ql_dbg(ql_dbg_taskm, vha, 0x800b,
211 ret = qla24xx_modify_vp_config(vha);
215 fc_vport_set_state(vha->fc_vport, FC_VPORT_FAILED);
219 ql_dbg(ql_dbg_taskm, vha, 0x801a,
220 "Virtual port with id: %d - Enabled.\n", vha->vp_idx);
224 ql_dbg(ql_dbg_taskm, vha, 0x801b,
225 "Virtual port with id: %d - Disabled.\n", vha->vp_idx);
230 qla24xx_configure_vp(scsi_qla_host_t *vha)
235 fc_vport = vha->fc_vport;
237 ql_dbg(ql_dbg_vport, vha, 0xa002,
239 ret = qla2x00_send_change_request(vha, 0x3, vha->vp_idx);
241 ql_dbg(ql_dbg_vport, vha, 0xa003, "Failed to enable "
246 clear_bit(VP_SCR_NEEDED, &vha->vp_flags);
249 vha->flags.online = 1;
250 if (qla24xx_configure_vhba(vha))
253 atomic_set(&vha->vp_state, VP_ACTIVE);
260 scsi_qla_host_t *vha;
266 list_for_each_entry(vha, &ha->vp_list, list) {
267 if (vha->vp_idx) {
268 if (test_bit(VPORT_DELETE, &vha->dpc_flags))
271 atomic_inc(&vha->vref_count);
281 ql_dbg(ql_dbg_async, vha, 0x5024,
282 "Async_event for VP[%d], mb=0x%x vha=%p.\n",
283 i, *mb, vha);
284 qla2x00_async_event(vha, rsp, mb);
288 if ((mb[3] & 0xff) == vha->vp_idx) {
289 ql_dbg(ql_dbg_async, vha, 0x5024,
290 "Async_event for VP[%d], mb=0x%x vha=%p\n",
291 i, *mb, vha);
292 qla2x00_async_event(vha, rsp, mb);
298 atomic_dec(&vha->vref_count);
299 wake_up(&vha->vref_waitq);
307 qla2x00_vp_abort_isp(scsi_qla_host_t *vha)
317 if (!test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) {
318 qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL);
319 list_for_each_entry(fcport, &vha->vp_fcports, list)
327 if (atomic_read(&vha->loop_state) != LOOP_DOWN) {
328 atomic_set(&vha->loop_state, LOOP_DOWN);
329 qla2x00_mark_all_devices_lost(vha);
331 if (!atomic_read(&vha->loop_down_timer))
332 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
335 ql_dbg(ql_dbg_taskm, vha, 0x801d,
336 "Scheduling enable of Vport %d.\n", vha->vp_idx);
338 return qla24xx_enable_vp(vha);
342 qla2x00_do_dpc_vp(scsi_qla_host_t *vha)
344 struct qla_hw_data *ha = vha->hw;
347 ql_dbg(ql_dbg_dpc + ql_dbg_verbose, vha, 0x4012,
348 "Entering %s vp_flags: 0x%lx.\n", __func__, vha->vp_flags);
352 if (test_and_clear_bit(VP_IDX_ACQUIRED, &vha->vp_flags)) {
354 ql_dbg(ql_dbg_dpc, vha, 0x4014,
356 qla24xx_configure_vp(vha);
357 ql_dbg(ql_dbg_dpc, vha, 0x4015,
363 if (test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags)) {
364 if (atomic_read(&vha->loop_state) == LOOP_READY) {
365 qla24xx_process_purex_list(&vha->purex_list);
366 clear_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags);
370 if (test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags)) {
371 ql_dbg(ql_dbg_dpc, vha, 0x4016,
373 qla2x00_update_fcports(vha);
374 clear_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags);
375 ql_dbg(ql_dbg_dpc, vha, 0x4017,
379 if (test_bit(RELOGIN_NEEDED, &vha->dpc_flags) &&
380 !test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) &&
381 atomic_read(&vha->loop_state) != LOOP_DOWN) {
383 if (!vha->relogin_jif ||
384 time_after_eq(jiffies, vha->relogin_jif)) {
385 vha->relogin_jif = jiffies + HZ;
386 clear_bit(RELOGIN_NEEDED, &vha->dpc_flags);
388 ql_dbg(ql_dbg_dpc, vha, 0x4018,
390 qla24xx_post_relogin_work(vha);
394 if (test_and_clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags) &&
395 (!(test_and_set_bit(RESET_ACTIVE, &vha->dpc_flags)))) {
396 clear_bit(RESET_ACTIVE, &vha->dpc_flags);
399 if (test_and_clear_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) {
400 if (!(test_and_set_bit(LOOP_RESYNC_ACTIVE, &vha->dpc_flags))) {
401 ql_dbg(ql_dbg_dpc, vha, 0x401a,
403 qla2x00_loop_resync(vha);
404 clear_bit(LOOP_RESYNC_ACTIVE, &vha->dpc_flags);
405 ql_dbg(ql_dbg_dpc, vha, 0x401b,
410 ql_dbg(ql_dbg_dpc + ql_dbg_verbose, vha, 0x401c,
416 qla2x00_do_dpc_all_vps(scsi_qla_host_t *vha)
418 struct qla_hw_data *ha = vha->hw;
422 if (vha->vp_idx)
427 clear_bit(VP_DPC_NEEDED, &vha->dpc_flags);
452 scsi_qla_host_t *vha;
470 vha = qla24xx_find_vhost_by_name(ha, port_name);
471 if (vha)
476 ql_dbg(ql_dbg_vport, vha, 0xa004,
490 scsi_qla_host_t *vha;
494 vha = qla2x00_create_host(sht, ha);
495 if (!vha) {
496 ql_log(ql_log_warn, vha, 0xa005,
501 host = vha->host;
502 fc_vport->dd_data = vha;
504 u64_to_wwn(fc_vport->node_name, vha->node_name);
505 u64_to_wwn(fc_vport->port_name, vha->port_name);
507 vha->fc_vport = fc_vport;
508 vha->device_flags = 0;
509 vha->vp_idx = qla24xx_allocate_vp_id(vha);
510 if (vha->vp_idx > ha->max_npiv_vports) {
511 ql_dbg(ql_dbg_vport, vha, 0xa006,
515 vha->mgmt_svr_loop_id = qla2x00_reserve_mgmt_server_loop_id(vha);
517 vha->dpc_flags = 0L;
519 set_bit(REGISTER_FDMI_NEEDED, &vha->dpc_flags);
520 set_bit(REGISTER_FC4_NEEDED, &vha->dpc_flags);
526 set_bit(VP_SCR_NEEDED, &vha->vp_flags);
527 atomic_set(&vha->loop_state, LOOP_DOWN);
528 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
530 qla2x00_start_timer(vha, WATCH_INTERVAL);
532 vha->req = base_vha->req;
533 vha->flags.nvme_enabled = base_vha->flags.nvme_enabled;
546 ql_dbg(ql_dbg_vport, vha, 0xa007,
548 vha->host_no, vha);
550 vha->flags.init_done = 1;
553 set_bit(vha->vp_idx, ha->vp_idx_map);
557 return vha;
564 qla25xx_free_req_que(struct scsi_qla_host *vha, struct req_que *req)
566 struct qla_hw_data *ha = vha->hw;
585 qla25xx_free_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
587 struct qla_hw_data *ha = vha->hw;
611 qla25xx_delete_req_que(struct scsi_qla_host *vha, struct req_que *req)
615 if (req && vha->flags.qpairs_req_created) {
617 ret = qla25xx_init_req_que(vha, req);
621 qla25xx_free_req_que(vha, req);
628 qla25xx_delete_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
632 if (rsp && vha->flags.qpairs_rsp_created) {
634 ret = qla25xx_init_rsp_que(vha, rsp);
638 qla25xx_free_rsp_que(vha, rsp);
646 qla25xx_delete_queues(struct scsi_qla_host *vha)
651 struct qla_hw_data *ha = vha->hw;
655 list_for_each_entry_safe(qpair, tqpair, &vha->qp_list,
657 qla2xxx_delete_qpair(vha, qpair);
663 ret = qla25xx_delete_req_que(vha, req);
665 ql_log(ql_log_warn, vha, 0x00ea,
677 ret = qla25xx_delete_rsp_que(vha, rsp);
679 ql_log(ql_log_warn, vha, 0x00eb,
698 struct scsi_qla_host *vha = pci_get_drvdata(ha->pdev);
795 vha->flags.qpairs_req_created = 1;
810 struct scsi_qla_host *vha = qpair->vha;
813 qla24xx_process_response_queue(vha, qpair->rsp);
826 struct scsi_qla_host *vha = pci_get_drvdata(ha->pdev);
911 vha->flags.qpairs_rsp_created = 1;
935 * @vha: adapter block pointer
940 int qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)
943 struct qla_hw_data *ha = vha->hw;
944 int vp_index = vha->vp_idx;
949 ql_dbg(ql_dbg_vport, vha, 0x10c1,
964 qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
970 ql_dbg(ql_dbg_async, vha, 0xffff,
976 ql_dbg(ql_dbg_vport, vha, 0x113f, "%s hndl %x submitted\n",
985 ql_dbg(ql_dbg_vport, vha, 0xffff, "%s: %s Timeout. %x.\n",
989 ql_dbg(ql_dbg_vport, vha, 0xffff, "%s: %s done.\n",
993 ql_dbg(ql_dbg_vport, vha, 0xffff, "%s: %s Failed. %x.\n",