[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190301160542.6474-8-jiri@resnulli.us>
Date: Fri, 1 Mar 2019 17:05:41 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, mlxsw@...lanox.com, idosch@...lanox.com,
jakub.kicinski@...ronome.com, dirk.vandermerwe@...ronome.com,
f.fainelli@...il.com, andrew@...n.ch, vivien.didelot@...il.com
Subject: [patch net-next RFC 7/8] nfp: register devlink port before netdev
From: Jiri Pirko <jiri@...lanox.com>
Change the init/fini flow and register devlink port instance before
netdev. Now it is needed for correct behavior of switch/parent id
reporting, but in general it makes sense to register devlink port first.
Signed-off-by: Jiri Pirko <jiri@...lanox.com>
---
drivers/net/ethernet/netronome/nfp/nfp_net_main.c | 27 +++++++++++------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
index 08f5fdbd8e41..6ec680482b37 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
@@ -150,34 +150,33 @@ nfp_net_pf_init_vnic(struct nfp_pf *pf, struct nfp_net *nn, unsigned int id)
nn->id = id;
- err = nfp_net_init(nn);
- if (err)
- return err;
-
- nfp_net_debugfs_vnic_add(nn, pf->ddir);
-
if (nn->port) {
err = nfp_devlink_port_register(pf->app, nn->port);
if (err)
- goto err_dfs_clean;
+ return err;
}
- nfp_net_info(nn);
-
if (nfp_net_is_data_vnic(nn)) {
err = nfp_app_vnic_init(pf->app, nn);
if (err)
goto err_devlink_port_clean;
}
+ err = nfp_net_init(nn);
+ if (err)
+ goto err_app_vnic_free;
+
+ nfp_net_debugfs_vnic_add(nn, pf->ddir);
+ nfp_net_info(nn);
+
return 0;
+err_app_vnic_free:
+ if (nfp_net_is_data_vnic(nn))
+ nfp_app_vnic_clean(pf->app, nn);
err_devlink_port_clean:
if (nn->port)
nfp_devlink_port_unregister(nn->port);
-err_dfs_clean:
- nfp_net_debugfs_dir_clean(&nn->debugfs_dir);
- nfp_net_clean(nn);
return err;
}
@@ -218,12 +217,12 @@ nfp_net_pf_alloc_vnics(struct nfp_pf *pf, void __iomem *ctrl_bar,
static void nfp_net_pf_clean_vnic(struct nfp_pf *pf, struct nfp_net *nn)
{
+ nfp_net_debugfs_dir_clean(&nn->debugfs_dir);
+ nfp_net_clean(nn);
if (nfp_net_is_data_vnic(nn))
nfp_app_vnic_clean(pf->app, nn);
if (nn->port)
nfp_devlink_port_unregister(nn->port);
- nfp_net_debugfs_dir_clean(&nn->debugfs_dir);
- nfp_net_clean(nn);
}
static int nfp_net_pf_alloc_irqs(struct nfp_pf *pf)
--
2.14.5
Powered by blists - more mailing lists