Subject: Re: [patch net-next 2/4] net/sched: Introduce sample tc action

From: Roman Mashak <[email-masked]>
Date: Sun, 22 Jan 2017 09:29:50 -0500

Jiri Pirko <[email-masked]> writes:

> From: Yotam Gigi <[email-masked]>
>
> 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).
>

[skip]
> diff --git a/include/uapi/linux/tc_act/tc_sample.h b/include/uapi/linux/tc_act/tc_sample.h
> new file mode 100644
> index 0000000..21378bc
> --- /dev/null
> +++ b/include/uapi/linux/tc_act/tc_sample.h
> @@ -0,0 +1,26 @@
> +#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_PARMS,
> +	TCA_SAMPLE_TM,
> +	TCA_SAMPLE_RATE,
> +	TCA_SAMPLE_TRUNC_SIZE,
> +	TCA_SAMPLE_PSAMPLE_GROUP,
> +	TCA_SAMPLE_PAD,
> +	__TCA_SAMPLE_MAX
> +};

Most of action implementations define TCA_X_TM attribute as 1,
and TCA_X_PARMS as 2 followed by action specific tlvs, it is better to
adhere this style in newly designed actions.

[skip]

-- 
Roman Mashak