* [PATCH iproute2 net-next v5 2/5] taprio: Add support for setting flags
2019-07-18 19:55 [PATCH iproute2 net-next v5 1/5] etf: Add skip_sock_check Vedang Patel
@ 2019-07-18 19:55 ` Vedang Patel
2019-07-18 19:55 ` [PATCH iproute2 net-next v5 3/5] taprio: add support for setting txtime_delay Vedang Patel
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Vedang Patel @ 2019-07-18 19:55 UTC (permalink / raw)
To: netdev
Cc: jhs, xiyou.wangcong, jiri, stephen, vinicius.gomes,
leandro.maciel.dorileo, jakub.kicinski, m-karicheri2, dsahern,
Vedang Patel
From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
This allows a new parameter, flags, to be passed to taprio. Currently, it
only supports enabling the txtime-assist mode. But, we plan to add
different modes for taprio (e.g. hardware offloading) and this parameter
will be useful in enabling those modes.
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: Vedang Patel <vedang.patel@intel.com>
---
tc/q_taprio.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/tc/q_taprio.c b/tc/q_taprio.c
index 62c8c591da99..1db2aba6efe7 100644
--- a/tc/q_taprio.c
+++ b/tc/q_taprio.c
@@ -159,6 +159,7 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
__s64 cycle_time_extension = 0;
struct list_head sched_entries;
struct rtattr *tail, *l;
+ __u32 taprio_flags = 0;
__s64 cycle_time = 0;
__s64 base_time = 0;
int err, idx;
@@ -281,6 +282,17 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
explain_clockid(*argv);
return -1;
}
+ } else if (strcmp(*argv, "flags") == 0) {
+ NEXT_ARG();
+ if (taprio_flags) {
+ fprintf(stderr, "taprio: duplicate \"flags\" specification\n");
+ return -1;
+ }
+ if (get_u32(&taprio_flags, *argv, 0)) {
+ PREV_ARG();
+ return -1;
+ }
+
} else if (strcmp(*argv, "help") == 0) {
explain();
return -1;
@@ -297,6 +309,9 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
if (clockid != CLOCKID_INVALID)
addattr_l(n, 1024, TCA_TAPRIO_ATTR_SCHED_CLOCKID, &clockid, sizeof(clockid));
+ if (taprio_flags)
+ addattr_l(n, 1024, TCA_TAPRIO_ATTR_FLAGS, &taprio_flags, sizeof(taprio_flags));
+
if (opt.num_tc > 0)
addattr_l(n, 1024, TCA_TAPRIO_ATTR_PRIOMAP, &opt, sizeof(opt));
@@ -442,6 +457,13 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
print_string(PRINT_ANY, "clockid", "clockid %s", get_clock_name(clockid));
+ if (tb[TCA_TAPRIO_ATTR_FLAGS]) {
+ __u32 flags;
+
+ flags = rta_getattr_u32(tb[TCA_TAPRIO_ATTR_FLAGS]);
+ print_0xhex(PRINT_ANY, "flags", " flags %#x", flags);
+ }
+
print_schedule(f, tb);
if (tb[TCA_TAPRIO_ATTR_ADMIN_SCHED]) {
--
2.7.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH iproute2 net-next v5 3/5] taprio: add support for setting txtime_delay.
2019-07-18 19:55 [PATCH iproute2 net-next v5 1/5] etf: Add skip_sock_check Vedang Patel
2019-07-18 19:55 ` [PATCH iproute2 net-next v5 2/5] taprio: Add support for setting flags Vedang Patel
@ 2019-07-18 19:55 ` Vedang Patel
2019-07-18 19:55 ` [PATCH iproute2 net-next v5 4/5] tc: etf: Add documentation for skip_sock_check Vedang Patel
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Vedang Patel @ 2019-07-18 19:55 UTC (permalink / raw)
To: netdev
Cc: jhs, xiyou.wangcong, jiri, stephen, vinicius.gomes,
leandro.maciel.dorileo, jakub.kicinski, m-karicheri2, dsahern,
Vedang Patel
This adds support for setting the txtime_delay parameter which is useful
for the txtime offload mode of taprio.
Signed-off-by: Vedang Patel <vedang.patel@intel.com>
---
tc/q_taprio.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/tc/q_taprio.c b/tc/q_taprio.c
index 1db2aba6efe7..b9954436b0f9 100644
--- a/tc/q_taprio.c
+++ b/tc/q_taprio.c
@@ -52,7 +52,7 @@ static void explain(void)
" [num_tc NUMBER] [map P0 P1 ...] "
" [queues COUNT@OFFSET COUNT@OFFSET COUNT@OFFSET ...] "
" [ [sched-entry index cmd gate-mask interval] ... ] "
- " [base-time time] "
+ " [base-time time] [txtime-delay delay]"
"\n"
"CLOCKID must be a valid SYS-V id (i.e. CLOCK_TAI)\n");
}
@@ -160,6 +160,7 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
struct list_head sched_entries;
struct rtattr *tail, *l;
__u32 taprio_flags = 0;
+ __u32 txtime_delay = 0;
__s64 cycle_time = 0;
__s64 base_time = 0;
int err, idx;
@@ -293,6 +294,17 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
return -1;
}
+ } else if (strcmp(*argv, "txtime-delay") == 0) {
+ NEXT_ARG();
+ if (txtime_delay != 0) {
+ fprintf(stderr, "taprio: duplicate \"txtime-delay\" specification\n");
+ return -1;
+ }
+ if (get_u32(&txtime_delay, *argv, 0)) {
+ PREV_ARG();
+ return -1;
+ }
+
} else if (strcmp(*argv, "help") == 0) {
explain();
return -1;
@@ -315,6 +327,9 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
if (opt.num_tc > 0)
addattr_l(n, 1024, TCA_TAPRIO_ATTR_PRIOMAP, &opt, sizeof(opt));
+ if (txtime_delay)
+ addattr_l(n, 1024, TCA_TAPRIO_ATTR_TXTIME_DELAY, &txtime_delay, sizeof(txtime_delay));
+
if (base_time)
addattr_l(n, 1024, TCA_TAPRIO_ATTR_SCHED_BASE_TIME, &base_time, sizeof(base_time));
@@ -464,6 +479,13 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
print_0xhex(PRINT_ANY, "flags", " flags %#x", flags);
}
+ if (tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]) {
+ __u32 txtime_delay;
+
+ txtime_delay = rta_getattr_s32(tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]);
+ print_uint(PRINT_ANY, "txtime_delay", " txtime delay %d", txtime_delay);
+ }
+
print_schedule(f, tb);
if (tb[TCA_TAPRIO_ATTR_ADMIN_SCHED]) {
--
2.7.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH iproute2 net-next v5 4/5] tc: etf: Add documentation for skip_sock_check.
2019-07-18 19:55 [PATCH iproute2 net-next v5 1/5] etf: Add skip_sock_check Vedang Patel
2019-07-18 19:55 ` [PATCH iproute2 net-next v5 2/5] taprio: Add support for setting flags Vedang Patel
2019-07-18 19:55 ` [PATCH iproute2 net-next v5 3/5] taprio: add support for setting txtime_delay Vedang Patel
@ 2019-07-18 19:55 ` Vedang Patel
2019-07-18 19:55 ` [PATCH iproute2 net-next v5 5/5] tc: taprio: Update documentation Vedang Patel
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Vedang Patel @ 2019-07-18 19:55 UTC (permalink / raw)
To: netdev
Cc: jhs, xiyou.wangcong, jiri, stephen, vinicius.gomes,
leandro.maciel.dorileo, jakub.kicinski, m-karicheri2, dsahern,
Vedang Patel
Document the newly added option (skip_sock_check) on the etf man-page.
Signed-off-by: Vedang Patel <vedang.patel@intel.com>
---
man/man8/tc-etf.8 | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/man/man8/tc-etf.8 b/man/man8/tc-etf.8
index 30a12de7d2c7..4cb3b9e02d6e 100644
--- a/man/man8/tc-etf.8
+++ b/man/man8/tc-etf.8
@@ -106,6 +106,16 @@ referred to as "Launch Time" or "Time-Based Scheduling" by the
documentation of network interface controllers.
The default is for this option to be disabled.
+.TP
+skip_sock_check
+.br
+.BR etf(8)
+currently drops any packet which does not have a socket associated with it or
+if the socket does not have SO_TXTIME socket option set. But, this will not
+work if the launchtime is set by another entity inside the kernel (e.g. some
+other Qdisc). Setting the skip_sock_check will skip checking for a socket
+associated with the packet.
+
.SH EXAMPLES
ETF is used to enforce a Quality of Service. It controls when each
--
2.7.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH iproute2 net-next v5 5/5] tc: taprio: Update documentation
2019-07-18 19:55 [PATCH iproute2 net-next v5 1/5] etf: Add skip_sock_check Vedang Patel
` (2 preceding siblings ...)
2019-07-18 19:55 ` [PATCH iproute2 net-next v5 4/5] tc: etf: Add documentation for skip_sock_check Vedang Patel
@ 2019-07-18 19:55 ` Vedang Patel
2019-07-18 22:48 ` [PATCH iproute2 net-next v5 1/5] etf: Add skip_sock_check David Ahern
2019-07-19 5:12 ` Stephen Hemminger
5 siblings, 0 replies; 8+ messages in thread
From: Vedang Patel @ 2019-07-18 19:55 UTC (permalink / raw)
To: netdev
Cc: jhs, xiyou.wangcong, jiri, stephen, vinicius.gomes,
leandro.maciel.dorileo, jakub.kicinski, m-karicheri2, dsahern,
Vedang Patel
Add documentation for the latest options, flags and txtime-delay, to the
taprio manpage.
This also adds an example to run tc in txtime offload mode.
Signed-off-by: Vedang Patel <vedang.patel@intel.com>
---
man/man8/tc-taprio.8 | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/man/man8/tc-taprio.8 b/man/man8/tc-taprio.8
index 850be9b03649..e1d19ba19089 100644
--- a/man/man8/tc-taprio.8
+++ b/man/man8/tc-taprio.8
@@ -112,6 +112,26 @@ means that traffic class 0 is "active" for that schedule entry.
long that state defined by <command> and <gate mask> should be held
before moving to the next entry.
+.TP
+flags
+.br
+Specifies different modes for taprio. Currently, only txtime-assist is
+supported which can be enabled by setting it to 0x1. In this mode, taprio will
+set the transmit timestamp depending on the interval in which the packet needs
+to be transmitted. It will then utililize the
+.BR etf(8)
+qdisc to sort and transmit the packets at the right time. The second example
+can be used as a reference to configure this mode.
+
+.TP
+txtime-delay
+.br
+This parameter is specific to the txtime offload mode. It specifies the maximum
+time a packet might take to reach the network card from the taprio qdisc. The
+value should always be greater than the delta specified in the
+.BR etf(8)
+qdisc.
+
.SH EXAMPLES
The following example shows how an traffic schedule with three traffic
@@ -137,6 +157,26 @@ reference CLOCK_TAI. The schedule is composed of three entries each of
clockid CLOCK_TAI
.EE
+Following is an example to enable the txtime offload mode in taprio. See
+.BR etf(8)
+for more information about configuring the ETF qdisc.
+
+.EX
+# tc qdisc replace dev eth0 parent root handle 100 taprio \\
+ num_tc 3 \\
+ map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \\
+ queues 1@0 1@0 1@0 \\
+ base-time 1528743495910289987 \\
+ sched-entry S 01 300000 \\
+ sched-entry S 02 300000 \\
+ sched-entry S 04 400000 \\
+ flags 0x1 \\
+ txtime-delay 200000 \\
+ clockid CLOCK_TAI
+
+# tc qdisc replace dev $IFACE parent 100:1 etf skip_skb_check \\
+ offload delta 200000 clockid CLOCK_TAI
+.EE
.SH AUTHORS
Vinicius Costa Gomes <vinicius.gomes@intel.com>
--
2.7.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH iproute2 net-next v5 1/5] etf: Add skip_sock_check
2019-07-18 19:55 [PATCH iproute2 net-next v5 1/5] etf: Add skip_sock_check Vedang Patel
` (3 preceding siblings ...)
2019-07-18 19:55 ` [PATCH iproute2 net-next v5 5/5] tc: taprio: Update documentation Vedang Patel
@ 2019-07-18 22:48 ` David Ahern
2019-07-19 5:12 ` Stephen Hemminger
5 siblings, 0 replies; 8+ messages in thread
From: David Ahern @ 2019-07-18 22:48 UTC (permalink / raw)
To: Vedang Patel, netdev
Cc: jhs, xiyou.wangcong, jiri, stephen, vinicius.gomes,
leandro.maciel.dorileo, jakub.kicinski, m-karicheri2
On 7/18/19 1:55 PM, Vedang Patel wrote:
> ETF Qdisc currently checks for a socket with SO_TXTIME socket option. If
> either is not present, the packet is dropped. In the future commits, we
> want other Qdiscs to add packet with launchtime to the ETF Qdisc. Also,
> there are some packets (e.g. ICMP packets) which may not have a socket
> associated with them. So, add an option to skip this check.
>
> Signed-off-by: Vedang Patel <vedang.patel@intel.com>
> ---
> tc/q_etf.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
applied all to iproute2-next. Thanks
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH iproute2 net-next v5 1/5] etf: Add skip_sock_check
2019-07-18 19:55 [PATCH iproute2 net-next v5 1/5] etf: Add skip_sock_check Vedang Patel
` (4 preceding siblings ...)
2019-07-18 22:48 ` [PATCH iproute2 net-next v5 1/5] etf: Add skip_sock_check David Ahern
@ 2019-07-19 5:12 ` Stephen Hemminger
2019-07-19 21:39 ` Patel, Vedang
5 siblings, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2019-07-19 5:12 UTC (permalink / raw)
To: Vedang Patel
Cc: netdev, jhs, xiyou.wangcong, jiri, vinicius.gomes,
leandro.maciel.dorileo, jakub.kicinski, m-karicheri2, dsahern
On Thu, 18 Jul 2019 12:55:39 -0700
Vedang Patel <vedang.patel@intel.com> wrote:
> - print_string(PRINT_ANY, "deadline_mode", "deadline_mode %s",
> + print_string(PRINT_ANY, "deadline_mode", "deadline_mode %s ",
> (qopt->flags & TC_ETF_DEADLINE_MODE_ON) ? "on" : "off");
> + print_string(PRINT_ANY, "skip_sock_check", "skip_sock_check %s",
> + (qopt->flags & TC_ETF_SKIP_SOCK_CHECK) ? "on" : "off");
These should really be boolean options in JSON, not string values.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH iproute2 net-next v5 1/5] etf: Add skip_sock_check
2019-07-19 5:12 ` Stephen Hemminger
@ 2019-07-19 21:39 ` Patel, Vedang
0 siblings, 0 replies; 8+ messages in thread
From: Patel, Vedang @ 2019-07-19 21:39 UTC (permalink / raw)
To: Stephen Hemminger
Cc: netdev, Jamal Hadi Salim, Cong Wang, Jiri Pirko, Gomes, Vinicius,
Dorileo, Leandro, jakub.kicinski, m-karicheri2, dsahern
> On Jul 18, 2019, at 10:12 PM, Stephen Hemminger <stephen@networkplumber.org> wrote:
>
> On Thu, 18 Jul 2019 12:55:39 -0700
> Vedang Patel <vedang.patel@intel.com> wrote:
>
>> - print_string(PRINT_ANY, "deadline_mode", "deadline_mode %s",
>> + print_string(PRINT_ANY, "deadline_mode", "deadline_mode %s ",
>> (qopt->flags & TC_ETF_DEADLINE_MODE_ON) ? "on" : "off");
>> + print_string(PRINT_ANY, "skip_sock_check", "skip_sock_check %s",
>> + (qopt->flags & TC_ETF_SKIP_SOCK_CHECK) ? "on" : "off");
>
> These should really be boolean options in JSON, not string values.
Ok. Sending out a patch to fix this.
Thanks,
Vedang
^ permalink raw reply [flat|nested] 8+ messages in thread