chenBright commented on code in PR #3145:
URL: https://github.com/apache/brpc/pull/3145#discussion_r2516473716
##########
src/brpc/rdma/rdma_endpoint.cpp:
##########
@@ -938,8 +961,16 @@ ssize_t RdmaEndpoint::HandleCompletion(ibv_wc& wc) {
bool zerocopy = FLAGS_rdma_recv_zerocopy;
switch (wc.opcode) {
case IBV_WC_SEND: { // send completion
- // Do nothing
- break;
+ if (SEND_TYPE_RDMA_IMM == wc.wr_id) {
+ // Do nothing for imm.
+ return 0;
+ }
+ // Update window
+ uint16_t wnd_to_update = _local_window_capacity / 4;
+ _sq_window_size.fetch_add(wnd_to_update, butil::memory_order_relaxed);
+ // Wake up writing thread right after every signaled sending cqe.
+ _socket->WakeAsEpollOut();
Review Comment:
An additional condition can be added: `_remote_rq_window_size >
_local_window_capacity / 8`.
##########
src/brpc/rdma/rdma_endpoint.cpp:
##########
@@ -972,9 +1001,9 @@ ssize_t RdmaEndpoint::HandleCompletion(ibv_wc& wc) {
// Update window
uint32_t wnd_thresh = _local_window_capacity / 8;
- if (_window_size.fetch_add(acks, butil::memory_order_relaxed) >=
wnd_thresh
+ if (_remote_rq_window_size.fetch_add(acks,
butil::memory_order_relaxed) >= wnd_thresh
|| acks >= wnd_thresh) {
- // Do not wake up writing thread right after _window_size > 0.
+ // Do not wake up writing thread right after
_remote_rq_window_size > 0.
Review Comment:
I think the comments are fine. "_remote_rq_window_size > 0, do not wake
up..."
##########
src/brpc/rdma/rdma_endpoint.cpp:
##########
@@ -938,8 +961,16 @@ ssize_t RdmaEndpoint::HandleCompletion(ibv_wc& wc) {
bool zerocopy = FLAGS_rdma_recv_zerocopy;
switch (wc.opcode) {
case IBV_WC_SEND: { // send completion
- // Do nothing
- break;
+ if (SEND_TYPE_RDMA_IMM == wc.wr_id) {
+ // Do nothing for imm.
+ return 0;
+ }
+ // Update window
+ uint16_t wnd_to_update = _local_window_capacity / 4;
Review Comment:
I agree.
##########
src/brpc/rdma/rdma_endpoint.cpp:
##########
@@ -938,8 +961,16 @@ ssize_t RdmaEndpoint::HandleCompletion(ibv_wc& wc) {
bool zerocopy = FLAGS_rdma_recv_zerocopy;
switch (wc.opcode) {
case IBV_WC_SEND: { // send completion
- // Do nothing
- break;
+ if (SEND_TYPE_RDMA_IMM == wc.wr_id) {
+ // Do nothing for imm.
+ return 0;
+ }
+ // Update window
+ uint16_t wnd_to_update = _local_window_capacity / 4;
Review Comment:
On the other hand, I don't understand why the number of reserved WRs in
SQ/RQ for pure ACK is 3.
https://github.com/apache/brpc/blob/ede6b7763ab52829bd1436c4f0bab4a708800c3a/src/brpc/rdma/rdma_endpoint.cpp#L70-L72
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]