Merge tag 'tpm-fixes-for-4.2-rc2' of https://github.com/PeterHuewe/linux-tpmdd into...
[firefly-linux-kernel-4.4.55.git] / include / target / target_core_base.h
index eefc2b0cfaa3a614cd60bd40cb03297101e6929b..17ae2d6a4891e57245c16fbeb4e2a8a6462d32d0 100644 (file)
@@ -6,34 +6,21 @@
 #include <linux/dma-mapping.h>
 #include <linux/blkdev.h>
 #include <linux/percpu_ida.h>
-#include <scsi/scsi_cmnd.h>
 #include <net/sock.h>
 #include <net/tcp.h>
 
-#define TARGET_CORE_MOD_VERSION                "v4.1.0"
-#define TARGET_CORE_VERSION            TARGET_CORE_MOD_VERSION
+#define TARGET_CORE_VERSION            "v5.0"
 
-/* Maximum Number of LUNs per Target Portal Group */
-/* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */
-#define TRANSPORT_MAX_LUNS_PER_TPG             256
 /*
- * By default we use 32-byte CDBs in TCM Core and subsystem plugin code.
- *
- * Note that both include/scsi/scsi_cmnd.h:MAX_COMMAND_SIZE and
- * include/linux/blkdev.h:BLOCK_MAX_CDB as of v2.6.36-rc4 still use
- * 16-byte CDBs by default and require an extra allocation for
- * 32-byte CDBs to because of legacy issues.
- *
- * Within TCM Core there are no such legacy limitiations, so we go ahead
- * use 32-byte CDBs by default and use include/scsi/scsi.h:scsi_command_size()
- * within all TCM Core and subsystem plugin code.
+ * Maximum size of a CDB that can be stored in se_cmd without allocating
+ * memory dynamically for the CDB.
  */
 #define TCM_MAX_COMMAND_SIZE                   32
 /*
  * From include/scsi/scsi_cmnd.h:SCSI_SENSE_BUFFERSIZE, currently
  * defined 96, but the real limit is 252 (or 260 including the header)
  */
-#define TRANSPORT_SENSE_BUFFER                 SCSI_SENSE_BUFFERSIZE
+#define TRANSPORT_SENSE_BUFFER                 96
 /* Used by transport_send_check_condition_and_sense() */
 #define SPC_SENSE_KEY_OFFSET                   2
 #define SPC_ADD_SENSE_LEN_OFFSET               7
@@ -355,8 +342,8 @@ struct t10_pr_registration {
        int pr_res_scope;
        /* Used for fabric initiator WWPNs using a ISID */
        bool isid_present_at_reg;
-       u32 pr_res_mapped_lun;
-       u32 pr_aptpl_target_lun;
+       u64 pr_res_mapped_lun;
+       u64 pr_aptpl_target_lun;
        u16 tg_pt_sep_rtpi;
        u32 pr_res_generation;
        u64 pr_reg_bin_isid;
@@ -476,7 +463,7 @@ struct se_cmd {
        /* Total size in bytes associated with command */
        u32                     data_length;
        u32                     residual_count;
-       u32                     orig_fe_lun;
+       u64                     orig_fe_lun;
        /* Persistent Reservation key */
        u64                     pr_res_key;
        /* Used for sense data */
@@ -493,9 +480,8 @@ struct se_cmd {
        struct kref             cmd_kref;
        const struct target_core_fabric_ops *se_tfo;
        sense_reason_t          (*execute_cmd)(struct se_cmd *);
-       sense_reason_t          (*execute_rw)(struct se_cmd *, struct scatterlist *,
-                                             u32, enum dma_data_direction);
        sense_reason_t (*transport_complete_callback)(struct se_cmd *, bool);
+       void                    *protocol_data;
 
        unsigned char           *t_task_cdb;
        unsigned char           __t_task_cdb[TCM_MAX_COMMAND_SIZE];
@@ -551,7 +537,6 @@ struct se_cmd {
 struct se_ua {
        u8                      ua_asc;
        u8                      ua_ascq;
-       struct se_node_acl      *ua_nacl;
        struct list_head        ua_nacl_list;
 };
 
@@ -614,7 +599,7 @@ struct se_ml_stat_grps {
 
 struct se_lun_acl {
        char                    initiatorname[TRANSPORT_IQN_LEN];
-       u32                     mapped_lun;
+       u64                     mapped_lun;
        struct se_node_acl      *se_lun_nacl;
        struct se_lun           *se_lun;
        struct config_group     se_lun_group;
@@ -623,10 +608,10 @@ struct se_lun_acl {
 
 struct se_dev_entry {
        /* See transport_lunflags_table */
-       u32                     lun_flags;
-       u32                     mapped_lun;
+       u64                     mapped_lun;
        u64                     pr_res_key;
        u64                     creation_time;
+       u32                     lun_flags;
        u32                     attach_count;
        atomic_long_t           total_cmds;
        atomic_long_t           read_bytes;
@@ -696,14 +681,15 @@ struct scsi_port_stats {
 };
 
 struct se_lun {
-       /* RELATIVE TARGET PORT IDENTIFER */
-       u16                     lun_rtpi;
+       u64                     unpacked_lun;
 #define SE_LUN_LINK_MAGIC                      0xffff7771
        u32                     lun_link_magic;
        u32                     lun_access;
        u32                     lun_flags;
-       u32                     unpacked_lun;
        u32                     lun_index;
+
+       /* RELATIVE TARGET PORT IDENTIFER */
+       u16                     lun_rtpi;
        atomic_t                lun_acl_count;
        struct se_device __rcu  *lun_se_dev;