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

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>

+9 -9
+9 -9
net/sunrpc/xprtrdma/svc_rdma_sendto.c
··· 116 116 static struct svc_rdma_send_ctxt * 117 117 svc_rdma_send_ctxt_alloc(struct svcxprt_rdma *rdma) 118 118 { 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); 120 121 struct svc_rdma_send_ctxt *ctxt; 121 122 unsigned long pages; 122 123 dma_addr_t addr; ··· 137 136 buffer = kmalloc_node(rdma->sc_max_req_size, GFP_KERNEL, node); 138 137 if (!buffer) 139 138 goto fail2; 140 - addr = ib_dma_map_single(rdma->sc_pd->device, buffer, 141 - rdma->sc_max_req_size, DMA_TO_DEVICE); 142 - if (ib_dma_mapping_error(rdma->sc_pd->device, addr)) 139 + addr = ib_dma_map_single(device, buffer, rdma->sc_max_req_size, 140 + DMA_TO_DEVICE); 141 + if (ib_dma_mapping_error(device, addr)) 143 142 goto fail3; 144 143 145 144 svc_rdma_send_cid_init(rdma, &ctxt->sc_cid); ··· 176 175 */ 177 176 void svc_rdma_send_ctxts_destroy(struct svcxprt_rdma *rdma) 178 177 { 178 + struct ib_device *device = rdma->sc_cm_id->device; 179 179 struct svc_rdma_send_ctxt *ctxt; 180 180 struct llist_node *node; 181 181 182 182 while ((node = llist_del_first(&rdma->sc_send_ctxts)) != NULL) { 183 183 ctxt = llist_entry(node, struct svc_rdma_send_ctxt, sc_node); 184 - ib_dma_unmap_single(rdma->sc_pd->device, 185 - ctxt->sc_sges[0].addr, 186 - rdma->sc_max_req_size, 187 - DMA_TO_DEVICE); 184 + ib_dma_unmap_single(device, ctxt->sc_sges[0].addr, 185 + rdma->sc_max_req_size, DMA_TO_DEVICE); 188 186 kfree(ctxt->sc_xprt_buf); 189 187 kfree(ctxt->sc_pages); 190 188 kfree(ctxt); ··· 463 463 might_sleep(); 464 464 465 465 /* 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, 467 467 send_wr->sg_list[0].addr, 468 468 send_wr->sg_list[0].length, 469 469 DMA_TO_DEVICE);