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) ...@@ -150,37 +150,39 @@ nfp_net_pf_init_vnic(struct nfp_pf *pf, struct nfp_net *nn, unsigned int id)
nn->id = id; nn->id = id;
err = nfp_net_init(nn); if (nn->port) {
err = nfp_devlink_port_register(pf->app, nn->port);
if (err) if (err)
return err; return err;
}
err = nfp_net_init(nn);
if (err)
goto err_devlink_port_clean;
nfp_net_debugfs_vnic_add(nn, pf->ddir); nfp_net_debugfs_vnic_add(nn, pf->ddir);
if (nn->port) { if (nn->port)
err = nfp_devlink_port_register(pf->app, nn->port);
if (err)
goto err_dfs_clean;
nfp_devlink_port_type_eth_set(nn->port); nfp_devlink_port_type_eth_set(nn->port);
}
nfp_net_info(nn); nfp_net_info(nn);
if (nfp_net_is_data_vnic(nn)) { if (nfp_net_is_data_vnic(nn)) {
err = nfp_app_vnic_init(pf->app, nn); err = nfp_app_vnic_init(pf->app, nn);
if (err) if (err)
goto err_devlink_port_clean; goto err_devlink_port_type_clean;
} }
return 0; return 0;
err_devlink_port_clean: err_devlink_port_type_clean:
if (nn->port) { if (nn->port)
nfp_devlink_port_type_clear(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_debugfs_dir_clean(&nn->debugfs_dir);
nfp_net_clean(nn); nfp_net_clean(nn);
err_devlink_port_clean:
if (nn->port)
nfp_devlink_port_unregister(nn->port);
return err; return err;
} }
...@@ -223,12 +225,12 @@ static void nfp_net_pf_clean_vnic(struct nfp_pf *pf, struct nfp_net *nn) ...@@ -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)) if (nfp_net_is_data_vnic(nn))
nfp_app_vnic_clean(pf->app, nn); nfp_app_vnic_clean(pf->app, nn);
if (nn->port) { if (nn->port)
nfp_devlink_port_type_clear(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_debugfs_dir_clean(&nn->debugfs_dir);
nfp_net_clean(nn); nfp_net_clean(nn);
if (nn->port)
nfp_devlink_port_unregister(nn->port);
} }
static int nfp_net_pf_alloc_irqs(struct nfp_pf *pf) 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