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

IB/mad: Remove ib_get_dma_mr calls

The pd now has a local_dma_lkey member which completely replaces
ib_get_dma_mr, use it instead.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>

authored by

Jason Gunthorpe and committed by
Doug Ledford
4be90bc6 96249d70

+3 -25
+3 -23
drivers/infiniband/core/mad.c
··· 338 338 goto error1; 339 339 } 340 340 341 - mad_agent_priv->agent.mr = ib_get_dma_mr(port_priv->qp_info[qpn].qp->pd, 342 - IB_ACCESS_LOCAL_WRITE); 343 - if (IS_ERR(mad_agent_priv->agent.mr)) { 344 - ret = ERR_PTR(-ENOMEM); 345 - goto error2; 346 - } 347 - 348 341 if (mad_reg_req) { 349 342 reg_req = kmemdup(mad_reg_req, sizeof *reg_req, GFP_KERNEL); 350 343 if (!reg_req) { ··· 422 429 spin_unlock_irqrestore(&port_priv->reg_lock, flags); 423 430 kfree(reg_req); 424 431 error3: 425 - ib_dereg_mr(mad_agent_priv->agent.mr); 426 - error2: 427 432 kfree(mad_agent_priv); 428 433 error1: 429 434 return ret; ··· 581 590 wait_for_completion(&mad_agent_priv->comp); 582 591 583 592 kfree(mad_agent_priv->reg_req); 584 - ib_dereg_mr(mad_agent_priv->agent.mr); 585 593 kfree(mad_agent_priv); 586 594 } 587 595 ··· 1028 1038 1029 1039 mad_send_wr->mad_agent_priv = mad_agent_priv; 1030 1040 mad_send_wr->sg_list[0].length = hdr_len; 1031 - mad_send_wr->sg_list[0].lkey = mad_agent->mr->lkey; 1041 + mad_send_wr->sg_list[0].lkey = mad_agent->qp->pd->local_dma_lkey; 1032 1042 1033 1043 /* OPA MADs don't have to be the full 2048 bytes */ 1034 1044 if (opa && base_version == OPA_MGMT_BASE_VERSION && ··· 1037 1047 else 1038 1048 mad_send_wr->sg_list[1].length = mad_size - hdr_len; 1039 1049 1040 - mad_send_wr->sg_list[1].lkey = mad_agent->mr->lkey; 1050 + mad_send_wr->sg_list[1].lkey = mad_agent->qp->pd->local_dma_lkey; 1041 1051 1042 1052 mad_send_wr->send_wr.wr_id = (unsigned long) mad_send_wr; 1043 1053 mad_send_wr->send_wr.sg_list = mad_send_wr->sg_list; ··· 2875 2885 struct ib_mad_queue *recv_queue = &qp_info->recv_queue; 2876 2886 2877 2887 /* Initialize common scatter list fields */ 2878 - sg_list.lkey = (*qp_info->port_priv->mr).lkey; 2888 + sg_list.lkey = qp_info->port_priv->pd->local_dma_lkey; 2879 2889 2880 2890 /* Initialize common receive WR fields */ 2881 2891 recv_wr.next = NULL; ··· 3191 3201 goto error4; 3192 3202 } 3193 3203 3194 - port_priv->mr = ib_get_dma_mr(port_priv->pd, IB_ACCESS_LOCAL_WRITE); 3195 - if (IS_ERR(port_priv->mr)) { 3196 - dev_err(&device->dev, "Couldn't get ib_mad DMA MR\n"); 3197 - ret = PTR_ERR(port_priv->mr); 3198 - goto error5; 3199 - } 3200 - 3201 3204 if (has_smi) { 3202 3205 ret = create_mad_qp(&port_priv->qp_info[0], IB_QPT_SMI); 3203 3206 if (ret) ··· 3231 3248 error7: 3232 3249 destroy_mad_qp(&port_priv->qp_info[0]); 3233 3250 error6: 3234 - ib_dereg_mr(port_priv->mr); 3235 - error5: 3236 3251 ib_dealloc_pd(port_priv->pd); 3237 3252 error4: 3238 3253 ib_destroy_cq(port_priv->cq); ··· 3265 3284 destroy_workqueue(port_priv->wq); 3266 3285 destroy_mad_qp(&port_priv->qp_info[1]); 3267 3286 destroy_mad_qp(&port_priv->qp_info[0]); 3268 - ib_dereg_mr(port_priv->mr); 3269 3287 ib_dealloc_pd(port_priv->pd); 3270 3288 ib_destroy_cq(port_priv->cq); 3271 3289 cleanup_recv_queue(&port_priv->qp_info[1]);
-1
drivers/infiniband/core/mad_priv.h
··· 199 199 int port_num; 200 200 struct ib_cq *cq; 201 201 struct ib_pd *pd; 202 - struct ib_mr *mr; 203 202 204 203 spinlock_t reg_lock; 205 204 struct ib_mad_mgmt_version_table version[MAX_MGMT_VERSION];
-1
include/rdma/ib_mad.h
··· 526 526 struct ib_mad_agent { 527 527 struct ib_device *device; 528 528 struct ib_qp *qp; 529 - struct ib_mr *mr; 530 529 ib_mad_recv_handler recv_handler; 531 530 ib_mad_send_handler send_handler; 532 531 ib_mad_snoop_handler snoop_handler;