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
This commit is contained in:
Bart Van Assche
2016-12-01 16:18:39 +00:00
parent 2470b10ad0
commit dca84e290b
2 changed files with 11 additions and 3 deletions

View File

@@ -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.

View File

@@ -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);