Commit ea63a69b authored by Julian Anastasov's avatar Julian Anastasov Committed by Stephen Hemminger

iproute2: add support for tcp_metrics

ip tcp_metrics/tcpmetrics

	We support get/del for single entry and dump for
show/flush.

v3:
 - fix rtt/rttvar shifts as suggested by Eric Dumazet
 - show rtt/rttvar usecs as suggested by David Laight
Signed-off-by: default avatarJulian Anastasov <ja@ssi.bg>
parent 6ea3ebaf
/* tcp_metrics.h - TCP Metrics Interface */
#ifndef _LINUX_TCP_METRICS_H
#define _LINUX_TCP_METRICS_H
#include <linux/types.h>
/* NETLINK_GENERIC related info
*/
#define TCP_METRICS_GENL_NAME "tcp_metrics"
#define TCP_METRICS_GENL_VERSION 0x1
enum tcp_metric_index {
TCP_METRIC_RTT,
TCP_METRIC_RTTVAR,
TCP_METRIC_SSTHRESH,
TCP_METRIC_CWND,
TCP_METRIC_REORDERING,
/* Always last. */
__TCP_METRIC_MAX,
};
#define TCP_METRIC_MAX (__TCP_METRIC_MAX - 1)
enum {
TCP_METRICS_ATTR_UNSPEC,
TCP_METRICS_ATTR_ADDR_IPV4, /* u32 */
TCP_METRICS_ATTR_ADDR_IPV6, /* binary */
TCP_METRICS_ATTR_AGE, /* msecs */
TCP_METRICS_ATTR_TW_TSVAL, /* u32, raw, rcv tsval */
TCP_METRICS_ATTR_TW_TS_STAMP, /* s32, sec age */
TCP_METRICS_ATTR_VALS, /* nested +1, u32 */
TCP_METRICS_ATTR_FOPEN_MSS, /* u16 */
TCP_METRICS_ATTR_FOPEN_SYN_DROPS, /* u16, count of drops */
TCP_METRICS_ATTR_FOPEN_SYN_DROP_TS, /* msecs age */
TCP_METRICS_ATTR_FOPEN_COOKIE, /* binary */
__TCP_METRICS_ATTR_MAX,
};
#define TCP_METRICS_ATTR_MAX (__TCP_METRICS_ATTR_MAX - 1)
enum {
TCP_METRICS_CMD_UNSPEC,
TCP_METRICS_CMD_GET,
TCP_METRICS_CMD_DEL,
__TCP_METRICS_CMD_MAX,
};
#define TCP_METRICS_CMD_MAX (__TCP_METRICS_CMD_MAX - 1)
#endif /* _LINUX_TCP_METRICS_H */
......@@ -4,7 +4,7 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \
ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o \
iplink_vlan.o link_veth.o link_gre.o iplink_can.o \
iplink_macvlan.o iplink_macvtap.o ipl2tp.o link_vti.o \
iplink_vxlan.o
iplink_vxlan.o tcp_metrics.o
RTMONOBJ=rtmon.o
......
......@@ -45,7 +45,7 @@ static void usage(void)
" ip [ -force ] -batch filename\n"
"where OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable |\n"
" tunnel | tuntap | maddr | mroute | mrule | monitor | xfrm |\n"
" netns | l2tp }\n"
" netns | l2tp | tcp_metrics }\n"
" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
" -f[amily] { inet | inet6 | ipx | dnet | bridge | link } |\n"
" -l[oops] { maximum-addr-flush-attempts } |\n"
......@@ -78,6 +78,8 @@ static const struct cmd {
{ "tunl", do_iptunnel },
{ "tuntap", do_iptuntap },
{ "tap", do_iptuntap },
{ "tcpmetrics", do_tcp_metrics },
{ "tcp_metrics",do_tcp_metrics },
{ "monitor", do_ipmonitor },
{ "xfrm", do_xfrm },
{ "mroute", do_multiroute },
......
......@@ -42,6 +42,7 @@ extern int do_multirule(int argc, char **argv);
extern int do_netns(int argc, char **argv);
extern int do_xfrm(int argc, char **argv);
extern int do_ipl2tp(int argc, char **argv);
extern int do_tcp_metrics(int argc, char **argv);
static inline int rtm_get_table(struct rtmsg *r, struct rtattr **tb)
{
......
This diff is collapsed.
......@@ -8,7 +8,8 @@ MAN8PAGES = $(TARGETS) ip.8 arpd.8 lnstat.8 routel.8 rtacct.8 rtmon.8 ss.8 \
bridge.8 rtstat.8 ctstat.8 nstat.8 routef.8 \
ip-address.8 ip-addrlabel.8 ip-l2tp.8 ip-link.8 \
ip-maddress.8 ip-monitor.8 ip-mroute.8 ip-neighbour.8 \
ip-netns.8 ip-ntable.8 ip-route.8 ip-rule.8 ip-tunnel.8 ip-xfrm.8
ip-netns.8 ip-ntable.8 ip-route.8 ip-rule.8 ip-tunnel.8 ip-xfrm.8 \
ip-tcp_metrics.8
all: $(TARGETS)
......
.TH "IP\-TCP_METRICS" 8 "23 Aug 2012" "iproute2" "Linux"
.SH "NAME"
ip-tcp_metrics \- management for TCP Metrics
.SH "SYNOPSIS"
.sp
.ad l
.in +8
.ti -8
.B ip
.RI "[ " OPTIONS " ]"
.B tcp_metrics
.RI "{ " COMMAND " | "
.BR help " }"
.sp
.ti -8
.BR "ip tcp_metrics" " { " show " | " flush " }
.IR SELECTOR
.ti -8
.BR "ip tcp_metrics delete " [ " address " ]
.IR ADDRESS
.ti -8
.IR SELECTOR " := "
.RB "[ [ " address " ] "
.IR PREFIX " ]"
.SH "DESCRIPTION"
.B ip tcp_metrics
is used to manipulate entries in the kernel that keep TCP information
for IPv4 and IPv6 destinations. The entries are created when
TCP sockets want to share information for destinations and are
stored in a cache keyed by the destination address. The saved
information may include values for metrics (initially obtained from
routes), recent TSVAL for TIME-WAIT recycling purposes, state for the
Fast Open feature, etc.
For performance reasons the cache can not grow above configured limit
and the older entries are replaced with fresh information, sometimes
reclaimed and used for new destinations. The kernel never removes
entries, they can be flushed only with this tool.
.SS ip tcp_metrics show - show cached entries
.TP
.BI address " PREFIX " (default)
IPv4/IPv6 prefix or address. If no prefix is provided all entries are shown.
.LP
The output may contain the following information:
.BI age " <S.MMM>" sec
- time after the entry was created, reset or updated with metrics
from sockets. The entry is reset and refreshed on use with metrics from
route if the metrics are not updated in last hour. Not all cached values
reset the age on update.
.BI cwnd " <N>"
- CWND metric value
.BI fo_cookie " <HEX-STRING>"
- Cookie value received in SYN-ACK to be used by Fast Open for next SYNs
.BI fo_mss " <N>"
- MSS value received in SYN-ACK to be used by Fast Open for next SYNs
.BI fo_syn_drops " <N>/<S.MMM>" "sec ago"
- Number of drops of initial outgoing Fast Open SYNs with data
detected by monitoring the received SYN-ACK after SYN retransmission.
The seconds show the time after last SYN drop and together with
the drop count can be used to disable Fast Open for some time.
.BI reordering " <N>"
- Reordering metric value
.BI rtt " <N>" us
- RTT metric value
.BI rttvar " <N>" us
- RTTVAR metric value
.BI ssthresh " <SSTHRESH>"
- SSTHRESH metric value
.BI tw_ts " <TSVAL>/<SEC>" "sec ago"
- recent TSVAL and the seconds after saving it into TIME-WAIT socket
.SS ip tcp_metrics delete - delete single entry
.TP
.BI address " ADDRESS " (default)
IPv4/IPv6 address. The address is a required argument.
.SS ip tcp_metrics flush - flush entries
This command flushes the entries selected by some criteria.
.PP
This command has the same arguments as
.B show.
.SH "EXAMPLES"
.PP
ip tcp_metrics show address 192.168.0.0/24
.RS 4
Shows the entries for destinations from subnet
.RE
.PP
ip tcp_metrics show 192.168.0.0/24
.RS 4
The same but address keyword is optional
.RE
.PP
ip tcp_metrics
.RS 4
Show all is the default action
.RE
.PP
ip tcp_metrics delete 192.168.0.1
.RS 4
Removes the entry for 192.168.0.1 from cache.
.RE
.PP
ip tcp_metrics flush 192.168.0.0/24
.RS 4
Removes entries for destinations from subnet
.RE
.PP
ip tcp_metrics flush all
.RS 4
Removes all entries from cache
.RE
.PP
ip -6 tcp_metrics flush all
.RS 4
Removes all IPv6 entries from cache keeping the IPv4 entries.
.RE
.SH SEE ALSO
.br
.BR ip (8)
.SH AUTHOR
Original Manpage by Julian Anastasov <ja@ssi.bg>
......@@ -15,7 +15,7 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
.IR OBJECT " := { "
.BR link " | " addr " | " addrlabel " | " route " | " rule " | " neigh " | "\
ntable " | " tunnel " | " tuntap " | " maddr " | " mroute " | " mrule " | "\
monitor " | " xfrm " | " netns " | " l2tp " }"
monitor " | " xfrm " | " netns " | " l2tp " | " tcp_metrics " }"
.sp
.ti -8
......@@ -160,6 +160,10 @@ host addresses.
.B rule
- rule in routing policy database.
.TP
.B tcp_metrics/tcpmetrics
- manage TCP Metrics
.TP
.B tunnel
- tunnel over IP.
......@@ -220,6 +224,7 @@ was written by Alexey N. Kuznetsov and added in Linux 2.2.
.BR ip-ntable (8),
.BR ip-route (8),
.BR ip-rule (8),
.BR ip-tcp_metrics (8),
.BR ip-tunnel (8),
.BR ip-xfrm (8)
.br
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment