diff options
author | Jiri Pirko <jiri@mellanox.com> | 2019-03-28 13:56:35 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-03-28 12:55:30 -0700 |
commit | 335bc0dde0120b9e46a726309cf6010e39d56c82 (patch) | |
tree | d5acea554ab1bc9d6724853b99e05cc8866b86a9 /drivers/net | |
parent | ede1fd1851467a107f14faace274479dfe28a36c (diff) | |
download | linux-335bc0dde0120b9e46a726309cf6010e39d56c82.tar.bz2 |
nfp: register devlink port before netdev
Change the init/fini flow and register devlink port instance before
netdev. Now it is needed for correct behavior of phys_port_name
generation, but in general it makes sense to register devlink port
first.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/nfp_net_main.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c index f35278062476..986464d4a206 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c @@ -150,37 +150,39 @@ nfp_net_pf_init_vnic(struct nfp_pf *pf, struct nfp_net *nn, unsigned int id) nn->id = id; + if (nn->port) { + err = nfp_devlink_port_register(pf->app, nn->port); + if (err) + return err; + } + err = nfp_net_init(nn); if (err) - return err; + goto err_devlink_port_clean; 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; + if (nn->port) nfp_devlink_port_type_eth_set(nn->port); - } 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; + goto err_devlink_port_type_clean; } return 0; -err_devlink_port_clean: - if (nn->port) { +err_devlink_port_type_clean: + if (nn->port) nfp_devlink_port_type_clear(nn->port); - nfp_devlink_port_unregister(nn->port); - } -err_dfs_clean: nfp_net_debugfs_dir_clean(&nn->debugfs_dir); nfp_net_clean(nn); +err_devlink_port_clean: + if (nn->port) + nfp_devlink_port_unregister(nn->port); return err; } @@ -223,12 +225,12 @@ static void nfp_net_pf_clean_vnic(struct nfp_pf *pf, struct nfp_net *nn) { if (nfp_net_is_data_vnic(nn)) nfp_app_vnic_clean(pf->app, nn); - if (nn->port) { + if (nn->port) nfp_devlink_port_type_clear(nn->port); - nfp_devlink_port_unregister(nn->port); - } nfp_net_debugfs_dir_clean(&nn->debugfs_dir); nfp_net_clean(nn); + if (nn->port) + nfp_devlink_port_unregister(nn->port); } static int nfp_net_pf_alloc_irqs(struct nfp_pf *pf) |