mirror of
https://github.com/SCST-project/scst.git
synced 2026-09-19 22:44:24 +00:00
svn+ssh://yanb123@svn.code.sf.net/p/scst/svn/trunk
........
r5785 | bvassche | 2014-09-09 14:09:20 +0300 (Tue, 09 Sep 2014) | 9 lines
scst_local: Change max_lun into SCST_MAX_LUN (16383)
Today SCST does not support LUN numbers >= 16384. Additionally,
there is a bug in older Linux initiator systems that prevents
proper handling of LUN numbers >= 2**32. See also Hannes Reinecke,
scsi_scan: Fixup scsilun_to_int(), June 25, 2014 (commit ID
d9e5d6183715e691b37afd3785c311d05cd1338d). Hence set max_lun to
16383.
........
r5786 | bvassche | 2014-09-09 14:27:27 +0300 (Tue, 09 Sep 2014) | 6 lines
scst_local: Set max_id to 1
The value 0 is not valid for the max_id member of struct Scsi_Host.
Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
........
r5793 | bvassche | 2014-09-10 14:42:54 +0300 (Wed, 10 Sep 2014) | 1 line
scstadmin: Sync saved configuration files
........
r5794 | bvassche | 2014-09-10 14:44:14 +0300 (Wed, 10 Sep 2014) | 2 lines
scstadmin test 06-cont-on-err.t: Filter out scstadmin version number
........
r5795 | bvassche | 2014-09-10 15:18:09 +0300 (Wed, 10 Sep 2014) | 1 line
ib_srpt: Add max_sge_delta kernel module parameter
........
r5796 | bvassche | 2014-09-10 15:20:30 +0300 (Wed, 10 Sep 2014) | 1 line
ib_srpt: Update Subversion ignore lists
........
r5798 | bvassche | 2014-09-12 14:16:35 +0300 (Fri, 12 Sep 2014) | 1 line
fcst/Makefile: Add release-archive target
........
r5801 | bvassche | 2014-09-12 14:20:16 +0300 (Fri, 12 Sep 2014) | 1 line
fcst: Change version number from 0.3 into 3.1.0-pre
........
r5802 | vlnb | 2014-09-13 04:13:29 +0300 (Sat, 13 Sep 2014) | 3 lines
Fix autofinding SCST headers in fileio_tgt
........
r5804 | vlnb | 2014-09-13 04:35:12 +0300 (Sat, 13 Sep 2014) | 3 lines
Web updates
........
r5805 | vlnb | 2014-09-13 04:37:12 +0300 (Sat, 13 Sep 2014) | 3 lines
Update root README to use symlink instead of bind mount for QLogic git driver integration
........
r5806 | bvassche | 2014-09-15 15:30:43 +0300 (Mon, 15 Sep 2014) | 1 line
ib_srpt: Make "make -j<n> install" work for n >= 2 if "make all" has not been run first
........
r5808 | bvassche | 2014-09-16 14:06:00 +0300 (Tue, 16 Sep 2014) | 6 lines
scst/src/Makefile: Make "make install" without prior "make" work
Avoid that MOD_VERS and MODS_VERS evaluate to an empty string.
Reported-by: Yan Burman <yanb@mellanox.com>
........
r5810 | bvassche | 2014-09-17 13:54:25 +0300 (Wed, 17 Sep 2014) | 1 line
scst_vdisk: Insert a blank line
........
r5811 | bvassche | 2014-09-17 13:56:40 +0300 (Wed, 17 Sep 2014) | 14 lines
vdisk_blockio: Make large COMPARE AND WRITE requests work for stacked block devices
Stacked block devices impose weird restrictions on S/G-lists. Hence
make the COMPARE AND WRITE implementation independent of these
restrictions.
Additionally, reduce the MAXIMUM COMPARE AND WRITE LENGTH limit from
0xff (no limit) to 0xfe to reduce the maximum amount of memory allocated
during a COMPARE AND WRITE. Also serialize COMPARE AND WRITE
operations, fix the offset reported for miscompares and fix the start
offset of the region that is synchronized if the FUA bit has been set.
Reported-by: Vishal Tripathi <vishal.tripathi@calsoftinc.com>
........
r5814 | bvassche | 2014-09-18 10:08:49 +0300 (Thu, 18 Sep 2014) | 1 line
nightly build: Update kernel versions
........
r5816 | vlnb | 2014-09-20 09:31:43 +0300 (Sat, 20 Sep 2014) | 3 lines
Web updates
........
r5817 | bvassche | 2014-09-28 21:54:04 +0200 (Sun, 28 Sep 2014) | 1 line
scripts/rebuild-rhel-kernel-rpm: Enable put_page_callback patch for RHEL 7
........
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/iser@5819 d57e44dd-8a1f-0410-8b47-8ef2f437770f
200 lines
6.1 KiB
C
200 lines
6.1 KiB
C
/*
|
|
* Copyright (c) 2010 Cisco Systems, Inc.
|
|
*
|
|
* This program is free software; you may redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; version 2 of the License.
|
|
*
|
|
* 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.
|
|
*
|
|
* $Id$
|
|
*/
|
|
#ifndef __SCSI_FCST_H__
|
|
#define __SCSI_FCST_H__
|
|
|
|
#ifdef INSIDE_KERNEL_TREE
|
|
#include <scst/scst.h>
|
|
#else
|
|
#include <linux/version.h>
|
|
#include "scst.h"
|
|
#endif
|
|
|
|
#define FT_VERSION "3.1.0-pre"
|
|
#define FT_MODULE "fcst"
|
|
|
|
#define FT_MAX_HW_PENDING_TIME 20 /* max I/O time in seconds */
|
|
|
|
/*
|
|
* Debug options.
|
|
*/
|
|
#define FT_DEBUG_CONF 0x01 /* configuration messages */
|
|
#define FT_DEBUG_SESS 0x02 /* session messages */
|
|
#define FT_DEBUG_IO 0x04 /* I/O operations */
|
|
|
|
extern unsigned int ft_debug_logging; /* debug options */
|
|
|
|
#define FT_ERR(fmt, args...) pr_err("%s: " fmt, __func__, ##args)
|
|
|
|
#define FT_DEBUG(mask, fmt, args...) \
|
|
do { \
|
|
if (ft_debug_logging & (mask)) \
|
|
pr_info("%s: " fmt, __func__, ##args); \
|
|
} while (0)
|
|
|
|
#define FT_CONF_DBG(fmt, args...) FT_DEBUG(FT_DEBUG_CONF, fmt, ##args)
|
|
#define FT_SESS_DBG(fmt, args...) FT_DEBUG(FT_DEBUG_SESS, fmt, ##args)
|
|
#define FT_IO_DBG(fmt, args...) FT_DEBUG(FT_DEBUG_IO, fmt, ##args)
|
|
|
|
#define FT_NAMELEN 32 /* length of ASCI WWPNs including pad */
|
|
|
|
/*
|
|
* Session (remote port).
|
|
*/
|
|
struct ft_sess {
|
|
u32 port_id; /* for hash lookup use only */
|
|
u32 params;
|
|
u16 max_payload; /* max transmitted payload size */
|
|
u32 max_lso_payload; /* max offloaded payload size */
|
|
u64 port_name; /* port name for transport ID */
|
|
struct ft_tport *tport;
|
|
struct scst_session *scst_sess;
|
|
struct hlist_node hash; /* linkage in ft_sess_hash table */
|
|
struct rcu_head rcu;
|
|
struct kref kref; /* ref for hash and outstanding I/Os */
|
|
};
|
|
|
|
/*
|
|
* Hash table of sessions per local port.
|
|
* Hash lookup by remote port FC_ID.
|
|
*/
|
|
#define FT_SESS_HASH_BITS 6
|
|
#define FT_SESS_HASH_SIZE (1 << FT_SESS_HASH_BITS)
|
|
|
|
/*
|
|
* Per local port data.
|
|
* This is created when the first session logs into the local port.
|
|
* Deleted when tpg is deleted or last session is logged off.
|
|
*/
|
|
struct ft_tport {
|
|
u32 sess_count; /* number of sessions in hash */
|
|
u8 enabled:1;
|
|
struct rcu_head rcu;
|
|
struct hlist_head hash[FT_SESS_HASH_SIZE]; /* list of sessions */
|
|
struct fc_lport *lport;
|
|
struct scst_tgt *tgt;
|
|
};
|
|
|
|
/**
|
|
* enum ft_cmd_state - SCSI command state managed by fcst
|
|
* @FT_STATE_NEW: New command arrived and is being processed.
|
|
* @FT_STATE_NEED_DATA: Processing a write or bidir command and waiting
|
|
* for data arrival.
|
|
* @FT_STATE_DATA_IN: Data for the write or bidir command arrived and is
|
|
* being processed.
|
|
* @FT_STATE_CMD_RSP_SENT: Response with SCSI status has been sent.
|
|
* @FT_STATE_MGMT: Processing a SCSI task management function.
|
|
* @FT_STATE_MGMT_RSP_SENT: Response for task management function has been sent.
|
|
* @FT_STATE_DONE: Command processing finished successfully, command
|
|
* processing has been aborted or command processing
|
|
* failed.
|
|
*/
|
|
enum ft_cmd_state {
|
|
FT_STATE_NEW = 0,
|
|
FT_STATE_NEED_DATA = 1,
|
|
FT_STATE_DATA_IN = 2,
|
|
FT_STATE_CMD_RSP_SENT = 3,
|
|
FT_STATE_MGMT = 4,
|
|
FT_STATE_MGMT_RSP_SENT = 5,
|
|
FT_STATE_DONE = 6,
|
|
};
|
|
|
|
/*
|
|
* Commands
|
|
*/
|
|
struct ft_cmd {
|
|
struct fc_seq *seq; /* sequence in exchange mgr */
|
|
struct fc_frame *req_frame; /* original request frame */
|
|
u32 write_data_len; /* data received from initiator */
|
|
u32 read_data_len; /* data sent to initiator */
|
|
u32 max_lso_payload; /* max offloaded (LSO) data payload */
|
|
u16 max_payload; /* max transmitted data payload */
|
|
struct scst_cmd *scst_cmd;
|
|
spinlock_t lock; /* protects state */
|
|
enum ft_cmd_state state;
|
|
};
|
|
|
|
extern struct list_head ft_lport_list;
|
|
extern struct mutex ft_lport_lock;
|
|
extern struct scst_tgt_template ft_scst_template;
|
|
|
|
/*
|
|
* libfc interface.
|
|
*/
|
|
extern struct fc4_prov ft_prov;
|
|
|
|
/*
|
|
* SCST interface.
|
|
*/
|
|
int ft_send_response(struct scst_cmd *);
|
|
int ft_send_xfer_rdy(struct scst_cmd *);
|
|
void ft_cmd_timeout(struct scst_cmd *);
|
|
void ft_cmd_free(struct scst_cmd *);
|
|
void ft_cmd_tm_done(struct scst_mgmt_cmd *);
|
|
int ft_tgt_detect(struct scst_tgt_template *);
|
|
int ft_tgt_release(struct scst_tgt *);
|
|
int ft_tgt_enable(struct scst_tgt *, bool);
|
|
bool ft_tgt_enabled(struct scst_tgt *);
|
|
int ft_report_aen(struct scst_aen *);
|
|
int ft_get_transport_id(struct scst_tgt *, struct scst_session *, uint8_t **);
|
|
|
|
/*
|
|
* Session interface.
|
|
*/
|
|
int ft_lport_notify(struct notifier_block *, unsigned long, void *);
|
|
void ft_lport_add(struct fc_lport *, void *);
|
|
void ft_lport_del(struct fc_lport *, void *);
|
|
|
|
/*
|
|
* other internal functions.
|
|
*/
|
|
int ft_thread(void *);
|
|
bool ft_test_and_set_cmd_state(struct ft_cmd *fcmd, enum ft_cmd_state old,
|
|
enum ft_cmd_state new);
|
|
void ft_recv_req(struct ft_sess *, struct fc_frame *);
|
|
void ft_recv_write_data(struct scst_cmd *, struct fc_frame *);
|
|
int ft_send_read_data(struct scst_cmd *);
|
|
struct ft_tpg *ft_lport_find_tpg(struct fc_lport *);
|
|
struct ft_node_acl *ft_acl_get(struct ft_tpg *, struct fc_rport_priv *);
|
|
void ft_cmd_dump(struct scst_cmd *, const char *);
|
|
|
|
/* #define FCST_INJECT_SEND_ERRORS 2 */
|
|
|
|
#ifdef FCST_INJECT_SEND_ERRORS
|
|
#define FCST_INJ_SEND_ERR(e) \
|
|
({ \
|
|
int _error = 0; \
|
|
\
|
|
if (scst_random() % 62929 == 0) \
|
|
_error = -ENOMEM; \
|
|
if (FCST_INJECT_SEND_ERRORS >= 2 && scst_random() % 69491 == 0) \
|
|
_error = -ENXIO; \
|
|
if (_error) \
|
|
pr_warn("%s: injected seq_send() error %d\n", __func__, \
|
|
_error); \
|
|
else \
|
|
_error = (e); \
|
|
_error; \
|
|
})
|
|
#else
|
|
#define FCST_INJ_SEND_ERR(e) (e)
|
|
#endif
|
|
|
|
#endif /* __SCSI_FCST_H__ */
|