netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Daniel Borkmann <borkmann@iogearbox.net>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	netdev@vger.kernel.org,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	brouer@redhat.com
Subject: Re: [PATCH net-next] net: add network device notifier trace points
Date: Wed, 19 Dec 2018 17:40:49 +0100	[thread overview]
Message-ID: <20181219174049.36952782@redhat.com> (raw)
In-Reply-To: <d1c3a477-f0fe-2c62-84c6-e29ad9be828c@iogearbox.net>

On Wed, 19 Dec 2018 16:46:05 +0100
Daniel Borkmann <borkmann@iogearbox.net> wrote:

> Hmm, why not just doing something as in your example below with napi_poll()
> where you pass in the napi pointer, and then use bpf_probe_read_str() on
> ctx->dev for fetching the name? At least there this should work and should
> be okay given it's rather slow-path event.
> 
> > [1] https://github.com/netoptimizer/prototype-kernel/blob/master/kernel/samples/bpf/napi_monitor_kern.c#L34-L130

I didn't try to use bpf_probe_read_str() in [1], but that is also not
what I want in my use-case.  I don't want the name, but the ifindex to
filter on, as it will be faster.  My use-case is allowing my
napi_monitor program to filter on a specific net_device, inside the
kernel via BPF.

E.g. this didn't work:
 bpf_probe_read(&ifindex, 4, &ctx->napi->dev->ifindex);

Perhaps you know how I can do this deref correctly?

My napi_monitor use-case is not a slow-path event, even-though in
optimal cases we should handle 64 packets per tracepoint invocation,
but I'm using this for 100G NICs with >20Mpps. And I mostly use the
tool when something looks wrong and I don't see 64 packet bulks, which
is also why I detect when this gets invoked from idle task or from
ksoftirqd.

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

  reply	other threads:[~2018-12-19 16:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-19  2:27 [PATCH net-next] net: add network device notifier trace points Stephen Hemminger
2018-12-19  3:38 ` David Ahern
2018-12-19  7:36 ` Jesper Dangaard Brouer
2018-12-19 15:43   ` Stephen Hemminger
2018-12-19 15:46   ` Daniel Borkmann
2018-12-19 16:40     ` Jesper Dangaard Brouer [this message]
2018-12-19 16:55       ` Steven Rostedt
2018-12-19 17:07       ` Daniel Borkmann
2018-12-19 15:51   ` Steven Rostedt
2018-12-19 16:48   ` David Ahern

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=20181219174049.36952782@redhat.com \
    --to=brouer@redhat.com \
    --cc=acme@redhat.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=borkmann@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=stephen@networkplumber.org \
    --cc=sthemmin@microsoft.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).