From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: netdev@vger.kernel.org, lorenzo.bianconi@redhat.com,
davem@davemloft.net, thomas.petazzoni@bootlin.com,
brouer@redhat.com, ilias.apalodimas@linaro.org,
matteo.croce@redhat.com, mw@semihalf.com
Subject: Re: [PATCH v4 net-next 4/7] net: mvneta: add basic XDP support
Date: Thu, 17 Oct 2019 11:46:09 +0200 [thread overview]
Message-ID: <20191017094609.GC2861@localhost.localdomain> (raw)
In-Reply-To: <20191016182650.2989ddf4@cakuba.netronome.com>
[-- Attachment #1: Type: text/plain, Size: 1648 bytes --]
> On Wed, 16 Oct 2019 23:03:09 +0200, Lorenzo Bianconi wrote:
> > Add basic XDP support to mvneta driver for devices that rely on software
> > buffer management. Currently supported verdicts are:
> > - XDP_DROP
> > - XDP_PASS
> > - XDP_REDIRECT
> > - XDP_ABORTED
> >
> > - iptables drop:
> > $iptables -t raw -I PREROUTING -p udp --dport 9 -j DROP
> > $nstat -n && sleep 1 && nstat
> > IpInReceives 151169 0.0
> > IpExtInOctets 6953544 0.0
> > IpExtInNoECTPkts 151165 0.0
> >
> > - XDP_DROP via xdp1
> > $./samples/bpf/xdp1 3
> > proto 0: 421419 pkt/s
> > proto 0: 421444 pkt/s
> > proto 0: 421393 pkt/s
> > proto 0: 421440 pkt/s
> > proto 0: 421184 pkt/s
> >
> > Tested-by: Matteo Croce <mcroce@redhat.com>
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
>
> > +static int mvneta_xdp_setup(struct net_device *dev, struct bpf_prog *prog,
> > + struct netlink_ext_ack *extack)
> > +{
> > + struct mvneta_port *pp = netdev_priv(dev);
> > + struct bpf_prog *old_prog;
> > +
> > + if (prog && dev->mtu > MVNETA_MAX_RX_BUF_SIZE) {
> > + NL_SET_ERR_MSG_MOD(extack, "Jumbo frames not supported on XDP");
> > + return -EOPNOTSUPP;
> > + }
> > +
> > + if (netif_running(dev))
> > + mvneta_stop(dev);
>
> Actually if pp->prog && prog you don't have to stop/start, right?
> You just gotta restart if !!pp->prog != !!prog?
uhm..right :). I will fix in in v5.
Regards,
Lorenzo
>
> > + old_prog = xchg(&pp->xdp_prog, prog);
> > + if (old_prog)
> > + bpf_prog_put(old_prog);
> > +
> > + if (netif_running(dev))
> > + return mvneta_open(dev);
> > +
> > + return 0;
> > +}
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2019-10-17 9:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-16 21:03 [PATCH v4 net-next 0/7] add XDP support to mvneta driver Lorenzo Bianconi
2019-10-16 21:03 ` [PATCH v4 net-next 1/7] net: mvneta: introduce mvneta_update_stats routine Lorenzo Bianconi
2019-10-17 1:01 ` Jakub Kicinski
2019-10-16 21:03 ` [PATCH v4 net-next 2/7] net: mvneta: introduce page pool API for sw buffer manager Lorenzo Bianconi
2019-10-17 1:14 ` Jakub Kicinski
2019-10-17 9:58 ` Lorenzo Bianconi
2019-10-16 21:03 ` [PATCH v4 net-next 3/7] net: mvneta: rely on build_skb in mvneta_rx_swbm poll routine Lorenzo Bianconi
2019-10-17 1:19 ` Jakub Kicinski
2019-10-16 21:03 ` [PATCH v4 net-next 4/7] net: mvneta: add basic XDP support Lorenzo Bianconi
2019-10-17 1:26 ` Jakub Kicinski
2019-10-17 9:46 ` Lorenzo Bianconi [this message]
2019-10-16 21:03 ` [PATCH v4 net-next 5/7] net: mvneta: move header prefetch in mvneta_swbm_rx_frame Lorenzo Bianconi
2019-10-16 21:03 ` [PATCH v4 net-next 6/7] net: mvneta: make tx buffer array agnostic Lorenzo Bianconi
2019-10-16 21:03 ` [PATCH v4 net-next 7/7] net: mvneta: add XDP_TX support Lorenzo Bianconi
2019-10-17 1:28 ` Jakub Kicinski
2019-10-17 9:44 ` Lorenzo Bianconi
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=20191017094609.GC2861@localhost.localdomain \
--to=lorenzo@kernel.org \
--cc=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=ilias.apalodimas@linaro.org \
--cc=jakub.kicinski@netronome.com \
--cc=lorenzo.bianconi@redhat.com \
--cc=matteo.croce@redhat.com \
--cc=mw@semihalf.com \
--cc=netdev@vger.kernel.org \
--cc=thomas.petazzoni@bootlin.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 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.