Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

svcrdma: Clean up use of rdma->sc_pd->device in Receive paths

I can't think of a reason why svcrdma is using the PD's device. Most
other consumers of the IB DMA API use the ib_device pointer from the
connection's rdma_cm_id.

I don't believe there's any functional difference between the two,
but it is a little confusing to see some uses of rdma_cm_id->device
and some of ib_pd->device.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

+7 -6
+7 -6
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
··· 118 118 static struct svc_rdma_recv_ctxt * 119 119 svc_rdma_recv_ctxt_alloc(struct svcxprt_rdma *rdma) 120 120 { 121 - int node = ibdev_to_node(rdma->sc_cm_id->device); 121 + struct ib_device *device = rdma->sc_cm_id->device; 122 + int node = ibdev_to_node(device); 122 123 struct svc_rdma_recv_ctxt *ctxt; 123 124 unsigned long pages; 124 125 dma_addr_t addr; ··· 134 133 buffer = kmalloc_node(rdma->sc_max_req_size, GFP_KERNEL, node); 135 134 if (!buffer) 136 135 goto fail1; 137 - addr = ib_dma_map_single(rdma->sc_pd->device, buffer, 138 - rdma->sc_max_req_size, DMA_FROM_DEVICE); 139 - if (ib_dma_mapping_error(rdma->sc_pd->device, addr)) 136 + addr = ib_dma_map_single(device, buffer, rdma->sc_max_req_size, 137 + DMA_FROM_DEVICE); 138 + if (ib_dma_mapping_error(device, addr)) 140 139 goto fail2; 141 140 142 141 svc_rdma_recv_cid_init(rdma, &ctxt->rc_cid); ··· 168 167 static void svc_rdma_recv_ctxt_destroy(struct svcxprt_rdma *rdma, 169 168 struct svc_rdma_recv_ctxt *ctxt) 170 169 { 171 - ib_dma_unmap_single(rdma->sc_pd->device, ctxt->rc_recv_sge.addr, 170 + ib_dma_unmap_single(rdma->sc_cm_id->device, ctxt->rc_recv_sge.addr, 172 171 ctxt->rc_recv_sge.length, DMA_FROM_DEVICE); 173 172 kfree(ctxt->rc_recv_buf); 174 173 kfree(ctxt); ··· 956 955 return 0; 957 956 958 957 percpu_counter_inc(&svcrdma_stat_recv); 959 - ib_dma_sync_single_for_cpu(rdma_xprt->sc_pd->device, 958 + ib_dma_sync_single_for_cpu(rdma_xprt->sc_cm_id->device, 960 959 ctxt->rc_recv_sge.addr, ctxt->rc_byte_len, 961 960 DMA_FROM_DEVICE); 962 961 svc_rdma_build_arg_xdr(rqstp, ctxt);