Subject: Re: [PATCH 3/3, net-next] net: netsec: add XDP support

From: Ilias Apalodimas <[email-masked]>
Date: Fri, 28 Jun 2019 19:47:41 +0300

On Fri, Jun 28, 2019 at 03:35:52PM +0200, Jesper Dangaard Brouer wrote:
> On Fri, 28 Jun 2019 13:39:15 +0300
> Ilias Apalodimas <[email-masked]> wrote:
> 
> > +static int netsec_xdp_setup(struct netsec_priv *priv, struct bpf_prog *prog,
> > +			    struct netlink_ext_ack *extack)
> > +{
> > +	struct net_device *dev = priv->ndev;
> > +	struct bpf_prog *old_prog;
> > +
> > +	/* For now just support only the usual MTU sized frames */
> > +	if (prog && dev->mtu > 1500) {
> > +		NL_SET_ERR_MSG_MOD(extack, "Jumbo frames not supported on XDP");
> > +		return -EOPNOTSUPP;
> > +	}
> > +
> > +	if (netif_running(dev))
> > +		netsec_netdev_stop(dev);
> > +
> > +	/* Detach old prog, if any */
> > +	old_prog = xchg(&priv->xdp_prog, prog);
> > +	if (old_prog)
> > +		bpf_prog_put(old_prog);
> > +
> > +	if (netif_running(dev))
> > +		netsec_netdev_open(dev);
> 
> Shouldn't the if-statement be if (!netif_running(dev))
> 
> > +
This is there to restart the device if it's up already (to rebuild the rings).
This should be fine as-is

> > +	return 0;
> > +}

Thanks
/Ilias