Lines Matching refs:port_priv
78 struct ib_mad_port_private *port_priv,
90 static bool ib_mad_send_error(struct ib_mad_port_private *port_priv,
212 struct ib_mad_port_private *port_priv; in ib_register_mad_agent() local
325 port_priv = ib_get_mad_port(device, port_num); in ib_register_mad_agent()
326 if (!port_priv) { in ib_register_mad_agent()
336 if (!port_priv->qp_info[qpn].qp) { in ib_register_mad_agent()
359 mad_agent_priv->qp_info = &port_priv->qp_info[qpn]; in ib_register_mad_agent()
366 mad_agent_priv->agent.qp = port_priv->qp_info[qpn].qp; in ib_register_mad_agent()
403 spin_lock_irq(&port_priv->reg_lock); in ib_register_mad_agent()
407 class = port_priv->version[mad_reg_req-> in ib_register_mad_agent()
421 vendor = port_priv->version[mad_reg_req-> in ib_register_mad_agent()
440 spin_unlock_irq(&port_priv->reg_lock); in ib_register_mad_agent()
444 spin_unlock_irq(&port_priv->reg_lock); in ib_register_mad_agent()
517 struct ib_mad_port_private *port_priv; in ib_register_mad_snoop() local
534 port_priv = ib_get_mad_port(device, port_num); in ib_register_mad_snoop()
535 if (!port_priv) { in ib_register_mad_snoop()
547 mad_snoop_priv->qp_info = &port_priv->qp_info[qpn]; in ib_register_mad_snoop()
552 mad_snoop_priv->agent.qp = port_priv->qp_info[qpn].qp; in ib_register_mad_snoop()
564 &port_priv->qp_info[qpn], in ib_register_mad_snoop()
596 struct ib_mad_port_private *port_priv; in unregister_mad_agent() local
605 port_priv = mad_agent_priv->qp_info->port_priv; in unregister_mad_agent()
608 spin_lock_irq(&port_priv->reg_lock); in unregister_mad_agent()
610 spin_unlock_irq(&port_priv->reg_lock); in unregister_mad_agent()
615 flush_workqueue(port_priv->wq); in unregister_mad_agent()
767 static size_t port_mad_size(const struct ib_mad_port_private *port_priv) in port_mad_size() argument
769 return rdma_max_mad_size(port_priv->device, port_priv->port_num); in port_mad_size()
791 struct ib_mad_port_private *port_priv; in handle_outgoing_dr_smp() local
797 size_t mad_size = port_mad_size(mad_agent_priv->qp_info->port_priv); in handle_outgoing_dr_smp()
800 bool opa = rdma_cap_opa_mad(mad_agent_priv->qp_info->port_priv->device, in handle_outgoing_dr_smp()
801 mad_agent_priv->qp_info->port_priv->port_num); in handle_outgoing_dr_smp()
909 port_priv = ib_get_mad_port(mad_agent_priv->agent.device, in handle_outgoing_dr_smp()
911 if (port_priv) { in handle_outgoing_dr_smp()
913 recv_mad_agent = find_mad_agent(port_priv, in handle_outgoing_dr_smp()
916 if (!port_priv || !recv_mad_agent) { in handle_outgoing_dr_smp()
945 queue_work(mad_agent_priv->qp_info->port_priv->wq, in handle_outgoing_dr_smp()
1486 struct ib_mad_port_private *port_priv; in add_nonoui_reg_req() local
1491 port_priv = agent_priv->qp_info->port_priv; in add_nonoui_reg_req()
1492 class = &port_priv->version[mad_reg_req->mgmt_class_version].class; in add_nonoui_reg_req()
1545 struct ib_mad_port_private *port_priv; in add_oui_reg_req() local
1555 port_priv = agent_priv->qp_info->port_priv; in add_oui_reg_req()
1556 vendor_table = &port_priv->version[ in add_oui_reg_req()
1642 struct ib_mad_port_private *port_priv; in remove_mad_reg_req() local
1658 port_priv = agent_priv->qp_info->port_priv; in remove_mad_reg_req()
1660 class = port_priv->version[ in remove_mad_reg_req()
1678 port_priv->version[ in remove_mad_reg_req()
1691 vendor = port_priv->version[ in remove_mad_reg_req()
1723 port_priv->version[ in remove_mad_reg_req()
1738 find_mad_agent(struct ib_mad_port_private *port_priv, in find_mad_agent() argument
1765 spin_lock_irqsave(&port_priv->reg_lock, flags); in find_mad_agent()
1773 class = port_priv->version[ in find_mad_agent()
1786 vendor = port_priv->version[ in find_mad_agent()
1808 spin_unlock_irqrestore(&port_priv->reg_lock, flags); in find_mad_agent()
1812 dev_notice(&port_priv->device->dev, in find_mad_agent()
1814 &mad_agent->agent, port_priv->port_num); in find_mad_agent()
2064 static enum smi_action handle_ib_smi(const struct ib_mad_port_private *port_priv, in handle_ib_smi() argument
2075 rdma_cap_ib_switch(port_priv->device), in handle_ib_smi()
2077 port_priv->device->phys_port_cnt) == in handle_ib_smi()
2087 rdma_cap_ib_switch(port_priv->device), in handle_ib_smi()
2091 if (smi_check_local_smp(smp, port_priv->device) == IB_SMI_DISCARD) in handle_ib_smi()
2093 } else if (rdma_cap_ib_switch(port_priv->device)) { in handle_ib_smi()
2102 port_priv->device, in handle_ib_smi()
2149 handle_opa_smi(struct ib_mad_port_private *port_priv, in handle_opa_smi() argument
2160 rdma_cap_ib_switch(port_priv->device), in handle_opa_smi()
2162 port_priv->device->phys_port_cnt) == in handle_opa_smi()
2172 rdma_cap_ib_switch(port_priv->device), in handle_opa_smi()
2176 if (opa_smi_check_local_smp(smp, port_priv->device) == in handle_opa_smi()
2180 } else if (rdma_cap_ib_switch(port_priv->device)) { in handle_opa_smi()
2190 port_priv->device, in handle_opa_smi()
2203 handle_smi(struct ib_mad_port_private *port_priv, in handle_smi() argument
2215 return handle_opa_smi(port_priv, qp_info, wc, port_num, recv, in handle_smi()
2218 return handle_ib_smi(port_priv, qp_info, wc, port_num, recv, response); in handle_smi()
2223 struct ib_mad_port_private *port_priv = cq->cq_context; in ib_mad_recv_done() local
2236 if (list_empty_careful(&port_priv->port_list)) in ib_mad_recv_done()
2250 opa = rdma_cap_opa_mad(qp_info->port_priv->device, in ib_mad_recv_done()
2251 qp_info->port_priv->port_num); in ib_mad_recv_done()
2256 ib_dma_unmap_single(port_priv->device, in ib_mad_recv_done()
2288 if (rdma_cap_ib_switch(port_priv->device)) in ib_mad_recv_done()
2291 port_num = port_priv->port_num; in ib_mad_recv_done()
2295 if (handle_smi(port_priv, qp_info, wc, port_num, recv, in ib_mad_recv_done()
2302 if (port_priv->device->process_mad) { in ib_mad_recv_done()
2303 ret = port_priv->device->process_mad(port_priv->device, 0, in ib_mad_recv_done()
2304 port_priv->port_num, in ib_mad_recv_done()
2320 port_priv->device, in ib_mad_recv_done()
2329 mad_agent = find_mad_agent(port_priv, (const struct ib_mad_hdr *)recv->mad); in ib_mad_recv_done()
2340 port_priv->device, port_num, in ib_mad_recv_done()
2371 mod_delayed_work(mad_agent_priv->qp_info->port_priv->wq, in adjust_timeout()
2406 mod_delayed_work(mad_agent_priv->qp_info->port_priv->wq, in wait_for_response()
2472 struct ib_mad_port_private *port_priv = cq->cq_context; in ib_mad_send_done() local
2482 if (list_empty_careful(&port_priv->port_list)) in ib_mad_send_done()
2486 if (!ib_mad_send_error(port_priv, wc)) in ib_mad_send_done()
2529 dev_err(&port_priv->device->dev, in ib_mad_send_done()
2554 static bool ib_mad_send_error(struct ib_mad_port_private *port_priv, in ib_mad_send_error() argument
2590 dev_err(&port_priv->device->dev, in ib_mad_send_error()
2714 opa = rdma_cap_opa_mad(mad_agent_priv->qp_info->port_priv->device, in local_completions()
2715 mad_agent_priv->qp_info->port_priv->port_num); in local_completions()
2854 port_priv->wq, in timeout_sends()
2894 sg_list.lkey = qp_info->port_priv->pd->local_dma_lkey; in ib_mad_post_receive_mads()
2907 mad_priv = alloc_mad_private(port_mad_size(qp_info->port_priv), in ib_mad_post_receive_mads()
2915 sg_list.addr = ib_dma_map_single(qp_info->port_priv->device, in ib_mad_post_receive_mads()
2919 if (unlikely(ib_dma_mapping_error(qp_info->port_priv->device, in ib_mad_post_receive_mads()
2940 ib_dma_unmap_single(qp_info->port_priv->device, in ib_mad_post_receive_mads()
2945 dev_err(&qp_info->port_priv->device->dev, in ib_mad_post_receive_mads()
2979 ib_dma_unmap_single(qp_info->port_priv->device, in cleanup_recv_queue()
2992 static int ib_mad_port_start(struct ib_mad_port_private *port_priv) in ib_mad_port_start() argument
3003 ret = ib_find_pkey(port_priv->device, port_priv->port_num, in ib_mad_port_start()
3009 qp = port_priv->qp_info[i].qp; in ib_mad_port_start()
3023 dev_err(&port_priv->device->dev, in ib_mad_port_start()
3032 dev_err(&port_priv->device->dev, in ib_mad_port_start()
3042 dev_err(&port_priv->device->dev, in ib_mad_port_start()
3049 ret = ib_req_notify_cq(port_priv->cq, IB_CQ_NEXT_COMP); in ib_mad_port_start()
3051 dev_err(&port_priv->device->dev, in ib_mad_port_start()
3058 if (!port_priv->qp_info[i].qp) in ib_mad_port_start()
3061 ret = ib_mad_post_receive_mads(&port_priv->qp_info[i], NULL); in ib_mad_port_start()
3063 dev_err(&port_priv->device->dev, in ib_mad_port_start()
3078 dev_err(&qp_info->port_priv->device->dev, in qp_event_handler()
3092 static void init_mad_qp(struct ib_mad_port_private *port_priv, in init_mad_qp() argument
3095 qp_info->port_priv = port_priv; in init_mad_qp()
3112 qp_init_attr.send_cq = qp_info->port_priv->cq; in create_mad_qp()
3113 qp_init_attr.recv_cq = qp_info->port_priv->cq; in create_mad_qp()
3120 qp_init_attr.port_num = qp_info->port_priv->port_num; in create_mad_qp()
3123 qp_info->qp = ib_create_qp(qp_info->port_priv->pd, &qp_init_attr); in create_mad_qp()
3125 dev_err(&qp_info->port_priv->device->dev, in create_mad_qp()
3157 struct ib_mad_port_private *port_priv; in ib_mad_port_open() local
3170 port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL); in ib_mad_port_open()
3171 if (!port_priv) in ib_mad_port_open()
3174 port_priv->device = device; in ib_mad_port_open()
3175 port_priv->port_num = port_num; in ib_mad_port_open()
3176 spin_lock_init(&port_priv->reg_lock); in ib_mad_port_open()
3177 init_mad_qp(port_priv, &port_priv->qp_info[0]); in ib_mad_port_open()
3178 init_mad_qp(port_priv, &port_priv->qp_info[1]); in ib_mad_port_open()
3185 port_priv->cq = ib_alloc_cq(port_priv->device, port_priv, cq_size, 0, in ib_mad_port_open()
3187 if (IS_ERR(port_priv->cq)) { in ib_mad_port_open()
3189 ret = PTR_ERR(port_priv->cq); in ib_mad_port_open()
3193 port_priv->pd = ib_alloc_pd(device, 0); in ib_mad_port_open()
3194 if (IS_ERR(port_priv->pd)) { in ib_mad_port_open()
3196 ret = PTR_ERR(port_priv->pd); in ib_mad_port_open()
3201 ret = create_mad_qp(&port_priv->qp_info[0], IB_QPT_SMI); in ib_mad_port_open()
3205 ret = create_mad_qp(&port_priv->qp_info[1], IB_QPT_GSI); in ib_mad_port_open()
3210 port_priv->wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM); in ib_mad_port_open()
3211 if (!port_priv->wq) { in ib_mad_port_open()
3217 list_add_tail(&port_priv->port_list, &ib_mad_port_list); in ib_mad_port_open()
3220 ret = ib_mad_port_start(port_priv); in ib_mad_port_open()
3230 list_del_init(&port_priv->port_list); in ib_mad_port_open()
3233 destroy_workqueue(port_priv->wq); in ib_mad_port_open()
3235 destroy_mad_qp(&port_priv->qp_info[1]); in ib_mad_port_open()
3237 destroy_mad_qp(&port_priv->qp_info[0]); in ib_mad_port_open()
3239 ib_dealloc_pd(port_priv->pd); in ib_mad_port_open()
3241 ib_free_cq(port_priv->cq); in ib_mad_port_open()
3242 cleanup_recv_queue(&port_priv->qp_info[1]); in ib_mad_port_open()
3243 cleanup_recv_queue(&port_priv->qp_info[0]); in ib_mad_port_open()
3245 kfree(port_priv); in ib_mad_port_open()
3257 struct ib_mad_port_private *port_priv; in ib_mad_port_close() local
3261 port_priv = __ib_get_mad_port(device, port_num); in ib_mad_port_close()
3262 if (port_priv == NULL) { in ib_mad_port_close()
3267 list_del_init(&port_priv->port_list); in ib_mad_port_close()
3270 destroy_workqueue(port_priv->wq); in ib_mad_port_close()
3271 destroy_mad_qp(&port_priv->qp_info[1]); in ib_mad_port_close()
3272 destroy_mad_qp(&port_priv->qp_info[0]); in ib_mad_port_close()
3273 ib_dealloc_pd(port_priv->pd); in ib_mad_port_close()
3274 ib_free_cq(port_priv->cq); in ib_mad_port_close()
3275 cleanup_recv_queue(&port_priv->qp_info[1]); in ib_mad_port_close()
3276 cleanup_recv_queue(&port_priv->qp_info[0]); in ib_mad_port_close()
3279 kfree(port_priv); in ib_mad_port_close()