Commit 8962a4d2 authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Nicholas Bellinger

target/tcm_fc: Update debugging statements to match libfc usage

Update the debug statements to match those from libfc.
Signed-off-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 91b385b4
...@@ -39,6 +39,11 @@ ...@@ -39,6 +39,11 @@
#include "tcm_fc.h" #include "tcm_fc.h"
#define TFC_SESS_DBG(lport, fmt, args...) \
pr_debug("host%u: rport %6.6x: " fmt, \
(lport)->host->host_no, \
(lport)->port_id, ##args )
static void ft_sess_delete_all(struct ft_tport *); static void ft_sess_delete_all(struct ft_tport *);
/* /*
...@@ -167,24 +172,29 @@ static struct ft_sess *ft_sess_get(struct fc_lport *lport, u32 port_id) ...@@ -167,24 +172,29 @@ static struct ft_sess *ft_sess_get(struct fc_lport *lport, u32 port_id)
struct ft_tport *tport; struct ft_tport *tport;
struct hlist_head *head; struct hlist_head *head;
struct ft_sess *sess; struct ft_sess *sess;
char *reason = "no session created";
rcu_read_lock(); rcu_read_lock();
tport = rcu_dereference(lport->prov[FC_TYPE_FCP]); tport = rcu_dereference(lport->prov[FC_TYPE_FCP]);
if (!tport) if (!tport) {
reason = "not an FCP port";
goto out; goto out;
}
head = &tport->hash[ft_sess_hash(port_id)]; head = &tport->hash[ft_sess_hash(port_id)];
hlist_for_each_entry_rcu(sess, head, hash) { hlist_for_each_entry_rcu(sess, head, hash) {
if (sess->port_id == port_id) { if (sess->port_id == port_id) {
kref_get(&sess->kref); kref_get(&sess->kref);
rcu_read_unlock(); rcu_read_unlock();
pr_debug("port_id %x found %p\n", port_id, sess); TFC_SESS_DBG(lport, "port_id %x found %p\n",
port_id, sess);
return sess; return sess;
} }
} }
out: out:
rcu_read_unlock(); rcu_read_unlock();
pr_debug("port_id %x not found\n", port_id); TFC_SESS_DBG(lport, "port_id %x not found, %s\n",
port_id, reason);
return NULL; return NULL;
} }
...@@ -195,7 +205,7 @@ static int ft_sess_alloc_cb(struct se_portal_group *se_tpg, ...@@ -195,7 +205,7 @@ static int ft_sess_alloc_cb(struct se_portal_group *se_tpg,
struct ft_tport *tport = sess->tport; struct ft_tport *tport = sess->tport;
struct hlist_head *head = &tport->hash[ft_sess_hash(sess->port_id)]; struct hlist_head *head = &tport->hash[ft_sess_hash(sess->port_id)];
pr_debug("port_id %x sess %p\n", sess->port_id, sess); TFC_SESS_DBG(tport->lport, "port_id %x sess %p\n", sess->port_id, sess);
hlist_add_head_rcu(&sess->hash, head); hlist_add_head_rcu(&sess->hash, head);
tport->sess_count++; tport->sess_count++;
...@@ -320,7 +330,7 @@ void ft_sess_close(struct se_session *se_sess) ...@@ -320,7 +330,7 @@ void ft_sess_close(struct se_session *se_sess)
mutex_unlock(&ft_lport_lock); mutex_unlock(&ft_lport_lock);
return; return;
} }
pr_debug("port_id %x\n", port_id); TFC_SESS_DBG(sess->tport->lport, "port_id %x close session\n", port_id);
ft_sess_unhash(sess); ft_sess_unhash(sess);
mutex_unlock(&ft_lport_lock); mutex_unlock(&ft_lport_lock);
ft_close_sess(sess); ft_close_sess(sess);
...@@ -380,8 +390,13 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len, ...@@ -380,8 +390,13 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len,
if (!(fcp_parm & FCP_SPPF_INIT_FCN)) if (!(fcp_parm & FCP_SPPF_INIT_FCN))
return FC_SPP_RESP_CONF; return FC_SPP_RESP_CONF;
sess = ft_sess_create(tport, rdata->ids.port_id, rdata); sess = ft_sess_create(tport, rdata->ids.port_id, rdata);
if (!sess) if (IS_ERR(sess)) {
return FC_SPP_RESP_RES; if (PTR_ERR(sess) == -EACCES) {
spp->spp_flags &= ~FC_SPP_EST_IMG_PAIR;
return FC_SPP_RESP_CONF;
} else
return FC_SPP_RESP_RES;
}
if (!sess->params) if (!sess->params)
rdata->prli_count++; rdata->prli_count++;
sess->params = fcp_parm; sess->params = fcp_parm;
...@@ -424,8 +439,8 @@ static int ft_prli(struct fc_rport_priv *rdata, u32 spp_len, ...@@ -424,8 +439,8 @@ static int ft_prli(struct fc_rport_priv *rdata, u32 spp_len,
mutex_lock(&ft_lport_lock); mutex_lock(&ft_lport_lock);
ret = ft_prli_locked(rdata, spp_len, rspp, spp); ret = ft_prli_locked(rdata, spp_len, rspp, spp);
mutex_unlock(&ft_lport_lock); mutex_unlock(&ft_lport_lock);
pr_debug("port_id %x flags %x ret %x\n", TFC_SESS_DBG(rdata->local_port, "port_id %x flags %x ret %x\n",
rdata->ids.port_id, rspp ? rspp->spp_flags : 0, ret); rdata->ids.port_id, rspp ? rspp->spp_flags : 0, ret);
return ret; return ret;
} }
...@@ -478,11 +493,11 @@ static void ft_recv(struct fc_lport *lport, struct fc_frame *fp) ...@@ -478,11 +493,11 @@ static void ft_recv(struct fc_lport *lport, struct fc_frame *fp)
struct ft_sess *sess; struct ft_sess *sess;
u32 sid = fc_frame_sid(fp); u32 sid = fc_frame_sid(fp);
pr_debug("sid %x\n", sid); TFC_SESS_DBG(lport, "recv sid %x\n", sid);
sess = ft_sess_get(lport, sid); sess = ft_sess_get(lport, sid);
if (!sess) { if (!sess) {
pr_debug("sid %x sess lookup failed\n", sid); TFC_SESS_DBG(lport, "sid %x sess lookup failed\n", sid);
/* TBD XXX - if FCP_CMND, send PRLO */ /* TBD XXX - if FCP_CMND, send PRLO */
fc_frame_free(fp); fc_frame_free(fp);
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment