rdma callback get_buffer rename to get_recv_buffer

support_rdma
YuQing 2023-09-27 11:22:37 +08:00
parent acaf94db0c
commit 255defa788
2 changed files with 10 additions and 6 deletions

View File

@ -44,7 +44,8 @@ static int node_init_for_rdma(ConnectionNode *node,
node->conn = (ConnectionInfo *)(node + 1); node->conn = (ConnectionInfo *)(node + 1);
node->conn->arg1 = node->conn->args + cp->extra_data_size; node->conn->arg1 = node->conn->args + cp->extra_data_size;
return G_RDMA_CONNECTION_CALLBACKS.init_connection(node->conn, return G_RDMA_CONNECTION_CALLBACKS.init_connection(node->conn,
cp->extra_params.rdma.buffer_size, cp->extra_params.rdma.pd); cp->extra_params.rdma.double_buffers, cp->extra_params.
rdma.buffer_size, cp->extra_params.rdma.pd);
} }
static void cp_tls_destroy(void *ptr) static void cp_tls_destroy(void *ptr)
@ -785,7 +786,7 @@ int conn_pool_global_init_for_rdma()
LOAD_API(G_RDMA_CONNECTION_CALLBACKS, close_connection); LOAD_API(G_RDMA_CONNECTION_CALLBACKS, close_connection);
LOAD_API(G_RDMA_CONNECTION_CALLBACKS, destroy_connection); LOAD_API(G_RDMA_CONNECTION_CALLBACKS, destroy_connection);
LOAD_API(G_RDMA_CONNECTION_CALLBACKS, is_connected); LOAD_API(G_RDMA_CONNECTION_CALLBACKS, is_connected);
LOAD_API(G_RDMA_CONNECTION_CALLBACKS, get_buffer); LOAD_API(G_RDMA_CONNECTION_CALLBACKS, get_recv_buffer);
LOAD_API(G_RDMA_CONNECTION_CALLBACKS, request_by_buf1); LOAD_API(G_RDMA_CONNECTION_CALLBACKS, request_by_buf1);
LOAD_API(G_RDMA_CONNECTION_CALLBACKS, request_by_buf2); LOAD_API(G_RDMA_CONNECTION_CALLBACKS, request_by_buf2);
LOAD_API(G_RDMA_CONNECTION_CALLBACKS, request_by_iov); LOAD_API(G_RDMA_CONNECTION_CALLBACKS, request_by_iov);
@ -821,7 +822,8 @@ ConnectionInfo *conn_pool_alloc_connection_ex(
if (comm_type == fc_comm_type_rdma) { if (comm_type == fc_comm_type_rdma) {
conn->arg1 = conn->args + extra_data_size; conn->arg1 = conn->args + extra_data_size;
if ((*err_no=G_RDMA_CONNECTION_CALLBACKS.init_connection( if ((*err_no=G_RDMA_CONNECTION_CALLBACKS.init_connection(
conn, extra_params->rdma.buffer_size, conn, extra_params->rdma.double_buffers,
extra_params->rdma.buffer_size,
extra_params->rdma.pd)) != 0) extra_params->rdma.pd)) != 0)
{ {
free(conn); free(conn);
@ -874,6 +876,7 @@ int conn_pool_set_rdma_extra_params(ConnectionExtraParams *extra_params,
extra_params->tls.htable_capacity = 0; extra_params->tls.htable_capacity = 0;
} }
extra_params->rdma.double_buffers = false;
if (server_group->comm_type == fc_comm_type_sock) { if (server_group->comm_type == fc_comm_type_sock) {
extra_params->rdma.buffer_size = 0; extra_params->rdma.buffer_size = 0;
extra_params->rdma.pd = NULL; extra_params->rdma.pd = NULL;

View File

@ -64,7 +64,7 @@ typedef struct ibv_pd *(*fc_alloc_pd_callback)(const char **ip_addrs,
const int count, const int port); const int count, const int port);
typedef int (*fc_get_connection_size_callback)(); typedef int (*fc_get_connection_size_callback)();
typedef int (*fc_init_connection_callback)(ConnectionInfo *conn, typedef int (*fc_init_connection_callback)(ConnectionInfo *conn,
const int buffer_size, void *arg); const bool double_buffers, const int buffer_size, void *arg);
typedef int (*fc_make_connection_callback)(ConnectionInfo *conn, typedef int (*fc_make_connection_callback)(ConnectionInfo *conn,
const char *service_name, const int timeout_ms, const char *service_name, const int timeout_ms,
const char *bind_ipaddr, const bool log_connect_error); const char *bind_ipaddr, const bool log_connect_error);
@ -72,7 +72,7 @@ typedef bool (*fc_is_connected_callback)(ConnectionInfo *conn);
typedef void (*fc_close_connection_callback)(ConnectionInfo *conn); typedef void (*fc_close_connection_callback)(ConnectionInfo *conn);
typedef void (*fc_destroy_connection_callback)(ConnectionInfo *conn); typedef void (*fc_destroy_connection_callback)(ConnectionInfo *conn);
typedef BufferInfo *(*fc_rdma_get_buffer_callback)(ConnectionInfo *conn); typedef BufferInfo *(*fc_rdma_get_recv_buffer_callback)(ConnectionInfo *conn);
typedef int (*fc_rdma_request_by_buf1_callback)(ConnectionInfo *conn, typedef int (*fc_rdma_request_by_buf1_callback)(ConnectionInfo *conn,
const char *data, const int length, const int timeout_ms); const char *data, const int length, const int timeout_ms);
typedef int (*fc_rdma_request_by_buf2_callback)(ConnectionInfo *conn, typedef int (*fc_rdma_request_by_buf2_callback)(ConnectionInfo *conn,
@ -105,7 +105,7 @@ typedef struct {
fc_destroy_connection_callback destroy_connection; fc_destroy_connection_callback destroy_connection;
fc_is_connected_callback is_connected; fc_is_connected_callback is_connected;
fc_rdma_get_buffer_callback get_buffer; fc_rdma_get_recv_buffer_callback get_recv_buffer;
fc_rdma_request_by_buf1_callback request_by_buf1; fc_rdma_request_by_buf1_callback request_by_buf1;
fc_rdma_request_by_buf2_callback request_by_buf2; fc_rdma_request_by_buf2_callback request_by_buf2;
fc_rdma_request_by_iov_callback request_by_iov; fc_rdma_request_by_iov_callback request_by_iov;
@ -128,6 +128,7 @@ typedef struct {
} tls; //for thread local } tls; //for thread local
struct { struct {
bool double_buffers;
int buffer_size; int buffer_size;
struct ibv_pd *pd; struct ibv_pd *pd;
} rdma; } rdma;