diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2017-06-23 22:12:00 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-25 11:42:01 -0400 |
commit | a7ceb9905eed38454d28c293afc2f0acb7915d00 (patch) | |
tree | 8af74ad27c731adc17acaf5c86bd9d62da97e733 /drivers/net/ethernet/netronome/nfp/nfp_app_nic.c | |
parent | 9daee04ae17fb886008ba222fe8150fcc1d0d8cb (diff) | |
download | blackbird-obmc-linux-a7ceb9905eed38454d28c293afc2f0acb7915d00.tar.gz blackbird-obmc-linux-a7ceb9905eed38454d28c293afc2f0acb7915d00.zip |
nfp: move physical port init into a helper
Move MAC/PHY port init into a helper to make it easier to reuse
it in the representor code.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/netronome/nfp/nfp_app_nic.c')
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/nfp_app_nic.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_app_nic.c b/drivers/net/ethernet/netronome/nfp/nfp_app_nic.c index 83c65e6291ee..7b966bd3d214 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_app_nic.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_app_nic.c @@ -42,6 +42,8 @@ static int nfp_app_nic_vnic_init_phy_port(struct nfp_pf *pf, struct nfp_app *app, struct nfp_net *nn, unsigned int id) { + int err; + if (!pf->eth_tbl) return 0; @@ -49,26 +51,13 @@ nfp_app_nic_vnic_init_phy_port(struct nfp_pf *pf, struct nfp_app *app, if (IS_ERR(nn->port)) return PTR_ERR(nn->port); - nn->port->eth_id = id; - nn->port->eth_port = nfp_net_find_port(pf->eth_tbl, id); - - /* Check if vNIC has external port associated and cfg is OK */ - if (!nn->port->eth_port) { - nfp_err(app->cpp, - "NSP port entries don't match vNICs (no entry for port #%d)\n", - id); + err = nfp_port_init_phy_port(pf, app, nn->port, id); + if (err) { nfp_port_free(nn->port); - return -EINVAL; - } - if (nn->port->eth_port->override_changed) { - nfp_warn(app->cpp, - "Config changed for port #%d, reboot required before port will be operational\n", - id); - nn->port->type = NFP_PORT_INVALID; - return 1; + return err; } - return 0; + return nn->port->type == NFP_PORT_INVALID; } int nfp_app_nic_vnic_init(struct nfp_app *app, struct nfp_net *nn, |