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

nfp: move devlink port type set after netdev registration

Similar to other driver, move the port type set after netdev registration
is done. Along with that, clear the type before unregistration.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 45b86112
...@@ -362,7 +362,6 @@ int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port) ...@@ -362,7 +362,6 @@ int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port)
if (ret) if (ret)
return ret; return ret;
devlink_port_type_eth_set(&port->dl_port, port->netdev);
devlink_port_attrs_set(&port->dl_port, DEVLINK_PORT_FLAVOUR_PHYSICAL, devlink_port_attrs_set(&port->dl_port, DEVLINK_PORT_FLAVOUR_PHYSICAL,
eth_port.label_port, eth_port.is_split, eth_port.label_port, eth_port.is_split,
eth_port.label_subport); eth_port.label_subport);
...@@ -377,6 +376,16 @@ void nfp_devlink_port_unregister(struct nfp_port *port) ...@@ -377,6 +376,16 @@ void nfp_devlink_port_unregister(struct nfp_port *port)
devlink_port_unregister(&port->dl_port); devlink_port_unregister(&port->dl_port);
} }
void nfp_devlink_port_type_eth_set(struct nfp_port *port)
{
devlink_port_type_eth_set(&port->dl_port, port->netdev);
}
void nfp_devlink_port_type_clear(struct nfp_port *port)
{
devlink_port_type_clear(&port->dl_port);
}
struct devlink *nfp_devlink_get_devlink(struct net_device *netdev) struct devlink *nfp_devlink_get_devlink(struct net_device *netdev)
{ {
struct nfp_app *app; struct nfp_app *app;
......
...@@ -160,6 +160,7 @@ nfp_net_pf_init_vnic(struct nfp_pf *pf, struct nfp_net *nn, unsigned int id) ...@@ -160,6 +160,7 @@ nfp_net_pf_init_vnic(struct nfp_pf *pf, struct nfp_net *nn, unsigned int id)
err = nfp_devlink_port_register(pf->app, nn->port); err = nfp_devlink_port_register(pf->app, nn->port);
if (err) if (err)
goto err_dfs_clean; goto err_dfs_clean;
nfp_devlink_port_type_eth_set(nn->port);
} }
nfp_net_info(nn); nfp_net_info(nn);
...@@ -173,8 +174,10 @@ nfp_net_pf_init_vnic(struct nfp_pf *pf, struct nfp_net *nn, unsigned int id) ...@@ -173,8 +174,10 @@ nfp_net_pf_init_vnic(struct nfp_pf *pf, struct nfp_net *nn, unsigned int id)
return 0; return 0;
err_devlink_port_clean: err_devlink_port_clean:
if (nn->port) if (nn->port) {
nfp_devlink_port_type_clear(nn->port);
nfp_devlink_port_unregister(nn->port); nfp_devlink_port_unregister(nn->port);
}
err_dfs_clean: 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);
...@@ -220,8 +223,10 @@ static void nfp_net_pf_clean_vnic(struct nfp_pf *pf, struct nfp_net *nn) ...@@ -220,8 +223,10 @@ 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_unregister(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);
} }
......
...@@ -131,6 +131,8 @@ int nfp_net_refresh_port_table_sync(struct nfp_pf *pf); ...@@ -131,6 +131,8 @@ int nfp_net_refresh_port_table_sync(struct nfp_pf *pf);
int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port); int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port);
void nfp_devlink_port_unregister(struct nfp_port *port); void nfp_devlink_port_unregister(struct nfp_port *port);
void nfp_devlink_port_type_eth_set(struct nfp_port *port);
void nfp_devlink_port_type_clear(struct nfp_port *port);
/** /**
* Mac stats (0x0000 - 0x0200) * Mac stats (0x0000 - 0x0200)
......
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