[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191017094609.GC2861@localhost.localdomain>
Date: Thu, 17 Oct 2019 11:46:09 +0200
From: Lorenzo Bianconi <lorenzo@...nel.org>
To: Jakub Kicinski <jakub.kicinski@...ronome.com>
Cc: netdev@...r.kernel.org, lorenzo.bianconi@...hat.com,
davem@...emloft.net, thomas.petazzoni@...tlin.com,
brouer@...hat.com, ilias.apalodimas@...aro.org,
matteo.croce@...hat.com, mw@...ihalf.com
Subject: Re: [PATCH v4 net-next 4/7] net: mvneta: add basic XDP support
> 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@...hat.com>
> > Signed-off-by: Lorenzo Bianconi <lorenzo@...nel.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;
> > +}
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists