Commit 9f5d32af authored by Doug Ledford's avatar Doug Ledford

ib_srpt: convert printk's to pr_* functions

The driver already defined the pr_format, it just hadn't
been converted to use pr_info, pr_warn, and pr_err instead
of the equivalent printks.  Convert so that messages from
the driver are now properly tagged with their driver name
and can be more easily debugged.

In addition, a number of these printk's were not newline
terminated, so fix that at the same time.
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 56b5390c
...@@ -207,7 +207,7 @@ static void srpt_event_handler(struct ib_event_handler *handler, ...@@ -207,7 +207,7 @@ static void srpt_event_handler(struct ib_event_handler *handler,
} }
break; break;
default: default:
printk(KERN_ERR "received unrecognized IB event %d\n", pr_err("received unrecognized IB event %d\n",
event->event); event->event);
break; break;
} }
...@@ -218,7 +218,7 @@ static void srpt_event_handler(struct ib_event_handler *handler, ...@@ -218,7 +218,7 @@ static void srpt_event_handler(struct ib_event_handler *handler,
*/ */
static void srpt_srq_event(struct ib_event *event, void *ctx) static void srpt_srq_event(struct ib_event *event, void *ctx)
{ {
printk(KERN_INFO "SRQ event %d\n", event->event); pr_info("SRQ event %d\n", event->event);
} }
/** /**
...@@ -242,8 +242,7 @@ static void srpt_qp_event(struct ib_event *event, struct srpt_rdma_ch *ch) ...@@ -242,8 +242,7 @@ static void srpt_qp_event(struct ib_event *event, struct srpt_rdma_ch *ch)
ch->sess_name, srpt_get_ch_state(ch)); ch->sess_name, srpt_get_ch_state(ch));
break; break;
default: default:
printk(KERN_ERR "received unrecognized IB QP event %d\n", pr_err("received unrecognized IB QP event %d\n", event->event);
event->event);
break; break;
} }
} }
...@@ -602,7 +601,7 @@ static void srpt_unregister_mad_agent(struct srpt_device *sdev) ...@@ -602,7 +601,7 @@ static void srpt_unregister_mad_agent(struct srpt_device *sdev)
sport = &sdev->port[i - 1]; sport = &sdev->port[i - 1];
WARN_ON(sport->port != i); WARN_ON(sport->port != i);
if (ib_modify_port(sdev->device, i, 0, &port_modify) < 0) if (ib_modify_port(sdev->device, i, 0, &port_modify) < 0)
printk(KERN_ERR "disabling MAD processing failed.\n"); pr_err("disabling MAD processing failed.\n");
if (sport->mad_agent) { if (sport->mad_agent) {
ib_unregister_mad_agent(sport->mad_agent); ib_unregister_mad_agent(sport->mad_agent);
sport->mad_agent = NULL; sport->mad_agent = NULL;
...@@ -810,7 +809,7 @@ static int srpt_post_send(struct srpt_rdma_ch *ch, ...@@ -810,7 +809,7 @@ static int srpt_post_send(struct srpt_rdma_ch *ch,
ret = -ENOMEM; ret = -ENOMEM;
if (unlikely(atomic_dec_return(&ch->sq_wr_avail) < 0)) { if (unlikely(atomic_dec_return(&ch->sq_wr_avail) < 0)) {
printk(KERN_WARNING "IB send queue full (needed 1)\n"); pr_warn("IB send queue full (needed 1)\n");
goto out; goto out;
} }
...@@ -912,7 +911,7 @@ static int srpt_get_desc_tbl(struct srpt_send_ioctx *ioctx, ...@@ -912,7 +911,7 @@ static int srpt_get_desc_tbl(struct srpt_send_ioctx *ioctx,
if (ioctx->n_rbuf > if (ioctx->n_rbuf >
(srp_cmd->data_out_desc_cnt + srp_cmd->data_in_desc_cnt)) { (srp_cmd->data_out_desc_cnt + srp_cmd->data_in_desc_cnt)) {
printk(KERN_ERR "received unsupported SRP_CMD request" pr_err("received unsupported SRP_CMD request"
" type (%u out + %u in != %u / %zu)\n", " type (%u out + %u in != %u / %zu)\n",
srp_cmd->data_out_desc_cnt, srp_cmd->data_out_desc_cnt,
srp_cmd->data_in_desc_cnt, srp_cmd->data_in_desc_cnt,
...@@ -1432,7 +1431,7 @@ static void srpt_handle_send_comp(struct srpt_rdma_ch *ch, ...@@ -1432,7 +1431,7 @@ static void srpt_handle_send_comp(struct srpt_rdma_ch *ch,
srpt_unmap_sg_to_ib_sge(ch, ioctx); srpt_unmap_sg_to_ib_sge(ch, ioctx);
transport_generic_free_cmd(&ioctx->cmd, 0); transport_generic_free_cmd(&ioctx->cmd, 0);
} else { } else {
printk(KERN_ERR "IB completion has been received too late for" pr_err("IB completion has been received too late for"
" wr_id = %u.\n", ioctx->ioctx.index); " wr_id = %u.\n", ioctx->ioctx.index);
} }
} }
...@@ -1457,7 +1456,7 @@ static void srpt_handle_rdma_comp(struct srpt_rdma_ch *ch, ...@@ -1457,7 +1456,7 @@ static void srpt_handle_rdma_comp(struct srpt_rdma_ch *ch,
SRPT_STATE_DATA_IN)) SRPT_STATE_DATA_IN))
target_execute_cmd(&ioctx->cmd); target_execute_cmd(&ioctx->cmd);
else else
printk(KERN_ERR "%s[%d]: wrong state = %d\n", __func__, pr_err("%s[%d]: wrong state = %d\n", __func__,
__LINE__, srpt_get_cmd_state(ioctx)); __LINE__, srpt_get_cmd_state(ioctx));
} else if (opcode == SRPT_RDMA_ABORT) { } else if (opcode == SRPT_RDMA_ABORT) {
ioctx->rdma_aborted = true; ioctx->rdma_aborted = true;
...@@ -1481,7 +1480,7 @@ static void srpt_handle_rdma_err_comp(struct srpt_rdma_ch *ch, ...@@ -1481,7 +1480,7 @@ static void srpt_handle_rdma_err_comp(struct srpt_rdma_ch *ch,
switch (opcode) { switch (opcode) {
case SRPT_RDMA_READ_LAST: case SRPT_RDMA_READ_LAST:
if (ioctx->n_rdma <= 0) { if (ioctx->n_rdma <= 0) {
printk(KERN_ERR "Received invalid RDMA read" pr_err("Received invalid RDMA read"
" error completion with idx %d\n", " error completion with idx %d\n",
ioctx->ioctx.index); ioctx->ioctx.index);
break; break;
...@@ -1490,14 +1489,13 @@ static void srpt_handle_rdma_err_comp(struct srpt_rdma_ch *ch, ...@@ -1490,14 +1489,13 @@ static void srpt_handle_rdma_err_comp(struct srpt_rdma_ch *ch,
if (state == SRPT_STATE_NEED_DATA) if (state == SRPT_STATE_NEED_DATA)
srpt_abort_cmd(ioctx); srpt_abort_cmd(ioctx);
else else
printk(KERN_ERR "%s[%d]: wrong state = %d\n", pr_err("%s[%d]: wrong state = %d\n",
__func__, __LINE__, state); __func__, __LINE__, state);
break; break;
case SRPT_RDMA_WRITE_LAST: case SRPT_RDMA_WRITE_LAST:
break; break;
default: default:
printk(KERN_ERR "%s[%d]: opcode = %u\n", __func__, pr_err("%s[%d]: opcode = %u\n", __func__, __LINE__, opcode);
__LINE__, opcode);
break; break;
} }
} }
...@@ -1549,8 +1547,8 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch, ...@@ -1549,8 +1547,8 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch,
BUILD_BUG_ON(MIN_MAX_RSP_SIZE <= sizeof(*srp_rsp)); BUILD_BUG_ON(MIN_MAX_RSP_SIZE <= sizeof(*srp_rsp));
max_sense_len = ch->max_ti_iu_len - sizeof(*srp_rsp); max_sense_len = ch->max_ti_iu_len - sizeof(*srp_rsp);
if (sense_data_len > max_sense_len) { if (sense_data_len > max_sense_len) {
printk(KERN_WARNING "truncated sense data from %d to %d" pr_warn("truncated sense data from %d to %d"
" bytes\n", sense_data_len, max_sense_len); " bytes\n", sense_data_len, max_sense_len);
sense_data_len = max_sense_len; sense_data_len = max_sense_len;
} }
...@@ -1628,8 +1626,8 @@ static uint64_t srpt_unpack_lun(const uint8_t *lun, int len) ...@@ -1628,8 +1626,8 @@ static uint64_t srpt_unpack_lun(const uint8_t *lun, int len)
int addressing_method; int addressing_method;
if (unlikely(len < 2)) { if (unlikely(len < 2)) {
printk(KERN_ERR "Illegal LUN length %d, expected 2 bytes or " pr_err("Illegal LUN length %d, expected 2 bytes or more\n",
"more", len); len);
goto out; goto out;
} }
...@@ -1663,7 +1661,7 @@ static uint64_t srpt_unpack_lun(const uint8_t *lun, int len) ...@@ -1663,7 +1661,7 @@ static uint64_t srpt_unpack_lun(const uint8_t *lun, int len)
case SCSI_LUN_ADDR_METHOD_EXTENDED_LUN: case SCSI_LUN_ADDR_METHOD_EXTENDED_LUN:
default: default:
printk(KERN_ERR "Unimplemented LUN addressing method %u", pr_err("Unimplemented LUN addressing method %u\n",
addressing_method); addressing_method);
break; break;
} }
...@@ -1672,8 +1670,7 @@ static uint64_t srpt_unpack_lun(const uint8_t *lun, int len) ...@@ -1672,8 +1670,7 @@ static uint64_t srpt_unpack_lun(const uint8_t *lun, int len)
return res; return res;
out_err: out_err:
printk(KERN_ERR "Support for multi-level LUNs has not yet been" pr_err("Support for multi-level LUNs has not yet been implemented\n");
" implemented");
goto out; goto out;
} }
...@@ -1723,7 +1720,7 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch, ...@@ -1723,7 +1720,7 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
} }
if (srpt_get_desc_tbl(send_ioctx, srp_cmd, &dir, &data_len)) { if (srpt_get_desc_tbl(send_ioctx, srp_cmd, &dir, &data_len)) {
printk(KERN_ERR "0x%llx: parsing SRP descriptor table failed.\n", pr_err("0x%llx: parsing SRP descriptor table failed.\n",
srp_cmd->tag); srp_cmd->tag);
ret = TCM_INVALID_CDB_FIELD; ret = TCM_INVALID_CDB_FIELD;
goto send_sense; goto send_sense;
...@@ -1912,7 +1909,7 @@ static void srpt_handle_new_iu(struct srpt_rdma_ch *ch, ...@@ -1912,7 +1909,7 @@ static void srpt_handle_new_iu(struct srpt_rdma_ch *ch,
srpt_handle_tsk_mgmt(ch, recv_ioctx, send_ioctx); srpt_handle_tsk_mgmt(ch, recv_ioctx, send_ioctx);
break; break;
case SRP_I_LOGOUT: case SRP_I_LOGOUT:
printk(KERN_ERR "Not yet implemented: SRP_I_LOGOUT\n"); pr_err("Not yet implemented: SRP_I_LOGOUT\n");
break; break;
case SRP_CRED_RSP: case SRP_CRED_RSP:
pr_debug("received SRP_CRED_RSP\n"); pr_debug("received SRP_CRED_RSP\n");
...@@ -1921,10 +1918,10 @@ static void srpt_handle_new_iu(struct srpt_rdma_ch *ch, ...@@ -1921,10 +1918,10 @@ static void srpt_handle_new_iu(struct srpt_rdma_ch *ch,
pr_debug("received SRP_AER_RSP\n"); pr_debug("received SRP_AER_RSP\n");
break; break;
case SRP_RSP: case SRP_RSP:
printk(KERN_ERR "Received SRP_RSP\n"); pr_err("Received SRP_RSP\n");
break; break;
default: default:
printk(KERN_ERR "received IU with unknown opcode 0x%x\n", pr_err("received IU with unknown opcode 0x%x\n",
srp_cmd->opcode); srp_cmd->opcode);
break; break;
} }
...@@ -1948,12 +1945,12 @@ static void srpt_process_rcv_completion(struct ib_cq *cq, ...@@ -1948,12 +1945,12 @@ static void srpt_process_rcv_completion(struct ib_cq *cq,
req_lim = atomic_dec_return(&ch->req_lim); req_lim = atomic_dec_return(&ch->req_lim);
if (unlikely(req_lim < 0)) if (unlikely(req_lim < 0))
printk(KERN_ERR "req_lim = %d < 0\n", req_lim); pr_err("req_lim = %d < 0\n", req_lim);
ioctx = sdev->ioctx_ring[index]; ioctx = sdev->ioctx_ring[index];
srpt_handle_new_iu(ch, ioctx, NULL); srpt_handle_new_iu(ch, ioctx, NULL);
} else { } else {
printk(KERN_INFO "receiving failed for idx %u with status %d\n", pr_info("receiving failed for idx %u with status %d\n",
index, wc->status); index, wc->status);
} }
} }
...@@ -1993,12 +1990,12 @@ static void srpt_process_send_completion(struct ib_cq *cq, ...@@ -1993,12 +1990,12 @@ static void srpt_process_send_completion(struct ib_cq *cq,
} }
} else { } else {
if (opcode == SRPT_SEND) { if (opcode == SRPT_SEND) {
printk(KERN_INFO "sending response for idx %u failed" pr_info("sending response for idx %u failed"
" with status %d\n", index, wc->status); " with status %d\n", index, wc->status);
srpt_handle_send_err_comp(ch, wc->wr_id); srpt_handle_send_err_comp(ch, wc->wr_id);
} else if (opcode != SRPT_RDMA_MID) { } else if (opcode != SRPT_RDMA_MID) {
printk(KERN_INFO "RDMA t %d for idx %u failed with" pr_info("RDMA t %d for idx %u failed with"
" status %d", opcode, index, wc->status); " status %d\n", opcode, index, wc->status);
srpt_handle_rdma_err_comp(ch, send_ioctx, opcode); srpt_handle_rdma_err_comp(ch, send_ioctx, opcode);
} }
} }
...@@ -2062,15 +2059,15 @@ static int srpt_compl_thread(void *arg) ...@@ -2062,15 +2059,15 @@ static int srpt_compl_thread(void *arg)
ch = arg; ch = arg;
BUG_ON(!ch); BUG_ON(!ch);
printk(KERN_INFO "Session %s: kernel thread %s (PID %d) started\n", pr_info("Session %s: kernel thread %s (PID %d) started\n",
ch->sess_name, ch->thread->comm, current->pid); ch->sess_name, ch->thread->comm, current->pid);
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
wait_event_interruptible(ch->wait_queue, wait_event_interruptible(ch->wait_queue,
(srpt_process_completion(ch->cq, ch), (srpt_process_completion(ch->cq, ch),
kthread_should_stop())); kthread_should_stop()));
} }
printk(KERN_INFO "Session %s: kernel thread %s (PID %d) stopped\n", pr_info("Session %s: kernel thread %s (PID %d) stopped\n",
ch->sess_name, ch->thread->comm, current->pid); ch->sess_name, ch->thread->comm, current->pid);
return 0; return 0;
} }
...@@ -2097,7 +2094,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) ...@@ -2097,7 +2094,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
ch->rq_size + srp_sq_size, 0); ch->rq_size + srp_sq_size, 0);
if (IS_ERR(ch->cq)) { if (IS_ERR(ch->cq)) {
ret = PTR_ERR(ch->cq); ret = PTR_ERR(ch->cq);
printk(KERN_ERR "failed to create CQ cqe= %d ret= %d\n", pr_err("failed to create CQ cqe= %d ret= %d\n",
ch->rq_size + srp_sq_size, ret); ch->rq_size + srp_sq_size, ret);
goto out; goto out;
} }
...@@ -2123,7 +2120,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) ...@@ -2123,7 +2120,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
goto retry; goto retry;
} }
} }
printk(KERN_ERR "failed to create_qp ret= %d\n", ret); pr_err("failed to create_qp ret= %d\n", ret);
goto err_destroy_cq; goto err_destroy_cq;
} }
...@@ -2143,7 +2140,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) ...@@ -2143,7 +2140,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
ch->thread = kthread_run(srpt_compl_thread, ch, "ib_srpt_compl"); ch->thread = kthread_run(srpt_compl_thread, ch, "ib_srpt_compl");
if (IS_ERR(ch->thread)) { if (IS_ERR(ch->thread)) {
printk(KERN_ERR "failed to create kernel thread %ld\n", pr_err("failed to create kernel thread %ld\n",
PTR_ERR(ch->thread)); PTR_ERR(ch->thread));
ch->thread = NULL; ch->thread = NULL;
goto err_destroy_qp; goto err_destroy_qp;
...@@ -2204,7 +2201,7 @@ static void __srpt_close_ch(struct srpt_rdma_ch *ch) ...@@ -2204,7 +2201,7 @@ static void __srpt_close_ch(struct srpt_rdma_ch *ch)
/* fall through */ /* fall through */
case CH_LIVE: case CH_LIVE:
if (ib_send_cm_dreq(ch->cm_id, NULL, 0) < 0) if (ib_send_cm_dreq(ch->cm_id, NULL, 0) < 0)
printk(KERN_ERR "sending CM DREQ failed.\n"); pr_err("sending CM DREQ failed.\n");
break; break;
case CH_DISCONNECTING: case CH_DISCONNECTING:
break; break;
...@@ -2291,7 +2288,7 @@ static void srpt_drain_channel(struct ib_cm_id *cm_id) ...@@ -2291,7 +2288,7 @@ static void srpt_drain_channel(struct ib_cm_id *cm_id)
ret = srpt_ch_qp_err(ch); ret = srpt_ch_qp_err(ch);
if (ret < 0) if (ret < 0)
printk(KERN_ERR "Setting queue pair in error state" pr_err("Setting queue pair in error state"
" failed: %d\n", ret); " failed: %d\n", ret);
} }
} }
...@@ -2435,17 +2432,17 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2435,17 +2432,17 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
it_iu_len = be32_to_cpu(req->req_it_iu_len); it_iu_len = be32_to_cpu(req->req_it_iu_len);
printk(KERN_INFO "Received SRP_LOGIN_REQ with i_port_id 0x%llx:0x%llx," pr_info("Received SRP_LOGIN_REQ with i_port_id 0x%llx:0x%llx,"
" t_port_id 0x%llx:0x%llx and it_iu_len %d on port %d" " t_port_id 0x%llx:0x%llx and it_iu_len %d on port %d"
" (guid=0x%llx:0x%llx)\n", " (guid=0x%llx:0x%llx)\n",
be64_to_cpu(*(__be64 *)&req->initiator_port_id[0]), be64_to_cpu(*(__be64 *)&req->initiator_port_id[0]),
be64_to_cpu(*(__be64 *)&req->initiator_port_id[8]), be64_to_cpu(*(__be64 *)&req->initiator_port_id[8]),
be64_to_cpu(*(__be64 *)&req->target_port_id[0]), be64_to_cpu(*(__be64 *)&req->target_port_id[0]),
be64_to_cpu(*(__be64 *)&req->target_port_id[8]), be64_to_cpu(*(__be64 *)&req->target_port_id[8]),
it_iu_len, it_iu_len,
param->port, param->port,
be64_to_cpu(*(__be64 *)&sdev->port[param->port - 1].gid.raw[0]), be64_to_cpu(*(__be64 *)&sdev->port[param->port - 1].gid.raw[0]),
be64_to_cpu(*(__be64 *)&sdev->port[param->port - 1].gid.raw[8])); be64_to_cpu(*(__be64 *)&sdev->port[param->port - 1].gid.raw[8]));
rsp = kzalloc(sizeof *rsp, GFP_KERNEL); rsp = kzalloc(sizeof *rsp, GFP_KERNEL);
rej = kzalloc(sizeof *rej, GFP_KERNEL); rej = kzalloc(sizeof *rej, GFP_KERNEL);
...@@ -2460,7 +2457,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2460,7 +2457,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
rej->reason = __constant_cpu_to_be32( rej->reason = __constant_cpu_to_be32(
SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE); SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE);
ret = -EINVAL; ret = -EINVAL;
printk(KERN_ERR "rejected SRP_LOGIN_REQ because its" pr_err("rejected SRP_LOGIN_REQ because its"
" length (%d bytes) is out of range (%d .. %d)\n", " length (%d bytes) is out of range (%d .. %d)\n",
it_iu_len, 64, srp_max_req_size); it_iu_len, 64, srp_max_req_size);
goto reject; goto reject;
...@@ -2470,7 +2467,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2470,7 +2467,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
rej->reason = __constant_cpu_to_be32( rej->reason = __constant_cpu_to_be32(
SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
ret = -EINVAL; ret = -EINVAL;
printk(KERN_ERR "rejected SRP_LOGIN_REQ because the target port" pr_err("rejected SRP_LOGIN_REQ because the target port"
" has not yet been enabled\n"); " has not yet been enabled\n");
goto reject; goto reject;
} }
...@@ -2516,7 +2513,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2516,7 +2513,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
rej->reason = __constant_cpu_to_be32( rej->reason = __constant_cpu_to_be32(
SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL); SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL);
ret = -ENOMEM; ret = -ENOMEM;
printk(KERN_ERR "rejected SRP_LOGIN_REQ because it" pr_err("rejected SRP_LOGIN_REQ because it"
" has an invalid target port identifier.\n"); " has an invalid target port identifier.\n");
goto reject; goto reject;
} }
...@@ -2525,7 +2522,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2525,7 +2522,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
if (!ch) { if (!ch) {
rej->reason = __constant_cpu_to_be32( rej->reason = __constant_cpu_to_be32(
SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
printk(KERN_ERR "rejected SRP_LOGIN_REQ because no memory.\n"); pr_err("rejected SRP_LOGIN_REQ because no memory.\n");
ret = -ENOMEM; ret = -ENOMEM;
goto reject; goto reject;
} }
...@@ -2562,7 +2559,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2562,7 +2559,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
if (ret) { if (ret) {
rej->reason = __constant_cpu_to_be32( rej->reason = __constant_cpu_to_be32(
SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
printk(KERN_ERR "rejected SRP_LOGIN_REQ because creating" pr_err("rejected SRP_LOGIN_REQ because creating"
" a new RDMA channel failed.\n"); " a new RDMA channel failed.\n");
goto free_ring; goto free_ring;
} }
...@@ -2571,7 +2568,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2571,7 +2568,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
if (ret) { if (ret) {
rej->reason = __constant_cpu_to_be32( rej->reason = __constant_cpu_to_be32(
SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
printk(KERN_ERR "rejected SRP_LOGIN_REQ because enabling" pr_err("rejected SRP_LOGIN_REQ because enabling"
" RTR failed (error code = %d)\n", ret); " RTR failed (error code = %d)\n", ret);
goto destroy_ib; goto destroy_ib;
} }
...@@ -2586,8 +2583,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2586,8 +2583,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
nacl = srpt_lookup_acl(sport, ch->i_port_id); nacl = srpt_lookup_acl(sport, ch->i_port_id);
if (!nacl) { if (!nacl) {
printk(KERN_INFO "Rejected login because no ACL has been" pr_info("Rejected login because no ACL has been"
" configured yet for initiator %s.\n", ch->sess_name); " configured yet for initiator %s.\n", ch->sess_name);
rej->reason = __constant_cpu_to_be32( rej->reason = __constant_cpu_to_be32(
SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED); SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED);
goto destroy_ib; goto destroy_ib;
...@@ -2631,7 +2628,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2631,7 +2628,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
ret = ib_send_cm_rep(cm_id, rep_param); ret = ib_send_cm_rep(cm_id, rep_param);
if (ret) { if (ret) {
printk(KERN_ERR "sending SRP_LOGIN_REQ response failed" pr_err("sending SRP_LOGIN_REQ response failed"
" (error code = %d)\n", ret); " (error code = %d)\n", ret);
goto release_channel; goto release_channel;
} }
...@@ -2679,7 +2676,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2679,7 +2676,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
static void srpt_cm_rej_recv(struct ib_cm_id *cm_id) static void srpt_cm_rej_recv(struct ib_cm_id *cm_id)
{ {
printk(KERN_INFO "Received IB REJ for cm_id %p.\n", cm_id); pr_info("Received IB REJ for cm_id %p.\n", cm_id);
srpt_drain_channel(cm_id); srpt_drain_channel(cm_id);
} }
...@@ -2714,13 +2711,13 @@ static void srpt_cm_rtu_recv(struct ib_cm_id *cm_id) ...@@ -2714,13 +2711,13 @@ static void srpt_cm_rtu_recv(struct ib_cm_id *cm_id)
static void srpt_cm_timewait_exit(struct ib_cm_id *cm_id) static void srpt_cm_timewait_exit(struct ib_cm_id *cm_id)
{ {
printk(KERN_INFO "Received IB TimeWait exit for cm_id %p.\n", cm_id); pr_info("Received IB TimeWait exit for cm_id %p.\n", cm_id);
srpt_drain_channel(cm_id); srpt_drain_channel(cm_id);
} }
static void srpt_cm_rep_error(struct ib_cm_id *cm_id) static void srpt_cm_rep_error(struct ib_cm_id *cm_id)
{ {
printk(KERN_INFO "Received IB REP error for cm_id %p.\n", cm_id); pr_info("Received IB REP error for cm_id %p.\n", cm_id);
srpt_drain_channel(cm_id); srpt_drain_channel(cm_id);
} }
...@@ -2755,9 +2752,9 @@ static void srpt_cm_dreq_recv(struct ib_cm_id *cm_id) ...@@ -2755,9 +2752,9 @@ static void srpt_cm_dreq_recv(struct ib_cm_id *cm_id)
if (send_drep) { if (send_drep) {
if (ib_send_cm_drep(ch->cm_id, NULL, 0) < 0) if (ib_send_cm_drep(ch->cm_id, NULL, 0) < 0)
printk(KERN_ERR "Sending IB DREP failed.\n"); pr_err("Sending IB DREP failed.\n");
printk(KERN_INFO "Received DREQ and sent DREP for session %s.\n", pr_info("Received DREQ and sent DREP for session %s.\n",
ch->sess_name); ch->sess_name);
} }
} }
...@@ -2766,8 +2763,7 @@ static void srpt_cm_dreq_recv(struct ib_cm_id *cm_id) ...@@ -2766,8 +2763,7 @@ static void srpt_cm_dreq_recv(struct ib_cm_id *cm_id)
*/ */
static void srpt_cm_drep_recv(struct ib_cm_id *cm_id) static void srpt_cm_drep_recv(struct ib_cm_id *cm_id)
{ {
printk(KERN_INFO "Received InfiniBand DREP message for cm_id %p.\n", pr_info("Received InfiniBand DREP message for cm_id %p.\n", cm_id);
cm_id);
srpt_drain_channel(cm_id); srpt_drain_channel(cm_id);
} }
...@@ -2811,14 +2807,13 @@ static int srpt_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event) ...@@ -2811,14 +2807,13 @@ static int srpt_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
srpt_cm_rep_error(cm_id); srpt_cm_rep_error(cm_id);
break; break;
case IB_CM_DREQ_ERROR: case IB_CM_DREQ_ERROR:
printk(KERN_INFO "Received IB DREQ ERROR event.\n"); pr_info("Received IB DREQ ERROR event.\n");
break; break;
case IB_CM_MRA_RECEIVED: case IB_CM_MRA_RECEIVED:
printk(KERN_INFO "Received IB MRA event\n"); pr_info("Received IB MRA event\n");
break; break;
default: default:
printk(KERN_ERR "received unrecognized IB CM event %d\n", pr_err("received unrecognized IB CM event %d\n", event->event);
event->event);
break; break;
} }
...@@ -2848,8 +2843,8 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch, ...@@ -2848,8 +2843,8 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch,
ret = -ENOMEM; ret = -ENOMEM;
sq_wr_avail = atomic_sub_return(n_rdma, &ch->sq_wr_avail); sq_wr_avail = atomic_sub_return(n_rdma, &ch->sq_wr_avail);
if (sq_wr_avail < 0) { if (sq_wr_avail < 0) {
printk(KERN_WARNING "IB send queue full (needed %d)\n", pr_warn("IB send queue full (needed %d)\n",
n_rdma); n_rdma);
goto out; goto out;
} }
} }
...@@ -2889,7 +2884,7 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch, ...@@ -2889,7 +2884,7 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch,
} }
if (ret) if (ret)
printk(KERN_ERR "%s[%d]: ib_post_send() returned %d for %d/%d", pr_err("%s[%d]: ib_post_send() returned %d for %d/%d\n",
__func__, __LINE__, ret, i, n_rdma); __func__, __LINE__, ret, i, n_rdma);
if (ret && i > 0) { if (ret && i > 0) {
wr.num_sge = 0; wr.num_sge = 0;
...@@ -2897,12 +2892,12 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch, ...@@ -2897,12 +2892,12 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch,
wr.send_flags = IB_SEND_SIGNALED; wr.send_flags = IB_SEND_SIGNALED;
while (ch->state == CH_LIVE && while (ch->state == CH_LIVE &&
ib_post_send(ch->qp, &wr, &bad_wr) != 0) { ib_post_send(ch->qp, &wr, &bad_wr) != 0) {
printk(KERN_INFO "Trying to abort failed RDMA transfer [%d]", pr_info("Trying to abort failed RDMA transfer [%d]\n",
ioctx->ioctx.index); ioctx->ioctx.index);
msleep(1000); msleep(1000);
} }
while (ch->state != CH_RELEASING && !ioctx->rdma_aborted) { while (ch->state != CH_RELEASING && !ioctx->rdma_aborted) {
printk(KERN_INFO "Waiting until RDMA abort finished [%d]", pr_info("Waiting until RDMA abort finished [%d]\n",
ioctx->ioctx.index); ioctx->ioctx.index);
msleep(1000); msleep(1000);
} }
...@@ -2923,17 +2918,17 @@ static int srpt_xfer_data(struct srpt_rdma_ch *ch, ...@@ -2923,17 +2918,17 @@ static int srpt_xfer_data(struct srpt_rdma_ch *ch,
ret = srpt_map_sg_to_ib_sge(ch, ioctx); ret = srpt_map_sg_to_ib_sge(ch, ioctx);
if (ret) { if (ret) {
printk(KERN_ERR "%s[%d] ret=%d\n", __func__, __LINE__, ret); pr_err("%s[%d] ret=%d\n", __func__, __LINE__, ret);
goto out; goto out;
} }
ret = srpt_perform_rdmas(ch, ioctx); ret = srpt_perform_rdmas(ch, ioctx);
if (ret) { if (ret) {
if (ret == -EAGAIN || ret == -ENOMEM) if (ret == -EAGAIN || ret == -ENOMEM)
printk(KERN_INFO "%s[%d] queue full -- ret=%d\n", pr_info("%s[%d] queue full -- ret=%d\n",
__func__, __LINE__, ret); __func__, __LINE__, ret);
else else
printk(KERN_ERR "%s[%d] fatal error -- ret=%d\n", pr_err("%s[%d] fatal error -- ret=%d\n",
__func__, __LINE__, ret); __func__, __LINE__, ret);
goto out_unmap; goto out_unmap;
} }
...@@ -3058,7 +3053,7 @@ static void srpt_queue_response(struct se_cmd *cmd) ...@@ -3058,7 +3053,7 @@ static void srpt_queue_response(struct se_cmd *cmd)
!ioctx->queue_status_only) { !ioctx->queue_status_only) {
ret = srpt_xfer_data(ch, ioctx); ret = srpt_xfer_data(ch, ioctx);
if (ret) { if (ret) {
printk(KERN_ERR "xfer_data failed for tag %llu\n", pr_err("xfer_data failed for tag %llu\n",
ioctx->tag); ioctx->tag);
return; return;
} }
...@@ -3075,7 +3070,7 @@ static void srpt_queue_response(struct se_cmd *cmd) ...@@ -3075,7 +3070,7 @@ static void srpt_queue_response(struct se_cmd *cmd)
} }
ret = srpt_post_send(ch, ioctx, resp_len); ret = srpt_post_send(ch, ioctx, resp_len);
if (ret) { if (ret) {
printk(KERN_ERR "sending cmd response failed for tag %llu\n", pr_err("sending cmd response failed for tag %llu\n",
ioctx->tag); ioctx->tag);
srpt_unmap_sg_to_ib_sge(ch, ioctx); srpt_unmap_sg_to_ib_sge(ch, ioctx);
srpt_set_cmd_state(ioctx, SRPT_STATE_DONE); srpt_set_cmd_state(ioctx, SRPT_STATE_DONE);
...@@ -3154,7 +3149,7 @@ static int srpt_release_sdev(struct srpt_device *sdev) ...@@ -3154,7 +3149,7 @@ static int srpt_release_sdev(struct srpt_device *sdev)
res = wait_event_interruptible(sdev->ch_releaseQ, res = wait_event_interruptible(sdev->ch_releaseQ,
srpt_ch_list_empty(sdev)); srpt_ch_list_empty(sdev));
if (res) if (res)
printk(KERN_ERR "%s: interrupted.\n", __func__); pr_err("%s: interrupted.\n", __func__);
return 0; return 0;
} }
...@@ -3293,7 +3288,7 @@ static void srpt_add_one(struct ib_device *device) ...@@ -3293,7 +3288,7 @@ static void srpt_add_one(struct ib_device *device)
spin_lock_init(&sport->port_acl_lock); spin_lock_init(&sport->port_acl_lock);
if (srpt_refresh_port(sport)) { if (srpt_refresh_port(sport)) {
printk(KERN_ERR "MAD registration failed for %s-%d.\n", pr_err("MAD registration failed for %s-%d.\n",
srpt_sdev_name(sdev), i); srpt_sdev_name(sdev), i);
goto err_ring; goto err_ring;
} }
...@@ -3330,7 +3325,7 @@ static void srpt_add_one(struct ib_device *device) ...@@ -3330,7 +3325,7 @@ static void srpt_add_one(struct ib_device *device)
kfree(sdev); kfree(sdev);
err: err:
sdev = NULL; sdev = NULL;
printk(KERN_INFO "%s(%s) failed.\n", __func__, device->name); pr_info("%s(%s) failed.\n", __func__, device->name);
goto out; goto out;
} }
...@@ -3344,8 +3339,7 @@ static void srpt_remove_one(struct ib_device *device) ...@@ -3344,8 +3339,7 @@ static void srpt_remove_one(struct ib_device *device)
sdev = ib_get_client_data(device, &srpt_client); sdev = ib_get_client_data(device, &srpt_client);
if (!sdev) { if (!sdev) {
printk(KERN_INFO "%s(%s): nothing to do.\n", __func__, pr_info("%s(%s): nothing to do.\n", __func__, device->name);
device->name);
return; return;
} }
...@@ -3464,7 +3458,7 @@ static struct se_node_acl *srpt_alloc_fabric_acl(struct se_portal_group *se_tpg) ...@@ -3464,7 +3458,7 @@ static struct se_node_acl *srpt_alloc_fabric_acl(struct se_portal_group *se_tpg)
nacl = kzalloc(sizeof(struct srpt_node_acl), GFP_KERNEL); nacl = kzalloc(sizeof(struct srpt_node_acl), GFP_KERNEL);
if (!nacl) { if (!nacl) {
printk(KERN_ERR "Unable to allocate struct srpt_node_acl\n"); pr_err("Unable to allocate struct srpt_node_acl\n");
return NULL; return NULL;
} }
...@@ -3615,7 +3609,7 @@ static struct se_node_acl *srpt_make_nodeacl(struct se_portal_group *tpg, ...@@ -3615,7 +3609,7 @@ static struct se_node_acl *srpt_make_nodeacl(struct se_portal_group *tpg,
u8 i_port_id[16]; u8 i_port_id[16];
if (srpt_parse_i_port_id(i_port_id, name) < 0) { if (srpt_parse_i_port_id(i_port_id, name) < 0) {
printk(KERN_ERR "invalid initiator port ID %s\n", name); pr_err("invalid initiator port ID %s\n", name);
ret = -EINVAL; ret = -EINVAL;
goto err; goto err;
} }
...@@ -3816,12 +3810,12 @@ static ssize_t srpt_tpg_store_enable( ...@@ -3816,12 +3810,12 @@ static ssize_t srpt_tpg_store_enable(
ret = kstrtoul(page, 0, &tmp); ret = kstrtoul(page, 0, &tmp);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "Unable to extract srpt_tpg_store_enable\n"); pr_err("Unable to extract srpt_tpg_store_enable\n");
return -EINVAL; return -EINVAL;
} }
if ((tmp != 0) && (tmp != 1)) { if ((tmp != 0) && (tmp != 1)) {
printk(KERN_ERR "Illegal value for srpt_tpg_store_enable: %lu\n", tmp); pr_err("Illegal value for srpt_tpg_store_enable: %lu\n", tmp);
return -EINVAL; return -EINVAL;
} }
if (tmp == 1) if (tmp == 1)
...@@ -3980,7 +3974,7 @@ static int __init srpt_init_module(void) ...@@ -3980,7 +3974,7 @@ static int __init srpt_init_module(void)
ret = -EINVAL; ret = -EINVAL;
if (srp_max_req_size < MIN_MAX_REQ_SIZE) { if (srp_max_req_size < MIN_MAX_REQ_SIZE) {
printk(KERN_ERR "invalid value %d for kernel module parameter" pr_err("invalid value %d for kernel module parameter"
" srp_max_req_size -- must be at least %d.\n", " srp_max_req_size -- must be at least %d.\n",
srp_max_req_size, MIN_MAX_REQ_SIZE); srp_max_req_size, MIN_MAX_REQ_SIZE);
goto out; goto out;
...@@ -3988,7 +3982,7 @@ static int __init srpt_init_module(void) ...@@ -3988,7 +3982,7 @@ static int __init srpt_init_module(void)
if (srpt_srq_size < MIN_SRPT_SRQ_SIZE if (srpt_srq_size < MIN_SRPT_SRQ_SIZE
|| srpt_srq_size > MAX_SRPT_SRQ_SIZE) { || srpt_srq_size > MAX_SRPT_SRQ_SIZE) {
printk(KERN_ERR "invalid value %d for kernel module parameter" pr_err("invalid value %d for kernel module parameter"
" srpt_srq_size -- must be in the range [%d..%d].\n", " srpt_srq_size -- must be in the range [%d..%d].\n",
srpt_srq_size, MIN_SRPT_SRQ_SIZE, MAX_SRPT_SRQ_SIZE); srpt_srq_size, MIN_SRPT_SRQ_SIZE, MAX_SRPT_SRQ_SIZE);
goto out; goto out;
...@@ -3996,7 +3990,7 @@ static int __init srpt_init_module(void) ...@@ -3996,7 +3990,7 @@ static int __init srpt_init_module(void)
srpt_target = target_fabric_configfs_init(THIS_MODULE, "srpt"); srpt_target = target_fabric_configfs_init(THIS_MODULE, "srpt");
if (IS_ERR(srpt_target)) { if (IS_ERR(srpt_target)) {
printk(KERN_ERR "couldn't register\n"); pr_err("couldn't register\n");
ret = PTR_ERR(srpt_target); ret = PTR_ERR(srpt_target);
goto out; goto out;
} }
...@@ -4018,13 +4012,13 @@ static int __init srpt_init_module(void) ...@@ -4018,13 +4012,13 @@ static int __init srpt_init_module(void)
ret = target_fabric_configfs_register(srpt_target); ret = target_fabric_configfs_register(srpt_target);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "couldn't register\n"); pr_err("couldn't register\n");
goto out_free_target; goto out_free_target;
} }
ret = ib_register_client(&srpt_client); ret = ib_register_client(&srpt_client);
if (ret) { if (ret) {
printk(KERN_ERR "couldn't register IB client\n"); pr_err("couldn't register IB client\n");
goto out_unregister_target; goto out_unregister_target;
} }
......
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