mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 18:51:27 +00:00
- Renamed PFX macro to LOG_PFX such that it is recognized by the
PRINT_INFO() and related macro's. - Replaced printk(KERN_INFO PFX and printk(KERN_ERROR PFX by PRINT_INFO( and PRINT_ERROR( respectively. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1089 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -51,7 +51,7 @@
|
||||
/* Name of this kernel module. */
|
||||
#define DRV_NAME "ib_srpt"
|
||||
/* Prefix for printk() kernel messages. */
|
||||
#define PFX DRV_NAME ": "
|
||||
#define LOG_PFX DRV_NAME ": "
|
||||
#define DRV_VERSION "1.0.1"
|
||||
#define DRV_RELDATE "July 10, 2008"
|
||||
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
|
||||
@@ -219,14 +219,14 @@ static void srpt_qp_event(struct ib_event *event, void *ctx)
|
||||
ib_cm_notify(ch->cm_id, event->event);
|
||||
#else
|
||||
/* Vanilla 2.6.19 kernel (or before) without OFED. */
|
||||
printk(KERN_ERR PFX "how to perform ib_cm_notify() on a"
|
||||
PRINT_ERROR("%s", "how to perform ib_cm_notify() on a"
|
||||
" vanilla 2.6.18 kernel ???\n");
|
||||
#endif
|
||||
break;
|
||||
case IB_EVENT_QP_LAST_WQE_REACHED:
|
||||
if (srpt_test_and_set_channel_state(ch, RDMA_CHANNEL_LIVE,
|
||||
RDMA_CHANNEL_DISCONNECTING)) {
|
||||
printk(KERN_INFO PFX "disconnected session %s.\n",
|
||||
PRINT_INFO("disconnected session %s.\n",
|
||||
ch->sess_name);
|
||||
ib_send_cm_dreq(ch->cm_id, NULL, 0);
|
||||
}
|
||||
@@ -575,8 +575,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 PFX "disabling MAD processing"
|
||||
" failed.\n");
|
||||
PRINT_ERROR("%s", "disabling MAD processing failed.\n");
|
||||
if (sport->mad_agent) {
|
||||
ib_unregister_mad_agent(sport->mad_agent);
|
||||
sport->mad_agent = NULL;
|
||||
@@ -870,7 +869,7 @@ static void srpt_reset_ioctx(struct srpt_rdma_ch *ch, struct srpt_ioctx *ioctx)
|
||||
kfree(ioctx->rbufs);
|
||||
|
||||
if (srpt_post_recv(ch->sport->sdev, ioctx))
|
||||
printk(KERN_ERR PFX "SRQ post_recv failed - this is serious\n");
|
||||
PRINT_ERROR("%s", "SRQ post_recv failed - this is serious\n");
|
||||
/* we should queue it back to free_ioctx queue */
|
||||
else
|
||||
atomic_inc(&ch->req_lim_delta);
|
||||
@@ -937,7 +936,7 @@ static void srpt_handle_err_comp(struct srpt_rdma_ch *ch, struct ib_wc *wc)
|
||||
|
||||
if (wc->wr_id & SRPT_OP_RECV) {
|
||||
ioctx = sdev->ioctx_ring[wc->wr_id & ~SRPT_OP_RECV];
|
||||
printk(KERN_ERR PFX "This is serious - SRQ is in bad state\n");
|
||||
PRINT_ERROR("%s", "This is serious - SRQ is in bad state\n");
|
||||
} else {
|
||||
ioctx = sdev->ioctx_ring[wc->wr_id];
|
||||
|
||||
@@ -1370,12 +1369,10 @@ err:
|
||||
|
||||
if (ch->state != RDMA_CHANNEL_LIVE) {
|
||||
/* Give up if another thread modified the channel state. */
|
||||
printk(KERN_ERR PFX "%s: channel is in state %d",
|
||||
__func__, ch->state);
|
||||
PRINT_ERROR("%s: channel is in state %d", __func__, ch->state);
|
||||
srpt_reset_ioctx(ch, ioctx);
|
||||
} else if (srpt_post_send(ch, ioctx, len)) {
|
||||
printk(KERN_ERR PFX "%s: sending SRP_RSP response failed",
|
||||
__func__);
|
||||
PRINT_ERROR("%s: sending SRP_RSP response failed", __func__);
|
||||
srpt_reset_ioctx(ch, ioctx);
|
||||
}
|
||||
}
|
||||
@@ -1423,7 +1420,7 @@ static void srpt_completion(struct ib_cq *cq, void *ctx)
|
||||
ib_req_notify_cq(ch->cq, IB_CQ_NEXT_COMP);
|
||||
while (ib_poll_cq(ch->cq, 1, &wc) > 0) {
|
||||
if (wc.status) {
|
||||
printk(KERN_ERR PFX "failed %s status= %d\n",
|
||||
PRINT_ERROR("failed %s status= %d\n",
|
||||
wc.wr_id & SRPT_OP_RECV ? "receive" : "send",
|
||||
wc.status);
|
||||
srpt_handle_err_comp(ch, &wc);
|
||||
@@ -1487,7 +1484,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
|
||||
#endif
|
||||
if (IS_ERR(ch->cq)) {
|
||||
ret = PTR_ERR(ch->cq);
|
||||
printk(KERN_ERR PFX "failed to create_cq cqe= %d ret= %d\n",
|
||||
PRINT_ERROR("failed to create_cq cqe= %d ret= %d\n",
|
||||
cqe, ret);
|
||||
goto out;
|
||||
}
|
||||
@@ -1512,7 +1509,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
|
||||
if (IS_ERR(ch->qp)) {
|
||||
ret = PTR_ERR(ch->qp);
|
||||
ib_destroy_cq(ch->cq);
|
||||
printk(KERN_ERR PFX "failed to create_qp ret= %d\n", ret);
|
||||
PRINT_ERROR("failed to create_qp ret= %d\n", ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -1638,7 +1635,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
|
||||
|
||||
it_iu_len = be32_to_cpu(req->req_it_iu_len);
|
||||
|
||||
printk(KERN_INFO PFX "received SRP_LOGIN_REQ with"
|
||||
PRINT_INFO("received SRP_LOGIN_REQ with"
|
||||
" i_port_id 0x%llx:0x%llx, t_port_id 0x%llx:0x%llx and length %d"
|
||||
" on port %d (guid=0x%llx:0x%llx)\n",
|
||||
(unsigned long long)be64_to_cpu(*(u64 *)&req->initiator_port_id[0]),
|
||||
@@ -1665,7 +1662,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
|
||||
rej->reason =
|
||||
cpu_to_be32(SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE);
|
||||
ret = -EINVAL;
|
||||
printk(KERN_ERR PFX "rejected SRP_LOGIN_REQ because its"
|
||||
PRINT_ERROR("rejected SRP_LOGIN_REQ because its"
|
||||
" length (%d bytes) is invalid\n", it_iu_len);
|
||||
goto reject;
|
||||
}
|
||||
@@ -1701,13 +1698,13 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
|
||||
|
||||
if (prev_state == RDMA_CHANNEL_LIVE) {
|
||||
ib_send_cm_dreq(ch->cm_id, NULL, 0);
|
||||
printk(KERN_ERR PFX "disconnected"
|
||||
PRINT_ERROR("disconnected"
|
||||
" session %s because a new"
|
||||
" SRP_LOGIN_REQ has been received.\n",
|
||||
ch->sess_name);
|
||||
} else if (prev_state ==
|
||||
RDMA_CHANNEL_CONNECTING) {
|
||||
printk(KERN_ERR PFX "rejected"
|
||||
PRINT_ERROR("%s", "rejected"
|
||||
" SRP_LOGIN_REQ because another login"
|
||||
" request is being processed.\n");
|
||||
ib_send_cm_rej(ch->cm_id,
|
||||
@@ -1732,7 +1729,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
|
||||
rej->reason =
|
||||
cpu_to_be32(SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL);
|
||||
ret = -ENOMEM;
|
||||
printk(KERN_ERR PFX "rejected SRP_LOGIN_REQ because it"
|
||||
PRINT_ERROR("%s", "rejected SRP_LOGIN_REQ because it"
|
||||
" has an invalid target port identifier\n");
|
||||
goto reject;
|
||||
}
|
||||
@@ -1740,8 +1737,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
|
||||
ch = kzalloc(sizeof *ch, GFP_KERNEL);
|
||||
if (!ch) {
|
||||
rej->reason = cpu_to_be32(SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
|
||||
printk(KERN_ERR PFX "rejected SRP_LOGIN_REQ because out of"
|
||||
" memory\n");
|
||||
PRINT_ERROR("%s", "rejected SRP_LOGIN_REQ because out of memory\n");
|
||||
ret = -ENOMEM;
|
||||
goto reject;
|
||||
}
|
||||
@@ -1758,7 +1754,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
|
||||
ret = srpt_create_ch_ib(ch);
|
||||
if (ret) {
|
||||
rej->reason = cpu_to_be32(SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
|
||||
printk(KERN_ERR PFX "rejected SRP_LOGIN_REQ because creating"
|
||||
PRINT_ERROR("%s", "rejected SRP_LOGIN_REQ because creating"
|
||||
" a new RDMA channel failed\n");
|
||||
goto free_ch;
|
||||
}
|
||||
@@ -1766,7 +1762,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
|
||||
ret = srpt_ch_qp_rtr(ch, ch->qp);
|
||||
if (ret) {
|
||||
rej->reason = cpu_to_be32(SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
|
||||
printk(KERN_ERR PFX "rejected SRP_LOGIN_REQ because enabling"
|
||||
PRINT_ERROR("rejected SRP_LOGIN_REQ because enabling"
|
||||
" RTR failed (error code = %d)\n", ret);
|
||||
goto destroy_ib;
|
||||
}
|
||||
@@ -1836,7 +1832,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
|
||||
|
||||
ret = ib_send_cm_rep(cm_id, rep_param);
|
||||
if (ret) {
|
||||
printk(KERN_ERR PFX "sending SRP_LOGIN_REQ response failed"
|
||||
PRINT_ERROR("sending SRP_LOGIN_REQ response failed"
|
||||
" (error code = %d)\n", ret);
|
||||
goto release_channel;
|
||||
}
|
||||
@@ -2251,14 +2247,14 @@ static int srpt_xfer_data(struct srpt_rdma_ch *ch, struct srpt_ioctx *ioctx,
|
||||
|
||||
ret = srpt_map_sg_to_ib_sge(ch, ioctx, scmnd);
|
||||
if (ret) {
|
||||
printk(KERN_ERR PFX "%s[%d] ret=%d\n", __func__, __LINE__, ret);
|
||||
PRINT_ERROR("%s[%d] ret=%d\n", __func__, __LINE__, ret);
|
||||
ret = SCST_TGT_RES_QUEUE_FULL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = srpt_perform_rdmas(ch, ioctx, scst_cmd_get_data_direction(scmnd));
|
||||
if (ret) {
|
||||
printk(KERN_ERR PFX "%s[%d] ret=%d\n", __func__, __LINE__, ret);
|
||||
PRINT_ERROR("%s[%d] ret=%d\n", __func__, __LINE__, ret);
|
||||
if (ret == -EAGAIN || ret == -ENOMEM)
|
||||
ret = SCST_TGT_RES_QUEUE_FULL;
|
||||
else
|
||||
@@ -2322,8 +2318,7 @@ static int srpt_xmit_response(struct scst_cmd *scmnd)
|
||||
ioctx->state = SRPT_STATE_PROCESSED;
|
||||
|
||||
if (ch->state != RDMA_CHANNEL_LIVE) {
|
||||
printk(KERN_ERR PFX
|
||||
"%s: tag= %lld channel in bad state %d\n",
|
||||
PRINT_ERROR("%s: tag= %lld channel in bad state %d\n",
|
||||
__func__, (unsigned long long)tag, ch->state);
|
||||
|
||||
if (ch->state == RDMA_CHANNEL_DISCONNECTING)
|
||||
@@ -2343,8 +2338,7 @@ static int srpt_xmit_response(struct scst_cmd *scmnd)
|
||||
srp_rsp = ioctx->buf;
|
||||
|
||||
if (unlikely(scst_cmd_aborted(scmnd))) {
|
||||
printk(KERN_ERR PFX
|
||||
"%s: tag= %lld already get aborted\n",
|
||||
PRINT_ERROR("%s: tag= %lld already get aborted\n",
|
||||
__func__, (unsigned long long)tag);
|
||||
goto out_aborted;
|
||||
}
|
||||
@@ -2377,8 +2371,7 @@ static int srpt_xmit_response(struct scst_cmd *scmnd)
|
||||
if (dir == SCST_DATA_READ && scst_cmd_get_resp_data_len(scmnd)) {
|
||||
ret = srpt_xfer_data(ch, ioctx, scmnd);
|
||||
if (ret != SCST_TGT_RES_SUCCESS) {
|
||||
printk(KERN_ERR PFX
|
||||
"%s: tag= %lld xfer_data failed\n",
|
||||
PRINT_ERROR("%s: tag= %lld xfer_data failed\n",
|
||||
__func__, (unsigned long long)tag);
|
||||
goto out;
|
||||
}
|
||||
@@ -2387,7 +2380,7 @@ static int srpt_xmit_response(struct scst_cmd *scmnd)
|
||||
if (srpt_post_send(ch, ioctx,
|
||||
sizeof *srp_rsp +
|
||||
be32_to_cpu(srp_rsp->sense_data_len))) {
|
||||
printk(KERN_ERR PFX "%s: ch->state= %d tag= %lld\n",
|
||||
PRINT_ERROR("%s: ch->state= %d tag= %lld\n",
|
||||
__func__, ch->state,
|
||||
(unsigned long long)tag);
|
||||
ret = SCST_TGT_RES_FATAL_ERROR;
|
||||
@@ -2825,7 +2818,7 @@ static void srpt_add_one(struct ib_device *device)
|
||||
|
||||
sdev->scst_tgt = scst_register(&srpt_template, NULL);
|
||||
if (!sdev->scst_tgt) {
|
||||
printk(KERN_ERR PFX "SCST registration failed for %s.\n",
|
||||
PRINT_ERROR("SCST registration failed for %s.\n",
|
||||
sdev->device->name);
|
||||
goto err_ring;
|
||||
}
|
||||
@@ -2846,8 +2839,8 @@ static void srpt_add_one(struct ib_device *device)
|
||||
INIT_WORK(&sport->work, srpt_refresh_port_work);
|
||||
#endif
|
||||
if (srpt_refresh_port(sport)) {
|
||||
printk(KERN_ERR PFX "MAD registration failed"
|
||||
" for %s-%d.\n", sdev->device->name, i);
|
||||
PRINT_ERROR("MAD registration failed for %s-%d.\n",
|
||||
sdev->device->name, i);
|
||||
goto err_refresh_port;
|
||||
}
|
||||
}
|
||||
@@ -2919,7 +2912,7 @@ static void srpt_remove_one(struct ib_device *device)
|
||||
* cancel_work_sync() was introduced in kernel 2.6.22. Older
|
||||
* kernels do not have a facility to cancel scheduled work.
|
||||
*/
|
||||
printk(KERN_ERR PFX
|
||||
PRINT_ERROR("%s",
|
||||
"your kernel does not provide cancel_work_sync().\n");
|
||||
#endif
|
||||
|
||||
@@ -2999,26 +2992,26 @@ static int __init srpt_init_module(void)
|
||||
|
||||
ret = class_register(&srpt_class);
|
||||
if (ret) {
|
||||
printk(KERN_ERR PFX "couldn't register class ib_srpt\n");
|
||||
PRINT_ERROR("%s", "couldn't register class ib_srpt\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = scst_register_target_template(&srpt_template);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR PFX "couldn't register with scst\n");
|
||||
PRINT_ERROR("%s", "couldn't register with scst\n");
|
||||
ret = -ENODEV;
|
||||
goto out_unregister_class;
|
||||
}
|
||||
|
||||
ret = srpt_register_procfs_entry(&srpt_template);
|
||||
if (ret) {
|
||||
printk(KERN_ERR PFX "couldn't register procfs entry\n");
|
||||
PRINT_ERROR("%s", "couldn't register procfs entry\n");
|
||||
goto out_unregister_target;
|
||||
}
|
||||
|
||||
ret = ib_register_client(&srpt_client);
|
||||
if (ret) {
|
||||
printk(KERN_ERR PFX "couldn't register IB client\n");
|
||||
PRINT_ERROR("%s", "couldn't register IB client\n");
|
||||
goto out_unregister_target;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user