Lines Matching +full:segment +full:- +full:no +full:- +full:remap
1 // SPDX-License-Identifier: GPL-2.0-only
49 if (cmd == e->cmd) in sc_to_str()
50 return e->str; in sc_to_str()
60 spin_lock_irqsave(&vha->e_dbell.db_lock, flags); in qla_edb_getnext()
62 /* db nodes are fifo - no qualifications done */ in qla_edb_getnext()
63 if (!list_empty(&vha->e_dbell.head)) { in qla_edb_getnext()
64 edbnode = list_first_entry(&vha->e_dbell.head, in qla_edb_getnext()
66 list_del_init(&edbnode->list); in qla_edb_getnext()
69 spin_unlock_irqrestore(&vha->e_dbell.db_lock, flags); in qla_edb_getnext()
76 list_del_init(&node->list); in qla_edb_node_free()
85 struct list_head *indx_list = &fcport->edif.edif_indx_list; in qla_edif_list_find_sa_index()
88 if (entry->handle == handle) in qla_edif_list_find_sa_index()
94 /* timeout called when no traffic and delayed rx sa_index delete */
98 fc_port_t *fcport = edif_entry->fcport; in qla2x00_sa_replace_iocb_timeout()
99 struct scsi_qla_host *vha = fcport->vha; in qla2x00_sa_replace_iocb_timeout()
106 __func__, edif_entry->handle, fcport->port_name, fcport->d_id.b24); in qla2x00_sa_replace_iocb_timeout()
109 * if delete_sa_index is valid then no one has serviced this in qla2x00_sa_replace_iocb_timeout()
112 spin_lock_irqsave(&fcport->edif.indx_list_lock, flags); in qla2x00_sa_replace_iocb_timeout()
117 * still looking for the new sa_index because there is no I/O and we in qla2x00_sa_replace_iocb_timeout()
121 if (edif_entry->delete_sa_index != INVALID_EDIF_SA_INDEX) { in qla2x00_sa_replace_iocb_timeout()
122 uint16_t delete_sa_index = edif_entry->delete_sa_index; in qla2x00_sa_replace_iocb_timeout()
124 edif_entry->delete_sa_index = INVALID_EDIF_SA_INDEX; in qla2x00_sa_replace_iocb_timeout()
125 nport_handle = edif_entry->handle; in qla2x00_sa_replace_iocb_timeout()
126 spin_unlock_irqrestore(&fcport->edif.indx_list_lock, flags); in qla2x00_sa_replace_iocb_timeout()
134 __func__, sa_ctl, delete_sa_index, edif_entry->update_sa_index, in qla2x00_sa_replace_iocb_timeout()
137 sa_ctl->flags = EDIF_SA_CTL_FLG_DEL; in qla2x00_sa_replace_iocb_timeout()
138 set_bit(EDIF_SA_CTL_REPL, &sa_ctl->state); in qla2x00_sa_replace_iocb_timeout()
139 qla_post_sa_replace_work(fcport->vha, fcport, in qla2x00_sa_replace_iocb_timeout()
145 __func__, edif_entry->delete_sa_index); in qla2x00_sa_replace_iocb_timeout()
148 spin_unlock_irqrestore(&fcport->edif.indx_list_lock, flags); in qla2x00_sa_replace_iocb_timeout()
154 * add an sa_update index to the list - called for sa_update
165 entry->update_sa_index = sa_index; in qla_edif_list_add_sa_update_index()
166 entry->count = 0; in qla_edif_list_add_sa_update_index()
171 * This is the normal path - there should be no existing entry in qla_edif_list_add_sa_update_index()
178 return -ENOMEM; in qla_edif_list_add_sa_update_index()
180 INIT_LIST_HEAD(&entry->next); in qla_edif_list_add_sa_update_index()
181 entry->handle = handle; in qla_edif_list_add_sa_update_index()
182 entry->update_sa_index = sa_index; in qla_edif_list_add_sa_update_index()
183 entry->delete_sa_index = INVALID_EDIF_SA_INDEX; in qla_edif_list_add_sa_update_index()
184 entry->count = 0; in qla_edif_list_add_sa_update_index()
185 entry->flags = 0; in qla_edif_list_add_sa_update_index()
186 timer_setup(&entry->timer, qla2x00_sa_replace_iocb_timeout, 0); in qla_edif_list_add_sa_update_index()
187 spin_lock_irqsave(&fcport->edif.indx_list_lock, flags); in qla_edif_list_add_sa_update_index()
188 list_add_tail(&entry->next, &fcport->edif.edif_indx_list); in qla_edif_list_add_sa_update_index()
189 spin_unlock_irqrestore(&fcport->edif.indx_list_lock, flags); in qla_edif_list_add_sa_update_index()
198 spin_lock_irqsave(&fcport->edif.indx_list_lock, flags); in qla_edif_list_delete_sa_index()
199 list_del(&entry->next); in qla_edif_list_delete_sa_index()
200 spin_unlock_irqrestore(&fcport->edif.indx_list_lock, flags); in qla_edif_list_delete_sa_index()
212 e->u.sa_update.fcport = fcport; in qla_post_sa_replace_work()
213 e->u.sa_update.sa_ctl = sa_ctl; in qla_post_sa_replace_work()
214 e->u.sa_update.nport_handle = nport_handle; in qla_post_sa_replace_work()
215 fcport->flags |= FCF_ASYNC_ACTIVE; in qla_post_sa_replace_work()
223 "Init SA_CTL List for fcport - nn %8phN pn %8phN portid=%06x.\n", in qla_edif_sa_ctl_init()
224 fcport->node_name, fcport->port_name, fcport->d_id.b24); in qla_edif_sa_ctl_init()
226 fcport->edif.tx_rekey_cnt = 0; in qla_edif_sa_ctl_init()
227 fcport->edif.rx_rekey_cnt = 0; in qla_edif_sa_ctl_init()
229 fcport->edif.tx_bytes = 0; in qla_edif_sa_ctl_init()
230 fcport->edif.rx_bytes = 0; in qla_edif_sa_ctl_init()
237 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla_bsg_check()
239 (struct qla_bsg_auth_els_request *)bsg_job->request; in qla_bsg_check()
241 if (!vha->hw->flags.edif_enabled) { in qla_bsg_check()
252 p = &req->e; in qla_bsg_check()
255 if (p->sub_cmd == PULL_ELS) { in qla_bsg_check()
257 (struct qla_bsg_auth_els_reply *)bsg_job->reply; in qla_bsg_check()
263 __func__, sc_to_str(p->sub_cmd), fcport->port_name, in qla_bsg_check()
264 fcport->d_id.b24, rpl->rx_xchg_address, in qla_bsg_check()
265 rpl->r.reply_payload_rcv_len, bsg_job); in qla_bsg_check()
273 bsg_job_done(bsg_job, bsg_reply->result, in qla_bsg_check()
274 bsg_reply->reply_payload_rcv_len); in qla_bsg_check()
275 return -EIO; in qla_bsg_check()
284 list_for_each_entry_safe(f, tf, &vha->vp_fcports, list) { in qla2x00_find_fcport_by_pid()
285 if (f->d_id.b24 == id->b24) in qla2x00_find_fcport_by_pid()
323 spin_lock_irqsave(&fcport->edif.sa_list_lock, flags); in qla_edif_free_sa_ctl()
324 list_del(&sa_ctl->next); in qla_edif_free_sa_ctl()
325 spin_unlock_irqrestore(&fcport->edif.sa_list_lock, flags); in qla_edif_free_sa_ctl()
327 fcport->edif.tx_rekey_cnt--; in qla_edif_free_sa_ctl()
329 fcport->edif.rx_rekey_cnt--; in qla_edif_free_sa_ctl()
338 struct scsi_qla_host *vha = fcport->vha; in qla_edif_add_sa_index_to_freepool()
339 struct qla_hw_data *ha = vha->hw; in qla_edif_add_sa_index_to_freepool()
347 sa_id_map = ha->edif_tx_sa_id_map; in qla_edif_add_sa_index_to_freepool()
348 lsa_index -= EDIF_TX_SA_INDEX_BASE; in qla_edif_add_sa_index_to_freepool()
350 sa_id_map = ha->edif_rx_sa_id_map; in qla_edif_add_sa_index_to_freepool()
353 spin_lock_irqsave(&ha->sadb_fp_lock, flags); in qla_edif_add_sa_index_to_freepool()
355 spin_unlock_irqrestore(&ha->sadb_fp_lock, flags); in qla_edif_add_sa_index_to_freepool()
370 if (entry->sa_pair[i].sa_index == INVALID_EDIF_SA_INDEX) in __qla2x00_release_all_sadb()
373 if (fcport->loop_id != entry->handle) { in __qla2x00_release_all_sadb()
376 __func__, i, entry->handle, fcport->loop_id, in __qla2x00_release_all_sadb()
377 entry->sa_pair[i].sa_index); in __qla2x00_release_all_sadb()
382 entry->sa_pair[i].sa_index, pdir); in __qla2x00_release_all_sadb()
384 qla_edif_find_sa_ctl_by_index(fcport, sa_ctl->index, pdir)) { in __qla2x00_release_all_sadb()
386 "%s: freeing sa_ctl for index %d\n", __func__, sa_ctl->index); in __qla2x00_release_all_sadb()
387 qla_edif_free_sa_ctl(fcport, sa_ctl, sa_ctl->index); in __qla2x00_release_all_sadb()
396 __func__, entry->sa_pair[i].sa_index, entry->handle); in __qla2x00_release_all_sadb()
398 dir = (entry->sa_pair[i].sa_index < in __qla2x00_release_all_sadb()
401 entry->sa_pair[i].sa_index); in __qla2x00_release_all_sadb()
406 qla_edif_list_find_sa_index(fcport, entry->handle); in __qla2x00_release_all_sadb()
410 __func__, edif_entry, edif_entry->update_sa_index, in __qla2x00_release_all_sadb()
411 edif_entry->delete_sa_index); in __qla2x00_release_all_sadb()
417 if (edif_entry->delete_sa_index != in __qla2x00_release_all_sadb()
419 timer_shutdown(&edif_entry->timer); in __qla2x00_release_all_sadb()
422 fcport->edif.rx_sa_set = 1; in __qla2x00_release_all_sadb()
423 fcport->edif.rx_sa_pending = 0; in __qla2x00_release_all_sadb()
431 __func__, edif_entry, edif_entry->update_sa_index, in __qla2x00_release_all_sadb()
432 edif_entry->delete_sa_index); in __qla2x00_release_all_sadb()
448 struct qla_hw_data *ha = vha->hw; in qla2x00_release_all_sadb()
454 spin_lock_irqsave(&ha->sadb_lock, flags); in qla2x00_release_all_sadb()
456 list_for_each_entry_safe(entry, tmp, &ha->sadb_rx_index_list, next) { in qla2x00_release_all_sadb()
457 if (entry->fcport == fcport) { in qla2x00_release_all_sadb()
458 list_del(&entry->next); in qla2x00_release_all_sadb()
459 spin_unlock_irqrestore(&ha->sadb_lock, flags); in qla2x00_release_all_sadb()
462 spin_lock_irqsave(&ha->sadb_lock, flags); in qla2x00_release_all_sadb()
467 list_for_each_entry_safe(entry, tmp, &ha->sadb_tx_index_list, next) { in qla2x00_release_all_sadb()
468 if (entry->fcport == fcport) { in qla2x00_release_all_sadb()
469 list_del(&entry->next); in qla2x00_release_all_sadb()
470 spin_unlock_irqrestore(&ha->sadb_lock, flags); in qla2x00_release_all_sadb()
475 spin_lock_irqsave(&ha->sadb_lock, flags); in qla2x00_release_all_sadb()
479 spin_unlock_irqrestore(&ha->sadb_lock, flags); in qla2x00_release_all_sadb()
487 * return code: 0 - found the session and completed the tear down.
488 * 1 - timeout occurred. Caller to use link bounce to reset.
493 int rc = -EIO; in qla_delete_n2n_sess_and_wait()
496 if (!N2N_TOPO(vha->hw)) in qla_delete_n2n_sess_and_wait()
500 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla_delete_n2n_sess_and_wait()
501 if (!fcport->n2n_flag) in qla_delete_n2n_sess_and_wait()
504 ql_dbg(ql_dbg_disc, fcport->vha, 0x2016, in qla_delete_n2n_sess_and_wait()
511 if (fcport->disc_state != DSC_DELETE_PEND) { in qla_delete_n2n_sess_and_wait()
518 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla_delete_n2n_sess_and_wait()
530 * Set/activate doorbell. Reset current sessions and re-login with
537 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla_edif_app_start()
543 … "EDIF application registration with driver, FC device connections will be re-established.\n"); in qla_edif_app_start()
545 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla_edif_app_start()
546 bsg_job->request_payload.sg_cnt, &appstart, in qla_edif_app_start()
554 vha->e_dbell.db_flags |= EDB_ACTIVE; in qla_edif_app_start()
559 if (N2N_TOPO(vha->hw)) { in qla_edif_app_start()
560 list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) in qla_edif_app_start()
561 fcport->n2n_link_reset_cnt = 0; in qla_edif_app_start()
563 if (vha->hw->flags.n2n_fw_acc_sec) { in qla_edif_app_start()
568 * reset the session, reconnect and re-authenticate. in qla_edif_app_start()
574 if (!vha->hw->flags.n2n_bigger || link_bounce) { in qla_edif_app_start()
575 set_bit(N2N_LINK_RESET, &vha->dpc_flags); in qla_edif_app_start()
580 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); in qla_edif_app_start()
585 list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) { in qla_edif_app_start()
587 "FCSP - nn %8phN pn %8phN portid=%06x.\n", in qla_edif_app_start()
588 fcport->node_name, fcport->port_name, in qla_edif_app_start()
589 fcport->d_id.b24); in qla_edif_app_start()
595 __func__, fcport->se_sess, fcport, in qla_edif_app_start()
596 fcport->port_name, fcport->loop_id, in qla_edif_app_start()
597 fcport->d_id.b24, fcport->logout_on_delete, in qla_edif_app_start()
598 fcport->keep_nport_handle, fcport->send_els_logo, in qla_edif_app_start()
599 fcport->disc_state, fcport->edif.auth_state, in qla_edif_app_start()
600 fcport->edif.app_stop); in qla_edif_app_start()
602 if (atomic_read(&vha->loop_state) == LOOP_DOWN) in qla_edif_app_start()
605 fcport->login_retry = vha->hw->login_retry_count; in qla_edif_app_start()
607 fcport->edif.app_stop = 0; in qla_edif_app_start()
608 fcport->edif.app_sess_online = 0; in qla_edif_app_start()
610 if (fcport->scan_state != QLA_FCPORT_FOUND) in qla_edif_app_start()
613 if (fcport->port_type == FCT_UNKNOWN && in qla_edif_app_start()
614 !fcport->fc4_features) in qla_edif_app_start()
617 if (!rval && !(fcport->fc4_features & FC4_FF_TARGET || in qla_edif_app_start()
618 fcport->port_type & (FCT_TARGET|FCT_NVME_TARGET))) in qla_edif_app_start()
625 __func__, fcport->port_name); in qla_edif_app_start()
629 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla_edif_app_start()
632 if (vha->pur_cinfo.enode_flags != ENODE_ACTIVE) { in qla_edif_app_start()
634 vha->pur_cinfo.enode_flags = ENODE_ACTIVE; in qla_edif_app_start()
641 appreply.host_support_edif = vha->hw->flags.edif_enabled; in qla_edif_app_start()
642 appreply.edif_enode_active = vha->pur_cinfo.enode_flags; in qla_edif_app_start()
643 appreply.edif_edb_active = vha->e_dbell.db_flags; in qla_edif_app_start()
646 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla_edif_app_start()
648 SET_DID_STATUS(bsg_reply->result, DID_OK); in qla_edif_app_start()
650 bsg_reply->reply_payload_rcv_len = sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla_edif_app_start()
651 bsg_job->reply_payload.sg_cnt, in qla_edif_app_start()
663 * qla_edif_app_stop - app has announced it's exiting.
674 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla_edif_app_stop()
677 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla_edif_app_stop()
678 bsg_job->request_payload.sg_cnt, &appstop, in qla_edif_app_stop()
690 list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) { in qla_edif_app_stop()
691 if (!(fcport->flags & FCF_FCSP_DEVICE)) in qla_edif_app_stop()
694 if (fcport->flags & FCF_FCSP_DEVICE) { in qla_edif_app_stop()
698 fcport->port_name, fcport->loop_id, fcport->d_id.b24, in qla_edif_app_stop()
699 fcport->logout_on_delete, fcport->keep_nport_handle, in qla_edif_app_stop()
700 fcport->send_els_logo); in qla_edif_app_stop()
702 if (atomic_read(&vha->loop_state) == LOOP_DOWN) in qla_edif_app_stop()
705 fcport->edif.app_stop = 1; in qla_edif_app_stop()
708 __func__, fcport->port_name); in qla_edif_app_stop()
710 fcport->send_els_logo = 1; in qla_edif_app_stop()
715 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla_edif_app_stop()
716 SET_DID_STATUS(bsg_reply->result, DID_OK); in qla_edif_app_stop()
718 /* no return interface to app - it assumes we cleaned up ok */ in qla_edif_app_stop()
729 if (!(fcport->edif.rx_sa_set && fcport->edif.tx_sa_set)) { in qla_edif_app_chk_sa_update()
732 __func__, fcport->port_name, fcport->edif.tx_sa_set, in qla_edif_app_chk_sa_update()
733 fcport->edif.rx_sa_set); in qla_edif_app_chk_sa_update()
734 appplogireply->prli_status = 0; in qla_edif_app_chk_sa_update()
739 fcport->port_name); in qla_edif_app_chk_sa_update()
740 fcport->edif.rx_sa_set = fcport->edif.tx_sa_set = 0; in qla_edif_app_chk_sa_update()
741 fcport->edif.rx_sa_pending = fcport->edif.tx_sa_pending = 0; in qla_edif_app_chk_sa_update()
742 appplogireply->prli_status = 1; in qla_edif_app_chk_sa_update()
748 * qla_edif_app_authok - authentication by app succeeded. Driver can proceed
758 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla_edif_app_authok()
762 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla_edif_app_authok()
763 bsg_job->request_payload.sg_cnt, &appplogiok, in qla_edif_app_authok()
796 SET_DID_STATUS(bsg_reply->result, DID_ERROR); in qla_edif_app_authok()
804 if (atomic_read(&fcport->state) == FCS_ONLINE) { in qla_edif_app_authok()
808 SET_DID_STATUS(bsg_reply->result, DID_OK); in qla_edif_app_authok()
814 if (fcport->disc_state != DSC_LOGIN_AUTH_PEND) { in qla_edif_app_authok()
817 __func__, fcport->port_name, fcport->disc_state); in qla_edif_app_authok()
818 SET_DID_STATUS(bsg_reply->result, DID_OK); in qla_edif_app_authok()
823 SET_DID_STATUS(bsg_reply->result, DID_OK); in qla_edif_app_authok()
825 fcport->edif.authok = 1; in qla_edif_app_authok()
826 if (!(fcport->edif.rx_sa_set && fcport->edif.tx_sa_set)) { in qla_edif_app_authok()
829 __func__, fcport->port_name, fcport->edif.tx_sa_set, in qla_edif_app_authok()
830 fcport->edif.rx_sa_set); in qla_edif_app_authok()
831 SET_DID_STATUS(bsg_reply->result, DID_OK); in qla_edif_app_authok()
838 fcport->port_name); in qla_edif_app_authok()
839 fcport->edif.rx_sa_set = fcport->edif.tx_sa_set = 0; in qla_edif_app_authok()
840 fcport->edif.rx_sa_pending = fcport->edif.tx_sa_pending = 0; in qla_edif_app_authok()
845 "%s AUTH complete - RESUME with prli for wwpn %8phC\n", in qla_edif_app_authok()
846 __func__, fcport->port_name); in qla_edif_app_authok()
851 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla_edif_app_authok()
852 bsg_reply->reply_payload_rcv_len = sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla_edif_app_authok()
853 bsg_job->reply_payload.sg_cnt, in qla_edif_app_authok()
861 * qla_edif_app_authfail - authentication by app has failed. Driver is given
871 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla_edif_app_authfail()
877 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla_edif_app_authfail()
878 bsg_job->request_payload.sg_cnt, &appplogifail, in qla_edif_app_authfail()
894 SET_DID_STATUS(bsg_reply->result, DID_OK); in qla_edif_app_authfail()
902 SET_DID_STATUS(bsg_reply->result, DID_OK); in qla_edif_app_authfail()
908 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla_edif_app_authfail()
909 SET_DID_STATUS(bsg_reply->result, DID_ERROR); in qla_edif_app_authfail()
910 rval = -1; in qla_edif_app_authfail()
920 "%s reset the auth process - %8phC, loopid=%x portid=%06x.\n", in qla_edif_app_authfail()
921 __func__, fcport->port_name, fcport->loop_id, fcport->d_id.b24); in qla_edif_app_authfail()
923 if (qla_ini_mode_enabled(fcport->vha)) { in qla_edif_app_authfail()
924 fcport->send_els_logo = 1; in qla_edif_app_authfail()
933 * qla_edif_app_getfcinfo - app would like to read session info (wwpn, nportid,
944 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla_edif_app_getfcinfo()
951 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla_edif_app_getfcinfo()
952 bsg_job->request_payload.sg_cnt, &app_req, in qla_edif_app_getfcinfo()
959 SET_DID_STATUS(bsg_reply->result, DID_ERROR); in qla_edif_app_getfcinfo()
960 rval = -1; in qla_edif_app_getfcinfo()
964 app_reply->version = EDIF_VERSION1; in qla_edif_app_getfcinfo()
966 list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) { in qla_edif_app_getfcinfo()
967 if (!(fcport->flags & FCF_FCSP_DEVICE)) in qla_edif_app_getfcinfo()
975 "APP request entry - portid=%06x.\n", tdid.b24); in qla_edif_app_getfcinfo()
981 if (tdid.b24 != 0 && tdid.b24 != fcport->d_id.b24) in qla_edif_app_getfcinfo()
984 if (!N2N_TOPO(vha->hw)) { in qla_edif_app_getfcinfo()
985 if (fcport->scan_state != QLA_FCPORT_FOUND) in qla_edif_app_getfcinfo()
988 if (fcport->port_type == FCT_UNKNOWN && in qla_edif_app_getfcinfo()
989 !fcport->fc4_features) in qla_edif_app_getfcinfo()
994 !(fcport->fc4_features & FC4_FF_TARGET || in qla_edif_app_getfcinfo()
995 fcport->port_type & in qla_edif_app_getfcinfo()
1002 app_reply->ports[pcnt].version = EDIF_VERSION1; in qla_edif_app_getfcinfo()
1003 app_reply->ports[pcnt].remote_type = in qla_edif_app_getfcinfo()
1005 if (fcport->port_type & (FCT_NVME_TARGET | FCT_TARGET)) in qla_edif_app_getfcinfo()
1006 app_reply->ports[pcnt].remote_type |= in qla_edif_app_getfcinfo()
1008 if (fcport->port_type & (FCT_NVME_INITIATOR | FCT_INITIATOR)) in qla_edif_app_getfcinfo()
1009 app_reply->ports[pcnt].remote_type |= in qla_edif_app_getfcinfo()
1012 app_reply->ports[pcnt].remote_pid = fcport->d_id; in qla_edif_app_getfcinfo()
1015 "Found FC_SP fcport - nn %8phN pn %8phN pcnt %d portid=%06x secure %d.\n", in qla_edif_app_getfcinfo()
1016 fcport->node_name, fcport->port_name, pcnt, in qla_edif_app_getfcinfo()
1017 fcport->d_id.b24, fcport->flags & FCF_FCSP_DEVICE); in qla_edif_app_getfcinfo()
1019 switch (fcport->edif.auth_state) { in qla_edif_app_getfcinfo()
1021 if (fcport->disc_state == DSC_LOGIN_AUTH_PEND) { in qla_edif_app_getfcinfo()
1022 fcport->edif.auth_state = VND_CMD_AUTH_STATE_NEEDED; in qla_edif_app_getfcinfo()
1023 app_reply->ports[pcnt].auth_state = in qla_edif_app_getfcinfo()
1026 app_reply->ports[pcnt].auth_state = in qla_edif_app_getfcinfo()
1031 app_reply->ports[pcnt].auth_state = fcport->edif.auth_state; in qla_edif_app_getfcinfo()
1035 memcpy(app_reply->ports[pcnt].remote_wwpn, in qla_edif_app_getfcinfo()
1036 fcport->port_name, 8); in qla_edif_app_getfcinfo()
1038 app_reply->ports[pcnt].remote_state = in qla_edif_app_getfcinfo()
1039 (atomic_read(&fcport->state) == in qla_edif_app_getfcinfo()
1047 app_reply->port_count = pcnt; in qla_edif_app_getfcinfo()
1048 SET_DID_STATUS(bsg_reply->result, DID_OK); in qla_edif_app_getfcinfo()
1051 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla_edif_app_getfcinfo()
1052 bsg_reply->reply_payload_rcv_len = sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla_edif_app_getfcinfo()
1053 bsg_job->reply_payload.sg_cnt, in qla_edif_app_getfcinfo()
1063 * qla_edif_app_getstats - app would like to read various statistics info
1071 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla_edif_app_getstats()
1078 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla_edif_app_getstats()
1079 bsg_job->request_payload.sg_cnt, &app_req, in qla_edif_app_getstats()
1085 SET_DID_STATUS(bsg_reply->result, DID_ERROR); in qla_edif_app_getstats()
1086 rval = -1; in qla_edif_app_getstats()
1094 SET_DID_STATUS(bsg_reply->result, DID_ERROR); in qla_edif_app_getstats()
1095 rval = -1; in qla_edif_app_getstats()
1099 app_reply->version = EDIF_VERSION1; in qla_edif_app_getstats()
1101 list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) { in qla_edif_app_getstats()
1102 if (fcport->edif.enable) { in qla_edif_app_getstats()
1106 app_reply->elem[pcnt].rekey_count = in qla_edif_app_getstats()
1107 fcport->edif.rekey_cnt; in qla_edif_app_getstats()
1108 app_reply->elem[pcnt].tx_bytes = in qla_edif_app_getstats()
1109 fcport->edif.tx_bytes; in qla_edif_app_getstats()
1110 app_reply->elem[pcnt].rx_bytes = in qla_edif_app_getstats()
1111 fcport->edif.rx_bytes; in qla_edif_app_getstats()
1113 memcpy(app_reply->elem[pcnt].remote_wwpn, in qla_edif_app_getstats()
1114 fcport->port_name, 8); in qla_edif_app_getstats()
1119 app_reply->elem_count = pcnt; in qla_edif_app_getstats()
1120 SET_DID_STATUS(bsg_reply->result, DID_OK); in qla_edif_app_getstats()
1123 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla_edif_app_getstats()
1124 bsg_reply->reply_payload_rcv_len = in qla_edif_app_getstats()
1125 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, in qla_edif_app_getstats()
1126 bsg_job->reply_payload.sg_cnt, app_reply, in qla_edif_app_getstats()
1139 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla_edif_ack()
1141 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla_edif_ack()
1142 bsg_job->request_payload.sg_cnt, &ack, sizeof(ack)); in qla_edif_ack()
1149 SET_DID_STATUS(bsg_reply->result, DID_OK); in qla_edif_ack()
1160 fcport->edif.sess_down_acked = 1; in qla_edif_ack()
1170 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla_edif_consume_dbell()
1178 reply_payload_len = bsg_job->reply_payload.payload_len; in qla_edif_consume_dbell()
1180 while ((reply_payload_len - sg_skip) >= sizeof(struct edb_node)) { in qla_edif_consume_dbell()
1185 ap.event_code = dbnode->ntype; in qla_edif_consume_dbell()
1186 switch (dbnode->ntype) { in qla_edif_consume_dbell()
1189 ap.port_id = dbnode->u.plogi_did; in qla_edif_consume_dbell()
1193 ap.port_id = dbnode->u.els_sid; in qla_edif_consume_dbell()
1197 ap.port_id = dbnode->u.sa_aen.port_id; in qla_edif_consume_dbell()
1198 memcpy(&ap.event_data, &dbnode->u, in qla_edif_consume_dbell()
1206 __func__, dbnode->ntype, dbnode); in qla_edif_consume_dbell()
1213 sg_skip += sg_copy_buffer(bsg_job->reply_payload.sg_list, in qla_edif_consume_dbell()
1214 bsg_job->reply_payload.sg_cnt, in qla_edif_consume_dbell()
1219 __func__, dbnode->ntype, dbnode); in qla_edif_consume_dbell()
1227 SET_DID_STATUS(bsg_reply->result, DID_OK); in qla_edif_consume_dbell()
1228 bsg_reply->reply_payload_rcv_len = sg_skip; in qla_edif_consume_dbell()
1229 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla_edif_consume_dbell()
1237 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in __qla_edif_dbell_bsg_done()
1245 bsg_job_done(bsg_job, bsg_reply->result, bsg_reply->reply_payload_rcv_len); in __qla_edif_dbell_bsg_done()
1253 spin_lock_irqsave(&vha->e_dbell.db_lock, flags); in qla_edif_dbell_bsg_done()
1254 if (vha->e_dbell.dbell_bsg_job) { in qla_edif_dbell_bsg_done()
1255 prev_bsg_job = vha->e_dbell.dbell_bsg_job; in qla_edif_dbell_bsg_done()
1256 vha->e_dbell.dbell_bsg_job = NULL; in qla_edif_dbell_bsg_done()
1258 spin_unlock_irqrestore(&vha->e_dbell.db_lock, flags); in qla_edif_dbell_bsg_done()
1273 spin_lock_irqsave(&vha->e_dbell.db_lock, flags); in qla_edif_dbell_bsg()
1274 if (list_empty(&vha->e_dbell.head) && DBELL_ACTIVE(vha)) { in qla_edif_dbell_bsg()
1279 vha->e_dbell.dbell_bsg_job = bsg_job; in qla_edif_dbell_bsg()
1280 vha->e_dbell.bsg_expire = jiffies + 10 * HZ; in qla_edif_dbell_bsg()
1284 spin_unlock_irqrestore(&vha->e_dbell.db_lock, flags); in qla_edif_dbell_bsg()
1295 struct fc_bsg_request *bsg_request = bsg_job->request; in qla_edif_app_mgmt()
1296 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla_edif_app_mgmt()
1302 uint32_t vnd_sc = bsg_request->rqst_data.h_vendor.vendor_cmd[1]; in qla_edif_app_mgmt()
1312 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla_edif_app_mgmt()
1313 bsg_job->request_payload.sg_cnt, &appcheck, in qla_edif_app_mgmt()
1316 if (!vha->hw->flags.edif_enabled || in qla_edif_app_mgmt()
1317 test_bit(VPORT_DELETE, &vha->dpc_flags)) { in qla_edif_app_mgmt()
1320 __func__, bsg_job, vha->dpc_flags); in qla_edif_app_mgmt()
1322 SET_DID_STATUS(bsg_reply->result, DID_ERROR); in qla_edif_app_mgmt()
1331 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla_edif_app_mgmt()
1332 SET_DID_STATUS(bsg_reply->result, DID_ERROR); in qla_edif_app_mgmt()
1369 bsg_request->rqst_data.h_vendor.vendor_cmd[1]); in qla_edif_app_mgmt()
1379 bsg_job_done(bsg_job, bsg_reply->result, in qla_edif_app_mgmt()
1380 bsg_reply->reply_payload_rcv_len); in qla_edif_app_mgmt()
1392 int index = sa_frame->fast_sa_index; in qla_edif_add_sa_ctl()
1398 ql_dbg(ql_dbg_edif, fcport->vha, 0x9100, in qla_edif_add_sa_ctl()
1405 * in both sa_ctl->index and sa_frame->fast_sa_index; in qla_edif_add_sa_ctl()
1408 INIT_LIST_HEAD(&sa_ctl->next); in qla_edif_add_sa_ctl()
1409 sap = &sa_ctl->sa_frame; in qla_edif_add_sa_ctl()
1411 sa_ctl->index = index; in qla_edif_add_sa_ctl()
1412 sa_ctl->fcport = fcport; in qla_edif_add_sa_ctl()
1413 sa_ctl->flags = 0; in qla_edif_add_sa_ctl()
1414 sa_ctl->state = 0L; in qla_edif_add_sa_ctl()
1415 ql_dbg(ql_dbg_edif, fcport->vha, 0x9100, in qla_edif_add_sa_ctl()
1417 __func__, sa_ctl, sa_ctl->index, sa_ctl->state); in qla_edif_add_sa_ctl()
1418 spin_lock_irqsave(&fcport->edif.sa_list_lock, flags); in qla_edif_add_sa_ctl()
1420 list_add_tail(&sa_ctl->next, &fcport->edif.tx_sa_list); in qla_edif_add_sa_ctl()
1422 list_add_tail(&sa_ctl->next, &fcport->edif.rx_sa_list); in qla_edif_add_sa_ctl()
1423 spin_unlock_irqrestore(&fcport->edif.sa_list_lock, flags); in qla_edif_add_sa_ctl()
1434 spin_lock_irqsave(&fcport->edif.sa_list_lock, flags); in qla_edif_flush_sa_ctl_lists()
1436 list_for_each_entry_safe(sa_ctl, tsa_ctl, &fcport->edif.tx_sa_list, in qla_edif_flush_sa_ctl_lists()
1438 list_del(&sa_ctl->next); in qla_edif_flush_sa_ctl_lists()
1442 list_for_each_entry_safe(sa_ctl, tsa_ctl, &fcport->edif.rx_sa_list, in qla_edif_flush_sa_ctl_lists()
1444 list_del(&sa_ctl->next); in qla_edif_flush_sa_ctl_lists()
1448 spin_unlock_irqrestore(&fcport->edif.sa_list_lock, flags); in qla_edif_flush_sa_ctl_lists()
1458 sa_list = &fcport->edif.tx_sa_list; in qla_edif_find_sa_ctl_by_index()
1460 sa_list = &fcport->edif.rx_sa_list; in qla_edif_find_sa_ctl_by_index()
1463 if (test_bit(EDIF_SA_CTL_USED, &sa_ctl->state) && in qla_edif_find_sa_ctl_by_index()
1464 sa_ctl->index == index) in qla_edif_find_sa_ctl_by_index()
1479 dir = (sa_frame->flags & SAU_FLG_TX); in qla24xx_check_sadb_avail_slot()
1485 ql_dbg(ql_dbg_edif, fcport->vha, 0x3063, in qla24xx_check_sadb_avail_slot()
1486 "%s: rx delete for lid 0x%x, spi 0x%x, no entry found\n", in qla24xx_check_sadb_avail_slot()
1487 __func__, fcport->loop_id, sa_frame->spi); in qla24xx_check_sadb_avail_slot()
1490 fcport->edif.rx_sa_set = 1; in qla24xx_check_sadb_avail_slot()
1491 fcport->edif.rx_sa_pending = 0; in qla24xx_check_sadb_avail_slot()
1492 qla_edb_eventcreate(fcport->vha, in qla24xx_check_sadb_avail_slot()
1500 ql_dbg(ql_dbg_edif, fcport->vha, 0x9100, in qla24xx_check_sadb_avail_slot()
1502 __func__, sa_frame->spi, dir); in qla24xx_check_sadb_avail_slot()
1506 ql_dbg(ql_dbg_edif, fcport->vha, 0x9100, in qla24xx_check_sadb_avail_slot()
1508 __func__, sa_index, sa_frame->spi, dir, fcport->loop_id); in qla24xx_check_sadb_avail_slot()
1511 sa_frame->fast_sa_index = sa_index; in qla24xx_check_sadb_avail_slot()
1515 ql_dbg(ql_dbg_edif, fcport->vha, 0x9100, in qla24xx_check_sadb_avail_slot()
1517 __func__, sa_frame->spi, dir, sa_index); in qla24xx_check_sadb_avail_slot()
1518 return -1; in qla24xx_check_sadb_avail_slot()
1521 set_bit(EDIF_SA_CTL_USED, &sa_ctl->state); in qla24xx_check_sadb_avail_slot()
1524 fcport->edif.tx_rekey_cnt++; in qla24xx_check_sadb_avail_slot()
1526 fcport->edif.rx_rekey_cnt++; in qla24xx_check_sadb_avail_slot()
1528 ql_dbg(ql_dbg_edif, fcport->vha, 0x9100, in qla24xx_check_sadb_avail_slot()
1530 __func__, sa_ctl, sa_ctl->index, sa_ctl->state, in qla24xx_check_sadb_avail_slot()
1531 fcport->edif.tx_rekey_cnt, in qla24xx_check_sadb_avail_slot()
1532 fcport->edif.rx_rekey_cnt, fcport->loop_id); in qla24xx_check_sadb_avail_slot()
1545 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla24xx_sadb_update()
1561 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla24xx_sadb_update()
1562 bsg_job->request_payload.sg_cnt, &sa_frame, in qla24xx_sadb_update()
1566 if (!vha->flags.online) { in qla24xx_sadb_update()
1568 rval = -EIO; in qla24xx_sadb_update()
1569 SET_DID_STATUS(bsg_reply->result, DID_ERROR); in qla24xx_sadb_update()
1575 rval = -EIO; in qla24xx_sadb_update()
1576 SET_DID_STATUS(bsg_reply->result, DID_ERROR); in qla24xx_sadb_update()
1589 fcport->edif.tx_bytes = 0; in qla24xx_sadb_update()
1591 fcport->edif.rx_bytes = 0; in qla24xx_sadb_update()
1597 rval = -EINVAL; in qla24xx_sadb_update()
1598 SET_DID_STATUS(bsg_reply->result, DID_NO_CONNECT); in qla24xx_sadb_update()
1603 if (fcport->loop_id == FC_NO_LOOP_ID) { in qla24xx_sadb_update()
1606 __func__, fcport->port_name, sa_frame.spi, in qla24xx_sadb_update()
1607 fcport->disc_state); in qla24xx_sadb_update()
1608 rval = -EINVAL; in qla24xx_sadb_update()
1609 SET_DID_STATUS(bsg_reply->result, DID_NO_CONNECT); in qla24xx_sadb_update()
1620 __func__, fcport->port_name); in qla24xx_sadb_update()
1621 rval = -EINVAL; in qla24xx_sadb_update()
1622 SET_DID_STATUS(bsg_reply->result, DID_ERROR); in qla24xx_sadb_update()
1629 __func__, fcport->port_name); in qla24xx_sadb_update()
1630 SET_DID_STATUS(bsg_reply->result, DID_OK); in qla24xx_sadb_update()
1636 __func__, fcport->port_name, sa_frame.fast_sa_index, in qla24xx_sadb_update()
1642 uint16_t nport_handle = fcport->loop_id; in qla24xx_sadb_update()
1651 edif_entry = qla_edif_list_find_sa_index(fcport, fcport->loop_id); in qla24xx_sadb_update()
1654 "%s: WARNING: no active sa_index for nport_handle 0x%x, forcing delete for sa_index 0x%x\n", in qla24xx_sadb_update()
1655 __func__, fcport->loop_id, sa_index); in qla24xx_sadb_update()
1667 __func__, fcport->loop_id, sa_index); in qla24xx_sadb_update()
1678 if (edif_entry->delete_sa_index != INVALID_EDIF_SA_INDEX) { in qla24xx_sadb_update()
1683 __func__, edif_entry->handle, edif_entry->delete_sa_index); in qla24xx_sadb_update()
1691 __func__, sa_ctl->index); in qla24xx_sadb_update()
1692 qla_edif_free_sa_ctl(fcport, sa_ctl, sa_ctl->index); in qla24xx_sadb_update()
1701 rval = -EINVAL; in qla24xx_sadb_update()
1702 SET_DID_STATUS(bsg_reply->result, DID_ERROR); in qla24xx_sadb_update()
1706 fcport->edif.rekey_cnt++; in qla24xx_sadb_update()
1709 edif_entry->fcport = fcport; in qla24xx_sadb_update()
1710 edif_entry->timer.expires = jiffies + RX_DELAY_DELETE_TIMEOUT * HZ; in qla24xx_sadb_update()
1721 add_timer(&edif_entry->timer); in qla24xx_sadb_update()
1734 edif_entry->delete_sa_index = sa_index; in qla24xx_sadb_update()
1736 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla24xx_sadb_update()
1737 bsg_reply->result = DID_OK << 16; in qla24xx_sadb_update()
1748 uint32_t nport_handle = fcport->loop_id; in qla24xx_sadb_update()
1770 fcport->edif.aes_gmac = 1; in qla24xx_sadb_update()
1772 fcport->edif.aes_gmac = 0; in qla24xx_sadb_update()
1781 rval = -ENOMEM; in qla24xx_sadb_update()
1782 SET_DID_STATUS(bsg_reply->result, DID_IMM_RETRY); in qla24xx_sadb_update()
1786 sp->type = SRB_SA_UPDATE; in qla24xx_sadb_update()
1787 sp->name = "bsg_sa_update"; in qla24xx_sadb_update()
1788 sp->u.bsg_job = bsg_job; in qla24xx_sadb_update()
1789 /* sp->free = qla2x00_bsg_sp_free; */ in qla24xx_sadb_update()
1790 sp->free = qla2x00_rel_sp; in qla24xx_sadb_update()
1791 sp->done = qla2x00_bsg_job_done; in qla24xx_sadb_update()
1792 iocb_cmd = &sp->u.iocb_cmd; in qla24xx_sadb_update()
1793 iocb_cmd->u.sa_update.sa_frame = sa_frame; in qla24xx_sadb_update()
1813 rval = -EIO; in qla24xx_sadb_update()
1814 SET_DID_STATUS(bsg_reply->result, DID_IMM_RETRY); in qla24xx_sadb_update()
1820 __func__, sp->name, sp->handle, fcport->d_id.b24); in qla24xx_sadb_update()
1822 fcport->edif.rekey_cnt++; in qla24xx_sadb_update()
1823 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla24xx_sadb_update()
1824 SET_DID_STATUS(bsg_reply->result, DID_OK); in qla24xx_sadb_update()
1832 bsg_job->reply_len = sizeof(struct fc_bsg_reply); in qla24xx_sadb_update()
1835 __func__, bsg_reply->result, bsg_job); in qla24xx_sadb_update()
1836 bsg_job_done(bsg_job, bsg_reply->result, in qla24xx_sadb_update()
1837 bsg_reply->reply_payload_rcv_len); in qla24xx_sadb_update()
1845 node->ntype = N_UNDEF; in qla_enode_free()
1850 * qla_enode_init - initialize enode structs & lock
1858 struct qla_hw_data *ha = vha->hw; in qla_enode_init()
1861 if (vha->pur_cinfo.enode_flags == ENODE_ACTIVE) { in qla_enode_init()
1862 /* list still active - error */ in qla_enode_init()
1869 spin_lock_init(&vha->pur_cinfo.pur_lock); in qla_enode_init()
1870 INIT_LIST_HEAD(&vha->pur_cinfo.head); in qla_enode_init()
1873 ha->pdev->device); in qla_enode_init()
1877 * qla_enode_stop - stop and clear and enode data
1888 if (vha->pur_cinfo.enode_flags != ENODE_ACTIVE) { in qla_enode_stop()
1896 spin_lock_irqsave(&vha->pur_cinfo.pur_lock, flags); in qla_enode_stop()
1898 vha->pur_cinfo.enode_flags &= ~ENODE_ACTIVE; /* mark it not active */ in qla_enode_stop()
1901 list_for_each_entry_safe(node, q, &vha->pur_cinfo.head, list) { in qla_enode_stop()
1903 "%s freeing enode type=%x, cnt=%x\n", __func__, node->ntype, in qla_enode_stop()
1904 node->dinfo.nodecnt); in qla_enode_stop()
1905 list_del_init(&node->list); in qla_enode_stop()
1908 spin_unlock_irqrestore(&vha->pur_cinfo.pur_lock, flags); in qla_enode_stop()
1918 if (vha->pur_cinfo.enode_flags != ENODE_ACTIVE) { in qla_enode_clear()
1923 spin_lock_irqsave(&vha->pur_cinfo.pur_lock, flags); in qla_enode_clear()
1924 list_for_each_entry_safe(e, tmp, &vha->pur_cinfo.head, list) { in qla_enode_clear()
1925 purex = &e->u.purexinfo; in qla_enode_clear()
1926 if (purex->pur_info.pur_sid.b24 == portid.b24) { in qla_enode_clear()
1930 purex->pur_info.pur_rx_xchg_address, in qla_enode_clear()
1931 purex->pur_info.pur_bytes_rcvd); in qla_enode_clear()
1933 list_del_init(&e->list); in qla_enode_clear()
1934 list_add_tail(&e->list, &enode_list); in qla_enode_clear()
1937 spin_unlock_irqrestore(&vha->pur_cinfo.pur_lock, flags); in qla_enode_clear()
1940 list_del_init(&e->list); in qla_enode_clear()
1960 purex = &node->u.purexinfo; in qla_enode_alloc()
1961 purex->msgp = (u8 *)(node + 1); in qla_enode_alloc()
1962 purex->msgp_len = ELS_MAX_PAYLOAD; in qla_enode_alloc()
1964 node->ntype = ntype; in qla_enode_alloc()
1965 INIT_LIST_HEAD(&node->list); in qla_enode_alloc()
1976 __func__, ptr->ntype, ptr->dinfo.nodecnt); in qla_enode_add()
1978 spin_lock_irqsave(&vha->pur_cinfo.pur_lock, flags); in qla_enode_add()
1979 list_add_tail(&ptr->list, &vha->pur_cinfo.head); in qla_enode_add()
1980 spin_unlock_irqrestore(&vha->pur_cinfo.pur_lock, flags); in qla_enode_add()
1995 spin_lock_irqsave(&vha->pur_cinfo.pur_lock, flags); in qla_enode_find()
1997 list_for_each_entry_safe(list_node, q, &vha->pur_cinfo.head, list) { in qla_enode_find()
2000 purex = &list_node->u.purexinfo; in qla_enode_find()
2003 if (purex->pur_info.pur_sid.b24 == sid) { in qla_enode_find()
2006 list_del(&list_node->list); in qla_enode_find()
2011 spin_unlock_irqrestore(&vha->pur_cinfo.pur_lock, flags); in qla_enode_find()
2017 * qla_pur_get_pending - read/return authentication message sent
2030 (struct qla_bsg_auth_els_reply *)bsg_job->reply; in qla_pur_get_pending()
2032 bsg_job->reply_len = sizeof(*rpl); in qla_pur_get_pending()
2034 ptr = qla_enode_find(vha, N_PUREX, fcport->d_id.b24, PUR_GET); in qla_pur_get_pending()
2037 "%s no enode data found for %8phN sid=%06x\n", in qla_pur_get_pending()
2038 __func__, fcport->port_name, fcport->d_id.b24); in qla_pur_get_pending()
2039 SET_DID_STATUS(rpl->r.result, DID_IMM_RETRY); in qla_pur_get_pending()
2040 return -EIO; in qla_pur_get_pending()
2046 purex = &ptr->u.purexinfo; in qla_pur_get_pending()
2049 rpl->rx_xchg_address = purex->pur_info.pur_rx_xchg_address; in qla_pur_get_pending()
2051 SET_DID_STATUS(rpl->r.result, DID_OK); in qla_pur_get_pending()
2052 rpl->r.reply_payload_rcv_len = in qla_pur_get_pending()
2053 sg_pcopy_from_buffer(bsg_job->reply_payload.sg_list, in qla_pur_get_pending()
2054 bsg_job->reply_payload.sg_cnt, purex->msgp, in qla_pur_get_pending()
2055 purex->pur_info.pur_bytes_rcvd, 0); in qla_pur_get_pending()
2057 /* data copy / passback completed - destroy enode */ in qla_pur_get_pending()
2080 "Sending ELS reject ox_id %04x s:%06x -> d:%06x\n", in qla_els_reject_iocb()
2081 a->ox_id, a->sid.b24, a->did.b24); in qla_els_reject_iocb()
2083 vha->hw->elsrej.c, sizeof(*vha->hw->elsrej.c)); in qla_els_reject_iocb()
2086 qla2x00_start_iocbs(vha, qp->req); in qla_els_reject_iocb()
2094 /* list already init'd - error */ in qla_edb_init()
2101 spin_lock_init(&vha->e_dbell.db_lock); in qla_edb_init()
2102 INIT_LIST_HEAD(&vha->e_dbell.head); in qla_edb_init()
2120 spin_lock_irqsave(&vha->e_dbell.db_lock, flags); in qla_edb_clear()
2121 list_for_each_entry_safe(e, tmp, &vha->e_dbell.head, list) { in qla_edb_clear()
2122 switch (e->ntype) { in qla_edb_clear()
2125 sid = e->u.plogi_did; in qla_edb_clear()
2128 sid = e->u.els_sid; in qla_edb_clear()
2135 "%s unknown node type: %x\n", __func__, e->ntype); in qla_edb_clear()
2142 __func__, e->ntype, e); in qla_edb_clear()
2143 list_del_init(&e->list); in qla_edb_clear()
2144 list_add_tail(&e->list, &edb_list); in qla_edb_clear()
2147 spin_unlock_irqrestore(&vha->e_dbell.db_lock, flags); in qla_edb_clear()
2169 spin_lock_irqsave(&vha->e_dbell.db_lock, flags); in qla_edb_stop()
2171 vha->e_dbell.db_flags &= ~EDB_ACTIVE; /* mark it not active */ in qla_edb_stop()
2173 list_for_each_entry_safe(node, q, &vha->e_dbell.head, list) { in qla_edb_stop()
2176 __func__, node->ntype); in qla_edb_stop()
2179 spin_unlock_irqrestore(&vha->e_dbell.db_lock, flags); in qla_edb_stop()
2197 node->ntype = ntype; in qla_edb_node_alloc()
2198 INIT_LIST_HEAD(&node->list); in qla_edb_node_alloc()
2215 spin_lock_irqsave(&vha->e_dbell.db_lock, flags); in qla_edb_node_add()
2216 list_add_tail(&ptr->list, &vha->e_dbell.head); in qla_edb_node_add()
2217 spin_unlock_irqrestore(&vha->e_dbell.db_lock, flags); in qla_edb_node_add()
2231 if (!vha->hw->flags.edif_enabled) { in qla_edb_eventcreate()
2238 fcport->edif.auth_state = dbtype; in qla_edb_eventcreate()
2262 "%s can't find fcport for sid= 0x%x - ignoring\n", in qla_edb_eventcreate()
2273 edbnode->u.plogi_did.b24 = fcport->d_id.b24; in qla_edb_eventcreate()
2276 edbnode->u.els_sid.b24 = fcport->d_id.b24; in qla_edb_eventcreate()
2279 edbnode->u.sa_aen.port_id = fcport->d_id; in qla_edb_eventcreate()
2280 edbnode->u.sa_aen.status = data; in qla_edb_eventcreate()
2281 edbnode->u.sa_aen.key_type = data2; in qla_edb_eventcreate()
2282 edbnode->u.sa_aen.version = EDIF_VERSION1; in qla_edb_eventcreate()
2303 fcport->edif.auth_state = dbtype; in qla_edb_eventcreate()
2310 struct qla_hw_data *ha = vha->hw; in qla_edif_timer()
2312 if (!vha->vp_idx && N2N_TOPO(ha) && ha->flags.n2n_fw_acc_sec) { in qla_edif_timer()
2314 ha->edif_post_stop_cnt_down) { in qla_edif_timer()
2315 ha->edif_post_stop_cnt_down--; in qla_edif_timer()
2322 if (ha->edif_post_stop_cnt_down == 0) { in qla_edif_timer()
2326 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); in qla_edif_timer()
2329 ha->edif_post_stop_cnt_down = 60; in qla_edif_timer()
2333 if (vha->e_dbell.dbell_bsg_job && time_after_eq(jiffies, vha->e_dbell.bsg_expire)) in qla_edif_timer()
2339 sp->fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); in qla_noop_sp_done()
2341 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla_noop_sp_done()
2355 struct edif_sa_ctl *sa_ctl = e->u.sa_update.sa_ctl; in qla24xx_issue_sa_replace_iocb()
2356 uint16_t nport_handle = e->u.sa_update.nport_handle; in qla24xx_issue_sa_replace_iocb()
2364 rval = -ENOMEM; in qla24xx_issue_sa_replace_iocb()
2368 fcport = sa_ctl->fcport; in qla24xx_issue_sa_replace_iocb()
2375 rval = -ENOMEM; in qla24xx_issue_sa_replace_iocb()
2379 fcport->flags |= FCF_ASYNC_SENT; in qla24xx_issue_sa_replace_iocb()
2380 iocb_cmd = &sp->u.iocb_cmd; in qla24xx_issue_sa_replace_iocb()
2381 iocb_cmd->u.sa_update.sa_ctl = sa_ctl; in qla24xx_issue_sa_replace_iocb()
2385 fcport->d_id.b24, sa_ctl, sa_ctl->index, nport_handle); in qla24xx_issue_sa_replace_iocb()
2390 if (sa_ctl->flags & EDIF_SA_CTL_FLG_CLEANUP_DEL) { in qla24xx_issue_sa_replace_iocb()
2392 sp->flags |= SRB_EDIF_CLEANUP_DELETE; in qla24xx_issue_sa_replace_iocb()
2397 sp->type = SRB_SA_REPLACE; in qla24xx_issue_sa_replace_iocb()
2398 sp->name = "SA_REPLACE"; in qla24xx_issue_sa_replace_iocb()
2399 sp->fcport = fcport; in qla24xx_issue_sa_replace_iocb()
2400 sp->free = qla2x00_rel_sp; in qla24xx_issue_sa_replace_iocb()
2401 sp->done = qla_noop_sp_done; in qla24xx_issue_sa_replace_iocb()
2411 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla24xx_issue_sa_replace_iocb()
2412 fcport->flags &= ~FCF_ASYNC_SENT; in qla24xx_issue_sa_replace_iocb()
2414 fcport->flags &= ~FCF_ASYNC_ACTIVE; in qla24xx_issue_sa_replace_iocb()
2421 struct scsi_qla_host *vha = sp->vha; in qla24xx_sa_update_iocb()
2423 &sp->u.iocb_cmd.u.sa_update.sa_frame; in qla24xx_sa_update_iocb()
2426 switch (sa_frame->flags & (SAU_FLG_INV | SAU_FLG_TX)) { in qla24xx_sa_update_iocb()
2430 __func__, vha, sa_frame->fast_sa_index); in qla24xx_sa_update_iocb()
2435 __func__, vha, sa_frame->fast_sa_index); in qla24xx_sa_update_iocb()
2441 __func__, vha, sa_frame->fast_sa_index); in qla24xx_sa_update_iocb()
2447 __func__, vha, sa_frame->fast_sa_index); in qla24xx_sa_update_iocb()
2452 sa_update_iocb->entry_type = SA_UPDATE_IOCB_TYPE; in qla24xx_sa_update_iocb()
2453 sa_update_iocb->entry_count = 1; in qla24xx_sa_update_iocb()
2454 sa_update_iocb->sys_define = 0; in qla24xx_sa_update_iocb()
2455 sa_update_iocb->entry_status = 0; in qla24xx_sa_update_iocb()
2456 sa_update_iocb->handle = sp->handle; in qla24xx_sa_update_iocb()
2457 sa_update_iocb->u.nport_handle = cpu_to_le16(sp->fcport->loop_id); in qla24xx_sa_update_iocb()
2458 sa_update_iocb->vp_index = sp->fcport->vha->vp_idx; in qla24xx_sa_update_iocb()
2459 sa_update_iocb->port_id[0] = sp->fcport->d_id.b.al_pa; in qla24xx_sa_update_iocb()
2460 sa_update_iocb->port_id[1] = sp->fcport->d_id.b.area; in qla24xx_sa_update_iocb()
2461 sa_update_iocb->port_id[2] = sp->fcport->d_id.b.domain; in qla24xx_sa_update_iocb()
2463 sa_update_iocb->flags = flags; in qla24xx_sa_update_iocb()
2464 sa_update_iocb->salt = cpu_to_le32(sa_frame->salt); in qla24xx_sa_update_iocb()
2465 sa_update_iocb->spi = cpu_to_le32(sa_frame->spi); in qla24xx_sa_update_iocb()
2466 sa_update_iocb->sa_index = cpu_to_le16(sa_frame->fast_sa_index); in qla24xx_sa_update_iocb()
2468 sa_update_iocb->sa_control |= SA_CNTL_ENC_FCSP; in qla24xx_sa_update_iocb()
2469 if (sp->fcport->edif.aes_gmac) in qla24xx_sa_update_iocb()
2470 sa_update_iocb->sa_control |= SA_CNTL_AES_GMAC; in qla24xx_sa_update_iocb()
2472 if (sa_frame->flags & SAU_FLG_KEY256) { in qla24xx_sa_update_iocb()
2473 sa_update_iocb->sa_control |= SA_CNTL_KEY256; in qla24xx_sa_update_iocb()
2475 sa_update_iocb->sa_key[itr] = sa_frame->sa_key[itr]; in qla24xx_sa_update_iocb()
2477 sa_update_iocb->sa_control |= SA_CNTL_KEY128; in qla24xx_sa_update_iocb()
2479 sa_update_iocb->sa_key[itr] = sa_frame->sa_key[itr]; in qla24xx_sa_update_iocb()
2484 __func__, sa_update_iocb->port_id[2], sa_update_iocb->port_id[1], in qla24xx_sa_update_iocb()
2485 sa_update_iocb->port_id[0], sa_update_iocb->flags, sa_update_iocb->sa_index, in qla24xx_sa_update_iocb()
2486 sa_update_iocb->sa_control, sa_update_iocb->spi, sa_frame->flags, sp->handle, in qla24xx_sa_update_iocb()
2487 sp->fcport->edif.aes_gmac); in qla24xx_sa_update_iocb()
2489 if (sa_frame->flags & SAU_FLG_TX) in qla24xx_sa_update_iocb()
2490 sp->fcport->edif.tx_sa_pending = 1; in qla24xx_sa_update_iocb()
2492 sp->fcport->edif.rx_sa_pending = 1; in qla24xx_sa_update_iocb()
2494 sp->fcport->vha->qla_stats.control_requests++; in qla24xx_sa_update_iocb()
2500 struct scsi_qla_host *vha = sp->vha; in qla24xx_sa_replace_iocb()
2501 struct srb_iocb *srb_iocb = &sp->u.iocb_cmd; in qla24xx_sa_replace_iocb()
2502 struct edif_sa_ctl *sa_ctl = srb_iocb->u.sa_update.sa_ctl; in qla24xx_sa_replace_iocb()
2503 uint16_t nport_handle = sp->fcport->loop_id; in qla24xx_sa_replace_iocb()
2505 sa_update_iocb->entry_type = SA_UPDATE_IOCB_TYPE; in qla24xx_sa_replace_iocb()
2506 sa_update_iocb->entry_count = 1; in qla24xx_sa_replace_iocb()
2507 sa_update_iocb->sys_define = 0; in qla24xx_sa_replace_iocb()
2508 sa_update_iocb->entry_status = 0; in qla24xx_sa_replace_iocb()
2509 sa_update_iocb->handle = sp->handle; in qla24xx_sa_replace_iocb()
2511 sa_update_iocb->u.nport_handle = cpu_to_le16(nport_handle); in qla24xx_sa_replace_iocb()
2513 sa_update_iocb->vp_index = sp->fcport->vha->vp_idx; in qla24xx_sa_replace_iocb()
2514 sa_update_iocb->port_id[0] = sp->fcport->d_id.b.al_pa; in qla24xx_sa_replace_iocb()
2515 sa_update_iocb->port_id[1] = sp->fcport->d_id.b.area; in qla24xx_sa_replace_iocb()
2516 sa_update_iocb->port_id[2] = sp->fcport->d_id.b.domain; in qla24xx_sa_replace_iocb()
2519 sa_update_iocb->flags = SA_FLAG_INVALIDATE; in qla24xx_sa_replace_iocb()
2520 sa_update_iocb->salt = 0; in qla24xx_sa_replace_iocb()
2521 sa_update_iocb->spi = 0; in qla24xx_sa_replace_iocb()
2522 sa_update_iocb->sa_index = cpu_to_le16(sa_ctl->index); in qla24xx_sa_replace_iocb()
2523 sa_update_iocb->sa_control = 0; in qla24xx_sa_replace_iocb()
2527 __func__, sa_update_iocb->port_id[2], sa_update_iocb->port_id[1], in qla24xx_sa_replace_iocb()
2528 sa_update_iocb->port_id[0], nport_handle, sa_update_iocb->flags, in qla24xx_sa_replace_iocb()
2529 sa_update_iocb->sa_index, sp->handle); in qla24xx_sa_replace_iocb()
2531 sp->fcport->vha->qla_stats.control_requests++; in qla24xx_sa_replace_iocb()
2550 a.nport_handle = p->nport_handle; in qla24xx_auth_els()
2551 a.rx_xchg_address = p->rx_xchg_addr; in qla24xx_auth_els()
2552 a.did.b.domain = p->s_id[2]; in qla24xx_auth_els()
2553 a.did.b.area = p->s_id[1]; in qla24xx_auth_els()
2554 a.did.b.al_pa = p->s_id[0]; in qla24xx_auth_els()
2556 a.tx_addr = vha->hw->elsrej.cdma; in qla24xx_auth_els()
2557 a.vp_idx = vha->vp_idx; in qla24xx_auth_els()
2559 a.ox_id = le16_to_cpu(p->ox_id); in qla24xx_auth_els()
2561 sid = p->s_id[0] | (p->s_id[1] << 8) | (p->s_id[2] << 16); in qla24xx_auth_els()
2563 totlen = (le16_to_cpu(p->frame_size) & 0x0fff) - PURX_ELS_HEADER_SIZE; in qla24xx_auth_els()
2564 if (le16_to_cpu(p->status_flags) & 0x8000) { in qla24xx_auth_els()
2565 totlen = le16_to_cpu(p->trunc_frame_size); in qla24xx_auth_els()
2566 qla_els_reject_iocb(vha, (*rsp)->qpair, &a); in qla24xx_auth_els()
2575 qla_els_reject_iocb(vha, (*rsp)->qpair, &a); in qla24xx_auth_els()
2580 if (!vha->hw->flags.edif_enabled) { in qla24xx_auth_els()
2584 qla_els_reject_iocb(vha, (*rsp)->qpair, &a); in qla24xx_auth_els()
2594 qla_els_reject_iocb(vha, (*rsp)->qpair, &a); in qla24xx_auth_els()
2599 purex = &ptr->u.purexinfo; in qla24xx_auth_els()
2600 purex->pur_info.pur_sid = a.did; in qla24xx_auth_els()
2601 purex->pur_info.pur_bytes_rcvd = totlen; in qla24xx_auth_els()
2602 purex->pur_info.pur_rx_xchg_address = le32_to_cpu(p->rx_xchg_addr); in qla24xx_auth_els()
2603 purex->pur_info.pur_nphdl = le16_to_cpu(p->nport_handle); in qla24xx_auth_els()
2604 purex->pur_info.pur_did.b.domain = p->d_id[2]; in qla24xx_auth_els()
2605 purex->pur_info.pur_did.b.area = p->d_id[1]; in qla24xx_auth_els()
2606 purex->pur_info.pur_did.b.al_pa = p->d_id[0]; in qla24xx_auth_els()
2607 purex->pur_info.vp_idx = p->vp_idx; in qla24xx_auth_els()
2609 a.sid = purex->pur_info.pur_did; in qla24xx_auth_els()
2611 rc = __qla_copy_purex_to_buffer(vha, pkt, rsp, purex->msgp, in qla24xx_auth_els()
2612 purex->msgp_len); in qla24xx_auth_els()
2614 qla_els_reject_iocb(vha, (*rsp)->qpair, &a); in qla24xx_auth_els()
2618 beid.al_pa = purex->pur_info.pur_did.b.al_pa; in qla24xx_auth_els()
2619 beid.area = purex->pur_info.pur_did.b.area; in qla24xx_auth_els()
2620 beid.domain = purex->pur_info.pur_did.b.domain; in qla24xx_auth_els()
2625 __func__, purex->pur_info.pur_did.b24); in qla24xx_auth_els()
2627 qla_els_reject_iocb(vha, (*rsp)->qpair, &a); in qla24xx_auth_els()
2632 fcport = qla2x00_find_fcport_by_pid(host, &purex->pur_info.pur_sid); in qla24xx_auth_els()
2636 __func__, host->e_dbell.db_flags, in qla24xx_auth_els()
2637 fcport ? fcport->d_id.b24 : 0); in qla24xx_auth_els()
2639 qla_els_reject_iocb(host, (*rsp)->qpair, &a); in qla24xx_auth_els()
2652 qla_els_reject_iocb(host, (*rsp)->qpair, &a); in qla24xx_auth_els()
2655 fcport->send_els_logo = 1; in qla24xx_auth_els()
2664 "%s COMPLETE purex->pur_info.pur_bytes_rcvd =%xh s:%06x -> d:%06x xchg=%xh\n", in qla24xx_auth_els()
2665 __func__, purex->pur_info.pur_bytes_rcvd, purex->pur_info.pur_sid.b24, in qla24xx_auth_els()
2666 purex->pur_info.pur_did.b24, purex->pur_info.pur_rx_xchg_address); in qla24xx_auth_els()
2673 struct scsi_qla_host *vha = fcport->vha; in qla_edif_get_sa_index_from_freepool()
2674 struct qla_hw_data *ha = vha->hw; in qla_edif_get_sa_index_from_freepool()
2683 sa_id_map = ha->edif_tx_sa_id_map; in qla_edif_get_sa_index_from_freepool()
2685 sa_id_map = ha->edif_rx_sa_id_map; in qla_edif_get_sa_index_from_freepool()
2687 spin_lock_irqsave(&ha->sadb_fp_lock, flags); in qla_edif_get_sa_index_from_freepool()
2690 spin_unlock_irqrestore(&ha->sadb_fp_lock, flags); in qla_edif_get_sa_index_from_freepool()
2694 spin_unlock_irqrestore(&ha->sadb_fp_lock, flags); in qla_edif_get_sa_index_from_freepool()
2715 if (entry->handle == nport_handle) in qla_edif_sadb_find_sa_index_entry()
2730 scsi_qla_host_t *vha = fcport->vha; in qla_edif_sadb_delete_sa_index()
2731 struct qla_hw_data *ha = vha->hw; in qla_edif_sadb_delete_sa_index()
2738 sa_list = &ha->sadb_tx_index_list; in qla_edif_sadb_delete_sa_index()
2740 sa_list = &ha->sadb_rx_index_list; in qla_edif_sadb_delete_sa_index()
2745 "%s: no entry found for nport_handle 0x%x\n", in qla_edif_sadb_delete_sa_index()
2747 return -1; in qla_edif_sadb_delete_sa_index()
2750 spin_lock_irqsave(&ha->sadb_lock, flags); in qla_edif_sadb_delete_sa_index()
2753 * the other is use at re-key time. in qla_edif_sadb_delete_sa_index()
2756 if (entry->sa_pair[slot].sa_index == sa_index) { in qla_edif_sadb_delete_sa_index()
2757 entry->sa_pair[slot].sa_index = INVALID_EDIF_SA_INDEX; in qla_edif_sadb_delete_sa_index()
2758 entry->sa_pair[slot].spi = 0; in qla_edif_sadb_delete_sa_index()
2761 } else if (entry->sa_pair[slot].sa_index == INVALID_EDIF_SA_INDEX) { in qla_edif_sadb_delete_sa_index()
2767 list_del(&entry->next); in qla_edif_sadb_delete_sa_index()
2770 spin_unlock_irqrestore(&ha->sadb_lock, flags); in qla_edif_sadb_delete_sa_index()
2794 "%s: no sp found for pkt\n", __func__); in qla28xx_sa_update_iocb_entry()
2797 /* use sp->vha due to npiv */ in qla28xx_sa_update_iocb_entry()
2798 vha = sp->vha; in qla28xx_sa_update_iocb_entry()
2800 switch (pkt->flags & (SA_FLAG_INVALIDATE | SA_FLAG_TX)) { in qla28xx_sa_update_iocb_entry()
2804 __func__, vha, pkt->sa_index); in qla28xx_sa_update_iocb_entry()
2809 __func__, vha, pkt->sa_index); in qla28xx_sa_update_iocb_entry()
2814 __func__, vha, pkt->sa_index); in qla28xx_sa_update_iocb_entry()
2819 __func__, vha, pkt->sa_index); in qla28xx_sa_update_iocb_entry()
2824 * dig the nport handle out of the iocb, fcport->loop_id can not be trusted in qla28xx_sa_update_iocb_entry()
2827 nport_handle = sp->fcport->loop_id; in qla28xx_sa_update_iocb_entry()
2831 __func__, sp->fcport->port_name, pkt->u.comp_sts, pkt->old_sa_info, pkt->new_sa_info, in qla28xx_sa_update_iocb_entry()
2832 nport_handle, pkt->sa_index, pkt->flags, sp->handle); in qla28xx_sa_update_iocb_entry()
2835 if ((pkt->flags & (SA_FLAG_INVALIDATE | SA_FLAG_TX)) == SA_FLAG_INVALIDATE) { in qla28xx_sa_update_iocb_entry()
2838 sp->fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); in qla28xx_sa_update_iocb_entry()
2840 edif_entry = qla_edif_list_find_sa_index(sp->fcport, nport_handle); in qla28xx_sa_update_iocb_entry()
2844 __func__, edif_entry, pkt->sa_index); in qla28xx_sa_update_iocb_entry()
2845 qla_edif_list_delete_sa_index(sp->fcport, edif_entry); in qla28xx_sa_update_iocb_entry()
2846 timer_shutdown(&edif_entry->timer); in qla28xx_sa_update_iocb_entry()
2850 __func__, edif_entry, pkt->sa_index); in qla28xx_sa_update_iocb_entry()
2860 if (pkt->flags & SA_FLAG_INVALIDATE) in qla28xx_sa_update_iocb_entry()
2861 old_sa_deleted = (le16_to_cpu(pkt->new_sa_info) == 0xffff) ? 1 : 0; in qla28xx_sa_update_iocb_entry()
2866 if (sp->flags & SRB_EDIF_CLEANUP_DELETE) { in qla28xx_sa_update_iocb_entry()
2867 sp->fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); in qla28xx_sa_update_iocb_entry()
2870 __func__, sp->fcport->loop_id, pkt->sa_index); in qla28xx_sa_update_iocb_entry()
2872 } else if ((pkt->entry_status == 0) && (pkt->u.comp_sts == 0) && in qla28xx_sa_update_iocb_entry()
2884 pkt->new_sa_info, in qla28xx_sa_update_iocb_entry()
2885 pkt->port_id[2], pkt->port_id[1], pkt->port_id[0]); in qla28xx_sa_update_iocb_entry()
2886 sp->fcport->edif.enable = 1; in qla28xx_sa_update_iocb_entry()
2887 if (pkt->flags & SA_FLAG_TX) { in qla28xx_sa_update_iocb_entry()
2888 sp->fcport->edif.tx_sa_set = 1; in qla28xx_sa_update_iocb_entry()
2889 sp->fcport->edif.tx_sa_pending = 0; in qla28xx_sa_update_iocb_entry()
2892 QL_VND_TX_SA_KEY, sp->fcport); in qla28xx_sa_update_iocb_entry()
2894 sp->fcport->edif.rx_sa_set = 1; in qla28xx_sa_update_iocb_entry()
2895 sp->fcport->edif.rx_sa_pending = 0; in qla28xx_sa_update_iocb_entry()
2898 QL_VND_RX_SA_KEY, sp->fcport); in qla28xx_sa_update_iocb_entry()
2903 __func__, sp->fcport->port_name, pkt->sa_index, pkt->new_sa_info, in qla28xx_sa_update_iocb_entry()
2904 pkt->port_id[2], pkt->port_id[1], pkt->port_id[0]); in qla28xx_sa_update_iocb_entry()
2906 if (pkt->flags & SA_FLAG_TX) in qla28xx_sa_update_iocb_entry()
2908 (le16_to_cpu(pkt->u.comp_sts) << 16) | QL_VND_SA_STAT_FAILED, in qla28xx_sa_update_iocb_entry()
2909 QL_VND_TX_SA_KEY, sp->fcport); in qla28xx_sa_update_iocb_entry()
2912 (le16_to_cpu(pkt->u.comp_sts) << 16) | QL_VND_SA_STAT_FAILED, in qla28xx_sa_update_iocb_entry()
2913 QL_VND_RX_SA_KEY, sp->fcport); in qla28xx_sa_update_iocb_entry()
2917 if (pkt->flags & SA_FLAG_INVALIDATE) { in qla28xx_sa_update_iocb_entry()
2919 sa_ctl = qla_edif_find_sa_ctl_by_index(sp->fcport, in qla28xx_sa_update_iocb_entry()
2920 le16_to_cpu(pkt->sa_index), (pkt->flags & SA_FLAG_TX)); in qla28xx_sa_update_iocb_entry()
2922 qla_edif_find_sa_ctl_by_index(sp->fcport, sa_ctl->index, in qla28xx_sa_update_iocb_entry()
2923 (pkt->flags & SA_FLAG_TX)) != NULL) { in qla28xx_sa_update_iocb_entry()
2926 __func__, sa_ctl->index); in qla28xx_sa_update_iocb_entry()
2927 qla_edif_free_sa_ctl(sp->fcport, sa_ctl, sa_ctl->index); in qla28xx_sa_update_iocb_entry()
2935 __func__, le16_to_cpu(pkt->sa_index), nport_handle); in qla28xx_sa_update_iocb_entry()
2936 qla_edif_sadb_delete_sa_index(sp->fcport, nport_handle, in qla28xx_sa_update_iocb_entry()
2937 le16_to_cpu(pkt->sa_index)); in qla28xx_sa_update_iocb_entry()
2942 } else if (pkt->u.comp_sts) { in qla28xx_sa_update_iocb_entry()
2945 __func__, pkt->sa_index, nport_handle); in qla28xx_sa_update_iocb_entry()
2946 qla_edif_sadb_delete_sa_index(sp->fcport, nport_handle, in qla28xx_sa_update_iocb_entry()
2947 le16_to_cpu(pkt->sa_index)); in qla28xx_sa_update_iocb_entry()
2948 switch (le16_to_cpu(pkt->u.comp_sts)) { in qla28xx_sa_update_iocb_entry()
2951 qlt_schedule_sess_for_deletion(sp->fcport); in qla28xx_sa_update_iocb_entry()
2958 sp->done(sp, 0); in qla28xx_sa_update_iocb_entry()
2962 * qla28xx_start_scsi_edif() - Send a SCSI type 6 command to the ISP
2965 * Return: non-zero if a failure occurred, else zero.
2982 struct scsi_qla_host *vha = sp->vha; in qla28xx_start_scsi_edif()
2983 struct qla_hw_data *ha = vha->hw; in qla28xx_start_scsi_edif()
2988 struct req_que *req = sp->qpair->req; in qla28xx_start_scsi_edif()
2989 spinlock_t *lock = sp->qpair->qp_lock_ptr; in qla28xx_start_scsi_edif()
2998 if (vha->marker_needed != 0) { in qla28xx_start_scsi_edif()
2999 if (qla2x00_marker(vha, sp->qpair, 0, 0, MK_SYNC_ALL) != in qla28xx_start_scsi_edif()
3005 vha->marker_needed = 0; in qla28xx_start_scsi_edif()
3012 handle = req->current_outstanding_cmd; in qla28xx_start_scsi_edif()
3013 for (index = 1; index < req->num_outstanding_cmds; index++) { in qla28xx_start_scsi_edif()
3015 if (handle == req->num_outstanding_cmds) in qla28xx_start_scsi_edif()
3017 if (!req->outstanding_cmds[handle]) in qla28xx_start_scsi_edif()
3020 if (index == req->num_outstanding_cmds) in qla28xx_start_scsi_edif()
3025 nseg = dma_map_sg(&ha->pdev->dev, scsi_sglist(cmd), in qla28xx_start_scsi_edif()
3026 scsi_sg_count(cmd), cmd->sc_data_direction); in qla28xx_start_scsi_edif()
3036 sp->iores.res_type = RESOURCE_IOCB | RESOURCE_EXCH; in qla28xx_start_scsi_edif()
3037 sp->iores.exch_cnt = 1; in qla28xx_start_scsi_edif()
3038 sp->iores.iocb_cnt = req_cnt; in qla28xx_start_scsi_edif()
3039 if (qla_get_fw_resources(sp->qpair, &sp->iores)) in qla28xx_start_scsi_edif()
3042 if (req->cnt < (req_cnt + 2)) { in qla28xx_start_scsi_edif()
3043 cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr : in qla28xx_start_scsi_edif()
3044 rd_reg_dword(req->req_q_out); in qla28xx_start_scsi_edif()
3045 if (req->ring_index < cnt) in qla28xx_start_scsi_edif()
3046 req->cnt = cnt - req->ring_index; in qla28xx_start_scsi_edif()
3048 req->cnt = req->length - in qla28xx_start_scsi_edif()
3049 (req->ring_index - cnt); in qla28xx_start_scsi_edif()
3050 if (req->cnt < (req_cnt + 2)) in qla28xx_start_scsi_edif()
3054 if (qla_get_buf(vha, sp->qpair, &sp->u.scmd.buf_dsc)) { in qla28xx_start_scsi_edif()
3060 sp->flags |= SRB_GOT_BUF; in qla28xx_start_scsi_edif()
3061 ctx = &sp->u.scmd.ct6_ctx; in qla28xx_start_scsi_edif()
3062 ctx->fcp_cmnd = sp->u.scmd.buf_dsc.buf; in qla28xx_start_scsi_edif()
3063 ctx->fcp_cmnd_dma = sp->u.scmd.buf_dsc.buf_dma; in qla28xx_start_scsi_edif()
3065 if (cmd->cmd_len > 16) { in qla28xx_start_scsi_edif()
3066 additional_cdb_len = cmd->cmd_len - 16; in qla28xx_start_scsi_edif()
3067 if ((cmd->cmd_len % 4) != 0) { in qla28xx_start_scsi_edif()
3074 cmd->cmd_len, cmd); in qla28xx_start_scsi_edif()
3077 ctx->fcp_cmnd_len = 12 + cmd->cmd_len + 4; in qla28xx_start_scsi_edif()
3080 ctx->fcp_cmnd_len = 12 + 16 + 4; in qla28xx_start_scsi_edif()
3083 cmd_pkt = (struct cmd_type_6 *)req->ring_ptr; in qla28xx_start_scsi_edif()
3084 cmd_pkt->handle = make_handle(req->id, handle); in qla28xx_start_scsi_edif()
3088 * tagged queuing modifier -- default is TSK_SIMPLE (0). in qla28xx_start_scsi_edif()
3091 memset(clr_ptr, 0, REQUEST_ENTRY_SIZE - 8); in qla28xx_start_scsi_edif()
3092 cmd_pkt->dseg_count = cpu_to_le16(tot_dsds); in qla28xx_start_scsi_edif()
3094 /* No data transfer */ in qla28xx_start_scsi_edif()
3095 if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) { in qla28xx_start_scsi_edif()
3096 cmd_pkt->byte_count = cpu_to_le32(0); in qla28xx_start_scsi_edif()
3101 if (cmd->sc_data_direction == DMA_TO_DEVICE) { in qla28xx_start_scsi_edif()
3102 cmd_pkt->control_flags = cpu_to_le16(CF_WRITE_DATA); in qla28xx_start_scsi_edif()
3103 vha->qla_stats.output_bytes += scsi_bufflen(cmd); in qla28xx_start_scsi_edif()
3104 vha->qla_stats.output_requests++; in qla28xx_start_scsi_edif()
3105 sp->fcport->edif.tx_bytes += scsi_bufflen(cmd); in qla28xx_start_scsi_edif()
3106 } else if (cmd->sc_data_direction == DMA_FROM_DEVICE) { in qla28xx_start_scsi_edif()
3107 cmd_pkt->control_flags = cpu_to_le16(CF_READ_DATA); in qla28xx_start_scsi_edif()
3108 vha->qla_stats.input_bytes += scsi_bufflen(cmd); in qla28xx_start_scsi_edif()
3109 vha->qla_stats.input_requests++; in qla28xx_start_scsi_edif()
3110 sp->fcport->edif.rx_bytes += scsi_bufflen(cmd); in qla28xx_start_scsi_edif()
3113 cmd_pkt->control_flags |= cpu_to_le16(CF_EN_EDIF); in qla28xx_start_scsi_edif()
3114 cmd_pkt->control_flags &= ~(cpu_to_le16(CF_NEW_SA)); in qla28xx_start_scsi_edif()
3118 cur_dsd = &cmd_pkt->fcp_dsd; in qla28xx_start_scsi_edif()
3132 cur_dsd = cont_pkt->dsd; in qla28xx_start_scsi_edif()
3137 put_unaligned_le64(sle_dma, &cur_dsd->address); in qla28xx_start_scsi_edif()
3138 cur_dsd->length = cpu_to_le32(sg_dma_len(sg)); in qla28xx_start_scsi_edif()
3140 avail_dsds--; in qla28xx_start_scsi_edif()
3144 /* Set NPORT-ID and LUN number*/ in qla28xx_start_scsi_edif()
3145 cmd_pkt->nport_handle = cpu_to_le16(sp->fcport->loop_id); in qla28xx_start_scsi_edif()
3146 cmd_pkt->port_id[0] = sp->fcport->d_id.b.al_pa; in qla28xx_start_scsi_edif()
3147 cmd_pkt->port_id[1] = sp->fcport->d_id.b.area; in qla28xx_start_scsi_edif()
3148 cmd_pkt->port_id[2] = sp->fcport->d_id.b.domain; in qla28xx_start_scsi_edif()
3149 cmd_pkt->vp_index = sp->vha->vp_idx; in qla28xx_start_scsi_edif()
3151 cmd_pkt->entry_type = COMMAND_TYPE_6; in qla28xx_start_scsi_edif()
3153 /* Set total data segment count. */ in qla28xx_start_scsi_edif()
3154 cmd_pkt->entry_count = (uint8_t)req_cnt; in qla28xx_start_scsi_edif()
3156 int_to_scsilun(cmd->device->lun, &cmd_pkt->lun); in qla28xx_start_scsi_edif()
3157 host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun)); in qla28xx_start_scsi_edif()
3160 int_to_scsilun(cmd->device->lun, &ctx->fcp_cmnd->lun); in qla28xx_start_scsi_edif()
3161 ctx->fcp_cmnd->additional_cdb_len = additional_cdb_len; in qla28xx_start_scsi_edif()
3163 if (cmd->sc_data_direction == DMA_TO_DEVICE) in qla28xx_start_scsi_edif()
3164 ctx->fcp_cmnd->additional_cdb_len |= 1; in qla28xx_start_scsi_edif()
3165 else if (cmd->sc_data_direction == DMA_FROM_DEVICE) in qla28xx_start_scsi_edif()
3166 ctx->fcp_cmnd->additional_cdb_len |= 2; in qla28xx_start_scsi_edif()
3169 if (ha->flags.fcp_prio_enabled) in qla28xx_start_scsi_edif()
3170 ctx->fcp_cmnd->task_attribute |= in qla28xx_start_scsi_edif()
3171 sp->fcport->fcp_prio << 3; in qla28xx_start_scsi_edif()
3173 memcpy(ctx->fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); in qla28xx_start_scsi_edif()
3175 fcp_dl = (__be32 *)(ctx->fcp_cmnd->cdb + 16 + in qla28xx_start_scsi_edif()
3179 cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(ctx->fcp_cmnd_len); in qla28xx_start_scsi_edif()
3180 put_unaligned_le64(ctx->fcp_cmnd_dma, &cmd_pkt->fcp_cmnd_dseg_address); in qla28xx_start_scsi_edif()
3182 cmd_pkt->byte_count = cpu_to_le32((uint32_t)scsi_bufflen(cmd)); in qla28xx_start_scsi_edif()
3183 /* Set total data segment count. */ in qla28xx_start_scsi_edif()
3184 cmd_pkt->entry_count = (uint8_t)req_cnt; in qla28xx_start_scsi_edif()
3185 cmd_pkt->entry_status = 0; in qla28xx_start_scsi_edif()
3188 req->current_outstanding_cmd = handle; in qla28xx_start_scsi_edif()
3189 req->outstanding_cmds[handle] = sp; in qla28xx_start_scsi_edif()
3190 sp->handle = handle; in qla28xx_start_scsi_edif()
3191 cmd->host_scribble = (unsigned char *)(unsigned long)handle; in qla28xx_start_scsi_edif()
3192 req->cnt -= req_cnt; in qla28xx_start_scsi_edif()
3196 req->ring_index++; in qla28xx_start_scsi_edif()
3197 if (req->ring_index == req->length) { in qla28xx_start_scsi_edif()
3198 req->ring_index = 0; in qla28xx_start_scsi_edif()
3199 req->ring_ptr = req->ring; in qla28xx_start_scsi_edif()
3201 req->ring_ptr++; in qla28xx_start_scsi_edif()
3204 sp->qpair->cmd_cnt++; in qla28xx_start_scsi_edif()
3206 wrt_reg_dword(req->req_q_in, req->ring_index); in qla28xx_start_scsi_edif()
3217 qla_put_buf(sp->qpair, &sp->u.scmd.buf_dsc); in qla28xx_start_scsi_edif()
3218 qla_put_fw_resources(sp->qpair, &sp->iores); in qla28xx_start_scsi_edif()
3233 struct list_head *indx_list = &fcport->edif.edif_indx_list; in qla_edif_list_del()
3236 spin_lock_irqsave(&fcport->edif.indx_list_lock, flags); in qla_edif_list_del()
3238 list_del(&indx_lst->next); in qla_edif_list_del()
3241 spin_unlock_irqrestore(&fcport->edif.indx_list_lock, flags); in qla_edif_list_del()
3255 int dir = sa_frame->flags & SAU_FLG_TX; in qla_edif_sadb_get_sa_index()
3257 int free_slot = -1; in qla_edif_sadb_get_sa_index()
3258 scsi_qla_host_t *vha = fcport->vha; in qla_edif_sadb_get_sa_index()
3259 struct qla_hw_data *ha = vha->hw; in qla_edif_sadb_get_sa_index()
3261 uint16_t nport_handle = fcport->loop_id; in qla_edif_sadb_get_sa_index()
3268 sa_list = &ha->sadb_tx_index_list; in qla_edif_sadb_get_sa_index()
3270 sa_list = &ha->sadb_rx_index_list; in qla_edif_sadb_get_sa_index()
3274 if ((sa_frame->flags & (SAU_FLG_TX | SAU_FLG_INV)) == SAU_FLG_INV) { in qla_edif_sadb_get_sa_index()
3276 "%s: rx delete request with no entry\n", __func__); in qla_edif_sadb_get_sa_index()
3280 /* if there is no entry for this nport, add one */ in qla_edif_sadb_get_sa_index()
3291 INIT_LIST_HEAD(&entry->next); in qla_edif_sadb_get_sa_index()
3292 entry->handle = nport_handle; in qla_edif_sadb_get_sa_index()
3293 entry->fcport = fcport; in qla_edif_sadb_get_sa_index()
3294 entry->sa_pair[0].spi = sa_frame->spi; in qla_edif_sadb_get_sa_index()
3295 entry->sa_pair[0].sa_index = sa_index; in qla_edif_sadb_get_sa_index()
3296 entry->sa_pair[1].spi = 0; in qla_edif_sadb_get_sa_index()
3297 entry->sa_pair[1].sa_index = INVALID_EDIF_SA_INDEX; in qla_edif_sadb_get_sa_index()
3298 spin_lock_irqsave(&ha->sadb_lock, flags); in qla_edif_sadb_get_sa_index()
3299 list_add_tail(&entry->next, sa_list); in qla_edif_sadb_get_sa_index()
3300 spin_unlock_irqrestore(&ha->sadb_lock, flags); in qla_edif_sadb_get_sa_index()
3303 __func__, nport_handle, sa_frame->spi, sa_index); in qla_edif_sadb_get_sa_index()
3308 spin_lock_irqsave(&ha->sadb_lock, flags); in qla_edif_sadb_get_sa_index()
3312 if (entry->sa_pair[slot].sa_index == INVALID_EDIF_SA_INDEX) { in qla_edif_sadb_get_sa_index()
3315 if (entry->sa_pair[slot].spi == sa_frame->spi) { in qla_edif_sadb_get_sa_index()
3316 spin_unlock_irqrestore(&ha->sadb_lock, flags); in qla_edif_sadb_get_sa_index()
3319 __func__, slot, entry->handle, sa_frame->spi, in qla_edif_sadb_get_sa_index()
3320 entry->sa_pair[slot].sa_index); in qla_edif_sadb_get_sa_index()
3321 return entry->sa_pair[slot].sa_index; in qla_edif_sadb_get_sa_index()
3325 spin_unlock_irqrestore(&ha->sadb_lock, flags); in qla_edif_sadb_get_sa_index()
3328 if (free_slot == -1) { in qla_edif_sadb_get_sa_index()
3330 "%s: WARNING: No free slots in sadb for nport_handle 0x%x, spi: 0x%x\n", in qla_edif_sadb_get_sa_index()
3331 __func__, entry->handle, sa_frame->spi); in qla_edif_sadb_get_sa_index()
3334 __func__, entry->sa_pair[0].spi, entry->sa_pair[0].sa_index, in qla_edif_sadb_get_sa_index()
3335 entry->sa_pair[1].spi, entry->sa_pair[1].sa_index); in qla_edif_sadb_get_sa_index()
3343 ql_dbg(ql_dbg_edif, fcport->vha, 0x3063, in qla_edif_sadb_get_sa_index()
3348 spin_lock_irqsave(&ha->sadb_lock, flags); in qla_edif_sadb_get_sa_index()
3349 entry->sa_pair[free_slot].spi = sa_frame->spi; in qla_edif_sadb_get_sa_index()
3350 entry->sa_pair[free_slot].sa_index = sa_index; in qla_edif_sadb_get_sa_index()
3351 spin_unlock_irqrestore(&ha->sadb_lock, flags); in qla_edif_sadb_get_sa_index()
3352 ql_dbg(ql_dbg_edif, fcport->vha, 0x3063, in qla_edif_sadb_get_sa_index()
3354 __func__, free_slot, entry->handle, sa_frame->spi, sa_index); in qla_edif_sadb_get_sa_index()
3359 /* release any sadb entries -- only done at teardown */
3364 list_for_each_entry_safe(entry, tmp, &ha->sadb_rx_index_list, next) { in qla_edif_sadb_release()
3365 list_del(&entry->next); in qla_edif_sadb_release()
3369 list_for_each_entry_safe(entry, tmp, &ha->sadb_tx_index_list, next) { in qla_edif_sadb_release()
3370 list_del(&entry->next); in qla_edif_sadb_release()
3379 /* build the rx and tx sa_index free pools -- only done at fcport init */
3382 ha->edif_tx_sa_id_map = in qla_edif_sadb_build_free_pool()
3385 if (!ha->edif_tx_sa_id_map) { in qla_edif_sadb_build_free_pool()
3386 ql_log_pci(ql_log_fatal, ha->pdev, 0x0009, in qla_edif_sadb_build_free_pool()
3388 return -ENOMEM; in qla_edif_sadb_build_free_pool()
3391 ha->edif_rx_sa_id_map = in qla_edif_sadb_build_free_pool()
3393 if (!ha->edif_rx_sa_id_map) { in qla_edif_sadb_build_free_pool()
3394 kfree(ha->edif_tx_sa_id_map); in qla_edif_sadb_build_free_pool()
3395 ha->edif_tx_sa_id_map = NULL; in qla_edif_sadb_build_free_pool()
3396 ql_log_pci(ql_log_fatal, ha->pdev, 0x0009, in qla_edif_sadb_build_free_pool()
3398 return -ENOMEM; in qla_edif_sadb_build_free_pool()
3403 /* release the free pool - only done during fcport teardown */
3406 kfree(ha->edif_tx_sa_id_map); in qla_edif_sadb_release_free_pool()
3407 ha->edif_tx_sa_id_map = NULL; in qla_edif_sadb_release_free_pool()
3408 kfree(ha->edif_rx_sa_id_map); in qla_edif_sadb_release_free_pool()
3409 ha->edif_rx_sa_id_map = NULL; in qla_edif_sadb_release_free_pool()
3419 uint16_t nport_handle = fcport->loop_id; in __chk_edif_rx_sa_delete_pending()
3422 spin_lock_irqsave(&fcport->edif.indx_list_lock, flags); in __chk_edif_rx_sa_delete_pending()
3425 spin_unlock_irqrestore(&fcport->edif.indx_list_lock, flags); in __chk_edif_rx_sa_delete_pending()
3426 return; /* no pending delete for this handle */ in __chk_edif_rx_sa_delete_pending()
3430 * check for no pending delete for this index or iocb does not in __chk_edif_rx_sa_delete_pending()
3433 if (edif_entry->delete_sa_index == INVALID_EDIF_SA_INDEX || in __chk_edif_rx_sa_delete_pending()
3434 edif_entry->update_sa_index != sa_index) { in __chk_edif_rx_sa_delete_pending()
3435 spin_unlock_irqrestore(&fcport->edif.indx_list_lock, flags); in __chk_edif_rx_sa_delete_pending()
3443 if (edif_entry->count++ < EDIF_RX_DELETE_FILTER_COUNT) { in __chk_edif_rx_sa_delete_pending()
3444 spin_unlock_irqrestore(&fcport->edif.indx_list_lock, flags); in __chk_edif_rx_sa_delete_pending()
3450 __func__, edif_entry->update_sa_index, sa_index, edif_entry->delete_sa_index); in __chk_edif_rx_sa_delete_pending()
3452 delete_sa_index = edif_entry->delete_sa_index; in __chk_edif_rx_sa_delete_pending()
3453 edif_entry->delete_sa_index = INVALID_EDIF_SA_INDEX; in __chk_edif_rx_sa_delete_pending()
3454 cached_nport_handle = edif_entry->handle; in __chk_edif_rx_sa_delete_pending()
3455 spin_unlock_irqrestore(&fcport->edif.indx_list_lock, flags); in __chk_edif_rx_sa_delete_pending()
3473 edif_entry->update_sa_index, nport_handle, handle); in __chk_edif_rx_sa_delete_pending()
3475 sa_ctl->flags = EDIF_SA_CTL_FLG_DEL; in __chk_edif_rx_sa_delete_pending()
3476 set_bit(EDIF_SA_CTL_REPL, &sa_ctl->state); in __chk_edif_rx_sa_delete_pending()
3477 qla_post_sa_replace_work(fcport->vha, fcport, in __chk_edif_rx_sa_delete_pending()
3489 fc_port_t *fcport = sp->fcport; in qla_chk_edif_rx_sa_delete_pending()
3494 handle = (uint32_t)LSW(sts24->handle); in qla_chk_edif_rx_sa_delete_pending()
3497 if (cmd->sc_data_direction != DMA_FROM_DEVICE) in qla_chk_edif_rx_sa_delete_pending()
3501 le16_to_cpu(sts24->edif_sa_index)); in qla_chk_edif_rx_sa_delete_pending()
3508 pkt->handle, le16_to_cpu(pkt->edif_sa_index)); in qlt_chk_edif_rx_sa_delete_pending()
3513 struct qla_els_pt_arg *a = &sp->u.bsg_cmd.u.els_arg; in qla_parse_auth_els_ctl()
3514 struct bsg_job *bsg_job = sp->u.bsg_cmd.bsg_job; in qla_parse_auth_els_ctl()
3515 struct fc_bsg_request *request = bsg_job->request; in qla_parse_auth_els_ctl()
3517 (struct qla_bsg_auth_els_request *)bsg_job->request; in qla_parse_auth_els_ctl()
3519 a->tx_len = a->tx_byte_count = sp->remap.req.len; in qla_parse_auth_els_ctl()
3520 a->tx_addr = sp->remap.req.dma; in qla_parse_auth_els_ctl()
3521 a->rx_len = a->rx_byte_count = sp->remap.rsp.len; in qla_parse_auth_els_ctl()
3522 a->rx_addr = sp->remap.rsp.dma; in qla_parse_auth_els_ctl()
3524 if (p->e.sub_cmd == SEND_ELS_REPLY) { in qla_parse_auth_els_ctl()
3525 a->control_flags = p->e.extra_control_flags << 13; in qla_parse_auth_els_ctl()
3526 a->rx_xchg_address = cpu_to_le32(p->e.extra_rx_xchg_address); in qla_parse_auth_els_ctl()
3527 if (p->e.extra_control_flags == BSG_CTL_FLAG_LS_ACC) in qla_parse_auth_els_ctl()
3528 a->els_opcode = ELS_LS_ACC; in qla_parse_auth_els_ctl()
3529 else if (p->e.extra_control_flags == BSG_CTL_FLAG_LS_RJT) in qla_parse_auth_els_ctl()
3530 a->els_opcode = ELS_LS_RJT; in qla_parse_auth_els_ctl()
3532 a->did = sp->fcport->d_id; in qla_parse_auth_els_ctl()
3533 a->els_opcode = request->rqst_data.h_els.command_code; in qla_parse_auth_els_ctl()
3534 a->nport_handle = cpu_to_le16(sp->fcport->loop_id); in qla_parse_auth_els_ctl()
3535 a->vp_idx = sp->vha->vp_idx; in qla_parse_auth_els_ctl()
3540 struct fc_bsg_request *bsg_request = bsg_job->request; in qla_edif_process_els()
3541 struct fc_bsg_reply *bsg_reply = bsg_job->reply; in qla_edif_process_els()
3543 struct qla_hw_data *ha = vha->hw; in qla_edif_process_els()
3548 (struct qla_bsg_auth_els_request *)bsg_job->request; in qla_edif_process_els()
3550 (struct qla_bsg_auth_els_reply *)bsg_job->reply; in qla_edif_process_els()
3552 rpl->version = EDIF_VERSION1; in qla_edif_process_els()
3554 d_id.b.al_pa = bsg_request->rqst_data.h_els.port_id[2]; in qla_edif_process_els()
3555 d_id.b.area = bsg_request->rqst_data.h_els.port_id[1]; in qla_edif_process_els()
3556 d_id.b.domain = bsg_request->rqst_data.h_els.port_id[0]; in qla_edif_process_els()
3564 SET_DID_STATUS(bsg_reply->result, DID_ERROR); in qla_edif_process_els()
3565 return -EIO; in qla_edif_process_els()
3573 "%s ELS code %x, no loop id.\n", __func__, in qla_edif_process_els()
3574 bsg_request->rqst_data.r_els.els_code); in qla_edif_process_els()
3575 SET_DID_STATUS(bsg_reply->result, DID_BAD_TARGET); in qla_edif_process_els()
3576 return -ENXIO; in qla_edif_process_els()
3579 if (!vha->flags.online) { in qla_edif_process_els()
3581 SET_DID_STATUS(bsg_reply->result, DID_BAD_TARGET); in qla_edif_process_els()
3582 rval = -EIO; in qla_edif_process_els()
3590 SET_DID_STATUS(bsg_reply->result, DID_BAD_TARGET); in qla_edif_process_els()
3591 rval = -EPERM; in qla_edif_process_els()
3598 "Failed get sp pid=%06x\n", fcport->d_id.b24); in qla_edif_process_els()
3599 rval = -ENOMEM; in qla_edif_process_els()
3600 SET_DID_STATUS(bsg_reply->result, DID_IMM_RETRY); in qla_edif_process_els()
3604 sp->remap.req.len = bsg_job->request_payload.payload_len; in qla_edif_process_els()
3605 sp->remap.req.buf = dma_pool_alloc(ha->purex_dma_pool, in qla_edif_process_els()
3606 GFP_KERNEL, &sp->remap.req.dma); in qla_edif_process_els()
3607 if (!sp->remap.req.buf) { in qla_edif_process_els()
3610 bsg_job->request_payload.payload_len); in qla_edif_process_els()
3611 rval = -ENOMEM; in qla_edif_process_els()
3612 SET_DID_STATUS(bsg_reply->result, DID_IMM_RETRY); in qla_edif_process_els()
3616 sp->remap.rsp.len = bsg_job->reply_payload.payload_len; in qla_edif_process_els()
3617 sp->remap.rsp.buf = dma_pool_alloc(ha->purex_dma_pool, in qla_edif_process_els()
3618 GFP_KERNEL, &sp->remap.rsp.dma); in qla_edif_process_els()
3619 if (!sp->remap.rsp.buf) { in qla_edif_process_els()
3622 bsg_job->reply_payload.payload_len); in qla_edif_process_els()
3623 rval = -ENOMEM; in qla_edif_process_els()
3624 SET_DID_STATUS(bsg_reply->result, DID_IMM_RETRY); in qla_edif_process_els()
3627 sg_copy_to_buffer(bsg_job->request_payload.sg_list, in qla_edif_process_els()
3628 bsg_job->request_payload.sg_cnt, sp->remap.req.buf, in qla_edif_process_els()
3629 sp->remap.req.len); in qla_edif_process_els()
3630 sp->remap.remapped = true; in qla_edif_process_els()
3632 sp->type = SRB_ELS_CMD_HST_NOLOGIN; in qla_edif_process_els()
3633 sp->name = "SPCN_BSG_HST_NOLOGIN"; in qla_edif_process_els()
3634 sp->u.bsg_cmd.bsg_job = bsg_job; in qla_edif_process_els()
3637 sp->free = qla2x00_bsg_sp_free; in qla_edif_process_els()
3638 sp->done = qla2x00_bsg_job_done; in qla_edif_process_els()
3647 __func__, sc_to_str(p->e.sub_cmd), fcport->port_name, in qla_edif_process_els()
3648 p->e.extra_rx_xchg_address, p->e.extra_control_flags, in qla_edif_process_els()
3649 sp->handle, sp->remap.req.len, bsg_job); in qla_edif_process_els()
3660 SET_DID_STATUS(bsg_reply->result, DID_IMM_RETRY); in qla_edif_process_els()
3661 rval = -EIO; in qla_edif_process_els()
3667 dma_pool_free(ha->purex_dma_pool, sp->remap.rsp.buf, in qla_edif_process_els()
3668 sp->remap.rsp.dma); in qla_edif_process_els()
3670 dma_pool_free(ha->purex_dma_pool, sp->remap.req.buf, in qla_edif_process_els()
3671 sp->remap.req.dma); in qla_edif_process_els()
3683 if (sess->edif.app_sess_online && DBELL_ACTIVE(vha)) { in qla_edif_sess_down()
3686 __func__, sess->port_name); in qla_edif_sess_down()
3687 sess->edif.app_sess_online = 0; in qla_edif_sess_down()
3688 sess->edif.sess_down_acked = 0; in qla_edif_sess_down()
3690 sess->d_id.b24, 0, sess); in qla_edif_sess_down()
3691 qla2x00_post_aen_work(vha, FCH_EVT_PORT_OFFLINE, sess->d_id.b24); in qla_edif_sess_down()
3693 while (!READ_ONCE(sess->edif.sess_down_acked) && in qla_edif_sess_down()
3694 !test_bit(VPORT_DELETE, &vha->dpc_flags)) { in qla_edif_sess_down()
3700 sess->edif.sess_down_acked = 0; in qla_edif_sess_down()
3703 __func__, sess->port_name); in qla_edif_sess_down()
3709 if (!(fcport->flags & FCF_FCSP_DEVICE)) in qla_edif_clear_appdata()
3712 qla_edb_clear(vha, fcport->d_id); in qla_edif_clear_appdata()
3713 qla_enode_clear(vha, fcport->d_id); in qla_edif_clear_appdata()