linux_dsm_epyc7002/include/uapi/linux/tc_act/tc_sample.h
Yotam Gigi 5c5670fae4 net/sched: Introduce sample tc action
This action allows the user to sample traffic matched by tc classifier.
The sampling consists of choosing packets randomly and sampling them using
the psample module. The user can configure the psample group number, the
sampling rate and the packet's truncation (to save kernel-user traffic).

Example:
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.

Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-01-24 13:44:28 -05:00

27 lines
420 B
C

#ifndef __LINUX_TC_SAMPLE_H
#define __LINUX_TC_SAMPLE_H
#include <linux/types.h>
#include <linux/pkt_cls.h>
#include <linux/if_ether.h>
#define TCA_ACT_SAMPLE 26
struct tc_sample {
tc_gen;
};
enum {
TCA_SAMPLE_UNSPEC,
TCA_SAMPLE_TM,
TCA_SAMPLE_PARMS,
TCA_SAMPLE_RATE,
TCA_SAMPLE_TRUNC_SIZE,
TCA_SAMPLE_PSAMPLE_GROUP,
TCA_SAMPLE_PAD,
__TCA_SAMPLE_MAX
};
#define TCA_SAMPLE_MAX (__TCA_SAMPLE_MAX - 1)
#endif