#include <linux/module.h>
#include <linux/utsname.h>
#include <linux/vmalloc.h>
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/configfs.h>
#include <linux/ctype.h>
#include <asm/unaligned.h>
#include <scsi/scsi_host.h>
#include <target/target_core_base.h>
#include <target/target_core_fabric.h>
#include "qla_def.h"
#include "qla_target.h"
#include "tcm_qla2xxx.h"
static struct workqueue_struct *tcm_qla2xxx_free_wq;
static ssize_t tcm_qla2xxx_parse_wwn(const char *name, u64 *wwn, int strict)
{ … }
static ssize_t tcm_qla2xxx_format_wwn(char *buf, size_t len, u64 wwn)
{ … }
static int tcm_qla2xxx_npiv_extract_wwn(const char *ns, u64 *nm)
{ … }
static int tcm_qla2xxx_npiv_parse_wwn(
const char *name,
size_t count,
u64 *wwpn,
u64 *wwnn)
{ … }
static char *tcm_qla2xxx_get_fabric_wwn(struct se_portal_group *se_tpg)
{ … }
static u16 tcm_qla2xxx_get_tag(struct se_portal_group *se_tpg)
{ … }
static int tcm_qla2xxx_check_demo_mode(struct se_portal_group *se_tpg)
{ … }
static int tcm_qla2xxx_check_demo_mode_cache(struct se_portal_group *se_tpg)
{ … }
static int tcm_qla2xxx_check_demo_write_protect(struct se_portal_group *se_tpg)
{ … }
static int tcm_qla2xxx_check_prod_write_protect(struct se_portal_group *se_tpg)
{ … }
static int tcm_qla2xxx_check_demo_mode_login_only(struct se_portal_group *se_tpg)
{ … }
static int tcm_qla2xxx_check_prot_fabric_only(struct se_portal_group *se_tpg)
{ … }
static u32 tcm_qla2xxx_tpg_get_inst_index(struct se_portal_group *se_tpg)
{ … }
static void tcm_qla2xxx_complete_mcmd(struct work_struct *work)
{ … }
static void tcm_qla2xxx_free_mcmd(struct qla_tgt_mgmt_cmd *mcmd)
{ … }
static void tcm_qla2xxx_complete_free(struct work_struct *work)
{ … }
static struct qla_tgt_cmd *tcm_qla2xxx_get_cmd(struct fc_port *sess)
{ … }
static void tcm_qla2xxx_rel_cmd(struct qla_tgt_cmd *cmd)
{ … }
static void tcm_qla2xxx_free_cmd(struct qla_tgt_cmd *cmd)
{ … }
static int tcm_qla2xxx_check_stop_free(struct se_cmd *se_cmd)
{ … }
static void tcm_qla2xxx_release_cmd(struct se_cmd *se_cmd)
{ … }
static void tcm_qla2xxx_release_session(struct kref *kref)
{ … }
static void tcm_qla2xxx_put_sess(struct fc_port *sess)
{ … }
static void tcm_qla2xxx_close_session(struct se_session *se_sess)
{ … }
static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd)
{ … }
static int tcm_qla2xxx_get_cmd_state(struct se_cmd *se_cmd)
{ … }
static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,
unsigned char *cdb, uint32_t data_length, int fcp_task_attr,
int data_dir, int bidi)
{ … }
static void tcm_qla2xxx_handle_data_work(struct work_struct *work)
{ … }
static void tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd)
{ … }
static int tcm_qla2xxx_chk_dif_tags(uint32_t tag)
{ … }
static int tcm_qla2xxx_dif_tags(struct qla_tgt_cmd *cmd,
uint16_t *pfw_prot_opts)
{ … }
static int tcm_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, u64 lun,
uint16_t tmr_func, uint32_t tag)
{ … }
static struct qla_tgt_cmd *tcm_qla2xxx_find_cmd_by_tag(struct fc_port *sess,
uint64_t tag)
{ … }
static int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd)
{ … }
static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd)
{ … }
static void tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd)
{ … }
static void tcm_qla2xxx_aborted_task(struct se_cmd *se_cmd)
{ … }
static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *,
struct tcm_qla2xxx_nacl *, struct fc_port *);
static void tcm_qla2xxx_clear_nacl_from_fcport_map(struct fc_port *sess)
{ … }
static void tcm_qla2xxx_shutdown_sess(struct fc_port *sess)
{ … }
static int tcm_qla2xxx_init_nodeacl(struct se_node_acl *se_nacl,
const char *name)
{ … }
#define DEF_QLA_TPG_ATTRIB(name) …
DEF_QLA_TPG_ATTRIB(…);
DEF_QLA_TPG_ATTRIB(…);
DEF_QLA_TPG_ATTRIB(…);
DEF_QLA_TPG_ATTRIB(…);
DEF_QLA_TPG_ATTRIB(…);
#ifdef CONFIG_TCM_QLA2XXX_DEBUG
DEF_QLA_TPG_ATTRIB(…);
#endif
static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = …;
static int tcm_qla2xxx_enable_tpg(struct se_portal_group *se_tpg,
bool enable)
{ … }
static ssize_t tcm_qla2xxx_tpg_dynamic_sessions_show(struct config_item *item,
char *page)
{ … }
static ssize_t tcm_qla2xxx_tpg_fabric_prot_type_store(struct config_item *item,
const char *page, size_t count)
{ … }
static ssize_t tcm_qla2xxx_tpg_fabric_prot_type_show(struct config_item *item,
char *page)
{ … }
CONFIGFS_ATTR_RO(…);
CONFIGFS_ATTR(…);
static struct configfs_attribute *tcm_qla2xxx_tpg_attrs[] = …;
static struct se_portal_group *tcm_qla2xxx_make_tpg(struct se_wwn *wwn,
const char *name)
{ … }
static void tcm_qla2xxx_drop_tpg(struct se_portal_group *se_tpg)
{ … }
static int tcm_qla2xxx_npiv_enable_tpg(struct se_portal_group *se_tpg,
bool enable)
{ … }
static struct se_portal_group *tcm_qla2xxx_npiv_make_tpg(struct se_wwn *wwn,
const char *name)
{ … }
static struct fc_port *tcm_qla2xxx_find_sess_by_s_id(scsi_qla_host_t *vha,
const be_id_t s_id)
{ … }
static void tcm_qla2xxx_set_sess_by_s_id(
struct tcm_qla2xxx_lport *lport,
struct se_node_acl *new_se_nacl,
struct tcm_qla2xxx_nacl *nacl,
struct se_session *se_sess,
struct fc_port *fc_port,
be_id_t s_id)
{ … }
static struct fc_port *tcm_qla2xxx_find_sess_by_loop_id(
scsi_qla_host_t *vha,
const uint16_t loop_id)
{ … }
static void tcm_qla2xxx_set_sess_by_loop_id(
struct tcm_qla2xxx_lport *lport,
struct se_node_acl *new_se_nacl,
struct tcm_qla2xxx_nacl *nacl,
struct se_session *se_sess,
struct fc_port *fc_port,
uint16_t loop_id)
{ … }
static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *lport,
struct tcm_qla2xxx_nacl *nacl, struct fc_port *sess)
{ … }
static void tcm_qla2xxx_free_session(struct fc_port *sess)
{ … }
static int tcm_qla2xxx_session_cb(struct se_portal_group *se_tpg,
struct se_session *se_sess, void *p)
{ … }
static int tcm_qla2xxx_check_initiator_node_acl(
scsi_qla_host_t *vha,
unsigned char *fc_wwpn,
struct fc_port *qlat_sess)
{ … }
static void tcm_qla2xxx_update_sess(struct fc_port *sess, port_id_t s_id,
uint16_t loop_id, bool conf_compl_supported)
{ … }
static const struct qla_tgt_func_tmpl tcm_qla2xxx_template = …;
static int tcm_qla2xxx_init_lport(struct tcm_qla2xxx_lport *lport)
{ … }
static int tcm_qla2xxx_lport_register_cb(struct scsi_qla_host *vha,
void *target_lport_ptr,
u64 npiv_wwpn, u64 npiv_wwnn)
{ … }
static struct se_wwn *tcm_qla2xxx_make_lport(
struct target_fabric_configfs *tf,
struct config_group *group,
const char *name)
{ … }
static void tcm_qla2xxx_drop_lport(struct se_wwn *wwn)
{ … }
static int tcm_qla2xxx_lport_register_npiv_cb(struct scsi_qla_host *base_vha,
void *target_lport_ptr,
u64 npiv_wwpn, u64 npiv_wwnn)
{ … }
static struct se_wwn *tcm_qla2xxx_npiv_make_lport(
struct target_fabric_configfs *tf,
struct config_group *group,
const char *name)
{ … }
static void tcm_qla2xxx_npiv_drop_lport(struct se_wwn *wwn)
{ … }
static ssize_t tcm_qla2xxx_wwn_version_show(struct config_item *item,
char *page)
{ … }
CONFIGFS_ATTR_RO(…);
static struct configfs_attribute *tcm_qla2xxx_wwn_attrs[] = …;
static const struct target_core_fabric_ops tcm_qla2xxx_ops = …;
static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = …;
static int tcm_qla2xxx_register_configfs(void)
{ … }
static void tcm_qla2xxx_deregister_configfs(void)
{ … }
static int __init tcm_qla2xxx_init(void)
{ … }
static void __exit tcm_qla2xxx_exit(void)
{ … }
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
module_init(…) …;
module_exit(tcm_qla2xxx_exit);