mirror_iproute2/include/linux
Yotam Gigi 0b1abd84fb tc: Add support for the sample tc action
The sample tc action allows sampling packets matching a classifier. It
peeks randomly packets, and samples them using the psample netlink
channel. The user can specify the psample group, which the packet will be
sampled to, the sampling rate and the packet truncation (to save
kernel-user traffic).

The sampled packets contain informative metadata, for example, the input
interface and the original packet length.

The action syntax:
tc filter add [...] \
	action sample rate <RATE> group <GROUP> [trunc <SIZE>]
	[...]

Where:
  RATE := The sampling rate which is the ratio of packets observed at the
	  data source to the samples generated
  GROUP := the psample module sampling group
  SIZE := optional truncation size

An example for a common usecase of the sample tc action: to sample ingress
traffic from interface eth1, one may use the commands:

tc qdisc add dev eth1 handle ffff: ingress

tc filter add dev eth1 parent ffff: \
       matchall action sample rate 12 group 4

Where the first command adds an ingress qdisc and the second starts
sampling randomly with an average of one sampled packet per 12 packets
on dev eth1 to psample group 4.

Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
2017-02-06 14:24:52 -08:00
..
can update kernel headers from net-next 2017-01-29 20:31:31 -08:00
hdlc Update kernel headers to 3.8-pre 2012-12-11 11:16:36 -08:00
netfilter add more uapi header files 2017-01-12 17:54:39 -08:00
netfilter_ipv4 update kernel headers to 4.6-rc6 2016-05-13 14:41:45 -07:00
netfilter_ipv6 add more uapi header files 2017-01-12 17:54:39 -08:00
tc_act tc: Add support for the sample tc action 2017-02-06 14:24:52 -08:00
tc_ematch include: remove unused header 2017-01-13 14:11:12 -08:00
atm.h Update kernel headers to 3.8-pre 2012-12-11 11:16:36 -08:00
atmapi.h ATM cell alignment. 2008-04-17 10:04:31 -07:00
atmarp.h add more uapi header files 2017-01-12 17:54:39 -08:00
atmdev.h add more uapi header files 2017-01-12 17:54:39 -08:00
atmioc.h ATM cell alignment. 2008-04-17 10:04:31 -07:00
atmsap.h ATM cell alignment. 2008-04-17 10:04:31 -07:00
bpf_common.h Update kernel headers to 3.18-rc2 2014-10-29 22:32:02 -07:00
bpf.h update kernel headers from net-next 2017-01-29 20:31:31 -08:00
can.h update to 4.9 release headers 2016-12-12 15:06:18 -08:00
devlink.h update kernel headers from net-next 2016-12-09 12:40:07 -08:00
elf-em.h add more uapi header files 2017-01-12 17:54:39 -08:00
fib_rules.h update net-next headers 2016-11-29 11:43:40 -08:00
filter.h update headers to reflect BPF changes 2015-04-29 12:33:24 -07:00
fou.h update kernel headers and add tc_connmark.h 2015-04-13 10:49:33 -07:00
gen_stats.h update kernel headers from net-next 2016-05-13 14:56:31 -07:00
genetlink.h update net-next headers 2016-11-29 11:43:40 -08:00
icmpv6.h add more uapi header files 2017-01-12 17:54:39 -08:00
if_addr.h update kernel headers to net-next 4.0-rc5 2015-03-24 15:45:23 -07:00
if_addrlabel.h Update exported kernel headers 2009-12-26 11:02:25 -08:00
if_alg.h if: add missing kernel headers 2016-06-21 11:24:52 -07:00
if_arp.h Update headers files from net-next 2014-01-20 12:28:42 -08:00
if_bonding.h if: add missing kernel headers 2016-06-21 11:24:52 -07:00
if_bridge.h update headers to 4.8-rc2 net-next 2016-08-25 08:49:07 -07:00
if_ether.h update kernel headers to 4.9-net-next 2016-10-26 11:20:29 -07:00
if_link.h update kernel headers from net-next 2017-01-29 20:31:31 -08:00
if_macsec.h update kernel headers 2016-08-08 08:51:22 -07:00
if_packet.h if: add missing kernel headers 2016-06-21 11:24:52 -07:00
if_tun.h headers update 2015-07-06 14:47:26 -07:00
if_tunnel.h update headers from pre 4.9 (net-next) 2016-10-09 18:55:58 -07:00
if_vlan.h Update kernel headers to 3.9.0-rc1 2013-02-28 08:43:46 -08:00
if.h update kernel headers 2016-12-09 12:38:35 -08:00
ila.h update kernel headers from net-next 2016-05-13 14:56:31 -07:00
in6.h update net-next headers 2016-11-29 11:43:40 -08:00
in_route.h add more uapi header files 2017-01-12 17:54:39 -08:00
in.h update net-next headers 2016-11-29 11:43:40 -08:00
inet_diag.h update kernel headers to 4.9-net-next 2016-10-26 11:20:29 -07:00
ip6_tunnel.h Update headers to 3.7-pre-rc 2012-10-03 08:48:37 -07:00
ip.h add more uapi header files 2017-01-12 17:54:39 -08:00
ipv6.h update kernel headers from net-next 2017-01-29 20:31:31 -08:00
kernel.h add more uapi header files 2017-01-12 17:54:39 -08:00
l2tp.h update to net-next headers (pre 4.10 rc) 2016-12-12 15:26:55 -08:00
libc-compat.h update kernel headers from 4.8-rc4 2016-09-01 09:10:43 -07:00
limits.h add more uapi header files 2017-01-12 17:54:39 -08:00
lwtunnel.h update kernel headers from net-next 2016-12-02 14:54:33 -08:00
magic.h add more uapi header files 2017-01-12 17:54:39 -08:00
mpls_iptunnel.h add tunnel header files from net-next uapi 2015-10-16 16:13:05 -07:00
mpls.h update kernel headers from 4.10 net-next 2017-01-20 09:28:36 -08:00
neighbour.h update kernel headers from net-next 2016-04-24 22:30:46 -07:00
net_namespace.h update headers to 3.20-rc1 2015-02-20 16:58:45 -08:00
netconf.h update kernel headers to 4.6 (pre rc1) 2016-03-21 12:02:32 -07:00
netdevice.h Update kernel headers to net-next 2014-08-04 12:39:49 -07:00
netfilter_ipv4.h Update kernel headers to 3.8-pre 2012-12-11 11:16:36 -08:00
netfilter_ipv6.h add more uapi header files 2017-01-12 17:54:39 -08:00
netfilter.h update net-next headers 2016-11-29 11:43:40 -08:00
netlink_diag.h update kernel headers (net-next) 2016-06-21 11:29:20 -07:00
netlink.h kernel headers update 2017-01-12 17:45:30 -08:00
packet_diag.h Update header files to 3.13-rc2 net-next 2013-12-17 22:32:19 -08:00
param.h add more uapi header files 2017-01-12 17:54:39 -08:00
pkt_cls.h update kernel headers from net-next 2017-01-29 20:31:31 -08:00
pkt_sched.h update headers from pre 4.9 (net-next) 2016-10-09 18:55:58 -07:00
posix_types.h add more uapi header files 2017-01-12 17:54:39 -08:00
rtnetlink.h minor kernel header update 2017-01-09 12:09:26 -08:00
sctp.h update kernel headers from 4.10 net-next 2017-01-20 09:28:36 -08:00
sock_diag.h update kernel headers 2016-04-11 13:44:50 -07:00
socket.h Update kernel headers to 3.8-pre 2012-12-11 11:16:36 -08:00
sockios.h add more uapi header files 2017-01-12 17:54:39 -08:00
stddef.h add more uapi header files 2017-01-12 17:54:39 -08:00
sysctl.h add more uapi header files 2017-01-12 17:54:39 -08:00
sysinfo.h add more uapi header files 2017-01-12 17:54:39 -08:00
tcp_metrics.h update kernel headers from net-next 2016-04-24 22:30:46 -07:00
tcp.h tcp: header file update 2017-02-06 14:08:07 -08:00
tipc_netlink.h update TIPC headers 2016-08-29 11:06:02 -07:00
tipc.h update kernel headers from 4.10 net-next 2017-01-20 09:28:36 -08:00
types.h update kernel headers 2016-12-21 15:58:49 -08:00
unix_diag.h Update header files to 3.13-rc2 net-next 2013-12-17 22:32:19 -08:00
veth.h veth.h move to linux/ 2007-12-25 12:38:08 -08:00
xfrm.h update headers from pre 4.9 (net-next) 2016-10-09 18:55:58 -07:00