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