librdma is a powerful library designed to simplify the development process of Remote Direct Memory Access (RDMA) applications. It abstracts away the complexities of underlying implementation details, providing a straightforward and user-friendly interface for RDMA development. This library aims to streamline the RDMA development experience, making it accessible to a broader audience and facilitating the creation of high-performance, low-latency networking applications.
To start using librdma in your project, follow these simple steps:
-
Clone the Repository:
git clone https://github.com/yj8023xx/librdma.git
-
Build the Library:
cd librdma make
-
Integrate into Your Project: Link against the librdma library in your project and include the necessary headers
If you want to generate debug information, please add a flag in the Makefile: RDMA_FLAGS += -DDEBUG
Server Side
// setup server accept conn param
struct conn_param accept_options = {
.poll_mode = CQ_POLL_MODE_POLLING,
.on_pre_connect_cb = app_on_pre_connect_cb,
.on_connect_cb = app_on_connect_cb};
struct agent_context *server = create_server(1, 1, &accept_options);
// sockfd for listening
char *src_addr = "10.10.10.2";
char *port = "12345";
struct conn_context *listen_ctx = server_listen(server, src_addr, port);
// start listening
start_listen(listen_ctx);
Client Side
// create client
struct agent_context *client = create_client(1, 1);
char *dst_addr = "10.10.10.2";
char *port = "12345";
struct conn_param rc_options = {.poll_mode = CQ_POLL_MODE_POLLING,
.on_pre_connect_cb = app_on_pre_connect_cb,
.on_connect_cb = app_on_connect_cb};
struct conn_context *rc_ctx =
add_connection_rc(client, dst_addr, port, &rc_options);
// connect to server
start_connect(rc_ctx);
// free resources
destroy_agent(client);
Callback
void app_on_pre_connect_cb(struct conn_context *ctx) {
// write your code, e.g, register mr
}
void app_on_connect_cb(struct conn_context *ctx) {
// write your code
}
void app_on_complete_cb(struct conn_context *ctx) {
// write your code to handle complete events
}
void app_on_disconnect_cb(struct conn_context *ctx) {
// write your code
}
For any inquiries or feedback, please contact the maintainers of librdma at 913660289@qq.com. We appreciate your input and participation in making librdma a valuable tool for RDMA development.