alxrxs commented on code in PR #3569:
URL: https://github.com/apache/brpc/pull/3569#discussion_r4176486459


##########
src/brpc/rdma/rdma_endpoint.cpp:
##########
@@ -1137,8 +1186,22 @@ static ibv_qp* AllocateQp(ibv_cq* send_cq, ibv_cq* 
recv_cq, uint32_t sq_size, ui
     attr.cap.max_recv_wr = rq_size;
     attr.cap.max_send_sge = GetRdmaMaxSge();
     attr.cap.max_recv_sge = 1;
+    attr.cap.max_inline_data = inline_size;
     attr.qp_type = IBV_QPT_RC;
-    return IbvCreateQp(GetRdmaPd(), &attr);
+    ibv_qp* qp = IbvCreateQp(GetRdmaPd(), &attr);
+    while (qp == nullptr && inline_size > 0) {

Review Comment:
   Good point. It now steps down only when ibv_create_qp fails with EINVAL, 
logs each step under FLAGS_rdma_trace_verbose, and any other failure is 
reported as before.



##########
src/brpc/rdma/rdma_endpoint.cpp:
##########
@@ -1128,7 +1156,28 @@ int RdmaEndpoint::PostRecv(uint32_t num, bool zerocopy) {
     return 0;
 }
 
-static ibv_qp* AllocateQp(ibv_cq* send_cq, ibv_cq* recv_cq, uint32_t sq_size, 
uint32_t rq_size) {
+// Inline size to request: on the first try, size capped at the vendor's first
+// known limit; after a refusal, the vendor's next smaller known limit, else
+// one step smaller.
+static uint32_t InlineDataToRequest(uint32_t vendor_id, uint32_t size,
+                                    bool refused) {
+    for (const auto& known : KNOWN_INLINE_LIMITS) {
+        if (known.vendor_id == vendor_id &&
+            (!refused || known.max_inline < size)) {
+            return std::min(known.max_inline, size);

Review Comment:
   Added unit tests for the size selection and the retry loop, with a stubbed 
IbvCreateQp.



-- 
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]

Reply via email to