Skip to content

Commit 5f30608

Browse files
moleksyvt-tv
authored andcommitted
Thread TargetSetupOptions through RCTarget; fix in_options doc
Signed-off-by: Maciej Oleksy <maciej.oleksy@intel.com>
1 parent d35380b commit 5f30608

3 files changed

Lines changed: 11 additions & 13 deletions

File tree

lib/fabrics/include/mxl/fabrics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ extern "C"
156156
* \param in_target A valid fabrics target
157157
* \param in_config The target configuration. This will be used to create an endpoint and register a memory region. The memory region
158158
* corresponds to the one that will be written to by the initiator.
159-
* \param options An optional json-formatted string with options. May be NULL or empty. Recognized fields:
159+
* \param in_options An optional json-formatted string with options. May be NULL or empty. Recognized fields:
160160
* - "cqDepth" (number >= 1): the depth of the target's completion queue. Increase this for high-frame-rate or many-stream
161161
* receivers, or when per-completion processing is slow, to avoid completion queue overflow. See the "Receiving grains" section
162162
* of docs/Fabrics.md. When omitted, an implementation default is used.

lib/fabrics/ofi/src/internal/RCTarget.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,22 @@ namespace mxl::lib::fabrics::ofi
6464
auto proto = selectIngressProtocol(mxlRegions.dataLayout(), mxlRegions.regions(), mxlRegions.maxSyncBatchSize());
6565
auto targetInfo = std::make_unique<TargetInfo>(pep.id(), pep.localAddress(), proto->registerMemory(domain), proto->bounceBufferInfo());
6666

67-
auto const cqSize = options.cqDepth.value_or(CompletionQueue::Attributes::DEFAULT_SIZE);
68-
6967
// Helper struct to enable the std::make_unique function to access the private constructor of this class.
7068
struct MakeUniqueEnabler : RCTarget
7169
{
72-
MakeUniqueEnabler(PassiveEndpoint pep, std::unique_ptr<IngressProtocol> proto, std::shared_ptr<Domain> domain, std::size_t cqDepth)
73-
: RCTarget(std::move(pep), std::move(proto), std::move(domain), cqDepth)
70+
MakeUniqueEnabler(PassiveEndpoint pep, std::unique_ptr<IngressProtocol> proto, std::shared_ptr<Domain> domain, TargetSetupOptions options)
71+
: RCTarget(std::move(pep), std::move(proto), std::move(domain), std::move(options))
7472
{}
7573
};
7674

7775
// Return the constructed RCTarget and associated TargetInfo for remote peers to connect.
78-
return {std::make_unique<MakeUniqueEnabler>(std::move(pep), std::move(proto), std::move(domain), cqSize), std::move(targetInfo)};
76+
return {std::make_unique<MakeUniqueEnabler>(std::move(pep), std::move(proto), std::move(domain), options), std::move(targetInfo)};
7977
}
8078

81-
RCTarget::RCTarget(PassiveEndpoint pep, std::unique_ptr<IngressProtocol> proto, std::shared_ptr<Domain> domain, std::size_t cqDepth)
79+
RCTarget::RCTarget(PassiveEndpoint pep, std::unique_ptr<IngressProtocol> proto, std::shared_ptr<Domain> domain, TargetSetupOptions options)
8280
: _proto(std::move(proto))
8381
, _domain(std::move(domain))
84-
, _cqDepth(cqDepth)
82+
, _setupOptions(std::move(options))
8583
, _state(WaitForConnectionRequest{std::move(pep)})
8684
{}
8785

@@ -162,7 +160,7 @@ namespace mxl::lib::fabrics::ofi
162160
auto endpoint = Endpoint::create(_domain, state.pep.id(), event->connReq().info());
163161

164162
auto cqAttr = CompletionQueue::Attributes::defaults();
165-
cqAttr.size = _cqDepth;
163+
cqAttr.size = _setupOptions.cqDepth.value_or(CompletionQueue::Attributes::DEFAULT_SIZE);
166164
auto cq = CompletionQueue::open(_domain, cqAttr);
167165
endpoint.bind(cq, FI_RECV);
168166

lib/fabrics/ofi/src/internal/RCTarget.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ namespace mxl::lib::fabrics::ofi
9090
*
9191
* \param domain The domain to create the RCTarget on.
9292
* \param pep The passive endpoint to use for listening for incoming connection requests.
93-
* \param cqDepth The depth of the completion queue created for the accepted connection.
93+
* \param options The setup options applied when the completion queue is created for the accepted connection.
9494
*/
95-
RCTarget(PassiveEndpoint pep, std::unique_ptr<IngressProtocol> proto, std::shared_ptr<Domain> domain, std::size_t cqDepth);
95+
RCTarget(PassiveEndpoint pep, std::unique_ptr<IngressProtocol> proto, std::shared_ptr<Domain> domain, TargetSetupOptions options);
9696

9797
/** \brief Internal method to drive progress based on the current state.
9898
*
@@ -108,7 +108,7 @@ namespace mxl::lib::fabrics::ofi
108108
private:
109109
std::unique_ptr<IngressProtocol> _proto;
110110
std::shared_ptr<Domain> _domain;
111-
std::size_t _cqDepth; /**< Completion queue depth for accepted connections. */
112-
State _state; /**< The current state of the RCTarget. */
111+
TargetSetupOptions _setupOptions; /**< Setup options applied when accepting connections. */
112+
State _state; /**< The current state of the RCTarget. */
113113
};
114114
}

0 commit comments

Comments
 (0)