All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciejromanfijalkowski@gmail.com>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>,
	netdev@vger.kernel.org, jaswinder.singh@linaro.org,
	ard.biesheuvel@linaro.org, bjorn.topel@intel.com,
	magnus.karlsson@intel.com, daniel@iogearbox.net, ast@kernel.org,
	makita.toshiaki@lab.ntt.co.jp, jakub.kicinski@netronome.com,
	john.fastabend@gmail.com, davem@davemloft.net
Subject: Re: [PATCH 3/3, net-next] net: netsec: add XDP support
Date: Fri, 28 Jun 2019 19:23:51 +0200	[thread overview]
Message-ID: <20190628192351.00003555@gmail.com> (raw)
In-Reply-To: <20190628164741.GA27936@apalos>

On Fri, 28 Jun 2019 19:47:41 +0300
Ilias Apalodimas <ilias.apalodimas@linaro.org> wrote:

> 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 <ilias.apalodimas@linaro.org> 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

I think that Jesper's concern was about that you could have already stopped the
netdev earlier via netsec_netdev_stop (before the xchg)? So at this point
__LINK_STATE_START might be not set.

Maybe initially store what netif_running(dev) returns in stack variable and
act on it, so your stop/open are symmetric?

> 
> > > +	return 0;
> > > +}  
> 
> Thanks
> /Ilias


  reply	other threads:[~2019-06-28 17:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 10:39 [PATCH 0/3, net-next] net: netsec: Add XDP Support Ilias Apalodimas
2019-06-28 10:39 ` [PATCH 1/3, net-next] net: netsec: Use page_pool API Ilias Apalodimas
2019-06-28 13:03   ` Jesper Dangaard Brouer
2019-06-28 13:04   ` Jesper Dangaard Brouer
2019-06-28 16:43     ` David Miller
2019-06-28 17:19       ` Ilias Apalodimas
2019-06-28 17:41         ` Jesper Dangaard Brouer
2019-06-28 10:39 ` [PATCH 2/3, net-next] net: page_pool: add helper function for retrieving dma direction Ilias Apalodimas
2019-06-28 13:07   ` Jesper Dangaard Brouer
2019-06-28 10:39 ` [PATCH 3/3, net-next] net: netsec: add XDP support Ilias Apalodimas
2019-06-28 13:35   ` Jesper Dangaard Brouer
2019-06-28 16:44     ` David Miller
2019-06-28 16:47     ` Ilias Apalodimas
2019-06-28 17:23       ` Maciej Fijalkowski [this message]
2019-06-28 17:59         ` Ilias Apalodimas

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=20190628192351.00003555@gmail.com \
    --to=maciejromanfijalkowski@gmail.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=ast@kernel.org \
    --cc=bjorn.topel@intel.com \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jakub.kicinski@netronome.com \
    --cc=jaswinder.singh@linaro.org \
    --cc=john.fastabend@gmail.com \
    --cc=magnus.karlsson@intel.com \
    --cc=makita.toshiaki@lab.ntt.co.jp \
    --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.