Skip to content

Commit a5f2087

Browse files
committed
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>
1 parent ccc89b9 commit a5f2087

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

net/sunrpc/xprtrdma/svc_rdma_recvfrom.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ svc_rdma_next_recv_ctxt(struct list_head *list)
118118
static struct svc_rdma_recv_ctxt *
119119
svc_rdma_recv_ctxt_alloc(struct svcxprt_rdma *rdma)
120120
{
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);
122123
struct svc_rdma_recv_ctxt *ctxt;
123124
unsigned long pages;
124125
dma_addr_t addr;
@@ -133,9 +134,9 @@ svc_rdma_recv_ctxt_alloc(struct svcxprt_rdma *rdma)
133134
buffer = kmalloc_node(rdma->sc_max_req_size, GFP_KERNEL, node);
134135
if (!buffer)
135136
goto fail1;
136-
addr = ib_dma_map_single(rdma->sc_pd->device, buffer,
137-
rdma->sc_max_req_size, DMA_FROM_DEVICE);
138-
if (ib_dma_mapping_error(rdma->sc_pd->device, addr))
137+
addr = ib_dma_map_single(device, buffer, rdma->sc_max_req_size,
138+
DMA_FROM_DEVICE);
139+
if (ib_dma_mapping_error(device, addr))
139140
goto fail2;
140141

141142
svc_rdma_recv_cid_init(rdma, &ctxt->rc_cid);
@@ -167,7 +168,7 @@ svc_rdma_recv_ctxt_alloc(struct svcxprt_rdma *rdma)
167168
static void svc_rdma_recv_ctxt_destroy(struct svcxprt_rdma *rdma,
168169
struct svc_rdma_recv_ctxt *ctxt)
169170
{
170-
ib_dma_unmap_single(rdma->sc_pd->device, ctxt->rc_recv_sge.addr,
171+
ib_dma_unmap_single(rdma->sc_cm_id->device, ctxt->rc_recv_sge.addr,
171172
ctxt->rc_recv_sge.length, DMA_FROM_DEVICE);
172173
kfree(ctxt->rc_recv_buf);
173174
kfree(ctxt);
@@ -955,7 +956,7 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
955956
return 0;
956957

957958
percpu_counter_inc(&svcrdma_stat_recv);
958-
ib_dma_sync_single_for_cpu(rdma_xprt->sc_pd->device,
959+
ib_dma_sync_single_for_cpu(rdma_xprt->sc_cm_id->device,
959960
ctxt->rc_recv_sge.addr, ctxt->rc_byte_len,
960961
DMA_FROM_DEVICE);
961962
svc_rdma_build_arg_xdr(rqstp, ctxt);

0 commit comments

Comments
 (0)