netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: netdev@vger.kernel.org, John Fastabend <john.fastabend@gmail.com>,
	brouer@redhat.com
Subject: Re: [PATCH net-next 5/5] xdp: get tracepoints xdp_exception and xdp_redirect in sync
Date: Wed, 23 Aug 2017 09:41:18 +0200	[thread overview]
Message-ID: <20170823094118.38010b86@redhat.com> (raw)
In-Reply-To: <599CA26D.7060003@iogearbox.net>

On Tue, 22 Aug 2017 23:30:21 +0200
Daniel Borkmann <daniel@iogearbox.net> wrote:

> On 08/22/2017 10:47 PM, Jesper Dangaard Brouer wrote:
> > Remove the net_device string name from the xdp_exception tracepoint,
> > like the xdp_redirect tracepoint.
> >
> > Align the TP_STRUCT to have common entries between these two
> > tracepoint.
> >
> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> > ---
> >   include/trace/events/xdp.h |   24 ++++++++++++------------
> >   1 file changed, 12 insertions(+), 12 deletions(-)
> >
> > diff --git a/include/trace/events/xdp.h b/include/trace/events/xdp.h
> > index 7511bed80558..6495b0d9d5c7 100644
> > --- a/include/trace/events/xdp.h
> > +++ b/include/trace/events/xdp.h
> > @@ -31,22 +31,22 @@ TRACE_EVENT(xdp_exception,
> >   	TP_ARGS(dev, xdp, act),
> >
> >   	TP_STRUCT__entry(
> > -		__string(name, dev->name)
> >   		__array(u8, prog_tag, 8)
> >   		__field(u32, act)
> > +		__field(int, ifindex)
> >   	),
> >
> >   	TP_fast_assign(
> >   		BUILD_BUG_ON(sizeof(__entry->prog_tag) != sizeof(xdp->tag));
> >   		memcpy(__entry->prog_tag, xdp->tag, sizeof(xdp->tag));
> > -		__assign_str(name, dev->name);
> > -		__entry->act = act;
> > +		__entry->act		= act;
> > +		__entry->ifindex	= dev->ifindex;
> >   	),
> >  
> [...]
> >   TRACE_EVENT(xdp_redirect,
> > @@ -57,26 +57,26 @@ TRACE_EVENT(xdp_redirect,
> >   	TP_ARGS(from_index, to_index, xdp, act, err),
> >
> >   	TP_STRUCT__entry(
> > -		__field(int, from_index)
> > -		__field(int, to_index)
> >   		__array(u8, prog_tag, 8)
> >   		__field(u32, act)
> > +		__field(int, from_index)
> > +		__field(int, to_index)
> >   		__field(int, err)
> >   	),
> >
> >   	TP_fast_assign(
> >   		BUILD_BUG_ON(sizeof(__entry->prog_tag) != sizeof(xdp->tag));
> >   		memcpy(__entry->prog_tag, xdp->tag, sizeof(xdp->tag));
> > +		__entry->act		= act;
> >   		__entry->from_index	= from_index;
> >   		__entry->to_index	= to_index;
> > -		__entry->act = act;  
> 
> If you already get them in sync, could you also make it consistent
> that for both tracepoints in TP_ARGS() we use either ifindex
> directly or device pointer and extract it from TP_fast_assign().
> Right now, it's mixed.

I did this because, in the (bpf_redirect)_map case, I was hoping that
"from_index" could be come the index from the map.  Looking closer at
the devmap design, I cannot see how we can ever know what (the bpf_prog
thinks) is the corresponding map-ingress/from_index.

Based on that, I think we can/should use the device pointer as arg (as
you suggested). And then rename "from_index" to "ifindex", where
ifindex is the XDP ifindex the xdp_buff arrived on.

I guess we can keep the "to_index".  We also need to extend the
tracepoint args with a "map", to let the trace user tell whether the
"to_index" is an ifindex or a map-index.

I'll code this up and submit at V2.
-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

  reply	other threads:[~2017-08-23  7:41 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 20:47 [PATCH net-next 0/5] xdp: more work on xdp tracepoints Jesper Dangaard Brouer
2017-08-22 20:47 ` [PATCH net-next 1/5] xdp: remove bpf_warn_invalid_xdp_redirect Jesper Dangaard Brouer
2017-08-22 21:19   ` Daniel Borkmann
2017-08-22 20:47 ` [PATCH net-next 2/5] xdp: make generic xdp redirect use tracepoint trace_xdp_redirect Jesper Dangaard Brouer
2017-08-22 21:21   ` Daniel Borkmann
2017-08-22 20:47 ` [PATCH net-next 3/5] ixgbe: use return codes from ndo_xdp_xmit that are distinguishable Jesper Dangaard Brouer
2017-08-22 21:21   ` Daniel Borkmann
2017-08-22 20:47 ` [PATCH net-next 4/5] xdp: remove net_device names from xdp_redirect tracepoint Jesper Dangaard Brouer
2017-08-22 21:23   ` Daniel Borkmann
2017-08-22 20:47 ` [PATCH net-next 5/5] xdp: get tracepoints xdp_exception and xdp_redirect in sync Jesper Dangaard Brouer
2017-08-22 21:30   ` Daniel Borkmann
2017-08-23  7:41     ` Jesper Dangaard Brouer [this message]
2017-08-23  8:54       ` Daniel Borkmann
2017-08-23 10:15         ` [V2 PATCH net-next 0/5] xdp: more work on xdp tracepoints Jesper Dangaard Brouer
2017-08-23 10:15           ` [V2 PATCH net-next 1/5] xdp: remove bpf_warn_invalid_xdp_redirect Jesper Dangaard Brouer
2017-08-23 10:15           ` [V2 PATCH net-next 2/5] xdp: make generic xdp redirect use tracepoint trace_xdp_redirect Jesper Dangaard Brouer
2017-08-23 10:15           ` [V2 PATCH net-next 3/5] ixgbe: use return codes from ndo_xdp_xmit that are distinguishable Jesper Dangaard Brouer
2017-08-23 10:15           ` [V2 PATCH net-next 4/5] xdp: remove net_device names from xdp_redirect tracepoint Jesper Dangaard Brouer
2017-08-23 10:58             ` Daniel Borkmann
2017-08-23 10:15           ` [V2 PATCH net-next 5/5] xdp: get tracepoints xdp_exception and xdp_redirect in sync Jesper Dangaard Brouer
2017-08-23 10:59             ` Daniel Borkmann
2017-08-23 11:16           ` [V2 PATCH net-next 0/5] xdp: more work on xdp tracepoints Jesper Dangaard Brouer
2017-08-24  0:07             ` David Miller
2017-08-24 10:32               ` [V3 " Jesper Dangaard Brouer
2017-08-24 10:33                 ` [V3 PATCH net-next 1/5] xdp: remove bpf_warn_invalid_xdp_redirect Jesper Dangaard Brouer
2017-08-24 10:33                 ` [V3 PATCH net-next 2/5] xdp: make generic xdp redirect use tracepoint trace_xdp_redirect Jesper Dangaard Brouer
2017-08-24 10:33                 ` [V3 PATCH net-next 3/5] ixgbe: use return codes from ndo_xdp_xmit that are distinguishable Jesper Dangaard Brouer
2017-08-24 10:33                 ` [V3 PATCH net-next 4/5] xdp: remove net_device names from xdp_redirect tracepoint Jesper Dangaard Brouer
2017-08-24 10:33                 ` [V3 PATCH net-next 5/5] xdp: get tracepoints xdp_exception and xdp_redirect in sync Jesper Dangaard Brouer
2017-08-24 14:46                 ` [V3 PATCH net-next 0/5] xdp: more work on xdp tracepoints John Fastabend
2017-08-24 19:00                 ` David Miller

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=20170823094118.38010b86@redhat.com \
    --to=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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).