Пример #1
0
void rxd_handle_recv_comp(struct rxd_ep *ep, struct fi_cq_msg_entry *comp)
{
	struct ofi_ctrl_hdr *ctrl;
	struct rxd_rx_buf *rx_buf;
	struct rxd_peer *peer;

	FI_DBG(&rxd_prov, FI_LOG_EP_CTRL, "got recv completion\n");

	assert(rxd_reposted_bufs);
	rxd_reposted_bufs--;

	rx_buf = container_of(comp->op_context, struct rxd_rx_buf, context);
	ctrl = (struct ofi_ctrl_hdr *) rx_buf->buf;
	peer = rxd_ep_getpeer_info(ep, ctrl->conn_id);

	if (ctrl->version != OFI_CTRL_VERSION) {
		FI_WARN(&rxd_prov, FI_LOG_EP_CTRL, "ctrl version mismatch\n");
		return;
	}

	switch (ctrl->type) {
	case ofi_ctrl_connreq:
		rxd_handle_conn_req(ep, ctrl, comp, rx_buf);
		break;
	case ofi_ctrl_ack:
		rxd_handle_ack(ep, ctrl, rx_buf);
		break;
	case ofi_ctrl_discard:
		rxd_handle_discard(ep, ctrl, rx_buf);
		break;
	case ofi_ctrl_connresp:
		rxd_handle_connect_ack(ep, ctrl, rx_buf);
		break;
	case ofi_ctrl_start_data:
		rxd_handle_start_data(ep, peer, ctrl, comp, rx_buf);
		break;
	case ofi_ctrl_data:
		rxd_handle_data(ep, peer, ctrl, comp, rx_buf);
		break;
	default:
		rxd_ep_repost_buff(rx_buf);
		FI_WARN(&rxd_prov, FI_LOG_EP_CTRL,
			"invalid ctrl type \n", ctrl->type);
	}

	rxd_check_waiting_rx(ep);
}
Пример #2
0
void rxd_handle_recv_comp(struct rxd_cq *cq, struct fi_cq_msg_entry *comp,
			   int is_unexpected)
{
	struct rxd_ep *ep;
	struct ofi_ctrl_hdr *ctrl;
	struct rxd_rx_buf *rx_buf;
	struct rxd_peer *peer;

	FI_DBG(&rxd_prov, FI_LOG_EP_CTRL, "got recv completion\n");

	rx_buf = container_of(comp->op_context, struct rxd_rx_buf, context);
	ctrl = (struct ofi_ctrl_hdr *) rx_buf->buf;
	ep = rx_buf->ep;
	peer = rxd_ep_getpeer_info(ep, ctrl->conn_id);

	if (ctrl->type != ofi_ctrl_ack && ctrl->type != ofi_ctrl_nack) {
		FI_DBG(&rxd_prov, FI_LOG_EP_CTRL,
		       "got data pkt - msg_id:[%p - %d], type: %d on buf %p [unexp: %d]\n",
		       ctrl->msg_id, ctrl->seg_no, ctrl->type, rx_buf, is_unexpected);
	} else {
		FI_DBG(&rxd_prov, FI_LOG_EP_CTRL,
		       "got ack pkt - msg_id:[%p - %d], type: %d on buf %p  [unexp: %d]\n",
		       ctrl->msg_id, ctrl->seg_no, ctrl->type, rx_buf, is_unexpected);
	}
	if (ctrl->version != OFI_CTRL_VERSION) {
		FI_DBG(&rxd_prov, FI_LOG_EP_CTRL, "ctrl version mismatch\n");
		return;
	}

	switch(ctrl->type) {
	case ofi_ctrl_connreq:
		rxd_handle_conn_req(ep, ctrl, comp, rx_buf);
		break;

	case ofi_ctrl_ack:
		rxd_handle_ack(ep, ctrl, rx_buf);
		break;

	case ofi_ctrl_nack:
		rxd_handle_nack(ep, ctrl, rx_buf);
		break;

	case ofi_ctrl_discard:
		rxd_handle_discard(ep, ctrl, rx_buf);
		break;

	case ofi_ctrl_connresp:
		rxd_handle_connect_ack(ep, ctrl, rx_buf);
		break;

	case ofi_ctrl_start_data:
		FI_DBG(&rxd_prov, FI_LOG_EP_CTRL,
		       "start data msg for tx: %p\n", ctrl->msg_id);
		rxd_handle_start_data(ep, peer, ctrl, comp, rx_buf);
		break;

	case ofi_ctrl_data:
		FI_DBG(&rxd_prov, FI_LOG_EP_CTRL,
			"data msg for tx: %p, %d \n", ctrl->msg_id, ctrl->seg_no);
		rxd_handle_data(ep, peer, ctrl, comp, rx_buf);
		break;

	default:
		FI_WARN(&rxd_prov, FI_LOG_EP_CTRL,
			"invalid ctrl type \n", ctrl->type);
	}

	rxd_ep_lock_if_required(ep);
	rxd_check_waiting_rx(ep);
	rxd_ep_unlock_if_required(ep);
	return;
}