1
2
3
4
5 #ifndef __TCM_FC_H__
6 #define __TCM_FC_H__
7
8 #include <linux/types.h>
9 #include <target/target_core_base.h>
10
11 #define FT_VERSION "0.4"
12
13 #define FT_NAMELEN 32
14 #define FT_TPG_NAMELEN 32
15 #define FT_LUN_NAMELEN 32
16 #define TCM_FC_DEFAULT_TAGS 512
17
18 struct ft_transport_id {
19 __u8 format;
20 __u8 __resvd1[7];
21 __u8 wwpn[8];
22 __u8 __resvd2[8];
23 } __attribute__((__packed__));
24
25
26
27
28 struct ft_sess {
29 u32 port_id;
30 u32 params;
31 u16 max_frame;
32 u64 port_name;
33 struct ft_tport *tport;
34 struct se_session *se_sess;
35 struct hlist_node hash;
36 struct rcu_head rcu;
37 struct kref kref;
38 };
39
40
41
42
43
44 #define FT_SESS_HASH_BITS 6
45 #define FT_SESS_HASH_SIZE (1 << FT_SESS_HASH_BITS)
46
47
48
49
50
51
52
53
54 struct ft_tport {
55 struct fc_lport *lport;
56 struct ft_tpg *tpg;
57 u32 sess_count;
58 struct rcu_head rcu;
59 struct hlist_head hash[FT_SESS_HASH_SIZE];
60 };
61
62
63
64
65 struct ft_node_auth {
66 u64 port_name;
67 u64 node_name;
68 };
69
70
71
72
73 struct ft_node_acl {
74 struct se_node_acl se_node_acl;
75 struct ft_node_auth node_auth;
76 };
77
78 struct ft_lun {
79 u32 index;
80 char name[FT_LUN_NAMELEN];
81 };
82
83
84
85
86 struct ft_tpg {
87 u32 index;
88 struct ft_lport_wwn *lport_wwn;
89 struct ft_tport *tport;
90 struct list_head lun_list;
91 struct se_portal_group se_tpg;
92 struct workqueue_struct *workqueue;
93 };
94
95 struct ft_lport_wwn {
96 u64 wwpn;
97 char name[FT_NAMELEN];
98 struct list_head ft_wwn_node;
99 struct ft_tpg *tpg;
100 struct se_wwn se_wwn;
101 };
102
103
104
105
106 struct ft_cmd {
107 struct ft_sess *sess;
108 struct fc_seq *seq;
109 struct se_cmd se_cmd;
110 struct fc_frame *req_frame;
111 u32 write_data_len;
112 struct work_struct work;
113
114 unsigned char ft_sense_buffer[TRANSPORT_SENSE_BUFFER];
115 u32 was_ddp_setup:1;
116 u32 aborted:1;
117 struct scatterlist *sg;
118 u32 sg_cnt;
119 };
120
121 extern struct mutex ft_lport_lock;
122 extern struct fc4_prov ft_prov;
123 extern unsigned int ft_debug_logging;
124
125
126
127
128
129
130
131
132 void ft_sess_put(struct ft_sess *);
133 void ft_sess_close(struct se_session *);
134 u32 ft_sess_get_index(struct se_session *);
135 u32 ft_sess_get_port_name(struct se_session *, unsigned char *, u32);
136
137 void ft_lport_add(struct fc_lport *, void *);
138 void ft_lport_del(struct fc_lport *, void *);
139 int ft_lport_notify(struct notifier_block *, unsigned long, void *);
140
141
142
143
144 int ft_check_stop_free(struct se_cmd *);
145 void ft_release_cmd(struct se_cmd *);
146 int ft_queue_status(struct se_cmd *);
147 int ft_queue_data_in(struct se_cmd *);
148 int ft_write_pending(struct se_cmd *);
149 int ft_get_cmd_state(struct se_cmd *);
150 void ft_queue_tm_resp(struct se_cmd *);
151 void ft_aborted_task(struct se_cmd *);
152
153
154
155
156 void ft_recv_req(struct ft_sess *, struct fc_frame *);
157 struct ft_tpg *ft_lport_find_tpg(struct fc_lport *);
158
159 void ft_recv_write_data(struct ft_cmd *, struct fc_frame *);
160 void ft_dump_cmd(struct ft_cmd *, const char *caller);
161
162 ssize_t ft_format_wwn(char *, size_t, u64);
163
164
165
166
167 void ft_invl_hw_context(struct ft_cmd *);
168
169 #endif