[PATCH 6/8] ib/srpt: Enhance printk output

2014-08-12 Thread Doug Ledford
The ib_srpt module has a metric ton of printks for debugging and
warnings and such.  And it never prefaces a single one of them with
information to allow an admin to know what errant module is spewing
garbage all through their dmesg output.  Fix that.

Signed-off-by: Doug Ledford dledf...@redhat.com
---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 201 +-
 1 file changed, 101 insertions(+), 100 deletions(-)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c 
b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 8a8311e35cb..238dfe2d8fb 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -182,7 +182,7 @@ static void srpt_event_handler(struct ib_event_handler 
*handler,
if (!sdev || sdev-device != event-device)
return;
 
-   pr_debug(ASYNC event= %d on device= %s\n, event-event,
+   pr_debug(ib_srpt: ASYNC event= %d on device= %s\n, event-event,
 srpt_sdev_name(sdev));
 
switch (event-event) {
@@ -206,7 +206,7 @@ static void srpt_event_handler(struct ib_event_handler 
*handler,
}
break;
default:
-   printk(KERN_ERR received unrecognized IB event %d\n,
+   printk(KERN_ERR ib_srpt: received unrecognized IB event %d\n,
   event-event);
break;
}
@@ -217,7 +217,7 @@ static void srpt_event_handler(struct ib_event_handler 
*handler,
  */
 static void srpt_srq_event(struct ib_event *event, void *ctx)
 {
-   printk(KERN_INFO SRQ event %d\n, event-event);
+   printk(KERN_INFO ib_srpt: SRQ event %d\n, event-event);
 }
 
 /**
@@ -225,7 +225,7 @@ static void srpt_srq_event(struct ib_event *event, void 
*ctx)
  */
 static void srpt_qp_event(struct ib_event *event, struct srpt_rdma_ch *ch)
 {
-   pr_debug(QP event %d on cm_id=%p sess_name=%s state=%d\n,
+   pr_debug(ib_srpt: QP event %d on cm_id=%p sess_name=%s state=%d\n,
 event-event, ch-cm_id, ch-sess_name, srpt_get_ch_state(ch));
 
switch (event-event) {
@@ -237,11 +237,11 @@ static void srpt_qp_event(struct ib_event *event, struct 
srpt_rdma_ch *ch)
   CH_RELEASING))
srpt_release_channel(ch);
else
-   pr_debug(%s: state %d - ignored LAST_WQE.\n,
+   pr_debug(ib_srpt: %s: state %d - ignored LAST_WQE.\n,
 ch-sess_name, srpt_get_ch_state(ch));
break;
default:
-   printk(KERN_ERR received unrecognized IB QP event %d\n,
+   printk(KERN_ERR ib_srpt: received unrecognized IB QP event 
%d\n,
   event-event);
break;
}
@@ -601,7 +601,7 @@ static void srpt_unregister_mad_agent(struct srpt_device 
*sdev)
sport = sdev-port[i - 1];
WARN_ON(sport-port != i);
if (ib_modify_port(sdev-device, i, 0, port_modify)  0)
-   printk(KERN_ERR disabling MAD processing failed.\n);
+   printk(KERN_ERR ib_srpt: disabling MAD processing 
failed.\n);
if (sport-mad_agent) {
ib_unregister_mad_agent(sport-mad_agent);
sport-mad_agent = NULL;
@@ -809,7 +809,7 @@ static int srpt_post_send(struct srpt_rdma_ch *ch,
 
ret = -ENOMEM;
if (unlikely(atomic_dec_return(ch-sq_wr_avail)  0)) {
-   printk(KERN_WARNING IB send queue full (needed 1)\n);
+   printk(KERN_WARNING ib_srpt: IB send queue full (needed 1)\n);
goto out;
}
 
@@ -911,7 +911,7 @@ static int srpt_get_desc_tbl(struct srpt_send_ioctx *ioctx,
 
if (ioctx-n_rbuf 
(srp_cmd-data_out_desc_cnt + srp_cmd-data_in_desc_cnt)) {
-   printk(KERN_ERR received unsupported SRP_CMD request
+   printk(KERN_ERR ib_srpt: received unsupported SRP_CMD 
request
type (%u out + %u in != %u / %zu)\n,
   srp_cmd-data_out_desc_cnt,
   srp_cmd-data_in_desc_cnt,
@@ -1338,7 +1338,7 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx)
goto out;
}
 
-   pr_debug(Aborting cmd with state %d and tag %lld\n, state,
+   pr_debug(ib_srpt: Aborting cmd with state %d and tag %lld\n, state,
 ioctx-tag);
 
switch (state) {
@@ -1372,7 +1372,7 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx)
target_put_sess_cmd(ioctx-ch-sess, ioctx-cmd);
break;
default:
-   WARN(1, Unexpected command state (%d), state);
+   WARN(1, ib_srpt: Unexpected command state (%d), state);
break;
}
 
@@ -1425,14 +1425,15 @@ static void srpt_handle_send_comp(struct srpt_rdma_ch 

Re: [PATCH 6/8] ib/srpt: Enhance printk output

2014-08-12 Thread Roland Dreier
On Tue, Aug 12, 2014 at 4:20 PM, Doug Ledford dledf...@redhat.com wrote:
 The ib_srpt module has a metric ton of printks for debugging and
 warnings and such.  And it never prefaces a single one of them with
 information to allow an admin to know what errant module is spewing
 garbage all through their dmesg output.  Fix that.

Target patches should probably go through Nic's tree, although for
srpt stuff like this I guess I can take it.

However I also think it would be a lot cleaner to define pr_fmt() at
the top of the file like

#define pr_fmt(fmt) KBUILD_MODNAME :  fmt

and then convert the printks to pr_info() or pr_warn() instead of
having to type ib_srpt: everywhere.

 - R.
--
To unsubscribe from this list: send the line unsubscribe linux-rdma in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html