linux/drivers/xen/xen-scsiback.c

/*
 * Xen SCSI backend driver
 *
 * Copyright (c) 2008, FUJITSU Limited
 *
 * Based on the blkback driver code.
 * Adaption to kernel taget core infrastructure taken from vhost/scsi.c
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation; or, when distributed
 * separately from the Linux kernel or incorporated into other
 * software packages, subject to the following license:
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this source file (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy, modify,
 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
 * and to permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

#define pr_fmt(fmt)

#include <linux/module.h>
#include <linux/utsname.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/wait.h>
#include <linux/sched.h>
#include <linux/list.h>
#include <linux/gfp.h>
#include <linux/delay.h>
#include <linux/spinlock.h>
#include <linux/configfs.h>

#include <generated/utsrelease.h>

#include <scsi/scsi_host.h> /* SG_ALL */

#include <target/target_core_base.h>
#include <target/target_core_fabric.h>

#include <asm/hypervisor.h>

#include <xen/xen.h>
#include <xen/balloon.h>
#include <xen/events.h>
#include <xen/xenbus.h>
#include <xen/grant_table.h>
#include <xen/page.h>

#include <xen/interface/grant_table.h>
#include <xen/interface/io/vscsiif.h>

#define VSCSI_VERSION
#define VSCSI_NAMELEN

struct ids_tuple {};

struct v2p_entry {};

struct vscsibk_info {};

/* theoretical maximum of grants for one request */
#define VSCSI_MAX_GRANTS

/*
 * VSCSI_GRANT_BATCH is the maximum number of grants to be processed in one
 * call to map/unmap grants. Don't choose it too large, as there are arrays
 * with VSCSI_GRANT_BATCH elements allocated on the stack.
 */
#define VSCSI_GRANT_BATCH

struct vscsibk_pend {};

#define VSCSI_DEFAULT_SESSION_TAGS

struct scsiback_nexus {};

struct scsiback_tport {};

struct scsiback_tpg {};

#define SCSIBACK_INVALID_HANDLE

static bool log_print_stat;
module_param(log_print_stat, bool, 0644);

static int scsiback_max_buffer_pages =;
module_param_named(max_buffer_pages, scsiback_max_buffer_pages, int, 0644);
MODULE_PARM_DESC();

/* Global spinlock to protect scsiback TPG list */
static DEFINE_MUTEX(scsiback_mutex);
static LIST_HEAD(scsiback_list);

static void scsiback_get(struct vscsibk_info *info)
{}

static void scsiback_put(struct vscsibk_info *info)
{}

static unsigned long vaddr_page(struct page *page)
{}

static unsigned long vaddr(struct vscsibk_pend *req, int seg)
{}

static void scsiback_print_status(char *sense_buffer, int errors,
					struct vscsibk_pend *pending_req)
{}

static void scsiback_fast_flush_area(struct vscsibk_pend *req)
{}

static void scsiback_free_translation_entry(struct kref *kref)
{}

static int32_t scsiback_result(int32_t result)
{}

static void scsiback_send_response(struct vscsibk_info *info,
			char *sense_buffer, int32_t result, uint32_t resid,
			uint16_t rqid)
{}

static void scsiback_do_resp_with_sense(char *sense_buffer, int32_t result,
			uint32_t resid, struct vscsibk_pend *pending_req)
{}

static void scsiback_cmd_done(struct vscsibk_pend *pending_req)
{}

static void scsiback_cmd_exec(struct vscsibk_pend *pending_req)
{}

static int scsiback_gnttab_data_map_batch(struct gnttab_map_grant_ref *map,
	struct page **pg, grant_handle_t *grant, int cnt)
{}

static int scsiback_gnttab_data_map_list(struct vscsibk_pend *pending_req,
			struct scsiif_request_segment *seg, struct page **pg,
			grant_handle_t *grant, int cnt, u32 flags)
{}

static int scsiback_gnttab_data_map(struct vscsiif_request *ring_req,
					struct vscsibk_pend *pending_req)
{}

static void scsiback_disconnect(struct vscsibk_info *info)
{}

static void scsiback_device_action(struct vscsibk_pend *pending_req,
	enum tcm_tmreq_table act, int tag)
{}

/*
  Perform virtual to physical translation
*/
static struct v2p_entry *scsiback_do_translation(struct vscsibk_info *info,
			struct ids_tuple *v)
{}

static struct vscsibk_pend *scsiback_get_pend_req(struct vscsiif_back_ring *ring,
				struct v2p_entry *v2p)
{}

static struct vscsibk_pend *prepare_pending_reqs(struct vscsibk_info *info,
				struct vscsiif_back_ring *ring,
				struct vscsiif_request *ring_req)
{}

static int scsiback_do_cmd_fn(struct vscsibk_info *info,
			      unsigned int *eoi_flags)
{}

static irqreturn_t scsiback_irq_fn(int irq, void *dev_id)
{}

static int scsiback_init_sring(struct vscsibk_info *info, grant_ref_t ring_ref,
			evtchn_port_t evtchn)
{}

static int scsiback_map(struct vscsibk_info *info)
{}

/*
  Check for a translation entry being present
*/
static struct v2p_entry *scsiback_chk_translation_entry(
	struct vscsibk_info *info, struct ids_tuple *v)
{}

/*
  Add a new translation entry
*/
static int scsiback_add_translation_entry(struct vscsibk_info *info,
					  char *phy, struct ids_tuple *v)
{}

/*
  Delete the translation entry specified
*/
static int scsiback_del_translation_entry(struct vscsibk_info *info,
					  struct ids_tuple *v)
{}

static void scsiback_do_add_lun(struct vscsibk_info *info, const char *state,
				char *phy, struct ids_tuple *vir, int try)
{}

static void scsiback_do_del_lun(struct vscsibk_info *info, const char *state,
				struct ids_tuple *vir)
{}

#define VSCSIBACK_OP_ADD_OR_DEL_LUN
#define VSCSIBACK_OP_UPDATEDEV_STATE

static void scsiback_do_1lun_hotplug(struct vscsibk_info *info, int op,
				     char *ent)
{}

static void scsiback_do_lun_hotplug(struct vscsibk_info *info, int op)
{}

static void scsiback_frontend_changed(struct xenbus_device *dev,
					enum xenbus_state frontend_state)
{}

/*
  Release the translation entry specfied
*/
static void scsiback_release_translation_entry(struct vscsibk_info *info)
{}

static void scsiback_remove(struct xenbus_device *dev)
{}

static int scsiback_probe(struct xenbus_device *dev,
			   const struct xenbus_device_id *id)
{}

static char *scsiback_dump_proto_id(struct scsiback_tport *tport)
{}

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

static u16 scsiback_get_tag(struct se_portal_group *se_tpg)
{}

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

static void scsiback_drop_tport(struct se_wwn *wwn)
{}

static int scsiback_check_stop_free(struct se_cmd *se_cmd)
{}

static void scsiback_release_cmd(struct se_cmd *se_cmd)
{}

static int scsiback_write_pending(struct se_cmd *se_cmd)
{}

static int scsiback_queue_data_in(struct se_cmd *se_cmd)
{}

static int scsiback_queue_status(struct se_cmd *se_cmd)
{}

static void scsiback_queue_tm_rsp(struct se_cmd *se_cmd)
{}

static void scsiback_aborted_task(struct se_cmd *se_cmd)
{}

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

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

CONFIGFS_ATTR();

static struct configfs_attribute *scsiback_param_attrs[] =;

static int scsiback_alloc_sess_cb(struct se_portal_group *se_tpg,
				  struct se_session *se_sess, void *p)
{}

static int scsiback_make_nexus(struct scsiback_tpg *tpg,
				const char *name)
{}

static int scsiback_drop_nexus(struct scsiback_tpg *tpg)
{}

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

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

CONFIGFS_ATTR();

static struct configfs_attribute *scsiback_tpg_attrs[] =;

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

CONFIGFS_ATTR_RO();

static struct configfs_attribute *scsiback_wwn_attrs[] =;

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

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

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

static void scsiback_drop_tpg(struct se_portal_group *se_tpg)
{}

static int scsiback_check_true(struct se_portal_group *se_tpg)
{}

static const struct target_core_fabric_ops scsiback_ops =;

static const struct xenbus_device_id scsiback_ids[] =;

static struct xenbus_driver scsiback_driver =;

static int __init scsiback_init(void)
{}

static void __exit scsiback_exit(void)
{}

module_init();
module_exit(scsiback_exit);

MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_ALIAS();
MODULE_AUTHOR();