1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 /* Copyright (C) 2017 Netronome Systems, Inc. */
4 #include "../nfpcore/nfp_cpp.h"
5 #include "../nfpcore/nfp_nsp.h"
6 #include "../nfp_app.h"
7 #include "../nfp_main.h"
8 #include "../nfp_net.h"
11 static int nfp_nic_init(struct nfp_app
*app
)
13 struct nfp_pf
*pf
= app
->pf
;
15 if (pf
->eth_tbl
&& pf
->max_data_vnics
!= pf
->eth_tbl
->count
) {
16 nfp_err(pf
->cpp
, "ETH entries don't match vNICs (%d vs %d)\n",
17 pf
->max_data_vnics
, pf
->eth_tbl
->count
);
24 static int nfp_nic_sriov_enable(struct nfp_app
*app
, int num_vfs
)
29 static void nfp_nic_sriov_disable(struct nfp_app
*app
)
33 static int nfp_nic_vnic_init(struct nfp_app
*app
, struct nfp_net
*nn
)
35 return nfp_nic_dcb_init(nn
);
38 static void nfp_nic_vnic_clean(struct nfp_app
*app
, struct nfp_net
*nn
)
40 nfp_nic_dcb_clean(nn
);
43 static int nfp_nic_vnic_alloc(struct nfp_app
*app
, struct nfp_net
*nn
,
46 struct nfp_app_nic_private
*app_pri
= nn
->app_priv
;
49 err
= nfp_app_nic_vnic_alloc(app
, nn
, id
);
53 if (sizeof(*app_pri
)) {
54 nn
->app_priv
= kzalloc(sizeof(*app_pri
), GFP_KERNEL
);
62 static void nfp_nic_vnic_free(struct nfp_app
*app
, struct nfp_net
*nn
)
67 const struct nfp_app_type app_nic
= {
68 .id
= NFP_APP_CORE_NIC
,
72 .vnic_alloc
= nfp_nic_vnic_alloc
,
73 .vnic_free
= nfp_nic_vnic_free
,
74 .sriov_enable
= nfp_nic_sriov_enable
,
75 .sriov_disable
= nfp_nic_sriov_disable
,
77 .vnic_init
= nfp_nic_vnic_init
,
78 .vnic_clean
= nfp_nic_vnic_clean
,