drivers/net/ethernet/netronome/nfp/nic/main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/nic/main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/netronome/nfp/nic/main.c- Extension
.c- Size
- 1688 bytes
- Lines
- 80
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
../nfpcore/nfp_cpp.h../nfpcore/nfp_nsp.h../nfp_app.h../nfp_main.h../nfp_net.hmain.h
Detected Declarations
function nfp_nic_initfunction nfp_nic_sriov_enablefunction nfp_nic_sriov_disablefunction nfp_nic_vnic_cleanfunction nfp_nic_vnic_allocfunction nfp_nic_vnic_free
Annotated Snippet
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright (C) 2017 Netronome Systems, Inc. */
#include "../nfpcore/nfp_cpp.h"
#include "../nfpcore/nfp_nsp.h"
#include "../nfp_app.h"
#include "../nfp_main.h"
#include "../nfp_net.h"
#include "main.h"
static int nfp_nic_init(struct nfp_app *app)
{
struct nfp_pf *pf = app->pf;
if (pf->eth_tbl && pf->max_data_vnics != pf->eth_tbl->count) {
nfp_err(pf->cpp, "ETH entries don't match vNICs (%d vs %d)\n",
pf->max_data_vnics, pf->eth_tbl->count);
return -EINVAL;
}
return 0;
}
static int nfp_nic_sriov_enable(struct nfp_app *app, int num_vfs)
{
return 0;
}
static void nfp_nic_sriov_disable(struct nfp_app *app)
{
}
static int nfp_nic_vnic_init(struct nfp_app *app, struct nfp_net *nn)
{
return nfp_nic_dcb_init(nn);
}
static void nfp_nic_vnic_clean(struct nfp_app *app, struct nfp_net *nn)
{
nfp_nic_dcb_clean(nn);
}
static int nfp_nic_vnic_alloc(struct nfp_app *app, struct nfp_net *nn,
unsigned int id)
{
struct nfp_app_nic_private *app_pri = nn->app_priv;
int err;
err = nfp_app_nic_vnic_alloc(app, nn, id);
if (err)
return err;
if (sizeof(*app_pri)) {
nn->app_priv = kzalloc_obj(*app_pri);
if (!nn->app_priv)
return -ENOMEM;
}
return 0;
}
static void nfp_nic_vnic_free(struct nfp_app *app, struct nfp_net *nn)
{
kfree(nn->app_priv);
}
const struct nfp_app_type app_nic = {
.id = NFP_APP_CORE_NIC,
.name = "nic",
.init = nfp_nic_init,
.vnic_alloc = nfp_nic_vnic_alloc,
.vnic_free = nfp_nic_vnic_free,
.sriov_enable = nfp_nic_sriov_enable,
.sriov_disable = nfp_nic_sriov_disable,
.vnic_init = nfp_nic_vnic_init,
.vnic_clean = nfp_nic_vnic_clean,
};
Annotation
- Immediate include surface: `../nfpcore/nfp_cpp.h`, `../nfpcore/nfp_nsp.h`, `../nfp_app.h`, `../nfp_main.h`, `../nfp_net.h`, `main.h`.
- Detected declarations: `function nfp_nic_init`, `function nfp_nic_sriov_enable`, `function nfp_nic_sriov_disable`, `function nfp_nic_vnic_clean`, `function nfp_nic_vnic_alloc`, `function nfp_nic_vnic_free`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.