diff --git a/iscsi-scst/kernel/isert-scst/iser_buf.c b/iscsi-scst/kernel/isert-scst/iser_buf.c index 7bd34c9a2..f6bc47fab 100644 --- a/iscsi-scst/kernel/isert-scst/iser_buf.c +++ b/iscsi-scst/kernel/isert-scst/iser_buf.c @@ -52,7 +52,7 @@ static int isert_buf_alloc_pg(struct ib_device *ib_dev, isert_buf->sg = kmalloc_array(isert_buf->sg_cnt, sizeof(*isert_buf->sg), GFP_KERNEL); if (unlikely(!isert_buf->sg)) { - pr_err("Failed to allocate buffer SG\n"); + PRINT_ERROR("Failed to allocate buffer SG"); res = -ENOMEM; goto out; } @@ -63,7 +63,7 @@ static int isert_buf_alloc_pg(struct ib_device *ib_dev, page = alloc_page(GFP_KERNEL); if (unlikely(!page)) { - pr_err("Failed to allocate page\n"); + PRINT_ERROR("Failed to allocate page"); res = -ENOMEM; goto out_map_failed; } @@ -74,8 +74,8 @@ static int isert_buf_alloc_pg(struct ib_device *ib_dev, res = ib_dma_map_sg(ib_dev, isert_buf->sg, isert_buf->sg_cnt, dma_dir); if (unlikely(!res)) { --i; /* do not overrun isert_buf->sg */ - pr_err("Failed to DMA map iser sg:%p len:%d\n", - isert_buf->sg, isert_buf->sg_cnt); + PRINT_ERROR("Failed to DMA map iser sg:%p len:%d", + isert_buf->sg, isert_buf->sg_cnt); res = -ENOMEM; goto out_map_failed; } @@ -111,14 +111,14 @@ static int isert_buf_malloc(struct ib_device *ib_dev, isert_buf->sg_cnt = 1; isert_buf->sg = kmalloc(sizeof(isert_buf->sg[0]), GFP_KERNEL); if (unlikely(!isert_buf->sg)) { - pr_err("Failed to allocate buffer SG\n"); + PRINT_ERROR("Failed to allocate buffer SG"); res = -ENOMEM; goto out; } isert_buf->addr = kmalloc(size, GFP_KERNEL); if (unlikely(!isert_buf->addr)) { - pr_err("Failed to allocate data buffer\n"); + PRINT_ERROR("Failed to allocate data buffer"); res = -ENOMEM; goto data_malloc_failed; } @@ -127,8 +127,8 @@ static int isert_buf_malloc(struct ib_device *ib_dev, res = ib_dma_map_sg(ib_dev, isert_buf->sg, isert_buf->sg_cnt, dma_dir); if (unlikely(!res)) { - pr_err("Failed to DMA map iser sg:%p len:%d\n", - isert_buf->sg, isert_buf->sg_cnt); + PRINT_ERROR("Failed to DMA map iser sg:%p len:%d", + isert_buf->sg, isert_buf->sg_cnt); res = -ENOMEM; goto out_map_failed; } @@ -233,7 +233,7 @@ int isert_wr_init(struct isert_wr *wr, case ISER_WR_RDMA_READ: send_wr_op = IB_WR_RDMA_READ; if (unlikely(!pdu->is_wstag_valid)) { - pr_err("No write tag/va specified for RDMA op\n"); + PRINT_ERROR("No write tag/va specified for RDMA op"); isert_buf_release(isert_buf); buff_offset = -EFAULT; goto out; @@ -250,7 +250,7 @@ int isert_wr_init(struct isert_wr *wr, case ISER_WR_RDMA_WRITE: send_wr_op = IB_WR_RDMA_WRITE; if (unlikely(!pdu->is_rstag_valid)) { - pr_err("No read tag/va specified for RDMA op\n"); + PRINT_ERROR("No read tag/va specified for RDMA op"); isert_buf_release(isert_buf); buff_offset = -EFAULT; goto out; diff --git a/iscsi-scst/kernel/isert-scst/iser_datamover.c b/iscsi-scst/kernel/isert-scst/iser_datamover.c index 165ab071b..7dd723dbc 100644 --- a/iscsi-scst/kernel/isert-scst/iser_datamover.c +++ b/iscsi-scst/kernel/isert-scst/iser_datamover.c @@ -47,7 +47,7 @@ int isert_datamover_init(void) err = isert_global_init(); if (unlikely(err)) { - pr_err("iser datamover init failed, err:%d\n", err); + PRINT_ERROR("iser datamover init failed, err:%d", err); return err; } return 0; @@ -189,7 +189,7 @@ int isert_login_rsp_tx(struct iscsi_cmnd *login_rsp, int last, int discovery) if (last && !discovery) { err = isert_alloc_conn_resources(isert_conn); if (unlikely(err)) { - pr_err("Failed to init conn resources\n"); + PRINT_ERROR("Failed to init conn resources"); return err; } isert_pdu_free(isert_conn->login_req_pdu); @@ -199,7 +199,7 @@ int isert_login_rsp_tx(struct iscsi_cmnd *login_rsp, int last, int discovery) &isert_conn->login_req_pdu->wr[0], 1); if (unlikely(err)) { - pr_err("Failed to post recv login req rx buf, err:%d\n", err); + PRINT_ERROR("Failed to post recv login req rx buf, err:%d", err); return err; } } diff --git a/iscsi-scst/kernel/isert-scst/iser_global.c b/iscsi-scst/kernel/isert-scst/iser_global.c index 31fe1f306..2c0c92410 100644 --- a/iscsi-scst/kernel/isert-scst/iser_global.c +++ b/iscsi-scst/kernel/isert-scst/iser_global.c @@ -106,7 +106,7 @@ int isert_global_init(void) isert_glob.conn_wq = create_workqueue("isert_conn_wq"); if (!isert_glob.conn_wq) { - pr_err("Failed to alloc iser conn work queue\n"); + PRINT_ERROR("Failed to alloc iser conn work queue"); return -ENOMEM; } @@ -114,7 +114,7 @@ int isert_global_init(void) SCST_SLAB_FLAGS|SLAB_HWCACHE_ALIGN); if (!isert_cmnd_cache) { destroy_workqueue(isert_glob.conn_wq); - pr_err("Failed to alloc iser command cache\n"); + PRINT_ERROR("Failed to alloc iser command cache"); return -ENOMEM; } @@ -123,7 +123,7 @@ int isert_global_init(void) if (!isert_conn_cache) { destroy_workqueue(isert_glob.conn_wq); kmem_cache_destroy(isert_cmnd_cache); - pr_err("Failed to alloc iser connection cache\n"); + PRINT_ERROR("Failed to alloc iser connection cache"); return -ENOMEM; } @@ -153,7 +153,7 @@ int isert_get_addr_size(struct sockaddr *sa, size_t *addr_len) *addr_len = sizeof(struct sockaddr_in6); break; default: - pr_err("Unknown address family\n"); + PRINT_ERROR("Unknown address family"); ret = -EINVAL; goto out; } diff --git a/iscsi-scst/kernel/isert-scst/iser_pdu.c b/iscsi-scst/kernel/isert-scst/iser_pdu.c index cf30db258..177b71f3b 100644 --- a/iscsi-scst/kernel/isert-scst/iser_pdu.c +++ b/iscsi-scst/kernel/isert-scst/iser_pdu.c @@ -263,8 +263,8 @@ int isert_prepare_rdma(struct isert_cmnd *isert_pdu, err = ib_dma_map_sg(ib_dev, isert_buf->sg, isert_buf->sg_cnt, isert_buf->dma_dir); if (unlikely(!err)) { - pr_err("Failed to DMA map iser sg:%p len:%d\n", - isert_buf->sg, isert_buf->sg_cnt); + PRINT_ERROR("Failed to DMA map iser sg:%p len:%d", + isert_buf->sg, isert_buf->sg_cnt); wr_cnt = -EFAULT; goto out; } @@ -331,27 +331,27 @@ struct isert_cmnd *isert_rx_pdu_alloc(struct isert_connection *isert_conn, pdu = isert_pdu_alloc(); if (unlikely(!pdu)) { - pr_err("Failed to alloc pdu\n"); + PRINT_ERROR("Failed to alloc pdu"); goto out; } err = isert_alloc_for_rdma(pdu, 4, isert_conn); if (unlikely(err)) { - pr_err("Failed to alloc sge and wr for rx pdu\n"); + PRINT_ERROR("Failed to alloc sge and wr for rx pdu"); goto out; } err = isert_buf_alloc_data_buf(isert_conn->isert_dev->ib_dev, &pdu->buf, size, DMA_FROM_DEVICE); if (unlikely(err)) { - pr_err("Failed to alloc rx pdu buf sz:%zd\n", size); + PRINT_ERROR("Failed to alloc rx pdu buf sz:%zd", size); goto buf_alloc_failed; } err = isert_rx_pdu_init(pdu, isert_conn); if (unlikely(err)) { - pr_err("Failed to init rx pdu wr:%p size:%zd err:%d\n", - &pdu->wr, size, err); + PRINT_ERROR("Failed to init rx pdu wr:%p size:%zd err:%d", + &pdu->wr, size, err); goto pdu_init_failed; } @@ -379,27 +379,27 @@ struct isert_cmnd *isert_tx_pdu_alloc(struct isert_connection *isert_conn, pdu = isert_pdu_alloc(); if (unlikely(!pdu)) { - pr_err("Failed to alloc pdu\n"); + PRINT_ERROR("Failed to alloc pdu"); goto out; } err = isert_alloc_for_rdma(pdu, 4, isert_conn); if (unlikely(err)) { - pr_err("Failed to alloc sge and wr for tx pdu\n"); + PRINT_ERROR("Failed to alloc sge and wr for tx pdu"); goto out; } err = isert_buf_alloc_data_buf(isert_conn->isert_dev->ib_dev, &pdu->buf, size, DMA_TO_DEVICE); if (unlikely(err)) { - pr_err("Failed to alloc tx pdu buf sz:%zd\n", size); + PRINT_ERROR("Failed to alloc tx pdu buf sz:%zd", size); goto buf_alloc_failed; } err = isert_pdu_tx_buf_init(pdu, isert_conn); if (unlikely(err < 0)) { - pr_err("Failed to init tx pdu wr:%p size:%zd err:%d\n", - &pdu->wr, size, err); + PRINT_ERROR("Failed to init tx pdu wr:%p size:%zd err:%d", + &pdu->wr, size, err); goto buf_init_failed; } @@ -449,8 +449,8 @@ int isert_alloc_conn_resources(struct isert_connection *isert_conn) to_alloc = isert_conn->queue_depth * 2 + isert_conn->repost_threshold; if (unlikely(to_alloc > ISER_MAX_WCE)) { - pr_err("QueuedCommands larger than %d not supported\n", - (ISER_MAX_WCE - isert_conn->repost_threshold) / 2); + PRINT_ERROR("QueuedCommands larger than %d not supported", + (ISER_MAX_WCE - isert_conn->repost_threshold) / 2); err = -EINVAL; goto out; } @@ -478,7 +478,7 @@ int isert_alloc_conn_resources(struct isert_connection *isert_conn) err = isert_post_recv(isert_conn, &first_pdu->wr[0], to_alloc); if (unlikely(err)) { - pr_err("Failed to post recv err:%d\n", err); + PRINT_ERROR("Failed to post recv err:%d", err); goto clean_pdus; } @@ -596,8 +596,8 @@ int isert_pdu_send(struct isert_connection *isert_conn, err = isert_post_send(isert_conn, wr, 1); if (unlikely(err)) { - pr_err("Failed to send pdu conn:%p pdu:%p err:%d\n", - isert_conn, tx_pdu, err); + PRINT_ERROR("Failed to send pdu conn:%p pdu:%p err:%d", + isert_conn, tx_pdu, err); } TRACE_EXIT_RES(err); @@ -623,8 +623,8 @@ int isert_pdu_post_rdma_write(struct isert_connection *isert_conn, isert_link_send_pdu_wrs(isert_cmd, isert_rsp, wr_cnt); err = isert_post_send(isert_conn, &isert_cmd->wr[0], wr_cnt + 1); if (unlikely(err)) { - pr_err("Failed to send pdu conn:%p pdu:%p err:%d\n", - isert_conn, isert_cmd, err); + PRINT_ERROR("Failed to send pdu conn:%p pdu:%p err:%d", + isert_conn, isert_cmd, err); } TRACE_EXIT_RES(err); @@ -640,8 +640,8 @@ int isert_pdu_post_rdma_read(struct isert_connection *isert_conn, err = isert_post_send(isert_conn, &isert_cmd->wr[0], wr_cnt); if (unlikely(err)) { - pr_err("Failed to send pdu conn:%p pdu:%p err:%d\n", - isert_conn, isert_cmd, err); + PRINT_ERROR("Failed to send pdu conn:%p pdu:%p err:%d", + isert_conn, isert_cmd, err); } TRACE_EXIT_RES(err); diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index 2e1cf989a..0c8d11014 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -77,7 +77,7 @@ int isert_post_recv(struct isert_connection *isert_conn, #ifdef CONFIG_SCST_EXTRACHECKS if (test_bit(ISERT_DRAIN_POSTED, &isert_conn->flags)) { - pr_err("conn:%p post recv after drain\n", isert_conn); + PRINT_ERROR("conn:%p post recv after drain", isert_conn); BUG(); } #endif @@ -86,9 +86,9 @@ int isert_post_recv(struct isert_connection *isert_conn, if (unlikely(err)) { num_posted = isert_num_recv_posted_on_err(first_ib_wr, bad_wr); - pr_err("conn:%p recv posted:%d/%d 1st wr_id:0x%llx sz:%d err:%d\n", - isert_conn, num_posted, num_wr, first_ib_wr->wr_id, - first_ib_wr->sg_list->length, err); + PRINT_ERROR("conn:%p recv posted:%d/%d 1st wr_id:0x%llx sz:%d err:%d", + isert_conn, num_posted, num_wr, first_ib_wr->wr_id, + first_ib_wr->sg_list->length, err); } TRACE_EXIT_RES(err); @@ -124,7 +124,7 @@ int isert_post_send(struct isert_connection *isert_conn, #ifdef CONFIG_SCST_EXTRACHECKS if (test_bit(ISERT_DRAIN_POSTED, &isert_conn->flags)) { - pr_err("conn:%p post send after drain\n", isert_conn); + PRINT_ERROR("conn:%p post send after drain", isert_conn); BUG(); } #endif @@ -133,9 +133,9 @@ int isert_post_send(struct isert_connection *isert_conn, if (unlikely(err)) { num_posted = isert_num_send_posted_on_err(first_ib_wr, bad_wr); - pr_err("conn:%p send posted:%d/%d bad wr_id:0x%llx sz:%d num_sge: %d err:%d\n", - isert_conn, num_posted, num_wr, bad_wr->wr_id, - bad_wr->sg_list->length, bad_wr->num_sge, err); + PRINT_ERROR("conn:%p send posted:%d/%d bad wr_id:0x%llx sz:%d num_sge: %d err:%d", + isert_conn, num_posted, num_wr, bad_wr->wr_id, + bad_wr->sg_list->length, bad_wr->num_sge, err); } TRACE_EXIT_RES(err); @@ -164,7 +164,7 @@ void isert_post_drain(struct isert_connection *isert_conn) &isert_conn->drain_wr.send_wr.wr, &bad_wr); #endif if (unlikely(err)) { - pr_err("Failed to post drain wr, err:%d\n", err); + PRINT_ERROR("Failed to post drain wr, err:%d", err); /* * We need to decrement iser_conn->kref in order to be * able to cleanup the connection. @@ -185,13 +185,13 @@ void isert_conn_disconnect(struct isert_connection *isert_conn) err = rdma_disconnect(isert_conn->cm_id); if (unlikely(err)) - pr_err("Failed to rdma disconnect, err:%d\n", err); + PRINT_ERROR("Failed to rdma disconnect, err:%d", err); } } static int isert_pdu_handle_hello_req(struct isert_cmnd *pdu) { - pr_info("iSER Hello not supported\n"); + PRINT_INFO("iSER Hello not supported"); return -EINVAL; /* meanwhile disconnect immediately */ } @@ -226,7 +226,7 @@ static int isert_pdu_handle_tm_func(struct isert_cmnd *pdu) static int isert_pdu_handle_data_out(struct isert_cmnd *pdu) { - pr_info("iser iscsi data out not supported\n"); + PRINT_INFO("iser iscsi data out not supported"); return -EINVAL; /* meanwhile disconnect immediately */ } @@ -237,7 +237,7 @@ static int isert_pdu_handle_logout(struct isert_cmnd *pdu) static int isert_pdu_handle_snack(struct isert_cmnd *pdu) { - pr_info("iser iscsi SNACK not supported\n"); + PRINT_INFO("iser iscsi SNACK not supported"); return -EINVAL; /* meanwhile disconnect immediately */ } @@ -360,8 +360,8 @@ static void isert_recv_completion_handler(struct isert_wr *wr) err = isert_pdu_handle_snack(pdu); break; default: - pr_err("Unexpected iscsi opcode:0x%x\n", - pdu->iscsi_opcode); + PRINT_ERROR("Unexpected iscsi opcode:0x%x", + pdu->iscsi_opcode); err = -EINVAL; break; } @@ -370,14 +370,14 @@ static void isert_recv_completion_handler(struct isert_wr *wr) err = isert_pdu_handle_hello_req(pdu); break; default: - pr_err("malformed isert_hdr, iser op:%x flags 0x%02x\n", - pdu->isert_opcode, pdu->isert_hdr->flags); + PRINT_ERROR("malformed isert_hdr, iser op:%x flags 0x%02x", + pdu->isert_opcode, pdu->isert_hdr->flags); err = -EINVAL; break; } if (unlikely(err)) { - pr_err("err:%d while handling iser pdu\n", err); + PRINT_ERROR("err:%d while handling iser pdu", err); isert_conn_disconnect(wr->conn); } @@ -443,7 +443,7 @@ static void isert_handle_wc(struct ib_wc *wc) if (unlikely(isert_conn->state == ISER_CONN_HANDSHAKE)) { isert_conn->state = ISER_CONN_ACTIVE; isert_conn->saved_wr = wr; - pr_info("iser rx pdu before conn established, pdu saved\n"); + PRINT_INFO("iser rx pdu before conn established, pdu saved"); break; } isert_recv_completion_handler(wr); @@ -459,8 +459,8 @@ static void isert_handle_wc(struct ib_wc *wc) break; default: isert_conn = wr->conn; - pr_err("unexpected work req op:%d, wc op:%d, wc:%p wr_id:%p conn:%p\n", - wr->wr_op, wc->opcode, wc, wr, isert_conn); + PRINT_ERROR("unexpected work req op:%d, wc op:%d, wc:%p wr_id:%p conn:%p", + wr->wr_op, wc->opcode, wc, wr, isert_conn); if (isert_conn) isert_conn_disconnect(isert_conn); break; @@ -670,9 +670,9 @@ static void isert_handle_wc_error(struct ib_wc *wc) TRACE_ENTRY(); if (wc->status != IB_WC_WR_FLUSH_ERR) - pr_err("conn:%p wr_id:0x%p status:%s vendor_err:0x%0x\n", - isert_conn, wr, wr_status_str(wc->status), - wc->vendor_err); + PRINT_ERROR("conn:%p wr_id:0x%p status:%s vendor_err:0x%0x", + isert_conn, wr, wr_status_str(wc->status), + wc->vendor_err); if (!test_bit(ISERT_CONNECTION_ABORTED, &isert_conn->flags)) if (!test_and_set_bit(ISERT_DISCON_CALLED, &isert_conn->flags)) @@ -715,8 +715,8 @@ static void isert_handle_wc_error(struct ib_wc *wc) */ break; default: - pr_err("unexpected opcode %d, wc:%p wr_id:%p conn:%p\n", - wr->wr_op, wc, wr, isert_conn); + PRINT_ERROR("unexpected opcode %d, wc:%p wr_id:%p conn:%p", + wr->wr_op, wc, wr, isert_conn); break; } @@ -764,7 +764,7 @@ static void isert_cq_comp_work_cb(struct work_struct *work) ret = isert_poll_cq(cq_desc); if (unlikely(ret < 0)) { /* poll error */ - pr_err("ib_poll_cq failed\n"); + PRINT_ERROR("ib_poll_cq failed"); goto out; } @@ -852,9 +852,9 @@ static void isert_async_evt_handler(struct ib_event *async_ev, void *context) switch (ev_type) { case IB_EVENT_COMM_EST: isert_conn = async_ev->element.qp->qp_context; - pr_info("conn:0x%p cm_id:0x%p dev:%s, QP evt: %s\n", - isert_conn, isert_conn->cm_id, dev_name, - ib_event_type_str(IB_EVENT_COMM_EST)); + PRINT_INFO("conn:0x%p cm_id:0x%p dev:%s, QP evt: %s", + isert_conn, isert_conn->cm_id, dev_name, + ib_event_type_str(IB_EVENT_COMM_EST)); /* force "connection established" event */ rdma_notify(isert_conn->cm_id, IB_EVENT_COMM_EST); break; @@ -868,22 +868,22 @@ static void isert_async_evt_handler(struct ib_event *async_ev, void *context) case IB_EVENT_PATH_MIG_ERR: case IB_EVENT_QP_LAST_WQE_REACHED: isert_conn = async_ev->element.qp->qp_context; - pr_err("conn:0x%p cm_id:0x%p dev:%s, QP evt: %s\n", - isert_conn, isert_conn->cm_id, dev_name, - ib_event_type_str(ev_type)); + PRINT_ERROR("conn:0x%p cm_id:0x%p dev:%s, QP evt: %s", + isert_conn, isert_conn->cm_id, dev_name, + ib_event_type_str(ev_type)); break; /* CQ-related events */ case IB_EVENT_CQ_ERR: - pr_err("dev:%s CQ evt: %s\n", dev_name, - ib_event_type_str(ev_type)); + PRINT_ERROR("dev:%s CQ evt: %s", dev_name, + ib_event_type_str(ev_type)); break; /* SRQ events */ case IB_EVENT_SRQ_ERR: case IB_EVENT_SRQ_LIMIT_REACHED: - pr_err("dev:%s SRQ evt: %s\n", dev_name, - ib_event_type_str(ev_type)); + PRINT_ERROR("dev:%s SRQ evt: %s", dev_name, + ib_event_type_str(ev_type)); break; /* Port events */ @@ -893,20 +893,20 @@ static void isert_async_evt_handler(struct ib_event *async_ev, void *context) case IB_EVENT_PKEY_CHANGE: case IB_EVENT_SM_CHANGE: case IB_EVENT_CLIENT_REREGISTER: - pr_err("dev:%s port:%d evt: %s\n", - dev_name, async_ev->element.port_num, - ib_event_type_str(ev_type)); + PRINT_ERROR("dev:%s port:%d evt: %s", + dev_name, async_ev->element.port_num, + ib_event_type_str(ev_type)); break; /* HCA events */ case IB_EVENT_DEVICE_FATAL: - pr_err("dev:%s HCA evt: %s\n", dev_name, - ib_event_type_str(ev_type)); + PRINT_ERROR("dev:%s HCA evt: %s", dev_name, + ib_event_type_str(ev_type)); break; default: - pr_err("dev:%s evt: %s\n", dev_name, - ib_event_type_str(ev_type)); + PRINT_ERROR("dev:%s evt: %s", dev_name, + ib_event_type_str(ev_type)); break; } @@ -927,7 +927,7 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) isert_dev = kzalloc(sizeof(*isert_dev), GFP_KERNEL); if (unlikely(isert_dev == NULL)) { - pr_err("Failed to allocate iser dev\n"); + PRINT_ERROR("Failed to allocate iser dev"); err = -ENOMEM; goto out; } @@ -935,7 +935,7 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) err = ib_query_device(ib_dev, &isert_dev->device_attr); if (unlikely(err)) { - pr_err("Failed to query device, err: %d\n", err); + PRINT_ERROR("Failed to query device, err: %d", err); goto free_isert_dev; } #else @@ -949,15 +949,15 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) sizeof(*isert_dev->cq_qps), GFP_KERNEL); if (unlikely(isert_dev->cq_qps == NULL)) { - pr_err("Failed to allocate iser cq_qps\n"); + PRINT_ERROR("Failed to allocate iser cq_qps"); err = -ENOMEM; goto free_isert_dev; } isert_dev->cq_desc = vmalloc(sizeof(*isert_dev->cq_desc) * isert_dev->num_cqs); if (unlikely(isert_dev->cq_desc == NULL)) { - pr_err("Failed to allocate %ld bytes for iser cq_desc\n", - sizeof(*isert_dev->cq_desc) * isert_dev->num_cqs); + PRINT_ERROR("Failed to allocate %ld bytes for iser cq_desc", + sizeof(*isert_dev->cq_desc) * isert_dev->num_cqs); err = -ENOMEM; goto fail_alloc_cq_desc; } @@ -965,14 +965,14 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) pd = ib_alloc_pd(ib_dev); if (unlikely(IS_ERR(pd))) { err = PTR_ERR(pd); - pr_err("Failed to alloc iser dev pd, err:%d\n", err); + PRINT_ERROR("Failed to alloc iser dev pd, err:%d", err); goto fail_pd; } mr = ib_get_dma_mr(pd, IB_ACCESS_LOCAL_WRITE); if (unlikely(IS_ERR(mr))) { err = PTR_ERR(mr); - pr_err("Failed to get dma mr, err: %d\n", err); + PRINT_ERROR("Failed to get dma mr, err: %d", err); goto fail_mr; } @@ -981,7 +981,7 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) #ifdef CONFIG_SCST_EXTRACHECKS if (isert_dev->device_attr.max_cqe == 0) - pr_err("Zero max_cqe encountered: you may have a compilation problem\n"); + PRINT_ERROR("Zero max_cqe encountered: you may have a compilation problem"); #endif for (i = 0; i < isert_dev->num_cqs; ++i) { @@ -1010,8 +1010,8 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) #endif #endif if (unlikely(!cq_desc->cq_workqueue)) { - pr_err("Failed to alloc iser cq work queue for dev:%s\n", - ib_dev->name); + PRINT_ERROR("Failed to alloc iser cq work queue for dev:%s", + ib_dev->name); err = -ENOMEM; goto fail_cq; } @@ -1040,14 +1040,14 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) if (unlikely(IS_ERR(cq))) { cq_desc->cq = NULL; err = PTR_ERR(cq); - pr_err("Failed to create iser dev cq, err:%d\n", err); + PRINT_ERROR("Failed to create iser dev cq, err:%d", err); goto fail_cq; } cq_desc->cq = cq; err = ib_req_notify_cq(cq, IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS); if (unlikely(err)) { - pr_err("Failed to request notify cq, err: %d\n", err); + PRINT_ERROR("Failed to request notify cq, err: %d", err); goto fail_cq; } } @@ -1062,7 +1062,7 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) isert_dev_list_add(isert_dev); - pr_info("iser created device:%p\n", isert_dev); + PRINT_INFO("iser created device:%p", isert_dev); return isert_dev; fail_cq: @@ -1111,14 +1111,14 @@ static void isert_device_release(struct isert_device *isert_dev) err = ib_destroy_cq(cq_desc->cq); if (unlikely(err)) - pr_err("Failed to destroy cq, err:%d\n", err); + PRINT_ERROR("Failed to destroy cq, err:%d", err); destroy_workqueue(cq_desc->cq_workqueue); } err = ib_dereg_mr(isert_dev->mr); if (unlikely(err)) - pr_err("Failed to destroy mr, err:%d\n", err); + PRINT_ERROR("Failed to destroy mr, err:%d", err); ib_dealloc_pd(isert_dev->pd); vfree(isert_dev->cq_desc); @@ -1176,7 +1176,7 @@ static int isert_conn_qp_create(struct isert_connection *isert_conn) do { if (max_wr < ISER_MIN_SQ_SIZE) { - pr_err("Failed to create qp, not enough memory\n"); + PRINT_ERROR("Failed to create qp, not enough memory"); goto fail_create_qp; } @@ -1185,7 +1185,7 @@ static int isert_conn_qp_create(struct isert_connection *isert_conn) err = rdma_create_qp(cm_id, isert_dev->pd, &qp_attr); if (err && err != -ENOMEM) { - pr_err("Failed to create qp, err:%d\n", err); + PRINT_ERROR("Failed to create qp, err:%d", err); goto fail_create_qp; } @@ -1194,7 +1194,7 @@ static int isert_conn_qp_create(struct isert_connection *isert_conn) isert_conn->qp = cm_id->qp; - pr_info("iser created cm_id:%p qp:0x%X\n", cm_id, cm_id->qp->qp_num); + PRINT_INFO("iser created cm_id:%p qp:0x%X", cm_id, cm_id->qp->qp_num); out: TRACE_EXIT_RES(err); @@ -1218,7 +1218,7 @@ static struct isert_connection *isert_conn_create(struct rdma_cm_id *cm_id, isert_conn = isert_conn_zalloc(); if (unlikely(!isert_conn)) { - pr_err("Unable to allocate iser conn, cm_id:%p\n", cm_id); + PRINT_ERROR("Unable to allocate iser conn, cm_id:%p", cm_id); err = -ENOMEM; goto fail_alloc; } @@ -1250,7 +1250,7 @@ static struct isert_connection *isert_conn_create(struct rdma_cm_id *cm_id, isert_conn->login_req_pdu = isert_rx_pdu_alloc(isert_conn, ISER_MAX_LOGIN_RDSL); if (unlikely(!isert_conn->login_req_pdu)) { - pr_err("Failed to init login req rx pdu\n"); + PRINT_ERROR("Failed to init login req rx pdu"); err = -ENOMEM; goto fail_login_req_pdu; } @@ -1258,7 +1258,7 @@ static struct isert_connection *isert_conn_create(struct rdma_cm_id *cm_id, isert_conn->login_rsp_pdu = isert_tx_pdu_alloc(isert_conn, ISER_MAX_LOGIN_RDSL); if (unlikely(!isert_conn->login_rsp_pdu)) { - pr_err("Failed to init login rsp tx pdu\n"); + PRINT_ERROR("Failed to init login rsp tx pdu"); err = -ENOMEM; goto fail_login_rsp_pdu; } @@ -1269,7 +1269,7 @@ static struct isert_connection *isert_conn_create(struct rdma_cm_id *cm_id, err = isert_post_recv(isert_conn, &isert_conn->login_req_pdu->wr[0], 1); if (unlikely(err)) { - pr_err("Failed to post recv login req rx buf, err:%d\n", err); + PRINT_ERROR("Failed to post recv login req rx buf, err:%d", err); goto fail_post_recv; } @@ -1314,7 +1314,7 @@ static void isert_kref_free(struct kref *kref) TRACE_ENTRY(); - pr_info("%s conn:%p\n", __func__, isert_conn); + PRINT_INFO("free conn:%p", isert_conn); isert_free_conn_resources(isert_conn); @@ -1433,39 +1433,39 @@ static int isert_cm_conn_req_handler(struct rdma_cm_id *cm_id, err = rdma_accept(cm_id, &tgt_conn_param); if (unlikely(err)) { - pr_err("Failed to accept conn request, err:%d\n", err); + PRINT_ERROR("Failed to accept conn request, err:%d", err); goto fail_accept; } switch (isert_conn->peer_addr.ss_family) { case AF_INET: #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) - pr_info("iser accepted connection cm_id:%p " - NIPQUAD_FMT "->" NIPQUAD_FMT "\n", cm_id, - NIPQUAD(((struct sockaddr_in *)&isert_conn->peer_addr)->sin_addr.s_addr), - NIPQUAD(((struct sockaddr_in *)&isert_conn->self_addr)->sin_addr.s_addr)); + PRINT_INFO("iser accepted connection cm_id:%p " + NIPQUAD_FMT "->" NIPQUAD_FMT, cm_id, + NIPQUAD(((struct sockaddr_in *)&isert_conn->peer_addr)->sin_addr.s_addr), + NIPQUAD(((struct sockaddr_in *)&isert_conn->self_addr)->sin_addr.s_addr)); #else - pr_info("iser accepted connection cm_id:%p " - "%pI4->%pI4\n", cm_id, - &((struct sockaddr_in *)&isert_conn->peer_addr)->sin_addr.s_addr, - &((struct sockaddr_in *)&isert_conn->self_addr)->sin_addr.s_addr); + PRINT_INFO("iser accepted connection cm_id:%p " + "%pI4->%pI4", cm_id, + &((struct sockaddr_in *)&isert_conn->peer_addr)->sin_addr.s_addr, + &((struct sockaddr_in *)&isert_conn->self_addr)->sin_addr.s_addr); #endif break; case AF_INET6: #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) - pr_info("iser accepted connection cm_id:%p " - NIP6_FMT "->" NIP6_FMT "\n", cm_id, - NIP6(((struct sockaddr_in6 *)&isert_conn->peer_addr)->sin6_addr), - NIP6(((struct sockaddr_in6 *)&isert_conn->self_addr)->sin6_addr)); + PRINT_INFO("iser accepted connection cm_id:%p " + NIP6_FMT "->" NIP6_FMT, cm_id, + NIP6(((struct sockaddr_in6 *)&isert_conn->peer_addr)->sin6_addr), + NIP6(((struct sockaddr_in6 *)&isert_conn->self_addr)->sin6_addr)); #else - pr_info("iser accepted connection cm_id:%p " - "%pI6->%pI6\n", cm_id, - &((struct sockaddr_in6 *)&isert_conn->peer_addr)->sin6_addr, - &((struct sockaddr_in6 *)&isert_conn->self_addr)->sin6_addr); + PRINT_INFO("iser accepted connection cm_id:%p " + "%pI6->%pI6", cm_id, + &((struct sockaddr_in6 *)&isert_conn->peer_addr)->sin6_addr, + &((struct sockaddr_in6 *)&isert_conn->self_addr)->sin6_addr); #endif break; default: - pr_info("iser accepted connection cm_id:%p\n", cm_id); + PRINT_INFO("iser accepted connection cm_id:%p", cm_id); } out: @@ -1527,7 +1527,7 @@ static int isert_cm_connect_handler(struct rdma_cm_id *cm_id, set_bit(ISERT_CONNECTION_EST, &isert_conn->flags); if (push_saved_pdu) { - pr_info("iser push saved rx pdu\n"); + PRINT_INFO("iser push saved rx pdu"); isert_recv_completion_handler(isert_conn->saved_wr); isert_conn->saved_wr = NULL; } @@ -1610,8 +1610,8 @@ static int isert_cm_evt_listener_handler(struct rdma_cm_id *cm_id, break; default: - pr_info("Listener event:%s(%d), ignored\n", - cm_event_type_str(ev_type), ev_type); + PRINT_INFO("Listener event:%s(%d), ignored", + cm_event_type_str(ev_type), ev_type); break; } @@ -1629,9 +1629,9 @@ static int isert_cm_evt_handler(struct rdma_cm_id *cm_id, ev_type = cm_ev->event; portal = cm_id->context; - pr_info("isert_cm_evt:%s(%d) status:%d portal:%p cm_id:%p\n", - cm_event_type_str(ev_type), ev_type, cm_ev->status, - portal, cm_id); + PRINT_INFO("isert_cm_evt:%s(%d) status:%d portal:%p cm_id:%p", + cm_event_type_str(ev_type), ev_type, cm_ev->status, + portal, cm_id); if (portal->cm_id == cm_id) { err = isert_cm_evt_listener_handler(cm_id, cm_ev); @@ -1665,7 +1665,7 @@ static int isert_cm_evt_handler(struct rdma_cm_id *cm_id, case RDMA_CM_EVENT_MULTICAST_JOIN: case RDMA_CM_EVENT_MULTICAST_ERROR: - pr_err("UD-related event:%d, ignored\n", ev_type); + PRINT_ERROR("UD-related event:%d, ignored", ev_type); break; case RDMA_CM_EVENT_ADDR_RESOLVED: @@ -1673,7 +1673,7 @@ static int isert_cm_evt_handler(struct rdma_cm_id *cm_id, case RDMA_CM_EVENT_ROUTE_RESOLVED: case RDMA_CM_EVENT_ROUTE_ERROR: case RDMA_CM_EVENT_CONNECT_RESPONSE: - pr_err("Active side event:%d, ignored\n", ev_type); + PRINT_ERROR("Active side event:%d, ignored", ev_type); break; /* We can receive this instead of RDMA_CM_EVENT_ESTABLISHED */ @@ -1695,13 +1695,13 @@ static int isert_cm_evt_handler(struct rdma_cm_id *cm_id, break; default: - pr_err("Illegal event:%d, ignored\n", ev_type); + PRINT_ERROR("Illegal event:%d, ignored", ev_type); break; } if (unlikely(err)) - pr_err("Failed to handle rdma cm evt:%d, err:%d\n", - ev_type, err); + PRINT_ERROR("Failed to handle rdma cm evt:%d, err:%d", + ev_type, err); out: TRACE_EXIT_RES(err); @@ -1718,14 +1718,14 @@ struct isert_portal *isert_portal_create(void) int err; if (unlikely(!try_module_get(THIS_MODULE))) { - pr_err("Unable increment module reference\n"); + PRINT_ERROR("Unable increment module reference"); portal = ERR_PTR(-EINVAL); goto out; } portal = kzalloc(sizeof(*portal), GFP_KERNEL); if (unlikely(!portal)) { - pr_err("Unable to allocate struct portal\n"); + PRINT_ERROR("Unable to allocate struct portal"); portal = ERR_PTR(-ENOMEM); goto err_alloc; } @@ -1742,7 +1742,7 @@ struct isert_portal *isert_portal_create(void) #endif if (unlikely(IS_ERR(cm_id))) { err = PTR_ERR(cm_id); - pr_err("Failed to create rdma id, err:%d\n", err); + PRINT_ERROR("Failed to create rdma id, err:%d", err); goto create_id_err; } portal->cm_id = cm_id; @@ -1754,7 +1754,7 @@ struct isert_portal *isert_portal_create(void) rdma_set_afonly(cm_id, 1); #endif - pr_info("Created iser portal cm_id:%p\n", cm_id); + PRINT_INFO("Created iser portal cm_id:%p", cm_id); out: return portal; @@ -1775,12 +1775,12 @@ int isert_portal_listen(struct isert_portal *portal, TRACE_ENTRY(); err = rdma_bind_addr(portal->cm_id, sa); if (err) { - pr_warn("Failed to bind rdma addr, err:%d\n", err); + PRINT_WARNING("Failed to bind rdma addr, err:%d", err); goto out; } err = rdma_listen(portal->cm_id, ISER_LISTEN_BACKLOG); if (err) { - pr_err("Failed rdma listen, err:%d\n", err); + PRINT_ERROR("Failed rdma listen, err:%d", err); goto out; } memcpy(&portal->addr, sa, addr_len); @@ -1788,33 +1788,33 @@ int isert_portal_listen(struct isert_portal *portal, switch (sa->sa_family) { case AF_INET: #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) - pr_info("iser portal cm_id:%p listens on: " - NIPQUAD_FMT ":%d\n", portal->cm_id, - NIPQUAD(((struct sockaddr_in *)sa)->sin_addr.s_addr), - (int)ntohs(((struct sockaddr_in *)sa)->sin_port)); + PRINT_INFO("iser portal cm_id:%p listens on: " + NIPQUAD_FMT ":%d", portal->cm_id, + NIPQUAD(((struct sockaddr_in *)sa)->sin_addr.s_addr), + (int)ntohs(((struct sockaddr_in *)sa)->sin_port)); #else - pr_info("iser portal cm_id:%p listens on: " - "%pI4:%d\n", portal->cm_id, - &((struct sockaddr_in *)sa)->sin_addr.s_addr, - (int)ntohs(((struct sockaddr_in *)sa)->sin_port)); + PRINT_INFO("iser portal cm_id:%p listens on: " + "%pI4:%d", portal->cm_id, + &((struct sockaddr_in *)sa)->sin_addr.s_addr, + (int)ntohs(((struct sockaddr_in *)sa)->sin_port)); #endif break; case AF_INET6: #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) - pr_info("iser portal cm_id:%p listens on: " - NIP6_FMT " %d\n", - portal->cm_id, - NIP6(((struct sockaddr_in6 *)sa)->sin6_addr), - (int)ntohs(((struct sockaddr_in6 *)sa)->sin6_port)); + PRINT_INFO("iser portal cm_id:%p listens on: " + NIP6_FMT " %d", + portal->cm_id, + NIP6(((struct sockaddr_in6 *)sa)->sin6_addr), + (int)ntohs(((struct sockaddr_in6 *)sa)->sin6_port)); #else - pr_info("iser portal cm_id:%p listens on: " - "%pI6 %d\n", portal->cm_id, - &((struct sockaddr_in6 *)sa)->sin6_addr, - (int)ntohs(((struct sockaddr_in6 *)sa)->sin6_port)); + PRINT_INFO("iser portal cm_id:%p listens on: " + "%pI6 %d", portal->cm_id, + &((struct sockaddr_in6 *)sa)->sin6_addr, + (int)ntohs(((struct sockaddr_in6 *)sa)->sin6_port)); #endif break; default: - pr_err("Unknown address family\n"); + PRINT_ERROR("Unknown address family"); err = -EINVAL; goto out; } @@ -1839,7 +1839,7 @@ void isert_portal_release(struct isert_portal *portal) { struct isert_connection *conn; - pr_info("iser portal cm_id:%p releasing\n", portal->cm_id); + PRINT_INFO("iser portal cm_id:%p releasing", portal->cm_id); if (portal->cm_id) { rdma_destroy_id(portal->cm_id); diff --git a/iscsi-scst/kernel/isert-scst/isert.c b/iscsi-scst/kernel/isert-scst/isert.c index 3493812e3..c0562e379 100644 --- a/iscsi-scst/kernel/isert-scst/isert.c +++ b/iscsi-scst/kernel/isert-scst/isert.c @@ -398,8 +398,8 @@ int isert_pdu_sent(struct iscsi_cmnd *pdu) struct iscsi_target *target = pdu->conn->session->target; PRINT_INFO("Closing all connections for target %x at " - "initiator's %s request", target->tid, - conn->session->initiator_name); + "initiator's %s request", target->tid, + conn->session->initiator_name); mutex_lock(&target->target_mutex); target_del_all_sess(target, 0); mutex_unlock(&target->target_mutex); @@ -497,7 +497,7 @@ static int __init isert_init_module(void) int ret; if (isert_nr_devs > 999) { - PRINT_ERROR("Invalid argument for isert_nr_devs provded: %d\n", + PRINT_ERROR("Invalid argument for isert_nr_devs provded: %d", isert_nr_devs); ret = -EINVAL; goto out; diff --git a/iscsi-scst/kernel/isert-scst/isert_login.c b/iscsi-scst/kernel/isert-scst/isert_login.c index 7ecab2595..cfce8f744 100644 --- a/iscsi-scst/kernel/isert-scst/isert_login.c +++ b/iscsi-scst/kernel/isert-scst/isert_login.c @@ -140,7 +140,7 @@ static void isert_conn_timer_fn(unsigned long arg) conn_dev->timer_active = 0; - PRINT_ERROR("Timeout on connection %p\n", conn_dev->conn); + PRINT_ERROR("Timeout on connection %p", conn_dev->conn); schedule_work(&conn->close_work); @@ -156,7 +156,7 @@ static int add_new_connection(struct isert_listener_dev *dev, TRACE_ENTRY(); if (!conn_dev) { - PRINT_WARNING("%s", "Unable to allocate new connection"); + PRINT_WARNING("Unable to allocate new connection"); res = -ENOSPC; goto out; } @@ -398,13 +398,13 @@ static long isert_listen_ioctl(struct file *filp, unsigned int cmd, case SET_LISTEN_ADDR: rc = copy_from_user(&dev->info, ptr, sizeof(dev->info)); if (unlikely(rc != 0)) { - PRINT_ERROR("Failed to copy %d user's bytes\n", rc); + PRINT_ERROR("Failed to copy %d user's bytes", rc); res = -EFAULT; goto out; } if (unlikely(dev->free_portal_idx >= ISERT_MAX_PORTALS)) { - PRINT_ERROR("Maximum number of portals exceeded: %d\n", + PRINT_ERROR("Maximum number of portals exceeded: %d", ISERT_MAX_PORTALS); res = -EINVAL; goto out; @@ -420,7 +420,7 @@ static long isert_listen_ioctl(struct file *filp, unsigned int cmd, portal = isert_portal_add((struct sockaddr *)&dev->info.addr, dev->info.addr_len); if (IS_ERR(portal)) { - PRINT_ERROR("Unable to add portal of size %zu\n", + PRINT_ERROR("Unable to add portal of size %zu", dev->info.addr_len); res = PTR_ERR(portal); goto out; @@ -622,8 +622,7 @@ static ssize_t isert_read(struct file *filp, char __user *buf, size_t count, break; default: - PRINT_ERROR("Invalid state in %s (%d)\n", __func__, - dev->state); + PRINT_ERROR("Invalid state %d", dev->state); to_read = 0; } @@ -666,8 +665,7 @@ static ssize_t isert_write(struct file *filp, const char __user *buf, break; default: - PRINT_ERROR("Invalid state in %s (%d)\n", __func__, - dev->state); + PRINT_ERROR("Invalid state %d", dev->state); to_write = 0; } @@ -959,7 +957,7 @@ int __init isert_init_login_devs(unsigned int ndevs) isert_major = MAJOR(devno); if (unlikely(res < 0)) { - PRINT_ERROR("isert: can't get major %d\n", isert_major); + PRINT_ERROR("can't get major %d", isert_major); goto out; } @@ -984,7 +982,7 @@ int __init isert_init_login_devs(unsigned int ndevs) res = isert_datamover_init(); if (unlikely(res)) { - PRINT_ERROR("Unable to initialize datamover: %d\n", res); + PRINT_ERROR("Unable to initialize datamover: %d", res); goto fail; }