From: Jesper Dangaard Brouer <brouer@redhat.com>
To: John Fastabend <john.fastabend@gmail.com>
Cc: netdev@vger.kernel.org, brouer@redhat.com
Subject: Re: [PATCH 2/2] xdp: adjust xdp redirect tracepoint to include return error code
Date: Thu, 17 Aug 2017 21:28:57 +0200 [thread overview]
Message-ID: <20170817212857.1de3f557@redhat.com> (raw)
In-Reply-To: <5995E472.70609@gmail.com>
On Thu, 17 Aug 2017 11:46:10 -0700 John Fastabend <john.fastabend@gmail.com> wrote:
> On 08/17/2017 09:22 AM, Jesper Dangaard Brouer wrote:
> > The return error code need to be included in the tracepoint
> > xdp:xdp_redirect, else its not possible to distinguish successful or
> > failed XDP_REDIRECT transmits.
> >
> > XDP have no queuing mechanism. Thus, it is fairly easily to overrun a
> > NIC transmit queue. The eBPF program invoking helpers (bpf_redirect
> > or bpf_redirect_map) to redirect a packet doesn't get any feedback
> > whether the packet was actually transmitted.
> >
> > Info on failed transmits in the tracepoint xdp:xdp_redirect, is
> > interesting as this opens for providing a feedback-loop to the
> > receiving XDP program.
> >
> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> > ---
>
> [...]
>
> > @@ -2532,12 +2535,14 @@ int xdp_do_redirect(struct net_device *dev, struct xdp_buff *xdp,
> > ri->map = NULL;
> > if (unlikely(!fwd)) {
> > bpf_warn_invalid_xdp_redirect(index);
> > - return -EINVAL;
> > + err = -EINVAL;
> > + goto out;
>
> It doesn't look like there is a check in trace_xdp_redirect to
> avoid dereferencing a NULL fwd pointer here (*to in trace code
> path). Did I miss something?
Nice that you spotted this in your review, but the __string() macro
used in trace code already takes case of this, see output:
xdp:xdp_redirect: prog=39cf08f65683838a from=ixgbe2 to=(null) action=REDIRECT err=-22
> > }
> >
> > - trace_xdp_redirect(dev, fwd, xdp_prog, XDP_REDIRECT);
> > -
> > - return __bpf_tx_xdp(fwd, NULL, xdp, 0);
> > + err = __bpf_tx_xdp(fwd, NULL, xdp, 0);
> > +out:
> > + trace_xdp_redirect(dev, fwd, xdp_prog, XDP_REDIRECT, err);
> > + return err;
> > }
> > EXPORT_SYMBOL_GPL(xdp_do_redirect);
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
next prev parent reply other threads:[~2017-08-17 19:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-17 16:22 [PATCH 0/2] xdp: adjust xdp redirect tracepoint Jesper Dangaard Brouer
2017-08-17 16:22 ` [PATCH 1/2] ixgbe: change ndo_xdp_xmit return code on xmit errors Jesper Dangaard Brouer
2017-08-17 18:32 ` John Fastabend
2017-08-17 16:22 ` [PATCH 2/2] xdp: adjust xdp redirect tracepoint to include return error code Jesper Dangaard Brouer
2017-08-17 18:46 ` John Fastabend
2017-08-17 19:28 ` Jesper Dangaard Brouer [this message]
2017-08-17 19:43 ` John Fastabend
2017-08-18 12:29 ` Jesper Dangaard Brouer
2017-08-18 12:38 ` Daniel Borkmann
2017-08-18 23:19 ` [PATCH 0/2] xdp: adjust xdp redirect tracepoint 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=20170817212857.1de3f557@redhat.com \
--to=brouer@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.