All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Dimitris Michailidis <d.michailidis@fungible.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH net-next v4 3/8] net/funeth: probing and netdev ops
Date: Wed, 5 Jan 2022 09:46:48 -0800	[thread overview]
Message-ID: <20220105094648.4ff74c9e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <CAOkoqZmxHZ6KTZQPe+w23E_UPYWLNRiU8gVX32EFsNXgyzkucg@mail.gmail.com>

On Wed, 5 Jan 2022 07:52:21 -0800 Dimitris Michailidis wrote:
> On Tue, Jan 4, 2022 at 6:07 PM Jakub Kicinski <kuba@kernel.org> wrote:
> > On Mon,  3 Jan 2022 22:46:52 -0800 Dimitris Michailidis wrote:  
> > > This is the first part of the Fungible ethernet driver. It deals with
> > > device probing, net_device creation, and netdev ops.  
> >  
> > > +static int fun_xdp_setup(struct net_device *dev, struct netdev_bpf *xdp)
> > > +{
> > > +     struct bpf_prog *old_prog, *prog = xdp->prog;
> > > +     struct funeth_priv *fp = netdev_priv(dev);
> > > +     bool reconfig;
> > > +     int rc, i;
> > > +
> > > +     /* XDP uses at most one buffer */
> > > +     if (prog && dev->mtu > XDP_MAX_MTU) {
> > > +             netdev_err(dev, "device MTU %u too large for XDP\n", dev->mtu);
> > > +             NL_SET_ERR_MSG_MOD(xdp->extack,
> > > +                                "Device MTU too large for XDP");
> > > +             return -EINVAL;
> > > +     }
> > > +
> > > +     reconfig = netif_running(dev) && (!!fp->xdp_prog ^ !!prog);
> > > +     if (reconfig) {
> > > +             rc = funeth_close(dev);  
> >
> > Please rework runtime reconfig to not do the close and then open thing.
> > This will prevent users from reconfiguring their NICs at runtime.
> > You should allocate the resources first, then take the datapath down,
> > reconfigure, swap and free the old resources.  
> 
> I imagine you have in mind something like nfp_net_ring_reconfig() but that
> doesn't work as well here. We have the linux part of the data path (ring memory,
> interrupts, etc) and the device part, handled by FW. I can't clone the device
> portion for a quick swap during downtime. Since it involves messages to FW
> updating the device portion is by far the bulk of the work and it needs to be
> during the downtime. Doing Linux allocations before downtime offers little
> improvement I think.

It does - real machines running real workloads will often be under
memory pressure. I've even seen XDP enable / disable fail just due 
to memory fragmentation, with plenty free memory when device rings
are large.

> There is ongoing work for FW to be able to modify live queues. When that
> is available I expect this function will be able to move in and out of XDP with
> no downtime.

> > > +static void fun_destroy_netdev(struct net_device *netdev)
> > > +{
> > > +     if (likely(netdev)) {  
> >
> > defensive programming?  
> 
> Looks that way but I'd rather have this function work with any input.

There's way too much defensive programming in this driver. Unless there
is a legit code path which can pass netdev == NULL you should remove
the check.

  parent reply	other threads:[~2022-01-05 17:46 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04  6:46 [PATCH net-next v4 0/8] new Fungible Ethernet driver Dimitris Michailidis
2022-01-04  6:46 ` [PATCH net-next v4 1/8] PCI: add Fungible vendor ID to pci_ids.h Dimitris Michailidis
2022-01-05  2:09   ` Jakub Kicinski
2022-01-04  6:46 ` [PATCH net-next v4 2/8] net/fungible: Add service module for Fungible drivers Dimitris Michailidis
2022-01-05  1:47   ` Jakub Kicinski
2022-01-05  4:28     ` Dimitris Michailidis
2022-01-05  2:09   ` Jakub Kicinski
2022-01-05  4:49     ` Dimitris Michailidis
2022-01-05  6:12       ` Dimitris Michailidis
2022-01-05 17:32         ` Jakub Kicinski
2022-01-06  0:57           ` Dimitris Michailidis
2022-01-04  6:46 ` [PATCH net-next v4 3/8] net/funeth: probing and netdev ops Dimitris Michailidis
2022-01-05  2:07   ` Jakub Kicinski
2022-01-05 15:52     ` Dimitris Michailidis
2022-01-05 16:12       ` Andrew Lunn
2022-01-07  0:53         ` Dimitris Michailidis
2022-01-07 13:40           ` Andrew Lunn
2022-01-05 17:46       ` Jakub Kicinski [this message]
2022-01-06  8:47         ` Dimitris Michailidis
2022-01-04  6:46 ` [PATCH net-next v4 4/8] net/funeth: ethtool operations Dimitris Michailidis
2022-01-04  6:46 ` [PATCH net-next v4 5/8] net/funeth: devlink support Dimitris Michailidis
2022-01-04  6:46 ` [PATCH net-next v4 6/8] net/funeth: add the data path Dimitris Michailidis
2022-01-04  6:46 ` [PATCH net-next v4 7/8] net/funeth: add kTLS TX control part Dimitris Michailidis
2022-01-04  6:46 ` [PATCH net-next v4 8/8] net/fungible: Kconfig, Makefiles, and MAINTAINERS Dimitris Michailidis

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=20220105094648.4ff74c9e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=d.michailidis@fungible.com \
    --cc=davem@davemloft.net \
    --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.