mirror of
https://github.com/versity/versitygw.git
synced 2026-09-22 07:54:14 +00:00
Port the hipObject v2 reliable-connection session core into cuwrapper/rc: the session table and state machine, the wire codec for the hipobj-rc-v2 headers, request parsing, the injectable clock and randomness sources, the transport layer (QP/CQ lifecycle, RTR/RTS transitions, staging registration), the data phase (RDMA write with immediate for GET, receive with immediate for PUT), the RDMA token codec, and the dynamically loaded ibverbs shim (ibv-core.h plus the dlopen host binding). The sources are a port of the upstream hipObject v2 core, kept close to the original so the two trees can be diffed during review. Nothing links against them yet; a Makefile rule builds the objects into rdma/librcserver.a for the ABI layer that follows. Signed-off-by: Jihyeon Gim <potatogim@potatogim.net>
38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
/* Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
#include "ibv-core.h"
|
|
|
|
namespace hipObj {
|
|
|
|
struct RdmaToken;
|
|
|
|
struct RcConnection {
|
|
struct ibv_context* ctx = nullptr;
|
|
struct ibv_pd* pd = nullptr;
|
|
struct ibv_cq* cq = nullptr;
|
|
struct ibv_qp* qp = nullptr;
|
|
uint8_t portNum = 1;
|
|
int gidIndex = -1;
|
|
union ibv_gid localGid = {};
|
|
};
|
|
|
|
int openRdmaDevice(int nicIndex, RcConnection& conn);
|
|
int openRdmaDeviceByName(const char* devName, RcConnection& conn);
|
|
void closeRdmaDevice(RcConnection& conn);
|
|
int createRcQp(RcConnection& conn, int cqSize, int maxSendWr, int maxRecvWr);
|
|
int transitionQpToInit(RcConnection& conn);
|
|
int transitionQpToRtr(RcConnection& conn, uint32_t destQpNum, uint16_t destLid,
|
|
union ibv_gid destGid);
|
|
int transitionQpToRts(RcConnection& conn);
|
|
int connectRcPeer(RcConnection& conn, const RdmaToken& peerToken);
|
|
int pollCompletion(RcConnection& conn, int expectedOpcode, int timeoutMs);
|
|
|
|
} // namespace hipObj
|