Lines Matching full:agent
47 struct ib_mad_agent_private *agent; member
87 void ib_cancel_rmpp_recvs(struct ib_mad_agent_private *agent) in ib_cancel_rmpp_recvs() argument
92 spin_lock_irqsave(&agent->lock, flags); in ib_cancel_rmpp_recvs()
93 list_for_each_entry(rmpp_recv, &agent->rmpp_list, list) { in ib_cancel_rmpp_recvs()
97 spin_unlock_irqrestore(&agent->lock, flags); in ib_cancel_rmpp_recvs()
99 flush_workqueue(agent->qp_info->port_priv->wq); in ib_cancel_rmpp_recvs()
102 &agent->rmpp_list, list) { in ib_cancel_rmpp_recvs()
137 msg = ib_create_send_mad(&rmpp_recv->agent->agent, recv_wc->wc->src_qp, in ack_recv()
151 static struct ib_mad_send_buf *alloc_response_msg(struct ib_mad_agent *agent, in alloc_response_msg() argument
158 ah = ib_create_ah_from_wc(agent->qp->pd, recv_wc->wc, in alloc_response_msg()
159 recv_wc->recv_buf.grh, agent->port_num); in alloc_response_msg()
164 msg = ib_create_send_mad(agent, recv_wc->wc->src_qp, in alloc_response_msg()
178 static void ack_ds_ack(struct ib_mad_agent_private *agent, in ack_ds_ack() argument
185 msg = alloc_response_msg(&agent->agent, recv_wc); in ack_ds_ack()
212 static void nack_recv(struct ib_mad_agent_private *agent, in nack_recv() argument
219 msg = alloc_response_msg(&agent->agent, recv_wc); in nack_recv()
248 spin_lock_irqsave(&rmpp_recv->agent->lock, flags); in recv_timeout_handler()
250 spin_unlock_irqrestore(&rmpp_recv->agent->lock, flags); in recv_timeout_handler()
255 spin_unlock_irqrestore(&rmpp_recv->agent->lock, flags); in recv_timeout_handler()
258 nack_recv(rmpp_recv->agent, rmpp_wc, IB_MGMT_RMPP_STATUS_T2L); in recv_timeout_handler()
269 spin_lock_irqsave(&rmpp_recv->agent->lock, flags); in recv_cleanup_handler()
271 spin_unlock_irqrestore(&rmpp_recv->agent->lock, flags); in recv_cleanup_handler()
276 create_rmpp_recv(struct ib_mad_agent_private *agent, in create_rmpp_recv() argument
286 rmpp_recv->ah = ib_create_ah_from_wc(agent->agent.qp->pd, in create_rmpp_recv()
289 agent->agent.port_num); in create_rmpp_recv()
293 rmpp_recv->agent = agent; in create_rmpp_recv()
323 find_rmpp_recv(struct ib_mad_agent_private *agent, in find_rmpp_recv() argument
329 list_for_each_entry(rmpp_recv, &agent->rmpp_list, list) { in find_rmpp_recv()
342 acquire_rmpp_recv(struct ib_mad_agent_private *agent, in acquire_rmpp_recv() argument
348 spin_lock_irqsave(&agent->lock, flags); in acquire_rmpp_recv()
349 rmpp_recv = find_rmpp_recv(agent, mad_recv_wc); in acquire_rmpp_recv()
352 spin_unlock_irqrestore(&agent->lock, flags); in acquire_rmpp_recv()
357 insert_rmpp_recv(struct ib_mad_agent_private *agent, in insert_rmpp_recv() argument
362 cur_rmpp_recv = find_rmpp_recv(agent, rmpp_recv->rmpp_wc); in insert_rmpp_recv()
364 list_add_tail(&rmpp_recv->list, &agent->rmpp_list); in insert_rmpp_recv()
394 static inline int window_size(struct ib_mad_agent_private *agent) in window_size() argument
396 return max(agent->qp_info->recv_queue.max_active >> 3, 1); in window_size()
431 bool opa = rdma_cap_opa_mad(rmpp_recv->agent->qp_info->port_priv->device, in get_mad_len()
432 rmpp_recv->agent->qp_info->port_priv->port_num); in get_mad_len()
463 queue_delayed_work(rmpp_recv->agent->qp_info->port_priv->wq, in complete_rmpp()
469 continue_rmpp(struct ib_mad_agent_private *agent, in continue_rmpp() argument
478 rmpp_recv = acquire_rmpp_recv(agent, mad_recv_wc); in continue_rmpp()
510 rmpp_recv->newwin += window_size(agent); in continue_rmpp()
528 start_rmpp(struct ib_mad_agent_private *agent, in start_rmpp() argument
534 rmpp_recv = create_rmpp_recv(agent, mad_recv_wc); in start_rmpp()
540 spin_lock_irqsave(&agent->lock, flags); in start_rmpp()
541 if (insert_rmpp_recv(agent, rmpp_recv)) { in start_rmpp()
542 spin_unlock_irqrestore(&agent->lock, flags); in start_rmpp()
545 return continue_rmpp(agent, mad_recv_wc); in start_rmpp()
551 spin_unlock_irqrestore(&agent->lock, flags); in start_rmpp()
554 spin_unlock_irqrestore(&agent->lock, flags); in start_rmpp()
556 queue_delayed_work(agent->qp_info->port_priv->wq, in start_rmpp()
559 rmpp_recv->newwin += window_size(agent); in start_rmpp()
598 static void abort_send(struct ib_mad_agent_private *agent, in abort_send() argument
605 spin_lock_irqsave(&agent->lock, flags); in abort_send()
606 mad_send_wr = ib_find_send_mad(agent, mad_recv_wc); in abort_send()
615 spin_unlock_irqrestore(&agent->lock, flags); in abort_send()
623 spin_unlock_irqrestore(&agent->lock, flags); in abort_send()
638 static void process_ds_ack(struct ib_mad_agent_private *agent, in process_ds_ack() argument
643 rmpp_recv = find_rmpp_recv(agent, mad_recv_wc); in process_ds_ack()
648 static void process_rmpp_ack(struct ib_mad_agent_private *agent, in process_rmpp_ack() argument
658 abort_send(agent, mad_recv_wc, IB_MGMT_RMPP_STATUS_BAD_STATUS); in process_rmpp_ack()
659 nack_recv(agent, mad_recv_wc, IB_MGMT_RMPP_STATUS_BAD_STATUS); in process_rmpp_ack()
666 abort_send(agent, mad_recv_wc, IB_MGMT_RMPP_STATUS_W2S); in process_rmpp_ack()
667 nack_recv(agent, mad_recv_wc, IB_MGMT_RMPP_STATUS_W2S); in process_rmpp_ack()
671 spin_lock_irqsave(&agent->lock, flags); in process_rmpp_ack()
672 mad_send_wr = ib_find_send_mad(agent, mad_recv_wc); in process_rmpp_ack()
675 process_ds_ack(agent, mad_recv_wc, newwin); in process_rmpp_ack()
681 spin_unlock_irqrestore(&agent->lock, flags); in process_rmpp_ack()
682 ack_ds_ack(agent, mad_recv_wc); in process_rmpp_ack()
692 spin_unlock_irqrestore(&agent->lock, flags); in process_rmpp_ack()
693 abort_send(agent, mad_recv_wc, IB_MGMT_RMPP_STATUS_S2B); in process_rmpp_ack()
694 nack_recv(agent, mad_recv_wc, IB_MGMT_RMPP_STATUS_S2B); in process_rmpp_ack()
712 spin_unlock_irqrestore(&agent->lock, flags); in process_rmpp_ack()
723 spin_unlock_irqrestore(&agent->lock, flags); in process_rmpp_ack()
724 ack_ds_ack(agent, mad_recv_wc); in process_rmpp_ack()
739 spin_unlock_irqrestore(&agent->lock, flags); in process_rmpp_ack()
743 process_rmpp_data(struct ib_mad_agent_private *agent, in process_rmpp_data() argument
761 return start_rmpp(agent, mad_recv_wc); in process_rmpp_data()
767 return continue_rmpp(agent, mad_recv_wc); in process_rmpp_data()
770 nack_recv(agent, mad_recv_wc, rmpp_status); in process_rmpp_data()
775 static void process_rmpp_stop(struct ib_mad_agent_private *agent, in process_rmpp_stop() argument
783 abort_send(agent, mad_recv_wc, IB_MGMT_RMPP_STATUS_BAD_STATUS); in process_rmpp_stop()
784 nack_recv(agent, mad_recv_wc, IB_MGMT_RMPP_STATUS_BAD_STATUS); in process_rmpp_stop()
786 abort_send(agent, mad_recv_wc, rmpp_mad->rmpp_hdr.rmpp_status); in process_rmpp_stop()
789 static void process_rmpp_abort(struct ib_mad_agent_private *agent, in process_rmpp_abort() argument
798 abort_send(agent, mad_recv_wc, IB_MGMT_RMPP_STATUS_BAD_STATUS); in process_rmpp_abort()
799 nack_recv(agent, mad_recv_wc, IB_MGMT_RMPP_STATUS_BAD_STATUS); in process_rmpp_abort()
801 abort_send(agent, mad_recv_wc, rmpp_mad->rmpp_hdr.rmpp_status); in process_rmpp_abort()
805 ib_process_rmpp_recv_wc(struct ib_mad_agent_private *agent, in ib_process_rmpp_recv_wc() argument
815 abort_send(agent, mad_recv_wc, IB_MGMT_RMPP_STATUS_UNV); in ib_process_rmpp_recv_wc()
816 nack_recv(agent, mad_recv_wc, IB_MGMT_RMPP_STATUS_UNV); in ib_process_rmpp_recv_wc()
822 return process_rmpp_data(agent, mad_recv_wc); in ib_process_rmpp_recv_wc()
824 process_rmpp_ack(agent, mad_recv_wc); in ib_process_rmpp_recv_wc()
827 process_rmpp_stop(agent, mad_recv_wc); in ib_process_rmpp_recv_wc()
830 process_rmpp_abort(agent, mad_recv_wc); in ib_process_rmpp_recv_wc()
833 abort_send(agent, mad_recv_wc, IB_MGMT_RMPP_STATUS_BADT); in ib_process_rmpp_recv_wc()
834 nack_recv(agent, mad_recv_wc, IB_MGMT_RMPP_STATUS_BADT); in ib_process_rmpp_recv_wc()
844 struct ib_mad_agent_private *agent = mad_send_wr->mad_agent_priv; in init_newwin() local
854 spin_lock_irqsave(&agent->lock, flags); in init_newwin()
855 list_for_each_entry(rmpp_recv, &agent->rmpp_list, list) { in init_newwin()
870 spin_unlock_irqrestore(&agent->lock, flags); in init_newwin()