diff --git a/bash-completion/tc b/bash-completion/tc index 007e1c2e..fe0d51ec 100644 --- a/bash-completion/tc +++ b/bash-completion/tc @@ -323,6 +323,7 @@ _tc_qdisc_options() _tc_once_attr 'limit target tupdate alpha beta' _tc_one_of_list 'bytemode nobytemode' _tc_one_of_list 'ecn noecn' + _tc_one_of_list 'dq_rate_estimator no_dq_rate_estimator' return 0 ;; red) diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h index 903cc2d2..3ac43637 100644 --- a/include/uapi/linux/magic.h +++ b/include/uapi/linux/magic.h @@ -94,5 +94,6 @@ #define ZSMALLOC_MAGIC 0x58295829 #define DMA_BUF_MAGIC 0x444d4142 /* "DMAB" */ #define Z3FOLD_MAGIC 0x33 +#define PPC_CMM_MAGIC 0xc7571590 #endif /* __LINUX_MAGIC_H__ */ diff --git a/man/man7/tc-hfsc.7 b/man/man7/tc-hfsc.7 index 5ae5e6b3..412b4c3b 100644 --- a/man/man7/tc-hfsc.7 +++ b/man/man7/tc-hfsc.7 @@ -56,6 +56,7 @@ RT \- realtime LS \- linkshare UL \- upperlimit SC \- service curve +.RE .fi . .SH "BASICS OF HFSC" diff --git a/man/man8/devlink-dev.8 b/man/man8/devlink-dev.8 index 2c6acbd3..289935db 100644 --- a/man/man8/devlink-dev.8 +++ b/man/man8/devlink-dev.8 @@ -262,6 +262,7 @@ Preparing to flash Flashing 100% .br Flashing done +.RE .SH SEE ALSO .BR devlink (8), diff --git a/man/man8/devlink-port.8 b/man/man8/devlink-port.8 index a639d01f..188bffb7 100644 --- a/man/man8/devlink-port.8 +++ b/man/man8/devlink-port.8 @@ -116,6 +116,7 @@ Split the specified devlink port into four ports. devlink port unsplit pci/0000:01:00.0/1 .RS 4 Unplit the specified previously split devlink port. +.RE .SH SEE ALSO .BR devlink (8), diff --git a/man/man8/devlink-region.8 b/man/man8/devlink-region.8 index ff10cdbd..c6756566 100644 --- a/man/man8/devlink-region.8 +++ b/man/man8/devlink-region.8 @@ -119,6 +119,7 @@ Dump the snapshot taken from cr-space address region with ID 1 devlink region read pci/0000:00:05.0/cr-space snapshot 1 address 0x10 legth 16 .RS 4 Read from address 0x10, 16 Bytes of snapshot ID 1 taken from cr-space address region +.RE .SH SEE ALSO .BR devlink (8), diff --git a/man/man8/devlink-resource.8 b/man/man8/devlink-resource.8 index b8f78806..8c315807 100644 --- a/man/man8/devlink-resource.8 +++ b/man/man8/devlink-resource.8 @@ -66,6 +66,7 @@ Shows the resources of the specified devlink device. devlink resource set pci/0000:01:00.0 /kvd/linear 98304 .RS 4 Sets the size of the specified resource for the specified devlink device. +.RE .SH SEE ALSO .BR devlink (8), diff --git a/man/man8/devlink-sb.8 b/man/man8/devlink-sb.8 index 91b68189..5a5a9bb9 100644 --- a/man/man8/devlink-sb.8 +++ b/man/man8/devlink-sb.8 @@ -310,6 +310,7 @@ Show occupancy for specified port from the snapshot. sudo devlink sb occupancy clearmax pci/0000:03:00.0 .RS 4 Clear watermarks for shared buffer of specified devlink device. +.RE .SH SEE ALSO diff --git a/man/man8/devlink-trap.8 b/man/man8/devlink-trap.8 index 4f079eb8..db19fe4c 100644 --- a/man/man8/devlink-trap.8 +++ b/man/man8/devlink-trap.8 @@ -127,6 +127,7 @@ Show attributes and statistics of a specific packet trap group. devlink trap set pci/0000:01:00.0 trap source_mac_is_multicast action trap .RS 4 Set the action of a specific packet trap to 'trap'. +.RE .SH SEE ALSO .BR devlink (8), diff --git a/man/man8/ip-neighbour.8 b/man/man8/ip-neighbour.8 index bc77b439..f71f18b1 100644 --- a/man/man8/ip-neighbour.8 +++ b/man/man8/ip-neighbour.8 @@ -253,6 +253,7 @@ the prefix selecting the neighbour to query. .TP .BI dev " NAME" get neighbour entry attached to this device. +.RE .SH EXAMPLES .PP diff --git a/man/man8/ip-nexthop.8 b/man/man8/ip-nexthop.8 index da87ca3b..68164f3c 100644 --- a/man/man8/ip-nexthop.8 +++ b/man/man8/ip-nexthop.8 @@ -130,7 +130,6 @@ create a blackhole nexthop .TP ip nexthop delete id ID delete nexthop with given id. -.RE .TP ip nexthop show @@ -154,7 +153,6 @@ show only nexthop groups ip nexthop flush flushes nexthops selected by some criteria. Criteria options are the same as show. -.RE .TP ip nexthop get id ID diff --git a/man/man8/ip.8 b/man/man8/ip.8 index e2bda2a2..1661aa67 100644 --- a/man/man8/ip.8 +++ b/man/man8/ip.8 @@ -382,7 +382,6 @@ Bring up interface x. .RE .PP ip link set x down -.RE .RS 4 Bring down interface x. .RE diff --git a/man/man8/rdma-statistic.8 b/man/man8/rdma-statistic.8 index 541b5d63..e3f4b51b 100644 --- a/man/man8/rdma-statistic.8 +++ b/man/man8/rdma-statistic.8 @@ -162,6 +162,7 @@ List all currently allocated MR's and their counters. rdma statistic show mr mrn 6 .RS 4 Dump a specific MR statistics with mrn 6. Dumps nothing if does not exists. +.RE .SH SEE ALSO .BR rdma (8), diff --git a/man/man8/tc-ctinfo.8 b/man/man8/tc-ctinfo.8 index 9015b844..5b761a8f 100644 --- a/man/man8/tc-ctinfo.8 +++ b/man/man8/tc-ctinfo.8 @@ -161,6 +161,7 @@ tc -s filter show dev eth0 Sent 32890260 bytes 120441 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 .br +.RE .SH SEE ALSO .BR tc (8), .BR tc-cake (8) diff --git a/man/man8/tc-pie.8 b/man/man8/tc-pie.8 index a302132f..bdcfba51 100644 --- a/man/man8/tc-pie.8 +++ b/man/man8/tc-pie.8 @@ -21,6 +21,10 @@ int ] [ .B bytemode | .B nobytemode +] [ +.B dq_rate_estimator +| +.B no_dq_rate_estimator ] .SH DESCRIPTION @@ -71,7 +75,7 @@ alpha and beta are parameters chosen to control the drop probability. These should be in the range between 0 and 32. .SS ecn | noecn -is used to mark packets instead of dropping +is used to mark packets instead of dropping. .B ecn to turn on ecn mode, .B noecn @@ -80,7 +84,7 @@ to turn off ecn mode. By default, is turned off. .SS bytemode | nobytemode -is used to scale drop probability proportional to packet size +is used to scale drop probability proportional to packet size. .B bytemode to turn on bytemode, .B nobytemode @@ -88,21 +92,38 @@ to turn off bytemode. By default, .B bytemode is turned off. +.SS dq_rate_estimator | no_dq_rate_estimator +is used to calculate delay using Little's law. +.B dq_rate_estimator +to turn on dq_rate_estimator, +.B no_dq_rate_estimator +to turn off no_dq_rate_estimator. By default, +.B dq_rate_estimator +is turned off. + .SH EXAMPLES # tc qdisc add dev eth0 root pie # tc -s qdisc show qdisc pie 8036: dev eth0 root refcnt 2 limit 1000p target 15.0ms tupdate 16.0ms alpha 2 beta 20 Sent 31216108 bytes 20800 pkt (dropped 80, overlimits 0 requeues 0) backlog 16654b 11p requeues 0 - prob 0.006161 delay 15666us avg_dq_rate 1159667 + prob 0.006161 delay 15666us pkts_in 20811 overlimit 0 dropped 80 maxq 50 ecn_mark 0 + # tc qdisc add dev eth0 root pie dq_rate_estimator + # tc -s qdisc show + qdisc pie 8036: dev eth0 root refcnt 2 limit 1000p target 15.0ms tupdate 16.0ms alpha 2 beta 20 + Sent 63947420 bytes 42414 pkt (dropped 41, overlimits 0 requeues 0) + backlog 271006b 179p requeues 0 + prob 0.000092 delay 22200us avg_dq_rate 12145996 + pkts_in 41 overlimit 343 dropped 0 maxq 50 ecn_mark 0 + # tc qdisc add dev eth0 root pie limit 100 target 20ms tupdate 30ms ecn # tc -s qdisc show qdisc pie 8036: dev eth0 root refcnt 2 limit 100p target 20.0ms tupdate 32.0ms alpha 2 beta 20 ecn Sent 6591724 bytes 4442 pkt (dropped 27, overlimits 0 requeues 0) backlog 18168b 12p requeues 0 - prob 0.008845 delay 11348us avg_dq_rate 1342773 + prob 0.008845 delay 11348us pkts_in 4454 overlimit 0 dropped 27 maxq 65 ecn_mark 0 # tc qdisc add dev eth0 root pie limit 100 target 50ms tupdate 30ms bytemode @@ -110,7 +131,7 @@ is turned off. qdisc pie 8036: dev eth0 root refcnt 2 limit 100p target 50.0ms tupdate 32.0ms alpha 2 beta 20 bytemode Sent 1616274 bytes 1137 pkt (dropped 0, overlimits 0 requeues 0) backlog 13626b 9p requeues 0 - prob 0.000000 delay 0us avg_dq_rate 0 + prob 0.000000 delay 0us pkts_in 1146 overlimit 0 dropped 0 maxq 23 ecn_mark 0 .SH SEE ALSO diff --git a/man/man8/tc-police.8 b/man/man8/tc-police.8 index bcc5f438..52279755 100644 --- a/man/man8/tc-police.8 +++ b/man/man8/tc-police.8 @@ -116,6 +116,7 @@ continue with the next filter in line (if any). This is the default for exceeding packets. .IP pipe Pass the packet to the next action in line. +.RE .SH EXAMPLES A typical application of the police action is to enforce ingress traffic rate by dropping exceeding packets. Although better done on the sender's side, diff --git a/man/man8/tc-sample.8 b/man/man8/tc-sample.8 index 3e03eba2..c4277caf 100644 --- a/man/man8/tc-sample.8 +++ b/man/man8/tc-sample.8 @@ -67,7 +67,6 @@ group .TP .BI PSAMPLE_ATTR_SAMPLE_RATE The rate the packet was sampled with -.RE .SH OPTIONS .TP @@ -117,8 +116,6 @@ tc filter add dev eth1 parent ffff: matchall \\ .EE .RE -.EE -.RE .SH SEE ALSO .BR tc (8), .BR tc-matchall (8) diff --git a/man/man8/tc-simple.8 b/man/man8/tc-simple.8 index 7363ab56..f565755e 100644 --- a/man/man8/tc-simple.8 +++ b/man/man8/tc-simple.8 @@ -54,7 +54,6 @@ grep the logs to see the logged message .IP 6) 4 display stats again and observe increment by 1 -.RE .EX hadi@noma1:$ tc qdisc add dev eth0 ingress hadi@noma1:$tc filter add dev eth0 parent ffff: protocol ip prio 5 \\ diff --git a/man/man8/tc-skbmod.8 b/man/man8/tc-skbmod.8 index 46418b65..eb3c38fa 100644 --- a/man/man8/tc-skbmod.8 +++ b/man/man8/tc-skbmod.8 @@ -75,6 +75,7 @@ Continue classification with the next filter in line. .B pass Finish classification process and return to calling qdisc for further packet processing. This is the default. +.RE .SH EXAMPLES To start, observe the following filter with a pedit action: diff --git a/man/man8/tc-u32.8 b/man/man8/tc-u32.8 index 2bf2e3e9..a23a1846 100644 --- a/man/man8/tc-u32.8 +++ b/man/man8/tc-u32.8 @@ -490,6 +490,7 @@ Match on source or destination ethernet address. This is dangerous: It assumes an ethernet header is present at the start of the packet. This will probably lead to unexpected things if used with layer three interfaces like e.g. tun or ppp. +.RE .SH EXAMPLES .RS .EX diff --git a/man/man8/tc.8 b/man/man8/tc.8 index b81a396f..d25aadda 100644 --- a/man/man8/tc.8 +++ b/man/man8/tc.8 @@ -828,6 +828,7 @@ Shows classes as ASCII graph on eth0 interface. tc -g -s class show dev eth0 .RS 4 Shows classes as ASCII graph with stats info under each class. +.RE .SH HISTORY .B tc diff --git a/misc/ss.c b/misc/ss.c index c58e5c4d..95f1d37a 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -1290,6 +1290,11 @@ static void render(void) token = buf_token_next(token); } + /* Deal with final end-of-line when the last non-empty field printed + * is not the last field. + */ + if (line_started) + printf("\n"); buf_free_all(); current_field = columns; diff --git a/tc/m_ct.c b/tc/m_ct.c index 8df2f610..45fa4a8c 100644 --- a/tc/m_ct.c +++ b/tc/m_ct.c @@ -359,7 +359,7 @@ static void ct_print_nat(int ct_action, struct rtattr **tb) { size_t done = 0; char out[256] = ""; - bool nat; + bool nat = false; if (!(ct_action & TCA_CT_ACT_NAT)) return; diff --git a/tc/q_pie.c b/tc/q_pie.c index 40982f96..fda98a71 100644 --- a/tc/q_pie.c +++ b/tc/q_pie.c @@ -31,9 +31,10 @@ static void explain(void) { fprintf(stderr, - "Usage: ... pie [ limit PACKETS ][ target TIME us]\n" - " [ tupdate TIME us][ alpha ALPHA ]" - "[beta BETA ][bytemode | nobytemode][ecn | noecn ]\n"); + "Usage: ... pie [ limit PACKETS ] [ target TIME ]\n" + " [ tupdate TIME ] [ alpha ALPHA ] [ beta BETA ]\n" + " [ bytemode | nobytemode ] [ ecn | noecn ]\n" + " [ dq_rate_estimator | no_dq_rate_estimator ]\n"); } #define ALPHA_MAX 32 @@ -49,6 +50,7 @@ static int pie_parse_opt(struct qdisc_util *qu, int argc, char **argv, unsigned int beta = 0; int ecn = -1; int bytemode = -1; + int dq_rate_estimator = -1; struct rtattr *tail; while (argc > 0) { @@ -92,6 +94,10 @@ static int pie_parse_opt(struct qdisc_util *qu, int argc, char **argv, bytemode = 1; } else if (strcmp(*argv, "nobytemode") == 0) { bytemode = 0; + } else if (strcmp(*argv, "dq_rate_estimator") == 0) { + dq_rate_estimator = 1; + } else if (strcmp(*argv, "no_dq_rate_estimator") == 0) { + dq_rate_estimator = 0; } else if (strcmp(*argv, "help") == 0) { explain(); return -1; @@ -120,6 +126,9 @@ static int pie_parse_opt(struct qdisc_util *qu, int argc, char **argv, if (bytemode != -1) addattr_l(n, 1024, TCA_PIE_BYTEMODE, &bytemode, sizeof(bytemode)); + if (dq_rate_estimator != -1) + addattr_l(n, 1024, TCA_PIE_DQ_RATE_ESTIMATOR, + &dq_rate_estimator, sizeof(dq_rate_estimator)); addattr_nest_end(n, tail); return 0; @@ -135,6 +144,7 @@ static int pie_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) unsigned int beta; unsigned int ecn; unsigned int bytemode; + unsigned int dq_rate_estimator; SPRINT_BUF(b1); @@ -182,6 +192,14 @@ static int pie_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) fprintf(f, "bytemode "); } + if (tb[TCA_PIE_DQ_RATE_ESTIMATOR] && + RTA_PAYLOAD(tb[TCA_PIE_DQ_RATE_ESTIMATOR]) >= sizeof(__u32)) { + dq_rate_estimator = + rta_getattr_u32(tb[TCA_PIE_DQ_RATE_ESTIMATOR]); + if (dq_rate_estimator) + fprintf(f, "dq_rate_estimator "); + } + return 0; } @@ -198,9 +216,14 @@ static int pie_print_xstats(struct qdisc_util *qu, FILE *f, st = RTA_DATA(xstats); /*prob is returned as a fracion of maximum integer value */ - fprintf(f, "prob %f delay %uus avg_dq_rate %u\n", - (double)st->prob / UINT64_MAX, st->delay, - st->avg_dq_rate); + fprintf(f, "prob %f delay %uus", + (double)st->prob / (double)UINT64_MAX, st->delay); + + if (st->dq_rate_estimating) + fprintf(f, " avg_dq_rate %u\n", st->avg_dq_rate); + else + fprintf(f, "\n"); + fprintf(f, "pkts_in %u overlimit %u dropped %u maxq %u ecn_mark %u\n", st->packets_in, st->overlimit, st->dropped, st->maxq, st->ecn_mark); diff --git a/tc/tc_util.c b/tc/tc_util.c index afdfc78f..0e70632d 100644 --- a/tc/tc_util.c +++ b/tc/tc_util.c @@ -809,17 +809,28 @@ void print_tcstats2_attr(FILE *fp, struct rtattr *rta, char *prefix, struct rtat if (tbs[TCA_STATS_BASIC]) { struct gnet_stats_basic bs = {0}; + __u64 packets64 = 0; - memcpy(&bs, RTA_DATA(tbs[TCA_STATS_BASIC]), MIN(RTA_PAYLOAD(tbs[TCA_STATS_BASIC]), sizeof(bs))); + if (tbs[TCA_STATS_PKT64]) + packets64 = rta_getattr_u64(tbs[TCA_STATS_PKT64]); + + memcpy(&bs, RTA_DATA(tbs[TCA_STATS_BASIC]), + MIN(RTA_PAYLOAD(tbs[TCA_STATS_BASIC]), sizeof(bs))); print_string(PRINT_FP, NULL, "%s", prefix); print_lluint(PRINT_ANY, "bytes", "Sent %llu bytes", bs.bytes); - print_uint(PRINT_ANY, "packets", " %u pkt", bs.packets); + if (packets64) + print_lluint(PRINT_ANY, "packets", + " %llu pkt", packets64); + else + print_uint(PRINT_ANY, "packets", + " %u pkt", bs.packets); } if (tbs[TCA_STATS_QUEUE]) { struct gnet_stats_queue q = {0}; - memcpy(&q, RTA_DATA(tbs[TCA_STATS_QUEUE]), MIN(RTA_PAYLOAD(tbs[TCA_STATS_QUEUE]), sizeof(q))); + memcpy(&q, RTA_DATA(tbs[TCA_STATS_QUEUE]), + MIN(RTA_PAYLOAD(tbs[TCA_STATS_QUEUE]), sizeof(q))); print_uint(PRINT_ANY, "drops", " (dropped %u", q.drops); print_uint(PRINT_ANY, "overlimits", ", overlimits %u", q.overlimits); @@ -855,7 +866,8 @@ void print_tcstats2_attr(FILE *fp, struct rtattr *rta, char *prefix, struct rtat if (tbs[TCA_STATS_QUEUE]) { struct gnet_stats_queue q = {0}; - memcpy(&q, RTA_DATA(tbs[TCA_STATS_QUEUE]), MIN(RTA_PAYLOAD(tbs[TCA_STATS_QUEUE]), sizeof(q))); + memcpy(&q, RTA_DATA(tbs[TCA_STATS_QUEUE]), + MIN(RTA_PAYLOAD(tbs[TCA_STATS_QUEUE]), sizeof(q))); if (!tbs[TCA_STATS_RATE_EST]) print_string(PRINT_FP, NULL, "\n", ""); print_uint(PRINT_JSON, "backlog", NULL, q.backlog); @@ -870,7 +882,8 @@ void print_tcstats2_attr(FILE *fp, struct rtattr *rta, char *prefix, struct rtat *xstats = tbs[TCA_STATS_APP] ? : NULL; } -void print_tcstats_attr(FILE *fp, struct rtattr *tb[], char *prefix, struct rtattr **xstats) +void print_tcstats_attr(FILE *fp, struct rtattr *tb[], char *prefix, + struct rtattr **xstats) { SPRINT_BUF(b1); @@ -885,25 +898,29 @@ void print_tcstats_attr(FILE *fp, struct rtattr *tb[], char *prefix, struct rtat struct tc_stats st = {}; /* handle case where kernel returns more/less than we know about */ - memcpy(&st, RTA_DATA(tb[TCA_STATS]), MIN(RTA_PAYLOAD(tb[TCA_STATS]), sizeof(st))); + memcpy(&st, RTA_DATA(tb[TCA_STATS]), + MIN(RTA_PAYLOAD(tb[TCA_STATS]), sizeof(st))); - fprintf(fp, "%sSent %llu bytes %u pkts (dropped %u, overlimits %u) ", - prefix, (unsigned long long)st.bytes, st.packets, st.drops, - st.overlimits); + fprintf(fp, + "%sSent %llu bytes %u pkts (dropped %u, overlimits %u) ", + prefix, (unsigned long long)st.bytes, + st.packets, st.drops, st.overlimits); if (st.bps || st.pps || st.qlen || st.backlog) { fprintf(fp, "\n%s", prefix); if (st.bps || st.pps) { fprintf(fp, "rate "); if (st.bps) - fprintf(fp, "%s ", sprint_rate(st.bps, b1)); + fprintf(fp, "%s ", + sprint_rate(st.bps, b1)); if (st.pps) fprintf(fp, "%upps ", st.pps); } if (st.qlen || st.backlog) { fprintf(fp, "backlog "); if (st.backlog) - fprintf(fp, "%s ", sprint_size(st.backlog, b1)); + fprintf(fp, "%s ", + sprint_size(st.backlog, b1)); if (st.qlen) fprintf(fp, "%up ", st.qlen); }