linux/drivers/scsi/qla2xxx/tcm_qla2xxx.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*******************************************************************************
 * This file contains tcm implementation using v4 configfs fabric infrastructure
 * for QLogic target mode HBAs
 *
 * (c) Copyright 2010-2013 Datera, Inc.
 *
 * Author: Nicholas A. Bellinger <[email protected]>
 *
 * tcm_qla2xxx_parse_wwn() and tcm_qla2xxx_format_wwn() contains code from
 * the TCM_FC / Open-FCoE.org fabric module.
 *
 * Copyright (c) 2010 Cisco Systems, Inc
 *
 ****************************************************************************/


#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;

/*
 * Parse WWN.
 * If strict, we require lower-case hex and colon separators to be sure
 * the name is the same as what would be generated by ft_format_wwn()
 * so the name and wwn are mapped one-to-one.
 */
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)
{}

/*
 * From drivers/scsi/scsi_transport_fc.c:fc_parse_wwn
 */
static int tcm_qla2xxx_npiv_extract_wwn(const char *ns, u64 *nm)
{}

/*
 * This parsing logic follows drivers/scsi/scsi_transport_fc.c:
 * store_fc_host_vport_create()
 */
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)
{}

/*
 * Called from qla_target_template->free_mcmd(), and will call
 * tcm_qla2xxx_release_cmd() via normal struct target_core_fabric_ops
 * release callback.  qla_hw_data->hardware_lock is expected to be held
 */
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)
{}

/*
 * Called from qla_target_template->free_cmd(), and will call
 * tcm_qla2xxx_release_cmd via normal struct target_core_fabric_ops
 * release callback.  qla_hw_data->hardware_lock is expected to be held
 */
static void tcm_qla2xxx_free_cmd(struct qla_tgt_cmd *cmd)
{}

/*
 * Called from struct target_core_fabric_ops->check_stop_free() context
 */
static int tcm_qla2xxx_check_stop_free(struct se_cmd *se_cmd)
{}

/* tcm_qla2xxx_release_cmd - Callback from TCM Core to release underlying
 * fabric descriptor @se_cmd command to release
 */
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)
{}

/*
 * Called from process context in qla_target.c:qlt_do_work() code
 */
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)
{}

/*
 * Called from qla_target.c:qlt_do_ctio_completion()
 */
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)
{}

/*
 * Called from qla_target.c:qlt_issue_task_mgmt()
 */
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 *);
/*
 * Expected to be called with struct qla_hw_data->tgt.sess_lock held
 */
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)
{}

/* Start items for tcm_qla2xxx_tpg_attrib_cit */

#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[] =;

/* End items for tcm_qla2xxx_tpg_attrib_cit */

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)
{}

/*
 * Expected to be called with struct qla_hw_data->tgt.sess_lock held
 */
static struct fc_port *tcm_qla2xxx_find_sess_by_s_id(scsi_qla_host_t *vha,
						     const be_id_t s_id)
{}

/*
 * Expected to be called with struct qla_hw_data->tgt.sess_lock held
 */
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)
{}

/*
 * Expected to be called with struct qla_hw_data->tgt.sess_lock held
 */
static struct fc_port *tcm_qla2xxx_find_sess_by_loop_id(
	scsi_qla_host_t *vha,
	const uint16_t loop_id)
{}

/*
 * Expected to be called with struct qla_hw_data->tgt.sess_lock held
 */
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)
{}

/*
 * Should always be called with qla_hw_data->tgt.sess_lock held.
 */
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)
{}

/*
 * Called via qlt_create_sess():ha->qla2x_tmpl->check_initiator_node_acl()
 * to locate struct se_node_acl
 */
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)
{}

/*
 * Calls into tcm_qla2xxx used by qla2xxx LLD I/O path.
 */
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);