This is an automated email from the ASF dual-hosted git repository.
chenBright pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git
The following commit(s) were added to refs/heads/master by this push:
new 35682ff8 Support rdma ece (#3255)
35682ff8 is described below
commit 35682ff8d8e567a941035b3c09838dd932465f1f
Author: randomkang <[email protected]>
AuthorDate: Mon Apr 20 23:18:04 2026 +0800
Support rdma ece (#3255)
---
src/brpc/rdma/rdma_endpoint.cpp | 18 ++++++++++++++++++
src/brpc/rdma/rdma_helper.cpp | 4 ++++
2 files changed, 22 insertions(+)
diff --git a/src/brpc/rdma/rdma_endpoint.cpp b/src/brpc/rdma/rdma_endpoint.cpp
index ad2f684e..c69bf8ec 100644
--- a/src/brpc/rdma/rdma_endpoint.cpp
+++ b/src/brpc/rdma/rdma_endpoint.cpp
@@ -47,6 +47,8 @@ extern ibv_qp* (*IbvCreateQp)(ibv_pd*, ibv_qp_init_attr*);
extern int (*IbvModifyQp)(ibv_qp*, ibv_qp_attr*, ibv_qp_attr_mask);
extern int (*IbvQueryQp)(ibv_qp*, ibv_qp_attr*, ibv_qp_attr_mask,
ibv_qp_init_attr*);
extern int (*IbvDestroyQp)(ibv_qp*);
+extern int (*IbvQueryEce)(ibv_qp*, ibv_ece*);
+extern int (*IbvSetEce)(ibv_qp*, ibv_ece*);
extern bool g_skip_rdma_init;
DEFINE_int32(rdma_sq_size, 128, "SQ size for RDMA");
@@ -64,6 +66,7 @@ DEFINE_bool(rdma_use_polling, false, "Use polling mode for
RDMA.");
DEFINE_int32(rdma_poller_num, 1, "Poller number in RDMA polling mode.");
DEFINE_bool(rdma_poller_yield, false, "Yield thread in RDMA polling mode.");
DEFINE_bool(rdma_disable_bthread, false, "Disable bthread in RDMA");
+DEFINE_bool(rdma_ece, false, "Open ece in RDMA, should use this feature when
rdma nics are from the same merchant.");
static const size_t IOBUF_BLOCK_HEADER_LEN = 32; // implementation-dependent
@@ -1251,6 +1254,21 @@ int RdmaEndpoint::BringUpQp(uint16_t lid, ibv_gid gid,
uint32_t qp_num) {
return -1;
}
+ if (FLAGS_rdma_ece) {
+ struct ibv_ece ece;
+ int err = IbvQueryEce(_resource->qp, &ece);
+ if (err != 0) {
+ LOG(WARNING) << "Fail to IbvQueryEce: " << berror(err);
+ return -1;
+ }
+ // ToDo: should check if remote qp support ece
+ err = IbvSetEce(_resource->qp, &ece);
+ if (err != 0) {
+ LOG(WARNING) << "Fail to IbvSetEce: " << berror(err);
+ return -1;
+ }
+ }
+
if (PostRecv(_rq_size, true) < 0) {
PLOG(WARNING) << "Fail to post recv wr";
return -1;
diff --git a/src/brpc/rdma/rdma_helper.cpp b/src/brpc/rdma/rdma_helper.cpp
index 9bad3375..35a47bd3 100644
--- a/src/brpc/rdma/rdma_helper.cpp
+++ b/src/brpc/rdma/rdma_helper.cpp
@@ -72,6 +72,8 @@ void (*IbvAckCqEvents)(ibv_cq*, unsigned int) = NULL;
int (*IbvGetAsyncEvent)(ibv_context*, ibv_async_event*) = NULL;
void (*IbvAckAsyncEvent)(ibv_async_event*) = NULL;
const char* (*IbvEventTypeStr)(ibv_event_type) = NULL;
+int (*IbvQueryEce)(ibv_qp*, ibv_ece*) = NULL;
+int (*IbvSetEce)(ibv_qp*, ibv_ece*) = NULL;
// NOTE:
// ibv_post_send, ibv_post_recv, ibv_poll_cq, ibv_req_notify_cq are all inline
function
@@ -386,6 +388,8 @@ static int ReadRdmaDynamicLib() {
LoadSymbol(g_handle_ibverbs, IbvGetAsyncEvent, "ibv_get_async_event");
LoadSymbol(g_handle_ibverbs, IbvAckAsyncEvent, "ibv_ack_async_event");
LoadSymbol(g_handle_ibverbs, IbvEventTypeStr, "ibv_event_type_str");
+ LoadSymbol(g_handle_ibverbs, IbvQueryEce, "ibv_query_ece");
+ LoadSymbol(g_handle_ibverbs, IbvSetEce, "ibv_set_ece");
return 0;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]