]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc: Add support for Hold/Release mechanism in TSN as per IEEE 802.1Q-2018
authorChoong Yong Liang <yong.liang.choong@linux.intel.com>
Tue, 12 Nov 2024 04:00:29 +0000 (12:00 +0800)
committerDavid Ahern <dsahern@kernel.org>
Mon, 18 Nov 2024 16:54:00 +0000 (16:54 +0000)
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 <yong.liang.choong@linux.intel.com>
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
man/man8/tc-taprio.8
tc/q_taprio.c

index bf489b032a7eb3205a458b804288602497fc5b68..b7a81fafea9ba30a8a37ad18ee66d12362efe7db 100644 (file)
@@ -115,14 +115,28 @@ parameters in a single schedule. Each one has the
 
 sched-entry <command> <gatemask> <interval>
 
-format. The only supported <command> is "S", which
-means "SetGateStates", following the IEEE 802.1Q-2018 definition
-(Table 8-7). <gate mask> 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.
-<interval> is a time duration, in nanoseconds, that specifies for how
-long that state defined by <command> and <gate mask> should be held
-before moving to the next entry.
+format.
+
+<command> 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).
+
+<gate mask> 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.
+
+<interval> is a time duration, in nanoseconds, that specifies for how long that
+state defined by <command> and <gate mask> should be held before moving to
+the next entry.
 
 .TP
 flags
index 416a222a8ef6383a80e37b8755e3b451355465a8..689c7a8f564f8a6a64af07dc9ddc0a9ad426cea7 100644 (file)
@@ -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;
 }