detect and negotiate mtu#3304
Open
randomkang wants to merge 5 commits into
Open
Conversation
chenBright
reviewed
May 19, 2026
Comment on lines
+462
to
+464
|
|
||
| if (ibv_query_port(ctx, port_num, &port_attr)) { | ||
| LOG(ERROR) << "ibv_query_port failed"; |
Comment on lines
+93
to
94
| static uint16_t g_rdma_hello_msg_len = 42; // In Byte | ||
| static uint16_t g_rdma_hello_version = 2; |
Comment on lines
+1259
to
+1267
| LOG(INFO) << "negotiated mtu is 256"; | ||
| } else if (mtu_type == IBV_MTU_512) { | ||
| LOG(INFO) << "negotiated mtu is 512"; | ||
| } else if (mtu_type == IBV_MTU_1024) { | ||
| LOG(INFO) << "negotiated mtu is 1024"; | ||
| } else if (mtu_type == IBV_MTU_2048) { | ||
| LOG(INFO) << "negotiated mtu is 2048"; | ||
| } else if (mtu_type == IBV_MTU_4096) { | ||
| LOG(INFO) << "negotiated mtu is 4096"; |
Comment on lines
+548
to
551
| // use the minimum of local mtu type and remote mtu type | ||
| uint16_t min_mtu_type = std::min(local_mtu_type, remote_msg.mtu_type); | ||
| if (ep->BringUpQp(remote_msg.lid, remote_msg.gid, remote_msg.qp_num, min_mtu_type) < 0) { | ||
| LOG(WARNING) << "Fail to bringup QP, fallback to tcp:" << s->description(); |
Comment on lines
697
to
703
| // Only happens in UT | ||
| local_msg.qp_num = 0; | ||
| } | ||
| local_msg.mtu_type = local_mtu_type; | ||
| } | ||
| memcpy(data, MAGIC_STR, 4); | ||
| local_msg.Serialize((char*)data + 4); |
chenBright
reviewed
May 20, 2026
| return NULL; | ||
| } | ||
|
|
||
| if (remote_msg.msg_len > HELLO_MSG_LEN_MIN) { |
Contributor
There was a problem hiding this comment.
We need to be compatible with scenarios where one peer does not support mtu_type. Keeping HELLO_MSG_LEN_MIN unchanged at 40 and using mtu_type as an extended field for parsing is more appropriate.
Contributor
Author
There was a problem hiding this comment.
ok, we need to be compatible with scenarios with the old versions.
Contributor
|
Please update the RDMA UTs in brpc_rdma_unittest.cpp. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: resolve
Problem Summary:
What is changed and the side effects?
Changed:
Side effects:
The bandwith of rdma perf will be increased 25%(in my case, from 33GB/s to 41GB/s ).
Check List: