0001
0002
0003
0004
0005 #ifndef __TCM_FC_H__
0006 #define __TCM_FC_H__
0007
0008 #include <linux/types.h>
0009 #include <target/target_core_base.h>
0010
0011 #define FT_VERSION "0.4"
0012
0013 #define FT_NAMELEN 32
0014 #define FT_TPG_NAMELEN 32
0015 #define FT_LUN_NAMELEN 32
0016 #define TCM_FC_DEFAULT_TAGS 512
0017
0018 struct ft_transport_id {
0019 __u8 format;
0020 __u8 __resvd1[7];
0021 __u8 wwpn[8];
0022 __u8 __resvd2[8];
0023 } __attribute__((__packed__));
0024
0025
0026
0027
0028 struct ft_sess {
0029 u32 port_id;
0030 u32 params;
0031 u16 max_frame;
0032 u64 port_name;
0033 struct ft_tport *tport;
0034 struct se_session *se_sess;
0035 struct hlist_node hash;
0036 struct rcu_head rcu;
0037 struct kref kref;
0038 };
0039
0040
0041
0042
0043
0044 #define FT_SESS_HASH_BITS 6
0045 #define FT_SESS_HASH_SIZE (1 << FT_SESS_HASH_BITS)
0046
0047
0048
0049
0050
0051
0052
0053
0054 struct ft_tport {
0055 struct fc_lport *lport;
0056 struct ft_tpg *tpg;
0057 u32 sess_count;
0058 struct rcu_head rcu;
0059 struct hlist_head hash[FT_SESS_HASH_SIZE];
0060 };
0061
0062
0063
0064
0065 struct ft_node_auth {
0066 u64 port_name;
0067 u64 node_name;
0068 };
0069
0070
0071
0072
0073 struct ft_node_acl {
0074 struct se_node_acl se_node_acl;
0075 struct ft_node_auth node_auth;
0076 };
0077
0078 struct ft_lun {
0079 u32 index;
0080 char name[FT_LUN_NAMELEN];
0081 };
0082
0083
0084
0085
0086 struct ft_tpg {
0087 u32 index;
0088 struct ft_lport_wwn *lport_wwn;
0089 struct ft_tport *tport;
0090 struct list_head lun_list;
0091 struct se_portal_group se_tpg;
0092 struct workqueue_struct *workqueue;
0093 };
0094
0095 struct ft_lport_wwn {
0096 u64 wwpn;
0097 char name[FT_NAMELEN];
0098 struct list_head ft_wwn_node;
0099 struct ft_tpg *tpg;
0100 struct se_wwn se_wwn;
0101 };
0102
0103
0104
0105
0106 struct ft_cmd {
0107 struct ft_sess *sess;
0108 struct fc_seq *seq;
0109 struct se_cmd se_cmd;
0110 struct fc_frame *req_frame;
0111 u32 write_data_len;
0112 struct work_struct work;
0113
0114 unsigned char ft_sense_buffer[TRANSPORT_SENSE_BUFFER];
0115 u32 was_ddp_setup:1;
0116 u32 aborted:1;
0117 struct scatterlist *sg;
0118 u32 sg_cnt;
0119 };
0120
0121 extern struct mutex ft_lport_lock;
0122 extern struct fc4_prov ft_prov;
0123 extern unsigned int ft_debug_logging;
0124
0125
0126
0127
0128
0129
0130
0131
0132 void ft_sess_put(struct ft_sess *);
0133 void ft_sess_close(struct se_session *);
0134 u32 ft_sess_get_index(struct se_session *);
0135 u32 ft_sess_get_port_name(struct se_session *, unsigned char *, u32);
0136
0137 void ft_lport_add(struct fc_lport *, void *);
0138 void ft_lport_del(struct fc_lport *, void *);
0139 int ft_lport_notify(struct notifier_block *, unsigned long, void *);
0140
0141
0142
0143
0144 int ft_check_stop_free(struct se_cmd *);
0145 void ft_release_cmd(struct se_cmd *);
0146 int ft_queue_status(struct se_cmd *);
0147 int ft_queue_data_in(struct se_cmd *);
0148 int ft_write_pending(struct se_cmd *);
0149 int ft_get_cmd_state(struct se_cmd *);
0150 void ft_queue_tm_resp(struct se_cmd *);
0151 void ft_aborted_task(struct se_cmd *);
0152
0153
0154
0155
0156 void ft_recv_req(struct ft_sess *, struct fc_frame *);
0157 struct ft_tpg *ft_lport_find_tpg(struct fc_lport *);
0158
0159 void ft_recv_write_data(struct ft_cmd *, struct fc_frame *);
0160 void ft_dump_cmd(struct ft_cmd *, const char *caller);
0161
0162 ssize_t ft_format_wwn(char *, size_t, u64);
0163
0164
0165
0166
0167 void ft_invl_hw_context(struct ft_cmd *);
0168
0169 #endif