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