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 <yong.liang.choong@linux.intel.com>
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
Choong Yong Liang
2024-11-12 12:00:29 +08:00
committed by David Ahern
parent 7b4d64895f
commit 863c96cea4
2 changed files with 30 additions and 8 deletions

View 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

View 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;
}