-
Notifications
You must be signed in to change notification settings - Fork 29
feat(scheduling): priority bands in ThreadPool + SocketReactor, RT priorities on host Task #735
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
83f9fdd
feat(scheduling): priority bands in ThreadPool + SocketReactor, RT pr…
finger563 17daf8c
fix(thread_pool): address PR #735 review + CI
finger563 3eb75f9
fix(task): host real-time scheduling is now explicit opt-in + doc upd…
finger563 d5d67e6
fix(thread_pool,task): address PR #735 round-3 review
finger563 5ba51c9
fix(task): make configured priority atomic; test bands/priority in so…
finger563 09a01f3
fix: address PR #735 round-5 review (RT fallback reset, DSCP validati…
finger563 758d1aa
Potential fix for pull request finding
finger563 0bd91af
fix: address remaining PR #735 review feedback (suppressed comments +…
finger563 17a4f0c
fix(task): serialize startup vs live priority application; macOS-appr…
finger563 287bf25
feat(socket): typed espp::Dscp enum for DSCP socket settings
finger563 fcaaf43
feat(thread_pool): per-band rejected counters (Stats::band_rejected)
finger563 17016c8
fix(socket): CamelCase Dscp enumerators - all-caps names collide with…
finger563 07cd217
Potential fix for pull request finding
finger563 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 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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| #pragma once | ||
|
|
||
| #include <cstdint> | ||
|
|
||
| namespace espp { | ||
|
|
||
| /// @brief Standard DiffServ code points (DSCP) for IP traffic marking. | ||
| /// | ||
| /// A DSCP is the 6-bit field carried in the upper bits of the IP TOS / | ||
| /// Traffic Class byte (RFC 2474); network devices use it to prioritize, | ||
| /// queue, or drop traffic. The named values below are the IANA-registered | ||
| /// per-hop behaviors, so application code can write `Dscp::Ef` instead of a | ||
| /// magic number: | ||
| /// | ||
| /// - **CS0..CS7** - class selectors (RFC 2474): backwards-compatible with the | ||
| /// legacy IP precedence bits. CS0 (0) is default/best-effort forwarding; | ||
| /// higher classes are conventionally more important (CS6/CS7 are typically | ||
| /// reserved for network control traffic). | ||
| /// - **AF11..AF43** - assured forwarding (RFC 2597): four classes (AF1x | ||
| /// lowest priority .. AF4x highest), each with three drop precedences | ||
| /// (x1 = lowest drop probability .. x3 = highest). E.g. AF41 = high | ||
| /// priority, low drop probability. | ||
| /// - **EF** - expedited forwarding (RFC 3246): the standard marking for | ||
| /// low-latency, low-jitter traffic (e.g. voice / control loops). | ||
| /// - **VoiceAdmit** - capacity-admitted EF traffic (RFC 5865). | ||
| /// - **LE** - lower effort (RFC 8622): scavenger-class traffic that should | ||
| /// yield to everything else (e.g. bulk background transfers). | ||
| /// | ||
| /// Enumerator names are CamelCase (Ef, Cs5, Af41) rather than the all-caps | ||
| /// RFC names (EF, CS5, AF41) because platform headers define macros with the | ||
| /// all-caps names (e.g. newlib's <sys/termios.h> defines CS5/CS6/CS7), which | ||
| /// would break the enum wherever both headers are included. | ||
| /// | ||
| /// A custom (non-standard) code point can still be expressed with | ||
| /// `static_cast<Dscp>(value)` for values 0-63; consumers reject out-of-range | ||
| /// values. | ||
| enum class Dscp : uint8_t { | ||
| Cs0 = 0, ///< Class selector 0 - default / best-effort forwarding. | ||
| Default = Cs0, ///< Alias for CS0. | ||
| Le = 1, ///< Lower effort / scavenger (RFC 8622). | ||
| Cs1 = 8, ///< Class selector 1 (conventionally low-priority data). | ||
| Af11 = 10, ///< Assured forwarding: class 1, low drop precedence. | ||
| Af12 = 12, ///< Assured forwarding: class 1, medium drop precedence. | ||
| Af13 = 14, ///< Assured forwarding: class 1, high drop precedence. | ||
| Cs2 = 16, ///< Class selector 2 (conventionally OAM / management). | ||
| Af21 = 18, ///< Assured forwarding: class 2, low drop precedence. | ||
| Af22 = 20, ///< Assured forwarding: class 2, medium drop precedence. | ||
| Af23 = 22, ///< Assured forwarding: class 2, high drop precedence. | ||
| Cs3 = 24, ///< Class selector 3 (conventionally call signaling). | ||
| Af31 = 26, ///< Assured forwarding: class 3, low drop precedence. | ||
| Af32 = 28, ///< Assured forwarding: class 3, medium drop precedence. | ||
| Af33 = 30, ///< Assured forwarding: class 3, high drop precedence. | ||
| Cs4 = 32, ///< Class selector 4 (conventionally real-time interactive). | ||
| Af41 = 34, ///< Assured forwarding: class 4, low drop precedence. | ||
| Af42 = 36, ///< Assured forwarding: class 4, medium drop precedence. | ||
| Af43 = 38, ///< Assured forwarding: class 4, high drop precedence. | ||
| Cs5 = 40, ///< Class selector 5 (conventionally broadcast video). | ||
| VoiceAdmit = 44, ///< Capacity-admitted EF traffic (RFC 5865). | ||
| Ef = 46, ///< Expedited forwarding (RFC 3246) - low-latency/low-jitter. | ||
| Cs6 = 48, ///< Class selector 6 (network control - use with care). | ||
| Cs7 = 56, ///< Class selector 7 (reserved network control). | ||
| }; | ||
|
|
||
| /// @brief Convert a DSCP code point to the IP TOS / Traffic Class byte value | ||
| /// that carries it (DSCP occupies the upper 6 bits - RFC 2474). | ||
| /// @param dscp The code point to convert. | ||
| /// @return The TOS byte value (dscp << 2), e.g. Dscp::Ef -> 184 (0xB8). | ||
| constexpr uint8_t dscp_to_tos(Dscp dscp) { return static_cast<uint8_t>(dscp) << 2; } | ||
|
|
||
| } // namespace espp |
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.