-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use canardTxPoll
; MediaPayload::Ownership
#409
Merged
+179
−159
Merged
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
edded3f
Sshirokov/352 zero copy (#401)
serges147 5856066
Single copy TX pipeline (#405)
serges147 ade0d04
Latest canard and udpard (v4 & v2) (#406)
serges147 215b27c
fix issue 398 #verification #sonar #docs
serges147 9ab3f9d
introduce libcyphal config #verification #sonar #docs
serges147 8e58076
build fix #verification #sonar #docs
serges147 9a3b932
sonar fixes #verification #sonar #docs
serges147 b333779
build fixes #verification #sonar #docs
serges147 e146b6a
sending now uses stack for serialization of small messages/request/re…
serges147 3e967e8
sonar and CI fixes #verification #sonar #docs
serges147 811d8f2
CI fixes #verification #sonar #docs
serges147 5732518
reworked config #verification #sonar #docs
serges147 25be9de
eliminated deprecatd NOSONAR cpp:S4963 #verification #sonar #docs
serges147 b8d8b55
sonar fixes #verification #sonar #docs
serges147 423849e
sonar fixes #verification #sonar #docs
serges147 bed3d2f
pr review fixes #verification #sonar #docs
serges147 37c076c
Merge branch 'issue/352_zero_copy' into sshirokov/config
serges147 eef24af
simplified config #verification #sonar #docs
serges147 118c5c2
fix build #verification #sonar #docs
serges147 9974086
Merge branch 'main' into sshirokov/config
serges147 1b7345b
try poll #verification #sonar #docs
serges147 9a4424d
try poll #verification #sonar #docs
serges147 bc19292
Added `MediaPayload::Ownership` nested struct #verification #sonar #docs
serges147 bc4a315
sonar fixes #verification #sonar #docs
serges147 5aba8c7
#verification #sonar #docs
serges147 fe4f7c6
rename `cavl` -> `libcyphal::common::cavl` #verification #sonar #docs
serges147 dc68e7c
build fix #verification #sonar #docs
serges147 a3039c9
Merge branch 'main' into sshirokov/tx_poll
serges147 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,10 @@ | |
|
||
// NOLINTBEGIN(cppcoreguidelines-pro-bounds-constant-array-index) | ||
|
||
namespace libcyphal | ||
{ | ||
namespace common | ||
{ | ||
namespace cavl | ||
{ | ||
template <typename Derived> | ||
|
@@ -58,10 +62,9 @@ class Tree; | |
/// The size of this type is 4x pointer size (16 bytes on a 32-bit platform). | ||
/// | ||
/// No Sonar cpp:S1448 b/c this is the main node entity without public members - maintainability is not a concern here. | ||
/// No Sonar cpp:S4963 b/c `Node` supports move operation. | ||
/// | ||
template <typename Derived> | ||
class Node // NOSONAR cpp:S1448 cpp:S4963 | ||
class Node // NOSONAR cpp:S1448 | ||
{ | ||
// Polyfill for C++17's std::invoke_result_t. | ||
template <typename F, typename... Args> | ||
|
@@ -789,7 +792,7 @@ class Tree final // NOSONAR cpp:S3624 | |
{ | ||
public: | ||
/// Helper alias of the compatible node type. | ||
using NodeType = ::cavl::Node<Derived>; | ||
using NodeType = Node<Derived>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. already in upstream |
||
using DerivedType = Derived; | ||
|
||
Tree() = default; | ||
|
@@ -954,8 +957,7 @@ class Tree final // NOSONAR cpp:S3624 | |
/// the same call stack) we may occasionally fail to detect a bona fide case of a race condition, but this is | ||
/// acceptable because the purpose of this feature is to provide a mere best-effort data race detection. | ||
/// | ||
/// No Sonar cpp:S4963 b/c of the RAII pattern. | ||
class TraversalIndicatorUpdater final // NOSONAR cpp:S4963 | ||
class TraversalIndicatorUpdater final | ||
{ | ||
public: | ||
explicit TraversalIndicatorUpdater(const Tree& sup) noexcept | ||
|
@@ -994,11 +996,13 @@ class Tree final // NOSONAR cpp:S3624 | |
// including the root node whos `up` points to this origin node (see `isRoot` method). | ||
Node<Derived> origin_node_{}; | ||
|
||
// No Sonar cpp:S4963 b/c of implicit modification by the `TraversalIndicatorUpdater` RAII class, | ||
// No Sonar cpp:S3687 b/c of implicit modification by the `TraversalIndicatorUpdater` RAII class, | ||
// even for `const` instance of the `Tree` class (hence the `mutable volatile` keywords). | ||
mutable volatile bool traversal_in_progress_ = false; // NOSONAR cpp:S3687 | ||
}; | ||
|
||
} // namespace cavl | ||
} // namespace common | ||
} // namespace libcyphal | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. upstream stay as before - just |
||
|
||
// NOLINTEND(cppcoreguidelines-pro-bounds-constant-array-index) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
/// @copyright | ||
/// Copyright (C) OpenCyphal Development Team <opencyphal.org> | ||
/// Copyright Amazon.com Inc. or its affiliates. | ||
/// SPDX-License-Identifier: MIT | ||
|
||
#ifndef LIBCYPHAL_CONFIG_HPP_INCLUDED | ||
#define LIBCYPHAL_CONFIG_HPP_INCLUDED | ||
|
||
#include <cstddef> | ||
|
||
namespace libcyphal | ||
{ | ||
|
||
// All below NOSONAR cpp:S799 "Rename this identifier to be shorter or equal to 31 characters." | ||
// are intentional and are used to keep the names consistent with the rest of the codebase. | ||
// F.e. `IExecutor_Callback_FunctionMaxSize` is consistent with `IExecutor::Callback::FunctionMaxSize`. | ||
|
||
/// Defines various configuration parameters of libcyphal. | ||
/// | ||
/// All methods are `static constexpr` - they are evaluated at compile time. | ||
/// | ||
/// Nolint b/c this is the main purpose of this file - define various constants. | ||
/// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers, readability-magic-numbers) | ||
/// | ||
struct Config | ||
{ | ||
/// Defines max footprint of a callback function in use by the executor. | ||
/// | ||
static constexpr std::size_t IExecutor_Callback_FunctionMaxSize() // NOSONAR cpp:S799 | ||
{ | ||
return sizeof(void*) * 8; | ||
} | ||
|
||
/// Defines footprint size reserved for a callback implementation. | ||
/// The actual max footprint for the callback implementation is `sizeof(IExecutor::Function)` bigger, | ||
/// and it depends on `Cfg_IExecutor_Callback_FunctionMaxSize`. | ||
/// | ||
static constexpr std::size_t IExecutor_Callback_ReserveSize() // NOSONAR cpp:S799 | ||
{ | ||
/// Size is chosen arbitrary, but it should be enough to store any lambda or function pointer. | ||
return sizeof(void*) * 16; | ||
} | ||
|
||
/// Defines various configuration parameters for the application layer. | ||
/// | ||
struct Application | ||
{ | ||
struct Node | ||
{ | ||
/// Defines max footprint of a callback function in use by the heartbeat producer. | ||
/// | ||
static constexpr std::size_t HeartbeatProducer_UpdateCallback_FunctionSize() // NOSONAR cpp:S799 | ||
{ | ||
/// Size is chosen arbitrary, but it should be enough to store any lambda or function pointer. | ||
return sizeof(void*) * 4; | ||
} | ||
|
||
}; // Node | ||
|
||
}; // Application | ||
|
||
/// Defines various configuration parameters for the presentation layer. | ||
/// | ||
struct Presentation | ||
{ | ||
/// Defines max footprint of a callback function in use by the RPC client response promise. | ||
/// | ||
static constexpr std::size_t ResponsePromiseBase_Callback_FunctionSize() // NOSONAR cpp:S799 | ||
{ | ||
/// Size is chosen arbitrary, but it should be enough to store any lambda or function pointer. | ||
return sizeof(void*) * 4; | ||
} | ||
|
||
/// Defines max footprint of a callback function in use by the RPC server response continuation. | ||
/// | ||
static constexpr std::size_t ServerBase_ContinuationImpl_FunctionMaxSize() // NOSONAR cpp:S799 | ||
{ | ||
/// Size is chosen arbitrary, but it should be enough to store any lambda or function pointer. | ||
return sizeof(void*) * 5; | ||
} | ||
|
||
/// Defines max footprint of a callback function in use by the RPC server request notification. | ||
/// | ||
static constexpr std::size_t ServerBase_OnRequestCallback_FunctionMaxSize() // NOSONAR cpp:S799 | ||
{ | ||
/// Size is chosen arbitrary, but it should be enough to store any lambda or function pointer. | ||
return sizeof(void*) * 5; | ||
} | ||
|
||
/// Defines the size serialization/deserialization payload buffer which is considered as a small one, | ||
/// and therefore could be used with stack buffer. Any payload larger than this size will be PMR allocated. | ||
/// | ||
/// Setting it to 0 will force all payload buffers to be PMR allocated (except zero-sized). | ||
/// | ||
static constexpr std::size_t SmallPayloadSize() | ||
{ | ||
/// Size is chosen arbitrary - as compromise between stack and PMR allocation. | ||
return 256; | ||
} | ||
|
||
/// Defines max footprint of a callback function in use by the message subscriber receive notification. | ||
/// | ||
static constexpr std::size_t Subscriber_OnReceiveCallback_FunctionMaxSize() // NOSONAR cpp:S799 | ||
{ | ||
/// Size is chosen arbitrary, but it should be enough to store any lambda or function pointer. | ||
return sizeof(void*) * 4; | ||
} | ||
}; | ||
|
||
/// Defines various configuration parameters for the transport layer. | ||
/// | ||
struct Transport | ||
{ | ||
/// Defines max footprint of a callback function in use by the message RX session notification. | ||
/// Size is chosen arbitrary, but it should be enough to store any lambda or function pointer. | ||
/// | ||
static constexpr std::size_t IMessageRxSession_OnReceiveCallback_FunctionMaxSize() // NOSONAR cpp:S799 | ||
{ | ||
/// Size is chosen arbitrary, but it should be enough to store any lambda or function pointer. | ||
return sizeof(void*) * 4; | ||
} | ||
|
||
/// Defines max footprint of a callback function in use by the service RX session notification. | ||
/// Size is chosen arbitrary, but it should be enough to store any lambda or function pointer. | ||
/// | ||
static constexpr std::size_t ISvcRxSession_OnReceiveCallback_FunctionMaxSize() // NOSONAR cpp:S799 | ||
{ | ||
/// Size is chosen arbitrary, but it should be enough to store any lambda or function pointer. | ||
return sizeof(void*) * 4; | ||
} | ||
|
||
/// Defines max footprint of a platform-specific error implementation. | ||
/// | ||
static constexpr std::size_t PlatformErrorMaxSize() | ||
{ | ||
/// Size is chosen arbitrary, but it should be enough to store simple implementation. | ||
return sizeof(void*) * 3; | ||
} | ||
|
||
/// Defines max footprint of a storage implementation used by the scattered buffer. | ||
/// | ||
static constexpr std::size_t ScatteredBuffer_StorageVariantFootprint() // NOSONAR cpp:S799 | ||
{ | ||
/// Size is chosen arbitrary, but it should be enough to store any implementation. | ||
return sizeof(void*) * 8; | ||
} | ||
|
||
/// Defines various configuration parameters for the CAN transport sublayer. | ||
/// | ||
struct Can | ||
{ | ||
/// Defines max footprint of a callback function in use by the CAN transport transient error handler. | ||
/// | ||
static constexpr std::size_t ICanTransport_TransientErrorHandlerMaxSize() // NOSONAR cpp:S799 | ||
{ | ||
/// Size is chosen arbitrary, but it should be enough to store simple lambda or function pointer. | ||
return sizeof(void*) * 3; | ||
} | ||
|
||
}; // Can | ||
|
||
/// Defines various configuration parameters for the UDO transport sublayer. | ||
/// | ||
struct Udp | ||
{ | ||
/// Defines max footprint of a callback function in use by the UDP transport transient error handler. | ||
/// | ||
static constexpr std::size_t IUdpTransport_TransientErrorHandlerMaxSize() // NOSONAR cpp:S799 | ||
{ | ||
/// Size is chosen arbitrary, but it should be enough to store simple lambda or function pointer. | ||
return sizeof(void*) * 3; | ||
} | ||
|
||
}; // Udp | ||
|
||
}; // Transport | ||
|
||
}; // Config | ||
|
||
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers, readability-magic-numbers) | ||
|
||
#ifdef LIBCYPHAL_CONFIG | ||
using config = LIBCYPHAL_CONFIG; | ||
#else | ||
using config = Config; | ||
#endif | ||
|
||
} // namespace libcyphal | ||
|
||
#endif // LIBCYPHAL_CONFIG_HPP_INCLUDED |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed for...
libcyphal/common/cavl/...
folder structure