From dca84e290bcce44bbe74c6ec2ef19f23ce0ca458 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 1 Dec 2016 16:18:39 +0000 Subject: [PATCH] ib_srpt: Only complain if immediate data has to be copied if CONFIG_SLUB_DEBUG=n git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7046 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/session-management.txt | 2 +- srpt/src/ib_srpt.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/srpt/session-management.txt b/srpt/session-management.txt index 89147cca8..53dae0f35 100644 --- a/srpt/session-management.txt +++ b/srpt/session-management.txt @@ -8,7 +8,7 @@ The following actions related to SRP sessions can all occur concurrently: * HCA driver invokes the QP async event handler srpt_qp_event(). * HCA transfers data between initiator and target via RDMA. * srpt_compl_thread() polls the QP. -* SCST core invokes one of the callback functions defined in srpt_template(). +* SCST core invokes one of the callback functions defined in srpt_template. The actions that occur over the lifetime of a session are as follows: - A REQ message is received from the initiator. diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index f6bae1923..d3384758d 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -809,8 +809,12 @@ static struct srpt_ioctx *srpt_alloc_ioctx(struct srpt_device *sdev, if (!ioctx->buf) goto err_free_ioctx; - /* Complain if it is not safe to use zero-copy */ - WARN_ON_ONCE(alignment_offset && ((uintptr_t)ioctx->buf & 511)); + if (alignment_offset && ((uintptr_t)ioctx->buf & 511)) { + pr_warn("Disabling zero-copy for immediate data\n"); +#ifndef CONFIG_SLUB_DEBUG + WARN_ON_ONCE(true); +#endif + } ioctx->dma = ib_dma_map_single(sdev->device, ioctx->buf, dma_size + alignment_offset, dir); @@ -3541,6 +3545,10 @@ static int srpt_xfer_data(struct srpt_rdma_ch *ch, unsigned offset = 0, len; uint8_t *buf; + /* + * Copy the immediate data if srpt_get_desc_tbl() + * did not call sg_init_one(). + */ len = scst_get_buf_first(cmd, &buf); while (len > 0) { memcpy(buf, ioctx->imm_data + offset, len);