From: Choong Yong Liang Date: Tue, 12 Nov 2024 04:00:29 +0000 (+0800) Subject: tc: Add support for Hold/Release mechanism in TSN as per IEEE 802.1Q-2018 X-Git-Tag: v6.13.0~15^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=863c96cea49d4a873a584f63e8851e661e475835;p=thirdparty%2Fiproute2.git tc: Add support for Hold/Release mechanism in TSN as per IEEE 802.1Q-2018 This commit enhances the q_taprio module by adding support for the Hold/Release mechanism in Time-Sensitive Networking (TSN), as specified in the IEEE 802.1Q-2018 standard. Changes include: - Addition of `TC_TAPRIO_CMD_SET_AND_HOLD` and `TC_TAPRIO_CMD_SET_AND_RELEASE` cases in the `entry_cmd_to_str` function to return "H" and "R" respectively. - Addition of corresponding string comparisons in the `str_to_entry_cmd` function to map "H" and "R" to `TC_TAPRIO_CMD_SET_AND_HOLD` and `TC_TAPRIO_CMD_SET_AND_RELEASE`. The Hold/Release feature works as follows: - Set-And-Hold-MAC (H): This command sets the gates and holds the current configuration, preventing any further changes until a release command is issued. - Set-And-Release-MAC (R): This command releases the hold, allowing subsequent gate configuration changes to take effect. These changes ensure that the q_taprio module can correctly interpret and handle the Hold/Release commands, aligning with the IEEE 802.1Q-2018 standard for enhanced TSN configuration. Signed-off-by: Choong Yong Liang Signed-off-by: Jose Abreu Signed-off-by: David Ahern --- diff --git a/man/man8/tc-taprio.8 b/man/man8/tc-taprio.8 index bf489b03..b7a81faf 100644 --- a/man/man8/tc-taprio.8 +++ b/man/man8/tc-taprio.8 @@ -115,14 +115,28 @@ parameters in a single schedule. Each one has the sched-entry -format. The only supported is "S", which -means "SetGateStates", following the IEEE 802.1Q-2018 definition -(Table 8-7). is a bitmask where each bit is a associated -with a traffic class, so bit 0 (the least significant bit) being "on" -means that traffic class 0 is "active" for that schedule entry. - is a time duration, in nanoseconds, that specifies for how -long that state defined by and should be held -before moving to the next entry. +format. + + support the following values: +.br +.I "S" +for SetGateStates +.br +.I "H" +for Set-And-Hold-MAC +.br +.I "R" +for Set-And-Release-MAC +.br +These commands follow the IEEE 802.1Q-2018 definition (Table 8-7). + + is a bitmask where each bit is associated with a traffic class, so +bit 0 (the least significant bit) being "on" means that traffic class 0 is +"active" for that schedule entry. + + is a time duration, in nanoseconds, that specifies for how long that +state defined by and should be held before moving to +the next entry. .TP flags diff --git a/tc/q_taprio.c b/tc/q_taprio.c index 416a222a..689c7a8f 100644 --- a/tc/q_taprio.c +++ b/tc/q_taprio.c @@ -53,6 +53,10 @@ static const char *entry_cmd_to_str(__u8 cmd) switch (cmd) { case TC_TAPRIO_CMD_SET_GATES: return "S"; + case TC_TAPRIO_CMD_SET_AND_HOLD: + return "H"; + case TC_TAPRIO_CMD_SET_AND_RELEASE: + return "R"; default: return "Invalid"; } @@ -62,6 +66,10 @@ static int str_to_entry_cmd(const char *str) { if (strcmp(str, "S") == 0) return TC_TAPRIO_CMD_SET_GATES; + else if (strcmp(str, "H") == 0) + return TC_TAPRIO_CMD_SET_AND_HOLD; + else if (strcmp(str, "R") == 0) + return TC_TAPRIO_CMD_SET_AND_RELEASE; return -1; }