"Fossies" - the Fresh Open Source Software archive 
Member "open-fcoe/kernel/openfc/openfc_scsi_pkt.h" of archive open-fcoe.tar.gz:
/*
* Copyright(c) 2007 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* Maintained at www.Open-FCoE.org
*/
#ifndef _OPENFC_SCSI_PKT_H_
#define _OPENFC_SCSI_PKT_H_
#include "fc_fcp.h"
#include "fc_frame.h"
#include "fc_exch.h"
struct openfc_softc;
/*
* SRB state definitions
*/
#define OPENFC_SRB_REC 12 /* this is an internal REC pkt */
#define OPENFC_SRB_TIMEOUT 10 /* cmd timed out */
#define OPENFC_SRB_TM_DONE 9 /* cmd on watchdog list */
#define OPENFC_SRB_ABORTED 8 /* cmd aborted command already */
#define OPENFC_SRB_ABORT_PENDING 7 /* cmd abort sent to device */
#define OPENFC_SRB_RCV_STATUS 6 /* cmd has sense data */
#define OPENFC_SRB_WAIT_FOR_STATUS 5 /* waiting for status frame */
#define OPENFC_SRB_IN_DATA_TRANS 4 /* cmd in data transfer */
#define OPENFC_SRB_CMD_SENT 3 /* cmd is sent */
#define OPENFC_SRB_CMD_BUILT 2 /* cmd is built */
#define OPENFC_SRB_INIT 1 /* INIT command. */
#define OPENFC_SRB_FREE 0 /* cmd needs retrying */
#define OPENFC_SRB_READ (1 << 1)
#define OPENFC_SRB_WRITE (1 << 0)
/*
* command status code
*/
#define OPENFC_COMPLETE 0
#define OPENFC_CMD_ABORTED 1
#define OPENFC_CMD_RESET 2
#define OPENFC_CMD_PLOGO 3
#define OPENFC_SNS_RCV 4
#define OPENFC_TRANS_ERR 5
#define OPENFC_DATA_OVRRUN 6
#define OPENFC_DATA_UNDRUN 7
#define OPENFC_ERROR 8
#define OPENFC_HRD_ERROR 9
#define OPENFC_CMD_TIME_OUT 10
#define OPENFC_MAX_CMD_SIZE 16
/*
* openfc scsi request structure,
* it is one for each scsi request
*/
struct fc_scsi_pkt {
/*
* housekeeping stuff
*/
struct openfc_softc *openfcp; /* handle to hba struct */
uint16_t state; /* scsi_pkt state state */
uint16_t tgt_flags; /* target flags */
atomic_t ref_cnt; /* only used byr REC ELS */
uint32_t idx; /* host given value */
/*
* SCSI I/O related stuff
*/
unsigned int id;
uint64_t lun;
void (*done) (struct fc_scsi_pkt *);
struct scsi_cmnd *cmd; /* scsi command pointer */
/*
* timeout related stuff
*/
struct timer_list timer; /* command timer */
struct completion tm_done;
int wait_for_comp;
unsigned long start_time; /* start jiffie */
unsigned long end_time; /* end jiffie */
unsigned long last_pkt_time; /* jiffies of last frame received */
void (*timer_fn) (struct fc_scsi_pkt *);
/*
* scsi cmd and data transfer information
*/
uint32_t data_len;
/*
* transport related veriables
*/
struct fcp_cmnd cdb_cmd;
size_t xfer_len;
size_t cmd_len;
/*
* scsi/fcp return status
*/
uint32_t io_status; /* SCSI result upper 24 bits */
uint8_t cdb_status;
uint8_t status_code; /* OPENFC I/O status */
/* bit 3 Underrun bit 2: overrun */
uint8_t scsi_comp_flags;
uint32_t req_flags; /* bit 0: read bit:1 write */
uint32_t scsi_resid; /* residule length */
/*
* FCS related data struct
*/
struct fc_remote_port *rp; /* remote port pointer */
struct fc_seq *seq_ptr; /* current sequence pointer */
void *disk; /* ptr to the Lun structure */
/*
* Error Processing
*/
uint16_t old_state; /* scsi_pkt state state */
struct fc_scsi_pkt *old_pkt;
uint32_t d_id; /* remote DID */
unsigned int sense_len;
void *private; /* ptr to transport data */
};
#endif /* _OPENFC_SCSI_PKT_H_ */