Lines Matching refs:sess

162 	struct ft_sess *sess;  in ft_sess_get()  local
173 hlist_for_each_entry_rcu(sess, head, hash) { in ft_sess_get()
174 if (sess->port_id == port_id) { in ft_sess_get()
175 kref_get(&sess->kref); in ft_sess_get()
178 port_id, sess); in ft_sess_get()
179 return sess; in ft_sess_get()
192 struct ft_sess *sess = p; in ft_sess_alloc_cb() local
193 struct ft_tport *tport = sess->tport; in ft_sess_alloc_cb()
194 struct hlist_head *head = &tport->hash[ft_sess_hash(sess->port_id)]; in ft_sess_alloc_cb()
196 TFC_SESS_DBG(tport->lport, "port_id %x sess %p\n", sess->port_id, sess); in ft_sess_alloc_cb()
197 hlist_add_head_rcu(&sess->hash, head); in ft_sess_alloc_cb()
211 struct ft_sess *sess; in ft_sess_create() local
218 hlist_for_each_entry_rcu(sess, head, hash) in ft_sess_create()
219 if (sess->port_id == port_id) in ft_sess_create()
220 return sess; in ft_sess_create()
222 sess = kzalloc(sizeof(*sess), GFP_KERNEL); in ft_sess_create()
223 if (!sess) in ft_sess_create()
226 kref_init(&sess->kref); /* ref for table entry */ in ft_sess_create()
227 sess->tport = tport; in ft_sess_create()
228 sess->port_id = port_id; in ft_sess_create()
230 sess->se_sess = target_setup_session(se_tpg, TCM_FC_DEFAULT_TAGS, in ft_sess_create()
233 sess, ft_sess_alloc_cb); in ft_sess_create()
234 if (IS_ERR(sess->se_sess)) { in ft_sess_create()
235 int rc = PTR_ERR(sess->se_sess); in ft_sess_create()
236 kfree(sess); in ft_sess_create()
237 sess = ERR_PTR(rc); in ft_sess_create()
239 return sess; in ft_sess_create()
246 static void ft_sess_unhash(struct ft_sess *sess) in ft_sess_unhash() argument
248 struct ft_tport *tport = sess->tport; in ft_sess_unhash()
250 hlist_del_rcu(&sess->hash); in ft_sess_unhash()
253 sess->port_id = -1; in ft_sess_unhash()
254 sess->params = 0; in ft_sess_unhash()
264 struct ft_sess *sess; in ft_sess_delete() local
267 hlist_for_each_entry_rcu(sess, head, hash) { in ft_sess_delete()
268 if (sess->port_id == port_id) { in ft_sess_delete()
269 ft_sess_unhash(sess); in ft_sess_delete()
270 return sess; in ft_sess_delete()
276 static void ft_close_sess(struct ft_sess *sess) in ft_close_sess() argument
278 target_stop_session(sess->se_sess); in ft_close_sess()
279 target_wait_for_sess_cmds(sess->se_sess); in ft_close_sess()
280 ft_sess_put(sess); in ft_close_sess()
290 struct ft_sess *sess; in ft_sess_delete_all() local
294 hlist_for_each_entry_rcu(sess, head, hash) { in ft_sess_delete_all()
295 ft_sess_unhash(sess); in ft_sess_delete_all()
296 ft_close_sess(sess); /* release from table */ in ft_sess_delete_all()
311 struct ft_sess *sess = se_sess->fabric_sess_ptr; in ft_sess_close() local
315 port_id = sess->port_id; in ft_sess_close()
320 TFC_SESS_DBG(sess->tport->lport, "port_id %x close session\n", port_id); in ft_sess_close()
321 ft_sess_unhash(sess); in ft_sess_close()
323 ft_close_sess(sess); in ft_sess_close()
330 struct ft_sess *sess = se_sess->fabric_sess_ptr; in ft_sess_get_index() local
332 return sess->port_id; /* XXX TBD probably not what is needed */ in ft_sess_get_index()
338 struct ft_sess *sess = se_sess->fabric_sess_ptr; in ft_sess_get_port_name() local
340 return ft_format_wwn(buf, len, sess->port_name); in ft_sess_get_port_name()
351 struct ft_sess *sess; in ft_prli_locked() local
379 sess = ft_sess_create(tport, rdata->ids.port_id, rdata); in ft_prli_locked()
380 if (IS_ERR(sess)) { in ft_prli_locked()
381 if (PTR_ERR(sess) == -EACCES) { in ft_prli_locked()
387 if (!sess->params) in ft_prli_locked()
389 sess->params = fcp_parm; in ft_prli_locked()
390 sess->port_name = rdata->ids.port_name; in ft_prli_locked()
391 sess->max_frame = rdata->maxframe_size; in ft_prli_locked()
436 struct ft_sess *sess = container_of(kref, struct ft_sess, kref); in ft_sess_free() local
438 target_remove_session(sess->se_sess); in ft_sess_free()
439 kfree_rcu(sess, rcu); in ft_sess_free()
442 void ft_sess_put(struct ft_sess *sess) in ft_sess_put() argument
444 int sess_held = kref_read(&sess->kref); in ft_sess_put()
447 kref_put(&sess->kref, ft_sess_free); in ft_sess_put()
452 struct ft_sess *sess; in ft_prlo() local
463 sess = ft_sess_delete(tport, rdata->ids.port_id); in ft_prlo()
464 if (!sess) { in ft_prlo()
469 ft_close_sess(sess); /* release from table */ in ft_prlo()
480 struct ft_sess *sess; in ft_recv() local
485 sess = ft_sess_get(lport, sid); in ft_recv()
486 if (!sess) { in ft_recv()
492 ft_recv_req(sess, fp); /* must do ft_sess_put() */ in ft_recv()