Skip to content

Commit c553983

Browse files
committed
svcrdma: Clean up use of rdma->sc_pd->device
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 think there's any functional difference between the two, but it is a little confusing to see some uses of rdma_cm_id and some of ib_pd. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent a5f2087 commit c553983

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

net/sunrpc/xprtrdma/svc_rdma_sendto.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ static void svc_rdma_wc_send(struct ib_cq *cq, struct ib_wc *wc);
116116
static struct svc_rdma_send_ctxt *
117117
svc_rdma_send_ctxt_alloc(struct svcxprt_rdma *rdma)
118118
{
119-
int node = ibdev_to_node(rdma->sc_cm_id->device);
119+
struct ib_device *device = rdma->sc_cm_id->device;
120+
int node = ibdev_to_node(device);
120121
struct svc_rdma_send_ctxt *ctxt;
121122
unsigned long pages;
122123
dma_addr_t addr;
@@ -136,9 +137,9 @@ svc_rdma_send_ctxt_alloc(struct svcxprt_rdma *rdma)
136137
buffer = kmalloc_node(rdma->sc_max_req_size, GFP_KERNEL, node);
137138
if (!buffer)
138139
goto fail2;
139-
addr = ib_dma_map_single(rdma->sc_pd->device, buffer,
140-
rdma->sc_max_req_size, DMA_TO_DEVICE);
141-
if (ib_dma_mapping_error(rdma->sc_pd->device, addr))
140+
addr = ib_dma_map_single(device, buffer, rdma->sc_max_req_size,
141+
DMA_TO_DEVICE);
142+
if (ib_dma_mapping_error(device, addr))
142143
goto fail3;
143144

144145
svc_rdma_send_cid_init(rdma, &ctxt->sc_cid);
@@ -175,15 +176,14 @@ svc_rdma_send_ctxt_alloc(struct svcxprt_rdma *rdma)
175176
*/
176177
void svc_rdma_send_ctxts_destroy(struct svcxprt_rdma *rdma)
177178
{
179+
struct ib_device *device = rdma->sc_cm_id->device;
178180
struct svc_rdma_send_ctxt *ctxt;
179181
struct llist_node *node;
180182

181183
while ((node = llist_del_first(&rdma->sc_send_ctxts)) != NULL) {
182184
ctxt = llist_entry(node, struct svc_rdma_send_ctxt, sc_node);
183-
ib_dma_unmap_single(rdma->sc_pd->device,
184-
ctxt->sc_sges[0].addr,
185-
rdma->sc_max_req_size,
186-
DMA_TO_DEVICE);
185+
ib_dma_unmap_single(device, ctxt->sc_sges[0].addr,
186+
rdma->sc_max_req_size, DMA_TO_DEVICE);
187187
kfree(ctxt->sc_xprt_buf);
188188
kfree(ctxt->sc_pages);
189189
kfree(ctxt);
@@ -463,7 +463,7 @@ int svc_rdma_post_send(struct svcxprt_rdma *rdma,
463463
might_sleep();
464464

465465
/* Sync the transport header buffer */
466-
ib_dma_sync_single_for_device(rdma->sc_pd->device,
466+
ib_dma_sync_single_for_device(rdma->sc_cm_id->device,
467467
send_wr->sg_list[0].addr,
468468
send_wr->sg_list[0].length,
469469
DMA_TO_DEVICE);

0 commit comments

Comments
 (0)