linux/drivers/target/sbp/sbp_target.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * SBP2 target driver (SCSI over IEEE1394 in target mode)
 *
 * Copyright (C) 2011  Chris Boot <[email protected]>
 */

#define KMSG_COMPONENT
#define pr_fmt(fmt)

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/configfs.h>
#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/firewire.h>
#include <linux/firewire-constants.h>
#include <scsi/scsi_proto.h>
#include <scsi/scsi_tcq.h>
#include <target/target_core_base.h>
#include <target/target_core_backend.h>
#include <target/target_core_fabric.h>
#include <asm/unaligned.h>

#include "sbp_target.h"

/* FireWire address region for management and command block address handlers */
static const struct fw_address_region sbp_register_region =;

static const u32 sbp_unit_directory_template[] =;

#define SESSION_MAINTENANCE_INTERVAL

static atomic_t login_id =;

static void session_maintenance_work(struct work_struct *);
static int sbp_run_transaction(struct fw_card *, int, int, int, int,
		unsigned long long, void *, size_t);

static int read_peer_guid(u64 *guid, const struct sbp_management_request *req)
{}

static struct sbp_session *sbp_session_find_by_guid(
	struct sbp_tpg *tpg, u64 guid)
{}

static struct sbp_login_descriptor *sbp_login_find_by_lun(
		struct sbp_session *session, u32 unpacked_lun)
{}

static int sbp_login_count_all_by_lun(
		struct sbp_tpg *tpg,
		u32 unpacked_lun,
		int exclusive)
{}

static struct sbp_login_descriptor *sbp_login_find_by_id(
	struct sbp_tpg *tpg, int login_id)
{}

static u32 sbp_get_lun_from_tpg(struct sbp_tpg *tpg, u32 login_lun, int *err)
{}

static struct sbp_session *sbp_session_create(
		struct sbp_tpg *tpg,
		u64 guid)
{}

static void sbp_session_release(struct sbp_session *sess, bool cancel_work)
{}

static void sbp_target_agent_unregister(struct sbp_target_agent *);

static void sbp_login_release(struct sbp_login_descriptor *login,
	bool cancel_work)
{}

static struct sbp_target_agent *sbp_target_agent_register(
	struct sbp_login_descriptor *);

static void sbp_management_request_login(
	struct sbp_management_agent *agent, struct sbp_management_request *req,
	int *status_data_size)
{}

static void sbp_management_request_query_logins(
	struct sbp_management_agent *agent, struct sbp_management_request *req,
	int *status_data_size)
{}

static void sbp_management_request_reconnect(
	struct sbp_management_agent *agent, struct sbp_management_request *req,
	int *status_data_size)
{}

static void sbp_management_request_logout(
	struct sbp_management_agent *agent, struct sbp_management_request *req,
	int *status_data_size)
{}

static void session_check_for_reset(struct sbp_session *sess)
{}

static void session_reconnect_expired(struct sbp_session *sess)
{}

static void session_maintenance_work(struct work_struct *work)
{}

static int tgt_agent_rw_agent_state(struct fw_card *card, int tcode, void *data,
		struct sbp_target_agent *agent)
{}

static int tgt_agent_rw_agent_reset(struct fw_card *card, int tcode, void *data,
		struct sbp_target_agent *agent)
{}

static int tgt_agent_rw_orb_pointer(struct fw_card *card, int tcode, void *data,
		struct sbp_target_agent *agent)
{}

static int tgt_agent_rw_doorbell(struct fw_card *card, int tcode, void *data,
		struct sbp_target_agent *agent)
{}

static int tgt_agent_rw_unsolicited_status_enable(struct fw_card *card,
		int tcode, void *data, struct sbp_target_agent *agent)
{}

static void tgt_agent_rw(struct fw_card *card, struct fw_request *request,
		int tcode, int destination, int source, int generation,
		unsigned long long offset, void *data, size_t length,
		void *callback_data)
{}

static void sbp_handle_command(struct sbp_target_request *);
static int sbp_send_status(struct sbp_target_request *);
static void sbp_free_request(struct sbp_target_request *);

static void tgt_agent_process_work(struct work_struct *work)
{}

/* used to double-check we haven't been issued an AGENT_RESET */
static inline bool tgt_agent_check_active(struct sbp_target_agent *agent)
{}

static struct sbp_target_request *sbp_mgt_get_req(struct sbp_session *sess,
	struct fw_card *card, u64 next_orb)
{}

static void tgt_agent_fetch_work(struct work_struct *work)
{}

static struct sbp_target_agent *sbp_target_agent_register(
		struct sbp_login_descriptor *login)
{}

static void sbp_target_agent_unregister(struct sbp_target_agent *agent)
{}

/*
 * Simple wrapper around fw_run_transaction that retries the transaction several
 * times in case of failure, with an exponential backoff.
 */
static int sbp_run_transaction(struct fw_card *card, int tcode, int destination_id,
		int generation, int speed, unsigned long long offset,
		void *payload, size_t length)
{}

/*
 * Wrapper around sbp_run_transaction that gets the card, destination,
 * generation and speed out of the request's session.
 */
static int sbp_run_request_transaction(struct sbp_target_request *req,
		int tcode, unsigned long long offset, void *payload,
		size_t length)
{}

static int sbp_fetch_command(struct sbp_target_request *req)
{}

static int sbp_fetch_page_table(struct sbp_target_request *req)
{}

static void sbp_calc_data_length_direction(struct sbp_target_request *req,
	u32 *data_len, enum dma_data_direction *data_dir)
{}

static void sbp_handle_command(struct sbp_target_request *req)
{}

/*
 * DMA_TO_DEVICE = read from initiator (SCSI WRITE)
 * DMA_FROM_DEVICE = write to initiator (SCSI READ)
 */
static int sbp_rw_data(struct sbp_target_request *req)
{}

static int sbp_send_status(struct sbp_target_request *req)
{}

static void sbp_sense_mangle(struct sbp_target_request *req)
{}

static int sbp_send_sense(struct sbp_target_request *req)
{}

static void sbp_free_request(struct sbp_target_request *req)
{}

static void sbp_mgt_agent_process(struct work_struct *work)
{}

static void sbp_mgt_agent_rw(struct fw_card *card,
	struct fw_request *request, int tcode, int destination, int source,
	int generation, unsigned long long offset, void *data, size_t length,
	void *callback_data)
{}

static struct sbp_management_agent *sbp_management_agent_register(
		struct sbp_tport *tport)
{}

static void sbp_management_agent_unregister(struct sbp_management_agent *agent)
{}

static int sbp_check_true(struct se_portal_group *se_tpg)
{}

static char *sbp_get_fabric_wwn(struct se_portal_group *se_tpg)
{}

static u16 sbp_get_tag(struct se_portal_group *se_tpg)
{}

static void sbp_release_cmd(struct se_cmd *se_cmd)
{}

static int sbp_write_pending(struct se_cmd *se_cmd)
{}

static int sbp_queue_data_in(struct se_cmd *se_cmd)
{}

/*
 * Called after command (no data transfer) or after the write (to device)
 * operation is completed
 */
static int sbp_queue_status(struct se_cmd *se_cmd)
{}

static void sbp_queue_tm_rsp(struct se_cmd *se_cmd)
{}

static void sbp_aborted_task(struct se_cmd *se_cmd)
{}

static int sbp_check_stop_free(struct se_cmd *se_cmd)
{}

static int sbp_count_se_tpg_luns(struct se_portal_group *tpg)
{}

static int sbp_update_unit_directory(struct sbp_tport *tport)
{}

static ssize_t sbp_parse_wwn(const char *name, u64 *wwn)
{}

static ssize_t sbp_format_wwn(char *buf, size_t len, u64 wwn)
{}

static int sbp_init_nodeacl(struct se_node_acl *se_nacl, const char *name)
{}

static int sbp_post_link_lun(
		struct se_portal_group *se_tpg,
		struct se_lun *se_lun)
{}

static void sbp_pre_unlink_lun(
		struct se_portal_group *se_tpg,
		struct se_lun *se_lun)
{}

static struct se_portal_group *sbp_make_tpg(struct se_wwn *wwn,
					    const char *name)
{}

static void sbp_drop_tpg(struct se_portal_group *se_tpg)
{}

static struct se_wwn *sbp_make_tport(
		struct target_fabric_configfs *tf,
		struct config_group *group,
		const char *name)
{}

static void sbp_drop_tport(struct se_wwn *wwn)
{}

static ssize_t sbp_wwn_version_show(struct config_item *item, char *page)
{}

CONFIGFS_ATTR_RO();

static struct configfs_attribute *sbp_wwn_attrs[] =;

static ssize_t sbp_tpg_directory_id_show(struct config_item *item, char *page)
{}

static ssize_t sbp_tpg_directory_id_store(struct config_item *item,
		const char *page, size_t count)
{}

static int sbp_enable_tpg(struct se_portal_group *se_tpg, bool enable)
{}

CONFIGFS_ATTR();

static struct configfs_attribute *sbp_tpg_base_attrs[] =;

static ssize_t sbp_tpg_attrib_mgt_orb_timeout_show(struct config_item *item,
		char *page)
{}

static ssize_t sbp_tpg_attrib_mgt_orb_timeout_store(struct config_item *item,
		const char *page, size_t count)
{}

static ssize_t sbp_tpg_attrib_max_reconnect_timeout_show(struct config_item *item,
		char *page)
{}

static ssize_t sbp_tpg_attrib_max_reconnect_timeout_store(struct config_item *item,
		const char *page, size_t count)
{}

static ssize_t sbp_tpg_attrib_max_logins_per_lun_show(struct config_item *item,
		char *page)
{}

static ssize_t sbp_tpg_attrib_max_logins_per_lun_store(struct config_item *item,
		const char *page, size_t count)
{}

CONFIGFS_ATTR();
CONFIGFS_ATTR();
CONFIGFS_ATTR();

static struct configfs_attribute *sbp_tpg_attrib_attrs[] =;

static const struct target_core_fabric_ops sbp_ops =;

static int __init sbp_init(void)
{
	return target_register_template(&sbp_ops);
};

static void __exit sbp_exit(void)
{
	target_unregister_template(&sbp_ops);
};

MODULE_DESCRIPTION();
MODULE_LICENSE();
module_init();
module_exit(sbp_exit);