netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Yotam Gigi <yotamg@mellanox.com>, Jiri Pirko <jiri@resnulli.us>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	Ido Schimmel <idosch@mellanox.com>, Elad Raz <eladr@mellanox.com>,
	Nogah Frankel <nogahf@mellanox.com>,
	Or Gerlitz <ogerlitz@mellanox.com>,
	"jhs@mojatatu.com" <jhs@mojatatu.com>,
	"geert+renesas@glider.be" <geert+renesas@glider.be>,
	"stephen@networkplumber.org" <stephen@networkplumber.org>,
	"xiyou.wangcong@gmail.com" <xiyou.wangcong@gmail.com>,
	"linux@roeck-us.net" <linux@roeck-us.net>,
	"roopa@cumulusnetworks.com" <roopa@cumulusnetworks.com>
Subject: Re: [patch net-next 5/8] Introduce sample tc action
Date: Thu, 10 Nov 2016 12:16:26 -0800	[thread overview]
Message-ID: <5824D59A.2000804@gmail.com> (raw)
In-Reply-To: <AM3PR05MB07594EA6AE3C0D4C71FEA155ACB80@AM3PR05MB0759.eurprd05.prod.outlook.com>

On 16-11-10 11:58 AM, Yotam Gigi wrote:
> 
> 
>> -----Original Message-----
>> From: John Fastabend [mailto:john.fastabend@gmail.com]
>> Sent: Thursday, November 10, 2016 9:38 PM
>> To: Jiri Pirko <jiri@resnulli.us>; netdev@vger.kernel.org
>> Cc: davem@davemloft.net; Yotam Gigi <yotamg@mellanox.com>; Ido Schimmel
>> <idosch@mellanox.com>; Elad Raz <eladr@mellanox.com>; Nogah Frankel
>> <nogahf@mellanox.com>; Or Gerlitz <ogerlitz@mellanox.com>;
>> jhs@mojatatu.com; geert+renesas@glider.be; stephen@networkplumber.org;
>> xiyou.wangcong@gmail.com; linux@roeck-us.net; roopa@cumulusnetworks.com
>> Subject: Re: [patch net-next 5/8] Introduce sample tc action
>>
>> On 16-11-10 11:35 AM, John Fastabend wrote:
>>> On 16-11-10 03:23 AM, Jiri Pirko wrote:
>>>> From: Yotam Gigi <yotamg@mellanox.com>
>>>>
>>>> This action allow the user to sample traffic matched by tc classifier.
>>>> The sampling consists of choosing packets randomly, truncating them,
>>>> adding some informative metadata regarding the interface and the original
>>>> packet size and mark them with specific mark, to allow further tc rules to
>>>> match and process. The marked sample packets are then injected into the
>>>> device ingress qdisc using netif_receive_skb.
>>>>
>>>> The packets metadata is packed using the ife encapsulation protocol, and
>>>> the outer packet's ethernet dest, source and eth_type, along with the
>>>> rate, mark and the optional truncation size can be configured from
>>>> userspace.
>>>>
>>>> Example:
>>>> To sample ingress traffic from interface eth1, and redirect the sampled
>>>> the sampled packets to interface dummy0, 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 mark 17
>>>>
>>>> tc filter add parent ffff: dev eth1 protocol all \
>>>> 	   u32 match mark 17 0xff \
>>>> 	   action mirred egress redirect dev dummy0
>>>>
>>>> Where the first command adds an ingress qdisc and the second starts
>>>> sampling every 12'th packet on dev eth1 and marks the sampled packets with
>>>> 17. The third command catches the sampled packets, which are marked with
>>>> 17, and redirects them to dev dummy0.
>>>
>>> The sampling algorithm was not randomized based on the above commit
>>> log? It really needs to be for all the reasons Roopa mentioned earlier.
>>> Did I miss some email on why it didn't get implemented?
>>>
>>> Also there was an indication the already is actually implemented
>>> correctly so don't we need the hw/sw to behave the same. The whole
>>> argument about sw/hw parity, etc.
>>
>> sorry bit of a typo there corrected 2nd paragraph here...
>>
>> Also there was an indication the hardware is already implemented \
>> correctly so don't we need the hw/sw to behave the same. The argument
>> about sw/hw parity, etc.
> 
> Our hardware currently does not support sampling with random behavior, so 
> we did implement it in software too. 
> 
> But, the API is extensible and it is possible to add a random keyword to 
> the tc action to allow random sampling. In that case, the keyword will be
> implemented in sw only and our driver will fail offloading it.
> 

For many use cases this will be limiting but OK maybe this is good
enough for something and we can add a flag/attribute to support random
sampling. Works for me.

  reply	other threads:[~2016-11-10 20:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-10 11:23 [patch net-next 0/8] Add support for offloading packet-sampling Jiri Pirko
2016-11-10 11:23 ` [patch net-next 1/8] Introduce ife encapsulation module Jiri Pirko
2016-11-10 19:17   ` David Miller
2016-11-10 19:52     ` Yotam Gigi
2016-11-10 11:23 ` [patch net-next 2/8] act_ife: Change to use ife module Jiri Pirko
2016-11-10 11:23 ` [patch net-next 3/8] net: ife: Introduce new metadata tlv types Jiri Pirko
2016-11-10 11:23 ` [patch net-next 4/8] net: ife: Introduce packet info packing method Jiri Pirko
2016-11-10 11:23 ` [patch net-next 5/8] Introduce sample tc action Jiri Pirko
2016-11-10 19:35   ` John Fastabend
2016-11-10 19:38     ` John Fastabend
2016-11-10 19:58       ` Yotam Gigi
2016-11-10 20:16         ` John Fastabend [this message]
2016-11-11  8:28       ` Yotam Gigi
2016-11-11 12:43         ` Simon Horman
2016-11-11 14:52           ` John Fastabend
2016-11-11 17:47             ` David Miller
2016-11-11 16:34           ` Yotam Gigi
2016-11-10 11:23 ` [patch net-next 6/8] tc: sample: Add sequence number and sampler_id fields Jiri Pirko
2016-11-10 11:23 ` [patch net-next 7/8] mlxsw: reg: add the Monitoring Packet Sampling Configuration Register Jiri Pirko
2016-11-10 11:23 ` [patch net-next 8/8] mlxsw: packet sample: Add packet sample offloading support Jiri Pirko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5824D59A.2000804@gmail.com \
    --to=john.fastabend@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eladr@mellanox.com \
    --cc=geert+renesas@glider.be \
    --cc=idosch@mellanox.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=linux@roeck-us.net \
    --cc=netdev@vger.kernel.org \
    --cc=nogahf@mellanox.com \
    --cc=ogerlitz@mellanox.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=stephen@networkplumber.org \
    --cc=xiyou.wangcong@gmail.com \
    --cc=yotamg@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).