#include "ocs_ramdisc.h"#include "ocs_dif.h"#include "scsi_asc_ascq.h"#include "ocs_ramd_thread.h"Go to the source code of this file.
SCSI RAMD target-service declarations.
Definition in file ocs_ramd.h.
Macros | |
| #define | SNS_ILLEGAL_REQ 0x05 /* sense key is byte 3 ([2]) */ |
| #define | SNS_UNIT_ATTENTION 0x06 |
| #define | SNS_ABORTED_CMD 0x0B /* sense key - aborted command */ |
| #define | SNSCODE_INV_CMDIU 0x0E /* INVALID FIELD IN COMMAND IU */ |
| #define | SNSCODE_DIF_ERR 0x10 /* ID CRC OR ECC ERROR */ |
| #define | SNSCODE_BAD_CMD 0x20 /* INVALID COMMAND OPERATION CODE */ |
| #define | SNSCODE_LBA_OOR 0x21 /* LOGICAL BLOCK ADDRESS OUT OF RANGE */ |
| #define | SNSCODE_INV_CDB 0x24 /* INVALID FIELD IN CDB */ |
| #define | SNSCODE_INV_PRM 0x26 /* INVALID FIELD IN PARAMETER LIST */ |
| #define | SNSCODE_ABORTED_CMD 0x47 /* Aborted command */ |
| #define | SNSCODE_OFF_ERR 0x4B /* DATA PHASE ERROR */ |
| #define | SNSCODE_SAVE_NOT_SUPPORTED 0x39 /* SAVING PARAMETERS NOT SUPPORTED */ |
| #define | SNSCODEQUAL_INV_CMDIU 0x03 /* INVALID FIELD IN COMMAND IU */ |
| #define | scsi_pack_result(key, code, qualifier) (((key & 0xff) << 16) | ((code && 0xff) << 8) | (qualifier & 0xff)) |
Functions | |
| int32_t | _ocs_scsi_recv_cmd (ocs_io_t *io, uint32_t lun, uint8_t *cdb, uint32_t cdb_len, uint32_t flags) |
| Receive an FCP SCSI command. More... | |
| int32_t | ocs_scsi_recv_cmd_common (ocs_io_t *io, uint32_t lun, uint8_t *cdb, uint32_t cdb_len, uint32_t flags, uint8_t has_first_burst, ocs_dma_t first_burst_buffers[], uint32_t first_burst_bytes) |
| Common code used by ocs_scsi_recv_cmd() and ocs_scsi_recv_cmd_first_burst(). More... | |
| ocs_ramd_hndlr_rtn_e | ocs_ramd_check_cond (ocs_io_t *io, uint8_t sense_key, uint8_t asc, uint8_t ascq) |
| Send a SCSI check condition. More... | |
| ocs_ramd_hndlr_rtn_e | ocs_ramd_task_set_full_or_busy (ocs_io_t *io) |
| Send a SCSI task set full or busy status. More... | |
| ocs_ramd_hndlr_rtn_e | ocs_ramd_good_status (ocs_io_t *io) |
| Send a good SCSI status. More... | |
| int32_t | scsi_io_cb (ocs_io_t *io, ocs_scsi_io_status_e scsi_status, uint32_t flags, void *arg) |
| int32_t | _scsi_io_cb (ocs_io_t *io, ocs_scsi_io_status_e scsi_status, uint32_t flags, void *arg) |
| Response phase callback. More... | |
| int32_t | scsi_dataphase_cb (ocs_io_t *io, ocs_scsi_io_status_e scsi_status, uint32_t flags, void *arg) |
| int32_t | _scsi_dataphase_cb (ocs_io_t *io, ocs_scsi_io_status_e scsi_status, uint32_t flags, void *arg) |
| Command data phase callback. More... | |
| ocs_ramdisc_t * | ocs_ramd_lookup (ocs_io_t *io, uint32_t lun) |
| Given an IO and a LUN number, return the ramdisc to which the IO is directed. More... | |
| ocs_ramdisc_t * | ocs_ramd_lookup_by_tgt (ocs_t *ocs, uint32_t tgt, uint32_t lun) |
| Given an TGT number and a LUN number, return the corresponding ramdisc. More... | |
| void | ocs_ramd_post_ua (ocs_t *ocs, ocs_ramdisc_t *ramdisc, uint8_t asc, uint8_t ascq, ocs_node_t *except_node) |
| Post a Unit Attention condition to a ramdisc. More... | |
| int32_t | ocs_ramd_get_ua (ocs_t *ocs, ocs_node_t *node, uint32_t lun, uint8_t *asc, uint8_t *ascq) |
| Get a pending Unit Attention, if any. More... | |
| void | ocs_ramd_clear_ua (ocs_t *ocs, ocs_node_t *node, uint32_t lun, uint8_t asc, uint8_t ascq) |
| Clear a Unit Attention condition. More... | |
| ocs_ramd_hndlr_rtn_e | ocs_ramd_mode_sense6 (ocs_io_t *io, uint8_t cdb[]) |
| Process SCSI Mode Sense 6 command. More... | |
| ocs_ramd_hndlr_rtn_e | ocs_ramd_mode_sense10 (ocs_io_t *io, uint8_t cdb[]) |
| Process SCSI Mode Sense 10 command. More... | |
| int32_t | ocs_port_rdisc_init (ocs_t *ocs) |
| Initialize per port ramdisc structure. More... | |
| void | ocs_port_rdisc_free (ocs_t *ocs) |
| Free per port ramdisc structure. More... | |
| int32_t | ocs_port_rdisc_find (ocs_t *ocs, uint32_t tgt_id, ocs_ramdisc_t ***rdisc, uint32_t *rdisc_count) |
| Find a per port ramdisc instance. More... | |
| int32_t | ocs_port_rdisc_save (ocs_t *ocs, uint32_t tgt_id, ocs_ramdisc_t **rdisc, uint32_t rdisc_count) |
| Save a per port ramdisc. More... | |
| #define scsi_pack_result | ( | key, | |
| code, | |||
| qualifier | |||
| ) | (((key & 0xff) << 16) | ((code && 0xff) << 8) | (qualifier & 0xff)) |
Definition at line 68 of file ocs_ramd.h.
| #define SNS_ABORTED_CMD 0x0B /* sense key - aborted command */ |
Definition at line 51 of file ocs_ramd.h.
| #define SNS_ILLEGAL_REQ 0x05 /* sense key is byte 3 ([2]) */ |
Definition at line 49 of file ocs_ramd.h.
| #define SNS_UNIT_ATTENTION 0x06 |
Definition at line 50 of file ocs_ramd.h.
| #define SNSCODE_ABORTED_CMD 0x47 /* Aborted command */ |
Definition at line 60 of file ocs_ramd.h.
| #define SNSCODE_BAD_CMD 0x20 /* INVALID COMMAND OPERATION CODE */ |
Definition at line 56 of file ocs_ramd.h.
| #define SNSCODE_DIF_ERR 0x10 /* ID CRC OR ECC ERROR */ |
Definition at line 55 of file ocs_ramd.h.
| #define SNSCODE_INV_CDB 0x24 /* INVALID FIELD IN CDB */ |
Definition at line 58 of file ocs_ramd.h.
| #define SNSCODE_INV_CMDIU 0x0E /* INVALID FIELD IN COMMAND IU */ |
Definition at line 54 of file ocs_ramd.h.
| #define SNSCODE_INV_PRM 0x26 /* INVALID FIELD IN PARAMETER LIST */ |
Definition at line 59 of file ocs_ramd.h.
| #define SNSCODE_LBA_OOR 0x21 /* LOGICAL BLOCK ADDRESS OUT OF RANGE */ |
Definition at line 57 of file ocs_ramd.h.
| #define SNSCODE_OFF_ERR 0x4B /* DATA PHASE ERROR */ |
Definition at line 61 of file ocs_ramd.h.
| #define SNSCODE_SAVE_NOT_SUPPORTED 0x39 /* SAVING PARAMETERS NOT SUPPORTED */ |
Definition at line 62 of file ocs_ramd.h.
| #define SNSCODEQUAL_INV_CMDIU 0x03 /* INVALID FIELD IN COMMAND IU */ |
Definition at line 65 of file ocs_ramd.h.
| enum ocs_ramd_hndlr_rtn_e |
| Enumerator | |
|---|---|
| SCSI_HANDLER_DATAPHASE_STARTED | |
| SCSI_HANDLER_RESP_STARTED | |
| SCSI_HANDLER_VALIDATED_DATAPHASE_STARTED | |
| SCSI_HANDLER_WRITE_SAME_DATAPHASE_STARTED | |
| SCSI_HANDLER_NOT_STARTED | |
| SCSI_CMD_NOT_SUPPORTED | |
Definition at line 71 of file ocs_ramd.h.
| int32_t _scsi_dataphase_cb | ( | ocs_io_t * | io, |
| ocs_scsi_io_status_e | scsi_status, | ||
| uint32_t | flags, | ||
| void * | arg | ||
| ) |
Command data phase callback.
| io | Pointer to the IO structure. |
| scsi_status | Completion status. |
| flags | Flags. |
| arg | Application-specified argument. |
Definition at line 2875 of file ocs_ramd.c.
| int32_t _scsi_io_cb | ( | ocs_io_t * | io, |
| ocs_scsi_io_status_e | scsi_status, | ||
| uint32_t | flags, | ||
| void * | arg | ||
| ) |
Response phase callback.
| io | Pointer to the IO structure. |
| scsi_status | Completion status. |
| flags | Flags. |
| arg | Application-specified argument. |
Definition at line 2846 of file ocs_ramd.c.
| int32_t ocs_port_rdisc_find | ( | ocs_t * | ocs, |
| uint32_t | tgt_id, | ||
| ocs_ramdisc_t *** | rdisc, | ||
| uint32_t * | rdisc_count | ||
| ) |
Find a per port ramdisc instance.
| ocs | Pointer to OCS structure. |
| tgt_id | Target id. |
| rdisc | Pointer to ramdiscs. |
| rdisc_count | Count of ramdiscs. |
Definition at line 7188 of file ocs_ramd.c.
| void ocs_port_rdisc_free | ( | ocs_t * | ocs | ) |
Free per port ramdisc structure.
| ocs | Pointer to OCS instance. |
Definition at line 7158 of file ocs_ramd.c.
| int32_t ocs_port_rdisc_init | ( | ocs_t * | ocs | ) |
Initialize per port ramdisc structure.
| ocs | pointer to OCS instance |
Definition at line 7140 of file ocs_ramd.c.
| int32_t ocs_port_rdisc_save | ( | ocs_t * | ocs, |
| uint32_t | tgt_id, | ||
| ocs_ramdisc_t ** | rdisc, | ||
| uint32_t | rdisc_count | ||
| ) |
Save a per port ramdisc.
| ocs | Pointer to OCS structure. |
| tgt_id | Target id for this ramdisc. |
| rdisc | Pointer to ramdiscs. |
| rdisc_count | Count of ramdiscs. |
Definition at line 7220 of file ocs_ramd.c.
| ocs_ramdisc_t* ocs_ramd_lookup | ( | ocs_io_t * | io, |
| uint32_t | lun | ||
| ) |
Given an IO and a LUN number, return the ramdisc to which the IO is directed.
| io | Pointer to the IO context. |
| lun | LUN for the command. |
lun is not valid. Definition at line 471 of file ocs_ramd.c.
| ocs_ramdisc_t* ocs_ramd_lookup_by_tgt | ( | ocs_t * | ocs, |
| uint32_t | tgt, | ||
| uint32_t | lun | ||
| ) |
Given an TGT number and a LUN number, return the corresponding ramdisc.
If per-port RAMD is being used then the TGT number is used to find the correct sport, then LUN n is at sport->tgt_sport.rdisc[n].
| ocs | Pointer to the ocs. |
| tgt | TGT number, 0..n. |
| lun | LUN number, 0..n. |
Definition at line 519 of file ocs_ramd.c.
| int32_t ocs_scsi_recv_cmd_common | ( | ocs_io_t * | io, |
| uint32_t | lun, | ||
| uint8_t * | cdb, | ||
| uint32_t | cdb_len, | ||
| uint32_t | flags, | ||
| uint8_t | has_first_burst, | ||
| ocs_dma_t | first_burst_buffers[], | ||
| uint32_t | first_burst_bytes | ||
| ) |
Common code used by ocs_scsi_recv_cmd() and ocs_scsi_recv_cmd_first_burst().
| io | Pointer to the IO context. |
| lun | LUN for this IO. |
| cdb | Pointer to the SCSI CDB. |
| cdb_len | Length of the CDB, in bytes. |
| flags | Command flags. |
| has_first_burst | TRUE if the command has first burst data. |
| first_burst_buffers | First burst buffer. |
| first_burst_bytes | The number of bytes received in the first burst. |
Definition at line 1302 of file ocs_ramd.c.
| int32_t scsi_dataphase_cb | ( | ocs_io_t * | io, |
| ocs_scsi_io_status_e | scsi_status, | ||
| uint32_t | flags, | ||
| void * | arg | ||
| ) |
Definition at line 317 of file ocs_ramd_thread.c.
| int32_t scsi_io_cb | ( | ocs_io_t * | io, |
| ocs_scsi_io_status_e | scsi_status, | ||
| uint32_t | flags, | ||
| void * | arg | ||
| ) |
Definition at line 351 of file ocs_ramd_thread.c.