diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-24 13:22:09 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-24 13:22:09 -0400 |
| commit | c6668726d2c2c581e6c417448c472c994d026f5f (patch) | |
| tree | ccbc5a73b9dfe09a065cb5d8627aa2297e730ec0 /include | |
| parent | 06b45f2aa703837163496f5db6a53575665cc6b4 (diff) | |
| parent | 68d4cef3bab3fb9bb0dbac690ba35a96cb5a16d9 (diff) | |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger:
"Lots of activity in target land the last months.
The highlights include:
- Convert fabric drivers tree-wide to target_register_template() (hch
+ bart)
- iser-target hardening fixes + v1.0 improvements (sagi)
- Convert iscsi_thread_set usage to kthread.h + kill
iscsi_target_tq.c (sagi + nab)
- Add support for T10-PI WRITE_STRIP + READ_INSERT operation (mkp +
sagi + nab)
- DIF fixes for CONFIG_DEBUG_SG=y + UNMAP file emulation (akinobu +
sagi + mkp)
- Extended TCMU ABI v2 for future BIDI + DIF support (andy + ilias)
- Fix COMPARE_AND_WRITE handling for NO_ALLLOC drivers (hch + nab)
Thanks to everyone who contributed this round with new features,
bug-reports, fixes, cleanups and improvements.
Looking forward, it's currently shaping up to be a busy v4.2 as well"
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (69 commits)
target: Put TCMU under a new config option
target: Version 2 of TCMU ABI
target: fix tcm_mod_builder.py
target/file: Fix UNMAP with DIF protection support
target/file: Fix SG table for prot_buf initialization
target/file: Fix BUG() when CONFIG_DEBUG_SG=y and DIF protection enabled
target: Make core_tmr_abort_task() skip TMFs
target/sbc: Update sbc_dif_generate pr_debug output
target/sbc: Make internal DIF emulation honor ->prot_checks
target/sbc: Return INVALID_CDB_FIELD if DIF + sess_prot_type disabled
target: Ensure sess_prot_type is saved across session restart
target/rd: Don't pass incomplete scatterlist entries to sbc_dif_verify_*
target: Remove the unused flag SCF_ACK_KREF
target: Fix two sparse warnings
target: Fix COMPARE_AND_WRITE with SG_TO_MEM_NOALLOC handling
target: simplify the target template registration API
target: simplify target_xcopy_init_pt_lun
target: remove the unused SCF_CMD_XCOPY_PASSTHROUGH flag
target/rd: reduce code duplication in rd_execute_rw()
tcm_loop: fixup tpgt string to integer conversion
...
Diffstat (limited to 'include')
| -rw-r--r-- | include/target/iscsi/iscsi_target_core.h | 15 | ||||
| -rw-r--r-- | include/target/target_core_base.h | 10 | ||||
| -rw-r--r-- | include/target/target_core_configfs.h | 6 | ||||
| -rw-r--r-- | include/target/target_core_fabric.h | 33 | ||||
| -rw-r--r-- | include/target/target_core_fabric_configfs.h | 5 | ||||
| -rw-r--r-- | include/uapi/linux/target_core_user.h | 44 |
6 files changed, 78 insertions, 35 deletions
diff --git a/include/target/iscsi/iscsi_target_core.h b/include/target/iscsi/iscsi_target_core.h index d3583d3ee193..54e7af301888 100644 --- a/include/target/iscsi/iscsi_target_core.h +++ b/include/target/iscsi/iscsi_target_core.h | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | #define ISCSIT_MIN_TAGS 16 | 20 | #define ISCSIT_MIN_TAGS 16 |
| 21 | #define ISCSIT_EXTRA_TAGS 8 | 21 | #define ISCSIT_EXTRA_TAGS 8 |
| 22 | #define ISCSIT_TCP_BACKLOG 256 | 22 | #define ISCSIT_TCP_BACKLOG 256 |
| 23 | #define ISCSI_RX_THREAD_NAME "iscsi_trx" | ||
| 24 | #define ISCSI_TX_THREAD_NAME "iscsi_ttx" | ||
| 23 | 25 | ||
| 24 | /* struct iscsi_node_attrib sanity values */ | 26 | /* struct iscsi_node_attrib sanity values */ |
| 25 | #define NA_DATAOUT_TIMEOUT 3 | 27 | #define NA_DATAOUT_TIMEOUT 3 |
| @@ -60,6 +62,7 @@ | |||
| 60 | #define TA_CACHE_CORE_NPS 0 | 62 | #define TA_CACHE_CORE_NPS 0 |
| 61 | /* T10 protection information disabled by default */ | 63 | /* T10 protection information disabled by default */ |
| 62 | #define TA_DEFAULT_T10_PI 0 | 64 | #define TA_DEFAULT_T10_PI 0 |
| 65 | #define TA_DEFAULT_FABRIC_PROT_TYPE 0 | ||
| 63 | 66 | ||
| 64 | #define ISCSI_IOV_DATA_BUFFER 5 | 67 | #define ISCSI_IOV_DATA_BUFFER 5 |
| 65 | 68 | ||
| @@ -600,8 +603,11 @@ struct iscsi_conn { | |||
| 600 | struct iscsi_tpg_np *tpg_np; | 603 | struct iscsi_tpg_np *tpg_np; |
| 601 | /* Pointer to parent session */ | 604 | /* Pointer to parent session */ |
| 602 | struct iscsi_session *sess; | 605 | struct iscsi_session *sess; |
| 603 | /* Pointer to thread_set in use for this conn's threads */ | 606 | int bitmap_id; |
| 604 | struct iscsi_thread_set *thread_set; | 607 | int rx_thread_active; |
| 608 | struct task_struct *rx_thread; | ||
| 609 | int tx_thread_active; | ||
| 610 | struct task_struct *tx_thread; | ||
| 605 | /* list_head for session connection list */ | 611 | /* list_head for session connection list */ |
| 606 | struct list_head conn_list; | 612 | struct list_head conn_list; |
| 607 | } ____cacheline_aligned; | 613 | } ____cacheline_aligned; |
| @@ -767,6 +773,7 @@ struct iscsi_tpg_attrib { | |||
| 767 | u32 demo_mode_discovery; | 773 | u32 demo_mode_discovery; |
| 768 | u32 default_erl; | 774 | u32 default_erl; |
| 769 | u8 t10_pi; | 775 | u8 t10_pi; |
| 776 | u32 fabric_prot_type; | ||
| 770 | struct iscsi_portal_group *tpg; | 777 | struct iscsi_portal_group *tpg; |
| 771 | }; | 778 | }; |
| 772 | 779 | ||
| @@ -871,10 +878,10 @@ struct iscsit_global { | |||
| 871 | /* Unique identifier used for the authentication daemon */ | 878 | /* Unique identifier used for the authentication daemon */ |
| 872 | u32 auth_id; | 879 | u32 auth_id; |
| 873 | u32 inactive_ts; | 880 | u32 inactive_ts; |
| 874 | /* Thread Set bitmap count */ | 881 | #define ISCSIT_BITMAP_BITS 262144 |
| 875 | int ts_bitmap_count; | ||
| 876 | /* Thread Set bitmap pointer */ | 882 | /* Thread Set bitmap pointer */ |
| 877 | unsigned long *ts_bitmap; | 883 | unsigned long *ts_bitmap; |
| 884 | spinlock_t ts_bitmap_lock; | ||
| 878 | /* Used for iSCSI discovery session authentication */ | 885 | /* Used for iSCSI discovery session authentication */ |
| 879 | struct iscsi_node_acl discovery_acl; | 886 | struct iscsi_node_acl discovery_acl; |
| 880 | struct iscsi_portal_group *discovery_tpg; | 887 | struct iscsi_portal_group *discovery_tpg; |
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 672150b6aaf5..480e9f82dfea 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
| @@ -165,10 +165,8 @@ enum se_cmd_flags_table { | |||
| 165 | SCF_SEND_DELAYED_TAS = 0x00004000, | 165 | SCF_SEND_DELAYED_TAS = 0x00004000, |
| 166 | SCF_ALUA_NON_OPTIMIZED = 0x00008000, | 166 | SCF_ALUA_NON_OPTIMIZED = 0x00008000, |
| 167 | SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00020000, | 167 | SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00020000, |
| 168 | SCF_ACK_KREF = 0x00040000, | ||
| 169 | SCF_COMPARE_AND_WRITE = 0x00080000, | 168 | SCF_COMPARE_AND_WRITE = 0x00080000, |
| 170 | SCF_COMPARE_AND_WRITE_POST = 0x00100000, | 169 | SCF_COMPARE_AND_WRITE_POST = 0x00100000, |
| 171 | SCF_CMD_XCOPY_PASSTHROUGH = 0x00200000, | ||
| 172 | }; | 170 | }; |
| 173 | 171 | ||
| 174 | /* struct se_dev_entry->lun_flags and struct se_lun->lun_access */ | 172 | /* struct se_dev_entry->lun_flags and struct se_lun->lun_access */ |
| @@ -520,11 +518,11 @@ struct se_cmd { | |||
| 520 | struct list_head se_cmd_list; | 518 | struct list_head se_cmd_list; |
| 521 | struct completion cmd_wait_comp; | 519 | struct completion cmd_wait_comp; |
| 522 | struct kref cmd_kref; | 520 | struct kref cmd_kref; |
| 523 | struct target_core_fabric_ops *se_tfo; | 521 | const struct target_core_fabric_ops *se_tfo; |
| 524 | sense_reason_t (*execute_cmd)(struct se_cmd *); | 522 | sense_reason_t (*execute_cmd)(struct se_cmd *); |
| 525 | sense_reason_t (*execute_rw)(struct se_cmd *, struct scatterlist *, | 523 | sense_reason_t (*execute_rw)(struct se_cmd *, struct scatterlist *, |
| 526 | u32, enum dma_data_direction); | 524 | u32, enum dma_data_direction); |
| 527 | sense_reason_t (*transport_complete_callback)(struct se_cmd *); | 525 | sense_reason_t (*transport_complete_callback)(struct se_cmd *, bool); |
| 528 | 526 | ||
| 529 | unsigned char *t_task_cdb; | 527 | unsigned char *t_task_cdb; |
| 530 | unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; | 528 | unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; |
| @@ -591,6 +589,7 @@ struct se_node_acl { | |||
| 591 | bool acl_stop:1; | 589 | bool acl_stop:1; |
| 592 | u32 queue_depth; | 590 | u32 queue_depth; |
| 593 | u32 acl_index; | 591 | u32 acl_index; |
| 592 | enum target_prot_type saved_prot_type; | ||
| 594 | #define MAX_ACL_TAG_SIZE 64 | 593 | #define MAX_ACL_TAG_SIZE 64 |
| 595 | char acl_tag[MAX_ACL_TAG_SIZE]; | 594 | char acl_tag[MAX_ACL_TAG_SIZE]; |
| 596 | /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */ | 595 | /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */ |
| @@ -616,6 +615,7 @@ struct se_session { | |||
| 616 | unsigned sess_tearing_down:1; | 615 | unsigned sess_tearing_down:1; |
| 617 | u64 sess_bin_isid; | 616 | u64 sess_bin_isid; |
| 618 | enum target_prot_op sup_prot_ops; | 617 | enum target_prot_op sup_prot_ops; |
| 618 | enum target_prot_type sess_prot_type; | ||
| 619 | struct se_node_acl *se_node_acl; | 619 | struct se_node_acl *se_node_acl; |
| 620 | struct se_portal_group *se_tpg; | 620 | struct se_portal_group *se_tpg; |
| 621 | void *fabric_sess_ptr; | 621 | void *fabric_sess_ptr; |
| @@ -890,7 +890,7 @@ struct se_portal_group { | |||
| 890 | /* List of TCM sessions associated wth this TPG */ | 890 | /* List of TCM sessions associated wth this TPG */ |
| 891 | struct list_head tpg_sess_list; | 891 | struct list_head tpg_sess_list; |
| 892 | /* Pointer to $FABRIC_MOD dependent code */ | 892 | /* Pointer to $FABRIC_MOD dependent code */ |
| 893 | struct target_core_fabric_ops *se_tpg_tfo; | 893 | const struct target_core_fabric_ops *se_tpg_tfo; |
| 894 | struct se_wwn *se_tpg_wwn; | 894 | struct se_wwn *se_tpg_wwn; |
| 895 | struct config_group tpg_group; | 895 | struct config_group tpg_group; |
| 896 | struct config_group *tpg_default_groups[7]; | 896 | struct config_group *tpg_default_groups[7]; |
diff --git a/include/target/target_core_configfs.h b/include/target/target_core_configfs.h index e0801386e4dc..25bb04c4209e 100644 --- a/include/target/target_core_configfs.h +++ b/include/target/target_core_configfs.h | |||
| @@ -5,12 +5,6 @@ | |||
| 5 | #define TARGET_CORE_NAME_MAX_LEN 64 | 5 | #define TARGET_CORE_NAME_MAX_LEN 64 |
| 6 | #define TARGET_FABRIC_NAME_SIZE 32 | 6 | #define TARGET_FABRIC_NAME_SIZE 32 |
| 7 | 7 | ||
| 8 | extern struct target_fabric_configfs *target_fabric_configfs_init( | ||
| 9 | struct module *, const char *); | ||
| 10 | extern void target_fabric_configfs_free(struct target_fabric_configfs *); | ||
| 11 | extern int target_fabric_configfs_register(struct target_fabric_configfs *); | ||
| 12 | extern void target_fabric_configfs_deregister(struct target_fabric_configfs *); | ||
| 13 | |||
| 14 | struct target_fabric_configfs_template { | 8 | struct target_fabric_configfs_template { |
| 15 | struct config_item_type tfc_discovery_cit; | 9 | struct config_item_type tfc_discovery_cit; |
| 16 | struct config_item_type tfc_wwn_cit; | 10 | struct config_item_type tfc_wwn_cit; |
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 22a4e98eec80..17c7f5ac7ea0 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | #define TARGET_CORE_FABRIC_H | 2 | #define TARGET_CORE_FABRIC_H |
| 3 | 3 | ||
| 4 | struct target_core_fabric_ops { | 4 | struct target_core_fabric_ops { |
| 5 | struct module *module; | ||
| 6 | const char *name; | ||
| 5 | struct configfs_subsystem *tf_subsys; | 7 | struct configfs_subsystem *tf_subsys; |
| 6 | char *(*get_fabric_name)(void); | 8 | char *(*get_fabric_name)(void); |
| 7 | u8 (*get_fabric_proto_ident)(struct se_portal_group *); | 9 | u8 (*get_fabric_proto_ident)(struct se_portal_group *); |
| @@ -27,6 +29,14 @@ struct target_core_fabric_ops { | |||
| 27 | * inquiry response | 29 | * inquiry response |
| 28 | */ | 30 | */ |
| 29 | int (*tpg_check_demo_mode_login_only)(struct se_portal_group *); | 31 | int (*tpg_check_demo_mode_login_only)(struct se_portal_group *); |
| 32 | /* | ||
| 33 | * Optionally used as a configfs tunable to determine when | ||
| 34 | * target-core should signal the PROTECT=1 feature bit for | ||
| 35 | * backends that don't support T10-PI, so that either fabric | ||
| 36 | * HW offload or target-core emulation performs the associated | ||
| 37 | * WRITE_STRIP and READ_INSERT operations. | ||
| 38 | */ | ||
| 39 | int (*tpg_check_prot_fabric_only)(struct se_portal_group *); | ||
| 30 | struct se_node_acl *(*tpg_alloc_fabric_acl)( | 40 | struct se_node_acl *(*tpg_alloc_fabric_acl)( |
| 31 | struct se_portal_group *); | 41 | struct se_portal_group *); |
| 32 | void (*tpg_release_fabric_acl)(struct se_portal_group *, | 42 | void (*tpg_release_fabric_acl)(struct se_portal_group *, |
| @@ -82,8 +92,23 @@ struct target_core_fabric_ops { | |||
| 82 | struct se_node_acl *(*fabric_make_nodeacl)(struct se_portal_group *, | 92 | struct se_node_acl *(*fabric_make_nodeacl)(struct se_portal_group *, |
| 83 | struct config_group *, const char *); | 93 | struct config_group *, const char *); |
| 84 | void (*fabric_drop_nodeacl)(struct se_node_acl *); | 94 | void (*fabric_drop_nodeacl)(struct se_node_acl *); |
| 95 | |||
| 96 | struct configfs_attribute **tfc_discovery_attrs; | ||
| 97 | struct configfs_attribute **tfc_wwn_attrs; | ||
| 98 | struct configfs_attribute **tfc_tpg_base_attrs; | ||
| 99 | struct configfs_attribute **tfc_tpg_np_base_attrs; | ||
| 100 | struct configfs_attribute **tfc_tpg_attrib_attrs; | ||
| 101 | struct configfs_attribute **tfc_tpg_auth_attrs; | ||
| 102 | struct configfs_attribute **tfc_tpg_param_attrs; | ||
| 103 | struct configfs_attribute **tfc_tpg_nacl_base_attrs; | ||
| 104 | struct configfs_attribute **tfc_tpg_nacl_attrib_attrs; | ||
| 105 | struct configfs_attribute **tfc_tpg_nacl_auth_attrs; | ||
| 106 | struct configfs_attribute **tfc_tpg_nacl_param_attrs; | ||
| 85 | }; | 107 | }; |
| 86 | 108 | ||
| 109 | int target_register_template(const struct target_core_fabric_ops *fo); | ||
| 110 | void target_unregister_template(const struct target_core_fabric_ops *fo); | ||
| 111 | |||
| 87 | struct se_session *transport_init_session(enum target_prot_op); | 112 | struct se_session *transport_init_session(enum target_prot_op); |
| 88 | int transport_alloc_session_tags(struct se_session *, unsigned int, | 113 | int transport_alloc_session_tags(struct se_session *, unsigned int, |
| 89 | unsigned int); | 114 | unsigned int); |
| @@ -95,13 +120,15 @@ void transport_register_session(struct se_portal_group *, | |||
| 95 | struct se_node_acl *, struct se_session *, void *); | 120 | struct se_node_acl *, struct se_session *, void *); |
| 96 | void target_get_session(struct se_session *); | 121 | void target_get_session(struct se_session *); |
| 97 | void target_put_session(struct se_session *); | 122 | void target_put_session(struct se_session *); |
| 123 | ssize_t target_show_dynamic_sessions(struct se_portal_group *, char *); | ||
| 98 | void transport_free_session(struct se_session *); | 124 | void transport_free_session(struct se_session *); |
| 99 | void target_put_nacl(struct se_node_acl *); | 125 | void target_put_nacl(struct se_node_acl *); |
| 100 | void transport_deregister_session_configfs(struct se_session *); | 126 | void transport_deregister_session_configfs(struct se_session *); |
| 101 | void transport_deregister_session(struct se_session *); | 127 | void transport_deregister_session(struct se_session *); |
| 102 | 128 | ||
| 103 | 129 | ||
| 104 | void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *, | 130 | void transport_init_se_cmd(struct se_cmd *, |
| 131 | const struct target_core_fabric_ops *, | ||
| 105 | struct se_session *, u32, int, int, unsigned char *); | 132 | struct se_session *, u32, int, int, unsigned char *); |
| 106 | sense_reason_t transport_lookup_cmd_lun(struct se_cmd *, u32); | 133 | sense_reason_t transport_lookup_cmd_lun(struct se_cmd *, u32); |
| 107 | sense_reason_t target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *); | 134 | sense_reason_t target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *); |
| @@ -153,8 +180,8 @@ int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *, | |||
| 153 | unsigned char *, u32, int); | 180 | unsigned char *, u32, int); |
| 154 | int core_tpg_set_initiator_node_tag(struct se_portal_group *, | 181 | int core_tpg_set_initiator_node_tag(struct se_portal_group *, |
| 155 | struct se_node_acl *, const char *); | 182 | struct se_node_acl *, const char *); |
| 156 | int core_tpg_register(struct target_core_fabric_ops *, struct se_wwn *, | 183 | int core_tpg_register(const struct target_core_fabric_ops *, |
| 157 | struct se_portal_group *, void *, int); | 184 | struct se_wwn *, struct se_portal_group *, void *, int); |
| 158 | int core_tpg_deregister(struct se_portal_group *); | 185 | int core_tpg_deregister(struct se_portal_group *); |
| 159 | 186 | ||
| 160 | /* SAS helpers */ | 187 | /* SAS helpers */ |
diff --git a/include/target/target_core_fabric_configfs.h b/include/target/target_core_fabric_configfs.h index b32a14905cfa..7a0649c09e79 100644 --- a/include/target/target_core_fabric_configfs.h +++ b/include/target/target_core_fabric_configfs.h | |||
| @@ -90,6 +90,11 @@ static struct target_fabric_tpg_attribute _fabric##_tpg_##_name = \ | |||
| 90 | _fabric##_tpg_store_##_name); | 90 | _fabric##_tpg_store_##_name); |
| 91 | 91 | ||
| 92 | 92 | ||
| 93 | #define TF_TPG_BASE_ATTR_RO(_fabric, _name) \ | ||
| 94 | static struct target_fabric_tpg_attribute _fabric##_tpg_##_name = \ | ||
| 95 | __CONFIGFS_EATTR_RO(_name, \ | ||
| 96 | _fabric##_tpg_show_##_name); | ||
| 97 | |||
| 93 | CONFIGFS_EATTR_STRUCT(target_fabric_wwn, target_fabric_configfs); | 98 | CONFIGFS_EATTR_STRUCT(target_fabric_wwn, target_fabric_configfs); |
| 94 | #define TF_WWN_ATTR(_fabric, _name, _mode) \ | 99 | #define TF_WWN_ATTR(_fabric, _name, _mode) \ |
| 95 | static struct target_fabric_wwn_attribute _fabric##_wwn_##_name = \ | 100 | static struct target_fabric_wwn_attribute _fabric##_wwn_##_name = \ |
diff --git a/include/uapi/linux/target_core_user.h b/include/uapi/linux/target_core_user.h index b483d1909d3e..b67f99d3c520 100644 --- a/include/uapi/linux/target_core_user.h +++ b/include/uapi/linux/target_core_user.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
| 7 | #include <linux/uio.h> | 7 | #include <linux/uio.h> |
| 8 | 8 | ||
| 9 | #define TCMU_VERSION "1.0" | 9 | #define TCMU_VERSION "2.0" |
| 10 | 10 | ||
| 11 | /* | 11 | /* |
| 12 | * Ring Design | 12 | * Ring Design |
| @@ -39,9 +39,13 @@ | |||
| 39 | * should process the next packet the same way, and so on. | 39 | * should process the next packet the same way, and so on. |
| 40 | */ | 40 | */ |
| 41 | 41 | ||
| 42 | #define TCMU_MAILBOX_VERSION 1 | 42 | #define TCMU_MAILBOX_VERSION 2 |
| 43 | #define ALIGN_SIZE 64 /* Should be enough for most CPUs */ | 43 | #define ALIGN_SIZE 64 /* Should be enough for most CPUs */ |
| 44 | 44 | ||
| 45 | /* See https://gcc.gnu.org/onlinedocs/cpp/Stringification.html */ | ||
| 46 | #define xstr(s) str(s) | ||
| 47 | #define str(s) #s | ||
| 48 | |||
| 45 | struct tcmu_mailbox { | 49 | struct tcmu_mailbox { |
| 46 | __u16 version; | 50 | __u16 version; |
| 47 | __u16 flags; | 51 | __u16 flags; |
| @@ -64,31 +68,36 @@ enum tcmu_opcode { | |||
| 64 | * Only a few opcodes, and length is 8-byte aligned, so use low bits for opcode. | 68 | * Only a few opcodes, and length is 8-byte aligned, so use low bits for opcode. |
| 65 | */ | 69 | */ |
| 66 | struct tcmu_cmd_entry_hdr { | 70 | struct tcmu_cmd_entry_hdr { |
| 67 | __u32 len_op; | 71 | __u32 len_op; |
| 72 | __u16 cmd_id; | ||
| 73 | __u8 kflags; | ||
| 74 | #define TCMU_UFLAG_UNKNOWN_OP 0x1 | ||
| 75 | __u8 uflags; | ||
| 76 | |||
| 68 | } __packed; | 77 | } __packed; |
| 69 | 78 | ||
| 70 | #define TCMU_OP_MASK 0x7 | 79 | #define TCMU_OP_MASK 0x7 |
| 71 | 80 | ||
| 72 | static inline enum tcmu_opcode tcmu_hdr_get_op(struct tcmu_cmd_entry_hdr *hdr) | 81 | static inline enum tcmu_opcode tcmu_hdr_get_op(__u32 len_op) |
| 73 | { | 82 | { |
| 74 | return hdr->len_op & TCMU_OP_MASK; | 83 | return len_op & TCMU_OP_MASK; |
| 75 | } | 84 | } |
| 76 | 85 | ||
| 77 | static inline void tcmu_hdr_set_op(struct tcmu_cmd_entry_hdr *hdr, enum tcmu_opcode op) | 86 | static inline void tcmu_hdr_set_op(__u32 *len_op, enum tcmu_opcode op) |
| 78 | { | 87 | { |
| 79 | hdr->len_op &= ~TCMU_OP_MASK; | 88 | *len_op &= ~TCMU_OP_MASK; |
| 80 | hdr->len_op |= (op & TCMU_OP_MASK); | 89 | *len_op |= (op & TCMU_OP_MASK); |
| 81 | } | 90 | } |
| 82 | 91 | ||
| 83 | static inline __u32 tcmu_hdr_get_len(struct tcmu_cmd_entry_hdr *hdr) | 92 | static inline __u32 tcmu_hdr_get_len(__u32 len_op) |
| 84 | { | 93 | { |
| 85 | return hdr->len_op & ~TCMU_OP_MASK; | 94 | return len_op & ~TCMU_OP_MASK; |
| 86 | } | 95 | } |
| 87 | 96 | ||
| 88 | static inline void tcmu_hdr_set_len(struct tcmu_cmd_entry_hdr *hdr, __u32 len) | 97 | static inline void tcmu_hdr_set_len(__u32 *len_op, __u32 len) |
| 89 | { | 98 | { |
| 90 | hdr->len_op &= TCMU_OP_MASK; | 99 | *len_op &= TCMU_OP_MASK; |
| 91 | hdr->len_op |= len; | 100 | *len_op |= len; |
| 92 | } | 101 | } |
| 93 | 102 | ||
| 94 | /* Currently the same as SCSI_SENSE_BUFFERSIZE */ | 103 | /* Currently the same as SCSI_SENSE_BUFFERSIZE */ |
| @@ -97,13 +106,14 @@ static inline void tcmu_hdr_set_len(struct tcmu_cmd_entry_hdr *hdr, __u32 len) | |||
| 97 | struct tcmu_cmd_entry { | 106 | struct tcmu_cmd_entry { |
| 98 | struct tcmu_cmd_entry_hdr hdr; | 107 | struct tcmu_cmd_entry_hdr hdr; |
| 99 | 108 | ||
| 100 | uint16_t cmd_id; | ||
| 101 | uint16_t __pad1; | ||
| 102 | |||
| 103 | union { | 109 | union { |
| 104 | struct { | 110 | struct { |
| 111 | uint32_t iov_cnt; | ||
| 112 | uint32_t iov_bidi_cnt; | ||
| 113 | uint32_t iov_dif_cnt; | ||
| 105 | uint64_t cdb_off; | 114 | uint64_t cdb_off; |
| 106 | uint64_t iov_cnt; | 115 | uint64_t __pad1; |
| 116 | uint64_t __pad2; | ||
| 107 | struct iovec iov[0]; | 117 | struct iovec iov[0]; |
| 108 | } req; | 118 | } req; |
| 109 | struct { | 119 | struct { |
