1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 /* Copyright (C) 2017-2018 Netronome Systems, Inc. */
4 #include "nfpcore/nfp_cpp.h"
5 #include "nfpcore/nfp_nsp.h"
11 int nfp_app_nic_vnic_init_phy_port(struct nfp_pf
*pf
, struct nfp_app
*app
,
12 struct nfp_net
*nn
, unsigned int id
)
19 nn
->port
= nfp_port_alloc(app
, NFP_PORT_PHYS_PORT
, nn
->dp
.netdev
);
21 return PTR_ERR(nn
->port
);
23 err
= nfp_port_init_phy_port(pf
, app
, nn
->port
, id
);
25 nfp_port_free(nn
->port
);
29 return nn
->port
->type
== NFP_PORT_INVALID
;
32 int nfp_app_nic_vnic_alloc(struct nfp_app
*app
, struct nfp_net
*nn
,
37 err
= nfp_app_nic_vnic_init_phy_port(app
->pf
, app
, nn
, id
);
39 return err
< 0 ? err
: 0;
41 nfp_net_get_mac_addr(app
->pf
, nn
->dp
.netdev
, nn
->port
);