Lines Matching defs:sess

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