Exemplo n.º 1
0
void
sdp_post_keepalive(struct sdp_sock *ssk)
{
	int rc;
	struct ib_send_wr wr, *bad_wr;

	sdp_dbg(ssk->socket, "%s\n", __func__);

	memset(&wr, 0, sizeof(wr));

	wr.next    = NULL;
	wr.wr_id   = 0;
	wr.sg_list = NULL;
	wr.num_sge = 0;
	wr.opcode  = IB_WR_RDMA_WRITE;

	rc = ib_post_send(ssk->qp, &wr, &bad_wr);
	if (rc) {
		sdp_dbg(ssk->socket,
			"ib_post_keepalive failed with status %d.\n", rc);
		sdp_notify(ssk, ECONNRESET);
	}

	sdp_cnt(sdp_keepalive_probes_sent);
}
Exemplo n.º 2
0
static inline void
sdp_process_tx_wc(struct sdp_sock *ssk, struct ib_wc *wc)
{

	if (likely(wc->wr_id & SDP_OP_SEND)) {
		sdp_handle_send_comp(ssk, wc);
		return;
	}

#ifdef SDP_ZCOPY
	if (wc->wr_id & SDP_OP_RDMA) {
		/* TODO: handle failed RDMA read cqe */

		sdp_dbg_data(ssk->socket,
	 	    "TX comp: RDMA read. status: %d\n", wc->status);
		sdp_prf1(sk, NULL, "TX comp: RDMA read");

		if (!ssk->tx_ring.rdma_inflight) {
			sdp_warn(ssk->socket, "ERROR: unexpected RDMA read\n");
			return;
		}

		if (!ssk->tx_ring.rdma_inflight->busy) {
			sdp_warn(ssk->socket,
			    "ERROR: too many RDMA read completions\n");
			return;
		}

		/* Only last RDMA read WR is signalled. Order is guaranteed -
		 * therefore if Last RDMA read WR is completed - all other
		 * have, too */
		ssk->tx_ring.rdma_inflight->busy = 0;
		sowwakeup(ssk->socket);
		sdp_dbg_data(ssk->socket, "woke up sleepers\n");
		return;
	}
#endif

	/* Keepalive probe sent cleanup */
	sdp_cnt(sdp_keepalive_probes_sent);

	if (likely(!wc->status))
		return;

	sdp_dbg(ssk->socket, " %s consumes KEEPALIVE status %d\n",
			__func__, wc->status);

	if (wc->status == IB_WC_WR_FLUSH_ERR)
		return;

	sdp_notify(ssk, ECONNRESET);
}
Exemplo n.º 3
0
static inline void sdp_process_tx_wc(struct sdp_sock *ssk, struct ib_wc *wc)
{
	struct sock *sk = sk_ssk(ssk);

	if (likely(wc->wr_id & SDP_OP_SEND)) {
		struct sk_buff *skb;

		skb = sdp_send_completion(ssk, wc->wr_id);
		if (likely(skb))
			sk_wmem_free_skb(sk, skb);
	} else if (wc->wr_id & SDP_OP_RDMA) {
		if (ssk->tx_ring.rdma_inflight &&
				ssk->tx_ring.rdma_inflight->busy) {
			/* Only last RDMA read WR is signalled. Order is guaranteed -
			 * therefore if Last RDMA read WR is completed - all other
			 * have, too */
			ssk->tx_ring.rdma_inflight->busy = 0;
		} else {
			sdp_warn(sk, "Unexpected RDMA read completion, "
					"probably was canceled already\n");
		}

		wake_up(sdp_sk_sleep(sk));
	} else {
		/* Keepalive probe sent cleanup */
		sdp_cnt(sdp_keepalive_probes_sent);
	}

	if (likely(!wc->status) || wc->status == IB_WC_WR_FLUSH_ERR)
		return;

	sdp_warn(sk, "Send completion with error. wr_id 0x%llx Status %d\n",
			wc->wr_id, wc->status);

	sdp_set_error(sk, -ECONNRESET);
}