public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Roopa Prabhu <roopa@cumulusnetworks•com>
To: Jiri Pirko <jiri@resnulli•us>
Cc: netdev@vger•kernel.org, davem@davemloft•net, yotamg@mellanox•com,
	idosch@mellanox•com, eladr@mellanox•com, nogahf@mellanox•com,
	ogerlitz@mellanox•com, jhs@mojatatu•com, geert+renesas@glider•be,
	stephen@networkplumber•org, xiyou.wangcong@gmail•com,
	linux@roeck-us•net, Shrijeet Mukherjee <shm@cumulusnetworks•com>
Subject: Re: [patch net-next RFC 4/6] Introduce sample tc action
Date: Sat, 15 Oct 2016 10:31:20 -0700	[thread overview]
Message-ID: <580267E8.70801@cumulusnetworks.com> (raw)
In-Reply-To: <58025A90.9010608@cumulusnetworks.com>

On 10/15/16, 9:34 AM, Roopa Prabhu wrote:
> On 10/12/16, 5:41 AM, Jiri Pirko wrote:
>> From: Yotam Gigi <yotam.gi@gmail•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 172 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 eth0 and marks the sampled packets with
>> 17. The command third catches the sampled packets, which are marked with
>> 17, and redirects them to dev dummy0.
>>
>> Signed-off-by: Yotam Gigi <yotamg@mellanox•com>
>> Signed-off-by: Jiri Pirko <jiri@mellanox•com>
> channeling some feedback from Peter Phaal @sflow inline below:
>
>
If it helps, one more thing that came up was using bpf.
They also use bpf filters for pkt sampling in the non-offloaded case:
http://blog.sflow.com/2016/05/berkeley-packet-filter-bpf.html

so, existing apps (like sflow) that care about packet sampling do prefer to use
a socket api for sample delivery: netlink nflog or bpf like socket filters

also, to keep the software and hardware models the same, wondering if ebpf attach
can be a viable option (have not thought about the offloaded case completely yet).
This would give apps more control on attaching sample headers (like sflow) if needed.

thanks,
Roopa

  reply	other threads:[~2016-10-15 17:31 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12 12:41 [patch net-next RFC 0/6] Add support for offloading packet-sampling Jiri Pirko
2016-10-12 12:41 ` [patch net-next RFC 1/6] Introduce ife encapsulation module Jiri Pirko
2016-10-12 12:41 ` [patch net-next RFC 2/6] act_ife: Change to use ife module Jiri Pirko
2016-10-12 12:41 ` [patch net-next RFC 3/6] ife: Introduce new metadata tlv types Jiri Pirko
2016-10-12 12:41 ` [patch net-next RFC 4/6] Introduce sample tc action Jiri Pirko
2016-10-15 16:34   ` Roopa Prabhu
2016-10-15 17:31     ` Roopa Prabhu [this message]
2016-10-17 10:10     ` Jamal Hadi Salim
2016-10-18  0:17       ` Roopa Prabhu
2016-10-18  5:07         ` Roopa Prabhu
2016-10-18 10:58         ` Yotam Gigi
2016-10-19  7:33           ` Roopa Prabhu
2016-10-19  8:28             ` Yotam Gigi
2016-10-16 10:27   ` Or Gerlitz
2016-10-18  8:33     ` Yotam Gigi
2016-10-12 12:41 ` [patch net-next RFC 5/6] mlxsw: reg: add the Monitoring Packet Sampling Configuration Register Jiri Pirko
2016-10-12 12:41 ` [patch net-next RFC 6/6] mlxsw: packet sample: Add packet sample offloading support Jiri Pirko
2016-10-13  7:29 ` [patch net-next RFC 0/6] Add support for offloading packet-sampling Roopa Prabhu
2016-10-13  8:48   ` Jiri Pirko
2016-10-13 11:49     ` Jamal Hadi Salim
2016-10-13 12:10       ` Jiri Pirko
2016-10-13 12:30         ` Jamal Hadi Salim
2016-10-13 12:45           ` Jiri Pirko
2016-10-14  5:02             ` Roopa Prabhu

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=580267E8.70801@cumulusnetworks.com \
    --to=roopa@cumulusnetworks$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=eladr@mellanox$(echo .)com \
    --cc=geert+renesas@glider$(echo .)be \
    --cc=idosch@mellanox$(echo .)com \
    --cc=jhs@mojatatu$(echo .)com \
    --cc=jiri@resnulli$(echo .)us \
    --cc=linux@roeck-us$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=nogahf@mellanox$(echo .)com \
    --cc=ogerlitz@mellanox$(echo .)com \
    --cc=shm@cumulusnetworks$(echo .)com \
    --cc=stephen@networkplumber$(echo .)org \
    --cc=xiyou.wangcong@gmail$(echo .)com \
    --cc=yotamg@mellanox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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