From: Jesper Dangaard Brouer <brouer@redhat•com>
To: Daniel Borkmann <daniel@iogearbox•net>
Cc: netdev@vger•kernel.org,
"Daniel Borkmann" <borkmann@iogearbox•net>,
"Alexei Starovoitov" <alexei.starovoitov@gmail•com>,
"Christoph Hellwig" <hch@infradead•org>,
BjörnTöpel <bjorn.topel@intel•com>,
"Magnus Karlsson" <magnus.karlsson@intel•com>,
makita.toshiaki@lab•ntt.co.jp, brouer@redhat•com
Subject: Re: [bpf-next V4 PATCH 1/8] bpf: devmap introduce dev_map_enqueue
Date: Wed, 23 May 2018 13:12:09 +0200 [thread overview]
Message-ID: <20180523131209.553a9089@redhat.com> (raw)
In-Reply-To: <1cb01875-6044-540a-e1f8-0cafd9587ee8@iogearbox.net>
On Wed, 23 May 2018 11:34:22 +0200 Daniel Borkmann <daniel@iogearbox•net> wrote:
> > +int dev_map_enqueue(struct bpf_dtab_netdev *dst, struct xdp_buff *xdp)
> > +{
> > + struct net_device *dev = dst->dev;
> > + struct xdp_frame *xdpf;
> > + int err;
> > +
> > + if (!dev->netdev_ops->ndo_xdp_xmit)
> > + return -EOPNOTSUPP;
> > +
> > + xdpf = convert_to_xdp_frame(xdp);
> > + if (unlikely(!xdpf))
> > + return -EOVERFLOW;
> > +
> > + /* TODO: implement a bulking/enqueue step later */
> > + err = dev->netdev_ops->ndo_xdp_xmit(dev, xdpf);
> > + if (err)
> > + return err;
> > +
> > + return 0;
>
> The 'err' is just unnecessary, lets just do:
>
> return dev->netdev_ops->ndo_xdp_xmit(dev, xdpf);
>
> Later after the other patches this becomes:
>
> return bq_enqueue(dst, xdpf, dev_rx);
I agree, I'll fix this up in V5.
After this patchset gets applied, there are also other opportunities to
do similar micro-optimizations. I have a branch (on top of this
patchset) which does such micro-optimizations (including this) plus
I've looked at the resulting asm-code layout. But my benchmarks only
show a 2 nanosec improvement for all these micro-optimizations (where
the focus is to reduce the asm-code I-cache size of 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:[~2018-05-23 11:12 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-18 13:34 [bpf-next V4 PATCH 0/8] xdp: introduce bulking for ndo_xdp_xmit API Jesper Dangaard Brouer
2018-05-18 13:34 ` [bpf-next V4 PATCH 1/8] bpf: devmap introduce dev_map_enqueue Jesper Dangaard Brouer
2018-05-23 9:34 ` Daniel Borkmann
2018-05-23 11:12 ` Jesper Dangaard Brouer [this message]
2018-05-18 13:34 ` [bpf-next V4 PATCH 2/8] bpf: devmap prepare xdp frames for bulking Jesper Dangaard Brouer
2018-05-23 9:54 ` Daniel Borkmann
2018-05-23 10:29 ` Jesper Dangaard Brouer
2018-05-23 10:45 ` Daniel Borkmann
2018-05-23 10:38 ` Jesper Dangaard Brouer
2018-05-18 13:34 ` [bpf-next V4 PATCH 3/8] xdp: add tracepoint for devmap like cpumap have Jesper Dangaard Brouer
2018-05-23 14:24 ` John Fastabend
2018-05-23 15:04 ` Jesper Dangaard Brouer
2018-05-18 13:34 ` [bpf-next V4 PATCH 4/8] samples/bpf: xdp_monitor use tracepoint xdp:xdp_devmap_xmit Jesper Dangaard Brouer
2018-05-18 13:34 ` [bpf-next V4 PATCH 5/8] xdp: introduce xdp_return_frame_rx_napi Jesper Dangaard Brouer
2018-05-18 20:46 ` Jesper Dangaard Brouer
2018-05-18 13:35 ` [bpf-next V4 PATCH 6/8] xdp: change ndo_xdp_xmit API to support bulking Jesper Dangaard Brouer
2018-05-23 14:42 ` John Fastabend
2018-05-23 15:27 ` Jesper Dangaard Brouer
2018-05-18 13:35 ` [bpf-next V4 PATCH 7/8] xdp/trace: extend tracepoint in devmap with an err Jesper Dangaard Brouer
2018-05-18 20:49 ` Jesper Dangaard Brouer
2018-05-18 13:35 ` [bpf-next V4 PATCH 8/8] samples/bpf: xdp_monitor use err code from tracepoint xdp:xdp_devmap_xmit Jesper Dangaard Brouer
2018-05-18 20:48 ` Jesper Dangaard Brouer
2018-05-23 9:24 ` [bpf-next V4 PATCH 0/8] xdp: introduce bulking for ndo_xdp_xmit API Daniel Borkmann
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=20180523131209.553a9089@redhat.com \
--to=brouer@redhat$(echo .)com \
--cc=alexei.starovoitov@gmail$(echo .)com \
--cc=bjorn.topel@intel$(echo .)com \
--cc=borkmann@iogearbox$(echo .)net \
--cc=daniel@iogearbox$(echo .)net \
--cc=hch@infradead$(echo .)org \
--cc=magnus.karlsson@intel$(echo .)com \
--cc=makita.toshiaki@lab$(echo .)ntt.co.jp \
--cc=netdev@vger$(echo .)kernel.org \
/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