// SPDX-License-Identifier: GPL-2.0-only /* * QLogic Fibre Channel HBA Driver * Copyright (c) 2003-2014 QLogic Corporation */ #include "qla_def.h" #include "qla_target.h" #include <linux/utsname.h> static int qla2x00_sns_ga_nxt(scsi_qla_host_t *, fc_port_t *); static int qla2x00_sns_gid_pt(scsi_qla_host_t *, sw_info_t *); static int qla2x00_sns_gpn_id(scsi_qla_host_t *, sw_info_t *); static int qla2x00_sns_gnn_id(scsi_qla_host_t *, sw_info_t *); static int qla2x00_sns_rft_id(scsi_qla_host_t *); static int qla2x00_sns_rnn_id(scsi_qla_host_t *); static int qla_async_rftid(scsi_qla_host_t *, port_id_t *); static int qla_async_rffid(scsi_qla_host_t *, port_id_t *, u8, u8); static int qla_async_rnnid(scsi_qla_host_t *, port_id_t *, u8*); static int qla_async_rsnn_nn(scsi_qla_host_t *); /** * qla2x00_prep_ms_iocb() - Prepare common MS/CT IOCB fields for SNS CT query. * @vha: HA context * @arg: CT arguments * * Returns a pointer to the @vha's ms_iocb. */ void * qla2x00_prep_ms_iocb(scsi_qla_host_t *vha, struct ct_arg *arg) { … } /** * qla24xx_prep_ms_iocb() - Prepare common CT IOCB fields for SNS CT query. * @vha: HA context * @arg: CT arguments * * Returns a pointer to the @ha's ms_iocb. */ void * qla24xx_prep_ms_iocb(scsi_qla_host_t *vha, struct ct_arg *arg) { … } /** * qla2x00_prep_ct_req() - Prepare common CT request fields for SNS query. * @p: CT request buffer * @cmd: GS command * @rsp_size: response size in bytes * * Returns a pointer to the intitialized @ct_req. */ static inline struct ct_sns_req * qla2x00_prep_ct_req(struct ct_sns_pkt *p, uint16_t cmd, uint16_t rsp_size) { … } int qla2x00_chk_ms_status(scsi_qla_host_t *vha, ms_iocb_entry_t *ms_pkt, struct ct_sns_rsp *ct_rsp, const char *routine) { … } /** * qla2x00_ga_nxt() - SNS scan for fabric devices via GA_NXT command. * @vha: HA context * @fcport: fcport entry to updated * * Returns 0 on success. */ int qla2x00_ga_nxt(scsi_qla_host_t *vha, fc_port_t *fcport) { … } static inline int qla2x00_gid_pt_rsp_size(scsi_qla_host_t *vha) { … } /** * qla2x00_gid_pt() - SNS scan for fabric devices via GID_PT command. * @vha: HA context * @list: switch info entries to populate * * NOTE: Non-Nx_Ports are not requested. * * Returns 0 on success. */ int qla2x00_gid_pt(scsi_qla_host_t *vha, sw_info_t *list) { … } /** * qla2x00_gpn_id() - SNS Get Port Name (GPN_ID) query. * @vha: HA context * @list: switch info entries to populate * * Returns 0 on success. */ int qla2x00_gpn_id(scsi_qla_host_t *vha, sw_info_t *list) { … } /** * qla2x00_gnn_id() - SNS Get Node Name (GNN_ID) query. * @vha: HA context * @list: switch info entries to populate * * Returns 0 on success. */ int qla2x00_gnn_id(scsi_qla_host_t *vha, sw_info_t *list) { … } static void qla2x00_async_sns_sp_done(srb_t *sp, int rc) { … } /** * qla2x00_rft_id() - SNS Register FC-4 TYPEs (RFT_ID) supported by the HBA. * @vha: HA context * * Returns 0 on success. */ int qla2x00_rft_id(scsi_qla_host_t *vha) { … } static int qla_async_rftid(scsi_qla_host_t *vha, port_id_t *d_id) { … } /** * qla2x00_rff_id() - SNS Register FC-4 Features (RFF_ID) supported by the HBA. * @vha: HA context * @type: not used * * Returns 0 on success. */ int qla2x00_rff_id(scsi_qla_host_t *vha, u8 type) { … } static int qla_async_rffid(scsi_qla_host_t *vha, port_id_t *d_id, u8 fc4feature, u8 fc4type) { … } /** * qla2x00_rnn_id() - SNS Register Node Name (RNN_ID) of the HBA. * @vha: HA context * * Returns 0 on success. */ int qla2x00_rnn_id(scsi_qla_host_t *vha) { … } static int qla_async_rnnid(scsi_qla_host_t *vha, port_id_t *d_id, u8 *node_name) { … } size_t qla2x00_get_sym_node_name(scsi_qla_host_t *vha, uint8_t *snn, size_t size) { … } /** * qla2x00_rsnn_nn() - SNS Register Symbolic Node Name (RSNN_NN) of the HBA. * @vha: HA context * * Returns 0 on success. */ int qla2x00_rsnn_nn(scsi_qla_host_t *vha) { … } static int qla_async_rsnn_nn(scsi_qla_host_t *vha) { … } /** * qla2x00_prep_sns_cmd() - Prepare common SNS command request fields for query. * @vha: HA context * @cmd: GS command * @scmd_len: Subcommand length * @data_size: response size in bytes * * Returns a pointer to the @ha's sns_cmd. */ static inline struct sns_cmd_pkt * qla2x00_prep_sns_cmd(scsi_qla_host_t *vha, uint16_t cmd, uint16_t scmd_len, uint16_t data_size) { … } /** * qla2x00_sns_ga_nxt() - SNS scan for fabric devices via GA_NXT command. * @vha: HA context * @fcport: fcport entry to updated * * This command uses the old Exectute SNS Command mailbox routine. * * Returns 0 on success. */ static int qla2x00_sns_ga_nxt(scsi_qla_host_t *vha, fc_port_t *fcport) { … } /** * qla2x00_sns_gid_pt() - SNS scan for fabric devices via GID_PT command. * @vha: HA context * @list: switch info entries to populate * * This command uses the old Exectute SNS Command mailbox routine. * * NOTE: Non-Nx_Ports are not requested. * * Returns 0 on success. */ static int qla2x00_sns_gid_pt(scsi_qla_host_t *vha, sw_info_t *list) { … } /** * qla2x00_sns_gpn_id() - SNS Get Port Name (GPN_ID) query. * @vha: HA context * @list: switch info entries to populate * * This command uses the old Exectute SNS Command mailbox routine. * * Returns 0 on success. */ static int qla2x00_sns_gpn_id(scsi_qla_host_t *vha, sw_info_t *list) { … } /** * qla2x00_sns_gnn_id() - SNS Get Node Name (GNN_ID) query. * @vha: HA context * @list: switch info entries to populate * * This command uses the old Exectute SNS Command mailbox routine. * * Returns 0 on success. */ static int qla2x00_sns_gnn_id(scsi_qla_host_t *vha, sw_info_t *list) { … } /** * qla2x00_sns_rft_id() - SNS Register FC-4 TYPEs (RFT_ID) supported by the HBA. * @vha: HA context * * This command uses the old Exectute SNS Command mailbox routine. * * Returns 0 on success. */ static int qla2x00_sns_rft_id(scsi_qla_host_t *vha) { … } /** * qla2x00_sns_rnn_id() - SNS Register Node Name (RNN_ID) of the HBA. * @vha: HA context * * This command uses the old Exectute SNS Command mailbox routine. * * Returns 0 on success. */ static int qla2x00_sns_rnn_id(scsi_qla_host_t *vha) { … } /** * qla2x00_mgmt_svr_login() - Login to fabric Management Service. * @vha: HA context * * Returns 0 on success. */ int qla2x00_mgmt_svr_login(scsi_qla_host_t *vha) { … } /** * qla2x00_prep_ms_fdmi_iocb() - Prepare common MS IOCB fields for FDMI query. * @vha: HA context * @req_size: request size in bytes * @rsp_size: response size in bytes * * Returns a pointer to the @ha's ms_iocb. */ void * qla2x00_prep_ms_fdmi_iocb(scsi_qla_host_t *vha, uint32_t req_size, uint32_t rsp_size) { … } /** * qla24xx_prep_ms_fdmi_iocb() - Prepare common MS IOCB fields for FDMI query. * @vha: HA context * @req_size: request size in bytes * @rsp_size: response size in bytes * * Returns a pointer to the @ha's ms_iocb. */ void * qla24xx_prep_ms_fdmi_iocb(scsi_qla_host_t *vha, uint32_t req_size, uint32_t rsp_size) { … } static void qla2x00_update_ms_fdmi_iocb(scsi_qla_host_t *vha, uint32_t req_size) { … } /** * qla2x00_prep_ct_fdmi_req() - Prepare common CT request fields for SNS query. * @p: CT request buffer * @cmd: GS command * @rsp_size: response size in bytes * * Returns a pointer to the intitialized @ct_req. */ static inline struct ct_sns_req * qla2x00_prep_ct_fdmi_req(struct ct_sns_pkt *p, uint16_t cmd, uint16_t rsp_size) { … } uint qla25xx_fdmi_port_speed_capability(struct qla_hw_data *ha) { … } uint qla25xx_fdmi_port_speed_currently(struct qla_hw_data *ha) { … } /** * qla2x00_hba_attributes() - perform HBA attributes registration * @vha: HA context * @entries: number of entries to use * @callopt: Option to issue extended or standard FDMI * command parameter * * Returns 0 on success. */ static unsigned long qla2x00_hba_attributes(scsi_qla_host_t *vha, void *entries, unsigned int callopt) { … } /** * qla2x00_port_attributes() - perform Port attributes registration * @vha: HA context * @entries: number of entries to use * @callopt: Option to issue extended or standard FDMI * command parameter * * Returns 0 on success. */ static unsigned long qla2x00_port_attributes(scsi_qla_host_t *vha, void *entries, unsigned int callopt) { … } /** * qla2x00_fdmi_rhba() - perform RHBA FDMI registration * @vha: HA context * @callopt: Option to issue FDMI registration * * Returns 0 on success. */ static int qla2x00_fdmi_rhba(scsi_qla_host_t *vha, unsigned int callopt) { … } static int qla2x00_fdmi_dhba(scsi_qla_host_t *vha) { … } /** * qla2x00_fdmi_rprt() - perform RPRT registration * @vha: HA context * @callopt: Option to issue extended or standard FDMI * command parameter * * Returns 0 on success. */ static int qla2x00_fdmi_rprt(scsi_qla_host_t *vha, int callopt) { … } /** * qla2x00_fdmi_rpa() - perform RPA registration * @vha: HA context * @callopt: Option to issue FDMI registration * * Returns 0 on success. */ static int qla2x00_fdmi_rpa(scsi_qla_host_t *vha, uint callopt) { … } /** * qla2x00_fdmi_register() - * @vha: HA context * * Returns 0 on success. */ int qla2x00_fdmi_register(scsi_qla_host_t *vha) { … } /** * qla2x00_gfpn_id() - SNS Get Fabric Port Name (GFPN_ID) query. * @vha: HA context * @list: switch info entries to populate * * Returns 0 on success. */ int qla2x00_gfpn_id(scsi_qla_host_t *vha, sw_info_t *list) { … } static inline struct ct_sns_req * qla24xx_prep_ct_fm_req(struct ct_sns_pkt *p, uint16_t cmd, uint16_t rsp_size) { … } static uint16_t qla2x00_port_speed_capability(uint16_t speed) { … } /** * qla2x00_gpsc() - FCS Get Port Speed Capabilities (GPSC) query. * @vha: HA context * @list: switch info entries to populate * * Returns 0 on success. */ int qla2x00_gpsc(scsi_qla_host_t *vha, sw_info_t *list) { … } /** * qla2x00_gff_id() - SNS Get FC-4 Features (GFF_ID) query. * * @vha: HA context * @list: switch info entries to populate * */ void qla2x00_gff_id(scsi_qla_host_t *vha, sw_info_t *list) { … } int qla24xx_post_gpsc_work(struct scsi_qla_host *vha, fc_port_t *fcport) { … } void qla24xx_handle_gpsc_event(scsi_qla_host_t *vha, struct event_arg *ea) { … } static void qla24xx_async_gpsc_sp_done(srb_t *sp, int res) { … } int qla24xx_async_gpsc(scsi_qla_host_t *vha, fc_port_t *fcport) { … } void qla24xx_sp_unmap(scsi_qla_host_t *vha, srb_t *sp) { … } void qla24xx_async_gffid_sp_done(srb_t *sp, int res) { … } /* Get FC4 Feature with Nport ID. */ int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport, bool wait) { … } /* GPN_FT + GNN_FT*/ static int qla2x00_is_a_vp(scsi_qla_host_t *vha, u64 wwn) { … } static bool qla_ok_to_clear_rscn(scsi_qla_host_t *vha, fc_port_t *fcport) { … } void qla_fab_scan_finish(scsi_qla_host_t *vha, srb_t *sp) { … } static int qla2x00_post_next_scan_work(struct scsi_qla_host *vha, srb_t *sp, int cmd) { … } static void qla2x00_find_free_fcp_nvme_slot(struct scsi_qla_host *vha, struct srb *sp) { … } static void qla_async_scan_sp_done(srb_t *sp, int res) { … } /* Get WWPN list for certain fc4_type */ int qla_fab_async_scan(scsi_qla_host_t *vha, srb_t *sp) { … } void qla_fab_scan_start(struct scsi_qla_host *vha) { … } void qla_scan_work_fn(struct work_struct *work) { … } /* GPFN_ID */ void qla24xx_handle_gfpnid_event(scsi_qla_host_t *vha, struct event_arg *ea) { … } static void qla2x00_async_gfpnid_sp_done(srb_t *sp, int res) { … } int qla24xx_async_gfpnid(scsi_qla_host_t *vha, fc_port_t *fcport) { … } int qla24xx_post_gfpnid_work(struct scsi_qla_host *vha, fc_port_t *fcport) { … }