Commit 335bc0dd authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

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: default avatarJiri Pirko <jiri@mellanox.com>
Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ede1fd18
......@@ -150,37 +150,39 @@ 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 (nn->port) {
err = nfp_devlink_port_register(pf->app, nn->port);
if (err)
return err;
}
err = nfp_net_init(nn);
if (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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment