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