[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190323133102.60fceb6e@cakuba.netronome.com>
Date: Sat, 23 Mar 2019 13:31:02 -0700
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: Jiri Pirko <jiri@...nulli.us>
Cc: netdev@...r.kernel.org, davem@...emloft.net, mlxsw@...lanox.com,
idosch@...lanox.com, f.fainelli@...il.com, andrew@...n.ch,
vivien.didelot@...il.com
Subject: Re: [patch net-next v2 11/15] nfp: move devlink port type set after
netdev registration
On Fri, 22 Mar 2019 17:56:32 +0100, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@...lanox.com>
>
> 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: Jiri Pirko <jiri@...lanox.com>
> diff --git a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
> index e9eca99cf493..cb59a18ec6a6 100644
> --- a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
> +++ b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
> @@ -362,7 +362,6 @@ int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port)
> if (ret)
> return ret;
>
> - devlink_port_type_eth_set(&port->dl_port, port->netdev);
> devlink_port_attrs_set(&port->dl_port, DEVLINK_PORT_FLAVOUR_PHYSICAL,
> eth_port.label_port, eth_port.is_split,
> eth_port.label_subport);
> @@ -377,6 +376,16 @@ void nfp_devlink_port_unregister(struct nfp_port *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 nfp_app *app;
> diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
> index 08f5fdbd8e41..e29744f2af02 100644
> --- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
> +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
> @@ -169,6 +169,8 @@ nfp_net_pf_init_vnic(struct nfp_pf *pf, struct nfp_net *nn, unsigned int id)
> if (err)
> goto err_devlink_port_clean;
> }
> + if (nn->port)
> + nfp_devlink_port_type_eth_set(nn->port);
>
> return 0;
>
> @@ -218,6 +220,8 @@ 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)
> {
> + if (nn->port)
> + nfp_devlink_port_type_clear(nn->port);
> if (nfp_net_is_data_vnic(nn))
> nfp_app_vnic_clean(pf->app, nn);
Sorry for not noticing right away, I thought you just split my patch in
two, but it seems you reordered the app_vnic_init/clean calls with the
type setting. I'd rather those calls happened on fully initialized
netdev (and port), could you perhaps just take this patch into the
series:
https://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git/commit/?h=devlink-pci-ports&id=1debfdef5aef369412e72f370d11120d309a6a74
> if (nn->port)
Powered by blists - more mailing lists