H A D | mad.c | 742 struct ib_mad_send_wr_private *mad_send_wr) handle_outgoing_dr_smp() 745 struct ib_smp *smp = mad_send_wr->send_buf.mad; handle_outgoing_dr_smp() 755 struct ib_ud_wr *send_wr = &mad_send_wr->send_wr; handle_outgoing_dr_smp() 840 mad_wc.byte_len = mad_send_wr->send_buf.hdr_len handle_outgoing_dr_smp() 841 + mad_send_wr->send_buf.data_len handle_outgoing_dr_smp() 895 local->mad_send_wr = mad_send_wr; handle_outgoing_dr_smp() 897 local->mad_send_wr->send_wr.pkey_index = out_mad_pkey_index; handle_outgoing_dr_smp() 925 static void free_send_rmpp_list(struct ib_mad_send_wr_private *mad_send_wr) free_send_rmpp_list() argument 929 list_for_each_entry_safe(s, t, &mad_send_wr->rmpp_list, list) { free_send_rmpp_list() 991 struct ib_mad_send_wr_private *mad_send_wr; ib_create_send_mad() local 1018 buf = kzalloc(sizeof *mad_send_wr + size, gfp_mask); ib_create_send_mad() 1022 mad_send_wr = buf + size; ib_create_send_mad() 1023 INIT_LIST_HEAD(&mad_send_wr->rmpp_list); ib_create_send_mad() 1024 mad_send_wr->send_buf.mad = buf; ib_create_send_mad() 1025 mad_send_wr->send_buf.hdr_len = hdr_len; ib_create_send_mad() 1026 mad_send_wr->send_buf.data_len = data_len; ib_create_send_mad() 1027 mad_send_wr->pad = pad; ib_create_send_mad() 1029 mad_send_wr->mad_agent_priv = mad_agent_priv; ib_create_send_mad() 1030 mad_send_wr->sg_list[0].length = hdr_len; ib_create_send_mad() 1031 mad_send_wr->sg_list[0].lkey = mad_agent->qp->pd->local_dma_lkey; ib_create_send_mad() 1036 mad_send_wr->sg_list[1].length = data_len; ib_create_send_mad() 1038 mad_send_wr->sg_list[1].length = mad_size - hdr_len; ib_create_send_mad() 1040 mad_send_wr->sg_list[1].lkey = mad_agent->qp->pd->local_dma_lkey; ib_create_send_mad() 1042 mad_send_wr->send_wr.wr.wr_id = (unsigned long) mad_send_wr; ib_create_send_mad() 1043 mad_send_wr->send_wr.wr.sg_list = mad_send_wr->sg_list; ib_create_send_mad() 1044 mad_send_wr->send_wr.wr.num_sge = 2; ib_create_send_mad() 1045 mad_send_wr->send_wr.wr.opcode = IB_WR_SEND; ib_create_send_mad() 1046 mad_send_wr->send_wr.wr.send_flags = IB_SEND_SIGNALED; ib_create_send_mad() 1047 mad_send_wr->send_wr.remote_qpn = remote_qpn; ib_create_send_mad() 1048 mad_send_wr->send_wr.remote_qkey = IB_QP_SET_QKEY; ib_create_send_mad() 1049 mad_send_wr->send_wr.pkey_index = pkey_index; ib_create_send_mad() 1052 ret = alloc_send_rmpp_list(mad_send_wr, mad_size, gfp_mask); ib_create_send_mad() 1059 mad_send_wr->send_buf.mad_agent = mad_agent; ib_create_send_mad() 1061 return &mad_send_wr->send_buf; ib_create_send_mad() 1096 struct ib_mad_send_wr_private *mad_send_wr; ib_get_rmpp_segment() local 1099 mad_send_wr = container_of(send_buf, struct ib_mad_send_wr_private, ib_get_rmpp_segment() 1101 list = &mad_send_wr->cur_seg->list; ib_get_rmpp_segment() 1103 if (mad_send_wr->cur_seg->num < seg_num) { ib_get_rmpp_segment() 1104 list_for_each_entry(mad_send_wr->cur_seg, list, list) ib_get_rmpp_segment() 1105 if (mad_send_wr->cur_seg->num == seg_num) ib_get_rmpp_segment() 1107 } else if (mad_send_wr->cur_seg->num > seg_num) { ib_get_rmpp_segment() 1108 list_for_each_entry_reverse(mad_send_wr->cur_seg, list, list) ib_get_rmpp_segment() 1109 if (mad_send_wr->cur_seg->num == seg_num) ib_get_rmpp_segment() 1112 return mad_send_wr->cur_seg->data; ib_get_rmpp_segment() 1116 static inline void *ib_get_payload(struct ib_mad_send_wr_private *mad_send_wr) ib_get_payload() argument 1118 if (mad_send_wr->send_buf.seg_count) ib_get_payload() 1119 return ib_get_rmpp_segment(&mad_send_wr->send_buf, ib_get_payload() 1120 mad_send_wr->seg_num); ib_get_payload() 1122 return mad_send_wr->send_buf.mad + ib_get_payload() 1123 mad_send_wr->send_buf.hdr_len; ib_get_payload() 1129 struct ib_mad_send_wr_private *mad_send_wr; ib_free_send_mad() local 1133 mad_send_wr = container_of(send_buf, struct ib_mad_send_wr_private, ib_free_send_mad() 1136 free_send_rmpp_list(mad_send_wr); ib_free_send_mad() 1142 int ib_send_mad(struct ib_mad_send_wr_private *mad_send_wr) ib_send_mad() argument 1152 /* Set WR ID to find mad_send_wr upon completion */ ib_send_mad() 1153 qp_info = mad_send_wr->mad_agent_priv->qp_info; ib_send_mad() 1154 mad_send_wr->send_wr.wr.wr_id = (unsigned long)&mad_send_wr->mad_list; ib_send_mad() 1155 mad_send_wr->mad_list.mad_queue = &qp_info->send_queue; ib_send_mad() 1157 mad_agent = mad_send_wr->send_buf.mad_agent; ib_send_mad() 1158 sge = mad_send_wr->sg_list; ib_send_mad() 1160 mad_send_wr->send_buf.mad, ib_send_mad() 1166 mad_send_wr->header_mapping = sge[0].addr; ib_send_mad() 1169 ib_get_payload(mad_send_wr), ib_send_mad() 1174 mad_send_wr->header_mapping, ib_send_mad() 1178 mad_send_wr->payload_mapping = sge[1].addr; ib_send_mad() 1182 ret = ib_post_send(mad_agent->qp, &mad_send_wr->send_wr.wr, ib_send_mad() 1192 list_add_tail(&mad_send_wr->mad_list.list, list); ib_send_mad() 1197 mad_send_wr->header_mapping, ib_send_mad() 1200 mad_send_wr->payload_mapping, ib_send_mad() 1215 struct ib_mad_send_wr_private *mad_send_wr; ib_post_send_mad() local 1222 mad_send_wr = container_of(send_buf, ib_post_send_mad() 1225 mad_agent_priv = mad_send_wr->mad_agent_priv; ib_post_send_mad() 1247 mad_send_wr->send_wr.ah = send_buf->ah; ib_post_send_mad() 1252 mad_send_wr); ib_post_send_mad() 1259 mad_send_wr->tid = ((struct ib_mad_hdr *) send_buf->mad)->tid; ib_post_send_mad() 1261 mad_send_wr->timeout = msecs_to_jiffies(send_buf->timeout_ms); ib_post_send_mad() 1262 mad_send_wr->max_retries = send_buf->retries; ib_post_send_mad() 1263 mad_send_wr->retries_left = send_buf->retries; ib_post_send_mad() 1266 mad_send_wr->refcount = 1 + (mad_send_wr->timeout > 0); ib_post_send_mad() 1267 mad_send_wr->status = IB_WC_SUCCESS; ib_post_send_mad() 1272 list_add_tail(&mad_send_wr->agent_list, ib_post_send_mad() 1277 ret = ib_send_rmpp_mad(mad_send_wr); ib_post_send_mad() 1279 ret = ib_send_mad(mad_send_wr); ib_post_send_mad() 1281 ret = ib_send_mad(mad_send_wr); ib_post_send_mad() 1285 list_del(&mad_send_wr->agent_list); ib_post_send_mad() 1946 void ib_mark_mad_done(struct ib_mad_send_wr_private *mad_send_wr) ib_mark_mad_done() argument 1948 mad_send_wr->timeout = 0; ib_mark_mad_done() 1949 if (mad_send_wr->refcount == 1) ib_mark_mad_done() 1950 list_move_tail(&mad_send_wr->agent_list, ib_mark_mad_done() 1951 &mad_send_wr->mad_agent_priv->done_list); ib_mark_mad_done() 1957 struct ib_mad_send_wr_private *mad_send_wr; ib_mad_complete_recv() local 1975 mad_send_wr = ib_find_send_mad(mad_agent_priv, mad_recv_wc); ib_mad_complete_recv() 1976 if (!mad_send_wr) { ib_mad_complete_recv() 1997 ib_mark_mad_done(mad_send_wr); ib_mad_complete_recv() 2001 mad_recv_wc->wc->wr_id = (unsigned long) &mad_send_wr->send_buf; ib_mad_complete_recv() 2008 mad_send_wc.send_buf = &mad_send_wr->send_buf; ib_mad_complete_recv() 2009 ib_mad_complete_send_wr(mad_send_wr, &mad_send_wc); ib_mad_complete_recv() 2301 struct ib_mad_send_wr_private *mad_send_wr; adjust_timeout() local 2307 mad_send_wr = list_entry(mad_agent_priv->wait_list.next, adjust_timeout() 2312 mad_send_wr->timeout)) { adjust_timeout() 2313 mad_agent_priv->timeout = mad_send_wr->timeout; adjust_timeout() 2314 delay = mad_send_wr->timeout - jiffies; adjust_timeout() 2323 static void wait_for_response(struct ib_mad_send_wr_private *mad_send_wr) wait_for_response() argument 2330 mad_agent_priv = mad_send_wr->mad_agent_priv; wait_for_response() 2331 list_del(&mad_send_wr->agent_list); wait_for_response() 2333 delay = mad_send_wr->timeout; wait_for_response() 2334 mad_send_wr->timeout += jiffies; wait_for_response() 2341 if (time_after(mad_send_wr->timeout, wait_for_response() 2348 list_add(&mad_send_wr->agent_list, list_item); wait_for_response() 2351 if (mad_agent_priv->wait_list.next == &mad_send_wr->agent_list) wait_for_response() 2356 void ib_reset_mad_timeout(struct ib_mad_send_wr_private *mad_send_wr, ib_reset_mad_timeout() argument 2359 mad_send_wr->timeout = msecs_to_jiffies(timeout_ms); ib_reset_mad_timeout() 2360 wait_for_response(mad_send_wr); ib_reset_mad_timeout() 2366 void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr, ib_mad_complete_send_wr() argument 2373 mad_agent_priv = mad_send_wr->mad_agent_priv; ib_mad_complete_send_wr() 2376 ret = ib_process_rmpp_send_wc(mad_send_wr, mad_send_wc); ib_mad_complete_send_wr() 2383 mad_send_wr->status == IB_WC_SUCCESS) { ib_mad_complete_send_wr() 2384 mad_send_wr->status = mad_send_wc->status; ib_mad_complete_send_wr() 2385 mad_send_wr->refcount -= (mad_send_wr->timeout > 0); ib_mad_complete_send_wr() 2388 if (--mad_send_wr->refcount > 0) { ib_mad_complete_send_wr() 2389 if (mad_send_wr->refcount == 1 && mad_send_wr->timeout && ib_mad_complete_send_wr() 2390 mad_send_wr->status == IB_WC_SUCCESS) { ib_mad_complete_send_wr() 2391 wait_for_response(mad_send_wr); ib_mad_complete_send_wr() 2397 list_del(&mad_send_wr->agent_list); ib_mad_complete_send_wr() 2401 if (mad_send_wr->status != IB_WC_SUCCESS ) ib_mad_complete_send_wr() 2402 mad_send_wc->status = mad_send_wr->status; ib_mad_complete_send_wr() 2419 struct ib_mad_send_wr_private *mad_send_wr, *queued_send_wr; ib_mad_send_done_handler() local 2429 mad_send_wr = container_of(mad_list, struct ib_mad_send_wr_private, ib_mad_send_done_handler() 2435 ib_dma_unmap_single(mad_send_wr->send_buf.mad_agent->device, ib_mad_send_done_handler() 2436 mad_send_wr->header_mapping, ib_mad_send_done_handler() 2437 mad_send_wr->sg_list[0].length, DMA_TO_DEVICE); ib_mad_send_done_handler() 2438 ib_dma_unmap_single(mad_send_wr->send_buf.mad_agent->device, ib_mad_send_done_handler() 2439 mad_send_wr->payload_mapping, ib_mad_send_done_handler() 2440 mad_send_wr->sg_list[1].length, DMA_TO_DEVICE); ib_mad_send_done_handler() 2456 mad_send_wc.send_buf = &mad_send_wr->send_buf; ib_mad_send_done_handler() 2460 snoop_send(qp_info, &mad_send_wr->send_buf, &mad_send_wc, ib_mad_send_done_handler() 2462 ib_mad_complete_send_wr(mad_send_wr, &mad_send_wc); ib_mad_send_done_handler() 2470 mad_send_wr = queued_send_wr; ib_mad_send_done_handler() 2479 struct ib_mad_send_wr_private *mad_send_wr; mark_sends_for_retry() local 2485 mad_send_wr = container_of(mad_list, mark_sends_for_retry() 2488 mad_send_wr->retry = 1; mark_sends_for_retry() 2498 struct ib_mad_send_wr_private *mad_send_wr; mad_error_handler() local 2515 mad_send_wr = container_of(mad_list, struct ib_mad_send_wr_private, mad_error_handler() 2518 if (mad_send_wr->retry) { mad_error_handler() 2522 mad_send_wr->retry = 0; mad_error_handler() 2523 ret = ib_post_send(qp_info->qp, &mad_send_wr->send_wr.wr, mad_error_handler() 2583 struct ib_mad_send_wr_private *mad_send_wr, *temp_mad_send_wr; cancel_mads() local 2590 list_for_each_entry_safe(mad_send_wr, temp_mad_send_wr, cancel_mads() 2592 if (mad_send_wr->status == IB_WC_SUCCESS) { cancel_mads() 2593 mad_send_wr->status = IB_WC_WR_FLUSH_ERR; cancel_mads() 2594 mad_send_wr->refcount -= (mad_send_wr->timeout > 0); cancel_mads() 2606 list_for_each_entry_safe(mad_send_wr, temp_mad_send_wr, cancel_mads() 2608 mad_send_wc.send_buf = &mad_send_wr->send_buf; cancel_mads() 2609 list_del(&mad_send_wr->agent_list); cancel_mads() 2620 struct ib_mad_send_wr_private *mad_send_wr; find_send_wr() local 2622 list_for_each_entry(mad_send_wr, &mad_agent_priv->wait_list, find_send_wr() 2624 if (&mad_send_wr->send_buf == send_buf) find_send_wr() 2625 return mad_send_wr; find_send_wr() 2628 list_for_each_entry(mad_send_wr, &mad_agent_priv->send_list, find_send_wr() 2631 mad_send_wr->send_buf.mad) && find_send_wr() 2632 &mad_send_wr->send_buf == send_buf) find_send_wr() 2633 return mad_send_wr; find_send_wr() 2642 struct ib_mad_send_wr_private *mad_send_wr; ib_modify_mad() local 2649 mad_send_wr = find_send_wr(mad_agent_priv, send_buf); ib_modify_mad() 2650 if (!mad_send_wr || mad_send_wr->status != IB_WC_SUCCESS) { ib_modify_mad() 2655 active = (!mad_send_wr->timeout || mad_send_wr->refcount > 1); ib_modify_mad() 2657 mad_send_wr->status = IB_WC_WR_FLUSH_ERR; ib_modify_mad() 2658 mad_send_wr->refcount -= (mad_send_wr->timeout > 0); ib_modify_mad() 2661 mad_send_wr->send_buf.timeout_ms = timeout_ms; ib_modify_mad() 2663 mad_send_wr->timeout = msecs_to_jiffies(timeout_ms); ib_modify_mad() 2665 ib_reset_mad_timeout(mad_send_wr, timeout_ms); ib_modify_mad() 2719 (unsigned long) local->mad_send_wr, local_completions() 2721 local->mad_send_wr->send_wr.pkey_index, local_completions() 2757 mad_send_wc.send_buf = &local->mad_send_wr->send_buf; local_completions() 2760 &local->mad_send_wr->send_buf, local_completions() 2774 static int retry_send(struct ib_mad_send_wr_private *mad_send_wr) retry_send() argument 2778 if (!mad_send_wr->retries_left) retry_send() 2781 mad_send_wr->retries_left--; retry_send() 2782 mad_send_wr->send_buf.retries++; retry_send() 2784 mad_send_wr->timeout = msecs_to_jiffies(mad_send_wr->send_buf.timeout_ms); retry_send() 2786 if (ib_mad_kernel_rmpp_agent(&mad_send_wr->mad_agent_priv->agent)) { retry_send() 2787 ret = ib_retry_rmpp(mad_send_wr); retry_send() 2790 ret = ib_send_mad(mad_send_wr); retry_send() 2800 ret = ib_send_mad(mad_send_wr); retry_send() 2803 mad_send_wr->refcount++; retry_send() 2804 list_add_tail(&mad_send_wr->agent_list, retry_send() 2805 &mad_send_wr->mad_agent_priv->send_list); retry_send() 2813 struct ib_mad_send_wr_private *mad_send_wr; timeout_sends() local 2823 mad_send_wr = list_entry(mad_agent_priv->wait_list.next, timeout_sends() 2827 if (time_after(mad_send_wr->timeout, jiffies)) { timeout_sends() 2828 delay = mad_send_wr->timeout - jiffies; timeout_sends() 2837 list_del(&mad_send_wr->agent_list); timeout_sends() 2838 if (mad_send_wr->status == IB_WC_SUCCESS && timeout_sends() 2839 !retry_send(mad_send_wr)) timeout_sends() 2844 if (mad_send_wr->status == IB_WC_SUCCESS) timeout_sends() 2847 mad_send_wc.status = mad_send_wr->status; timeout_sends() 2848 mad_send_wc.send_buf = &mad_send_wr->send_buf; timeout_sends() 741 handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, struct ib_mad_send_wr_private *mad_send_wr) handle_outgoing_dr_smp() argument
|