1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 /* Copyright (C) 2017 Netronome Systems, Inc. */
3 
4 #include "../nfpcore/nfp_cpp.h"
5 #include "../nfpcore/nfp_nsp.h"
6 #include "../nfp_app.h"
7 #include "../nfp_main.h"
8 
nfp_nic_init(struct nfp_app * app)9 static int nfp_nic_init(struct nfp_app *app)
10 {
11 	struct nfp_pf *pf = app->pf;
12 
13 	if (pf->eth_tbl && pf->max_data_vnics != pf->eth_tbl->count) {
14 		nfp_err(pf->cpp, "ETH entries don't match vNICs (%d vs %d)\n",
15 			pf->max_data_vnics, pf->eth_tbl->count);
16 		return -EINVAL;
17 	}
18 
19 	return 0;
20 }
21 
nfp_nic_sriov_enable(struct nfp_app * app,int num_vfs)22 static int nfp_nic_sriov_enable(struct nfp_app *app, int num_vfs)
23 {
24 	return 0;
25 }
26 
nfp_nic_sriov_disable(struct nfp_app * app)27 static void nfp_nic_sriov_disable(struct nfp_app *app)
28 {
29 }
30 
31 const struct nfp_app_type app_nic = {
32 	.id		= NFP_APP_CORE_NIC,
33 	.name		= "nic",
34 
35 	.init		= nfp_nic_init,
36 	.vnic_alloc	= nfp_app_nic_vnic_alloc,
37 
38 	.sriov_enable	= nfp_nic_sriov_enable,
39 	.sriov_disable	= nfp_nic_sriov_disable,
40 };
41