예제 #1
0
파일: qp_linux.go 프로젝트: hpdvanwyk/ib
func (qp *queuePair) PostSendImm(imm uint32, mr *MemoryRegion) error {
	if qp.qp == nil {
		return errQPAlreadyClosed
	}

	var sendWr C.struct_ibv_send_wr
	var bad *C.struct_ibv_send_wr
	if imm > 0 {
		sendWr.opcode = C.IBV_WR_SEND_WITH_IMM
		// always send inline if there is immediate data
		sendWr.send_flags = C.IBV_SEND_INLINE
		sendWr.imm_data = C.uint32_t(imm)
	} else {
		sendWr.opcode = C.IBV_WR_SEND
		sendWr.send_flags = C.IBV_SEND_SIGNALED
	}

	if mr != nil {
		var sge C.struct_ibv_sge
		sendWr.sg_list = &sge
		sendWr.num_sge = 1
		mr.populateSge(qp.iface.pd, &sge)
	} else {
		// send inline if there is no memory region to send
		sendWr.send_flags = C.IBV_SEND_INLINE
	}

	sendWr.wr_id = C.uint64_t(uintptr(unsafe.Pointer(&sendWr)))
	qp.workRequests[sendWr.wr_id] = workRequest{mr, &sendWr, nil, false}

	errno := C.ibv_post_send(qp.qp, &sendWr, &bad)
	return newError("ibv_post_send", errno)
}
예제 #2
0
파일: qp_linux.go 프로젝트: hpdvanwyk/ib
// Zero-length RDMA write.
func (qp *queuePair) PostKeepalive() error {
	if qp.qp == nil {
		return errQPAlreadyClosed
	}

	var sendWr C.struct_ibv_send_wr
	var bad *C.struct_ibv_send_wr
	sendWr.opcode = C.IBV_WR_RDMA_WRITE
	sendWr.send_flags = C.IBV_SEND_SIGNALED

	sendWr.wr_id = C.uint64_t(uintptr(unsafe.Pointer(&sendWr)))
	qp.workRequests[sendWr.wr_id] = workRequest{nil, &sendWr, nil, true}

	errno := C.ibv_post_send(qp.qp, &sendWr, &bad)
	return newError("ibv_post_send", errno)
}
예제 #3
0
파일: qp_linux.go 프로젝트: hpdvanwyk/ib
func (qp *queuePair) PostWrite(mr *MemoryRegion, remoteAddr uint64, rkey uint32) error {
	if qp.qp == nil {
		return errQPAlreadyClosed
	}

	var sendWr C.struct_ibv_send_wr
	var sge C.struct_ibv_sge
	var bad *C.struct_ibv_send_wr
	sendWr.opcode = C.IBV_WR_RDMA_WRITE
	sendWr.send_flags = C.IBV_SEND_SIGNALED
	sendWr.sg_list = &sge
	sendWr.num_sge = 1
	mr.populateSge(qp.iface.pd, &sge)
	r := (*rdma)(unsafe.Pointer(&sendWr.wr))
	r.remoteAddr = remoteAddr
	r.rkey = rkey

	sendWr.wr_id = C.uint64_t(uintptr(unsafe.Pointer(&sendWr)))
	qp.workRequests[sendWr.wr_id] = workRequest{mr, &sendWr, nil, false}

	errno := C.ibv_post_send(qp.qp, &sendWr, &bad)
	return newError("ibv_post_send", errno)
}