drivers/net/ethernet/netronome/nfp/nfp_app.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/nfp_app.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/netronome/nfp/nfp_app.c- Extension
.c- Size
- 5445 bytes
- Lines
- 258
- 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
linux/bug.hlinux/lockdep.hlinux/rcupdate.hlinux/skbuff.hlinux/slab.hnfpcore/nfp_cpp.hnfpcore/nfp_nffw.hnfp_app.hnfp_main.hnfp_net.hnfp_net_repr.hnfp_port.h
Detected Declarations
function nfp_check_rhashtable_emptyfunction nfp_app_ndo_initfunction nfp_app_ndo_uninitfunction nfp_app_port_get_stats_countfunction nfp_app_ctrl_msg_allocfunction nfp_reprs_get_lockedfunction nfp_app_reprs_setfunction nfp_app_netdev_feat_changefunction nfp_app_netdev_eventfunction nfp_app_startfunction nfp_app_stopfunction nfp_app_free
Annotated Snippet
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright (C) 2017-2018 Netronome Systems, Inc. */
#include <linux/bug.h>
#include <linux/lockdep.h>
#include <linux/rcupdate.h>
#include <linux/skbuff.h>
#include <linux/slab.h>
#include "nfpcore/nfp_cpp.h"
#include "nfpcore/nfp_nffw.h"
#include "nfp_app.h"
#include "nfp_main.h"
#include "nfp_net.h"
#include "nfp_net_repr.h"
#include "nfp_port.h"
static const struct nfp_app_type *apps[] = {
[NFP_APP_CORE_NIC] = &app_nic,
#ifdef CONFIG_BPF_SYSCALL
[NFP_APP_BPF_NIC] = &app_bpf,
#else
[NFP_APP_BPF_NIC] = &app_nic,
#endif
#ifdef CONFIG_NFP_APP_FLOWER
[NFP_APP_FLOWER_NIC] = &app_flower,
#endif
#ifdef CONFIG_NFP_APP_ABM_NIC
[NFP_APP_ACTIVE_BUFFER_MGMT_NIC] = &app_abm,
#endif
};
void nfp_check_rhashtable_empty(void *ptr, void *arg)
{
WARN_ON_ONCE(1);
}
struct nfp_app *nfp_app_from_netdev(struct net_device *netdev)
{
if (nfp_netdev_is_nfp_net(netdev)) {
struct nfp_net *nn = netdev_priv(netdev);
return nn->app;
}
if (nfp_netdev_is_nfp_repr(netdev)) {
struct nfp_repr *repr = netdev_priv(netdev);
return repr->app;
}
WARN(1, "Unknown netdev type for nfp_app\n");
return NULL;
}
const char *nfp_app_mip_name(struct nfp_app *app)
{
if (!app || !app->pf->mip)
return "";
return nfp_mip_name(app->pf->mip);
}
int nfp_app_ndo_init(struct net_device *netdev)
{
struct nfp_app *app = nfp_app_from_netdev(netdev);
if (!app || !app->type->ndo_init)
return 0;
return app->type->ndo_init(app, netdev);
}
void nfp_app_ndo_uninit(struct net_device *netdev)
{
struct nfp_app *app = nfp_app_from_netdev(netdev);
if (app && app->type->ndo_uninit)
app->type->ndo_uninit(app, netdev);
}
u64 *nfp_app_port_get_stats(struct nfp_port *port, u64 *data)
{
if (!port || !port->app || !port->app->type->port_get_stats)
return data;
return port->app->type->port_get_stats(port->app, port, data);
}
int nfp_app_port_get_stats_count(struct nfp_port *port)
{
if (!port || !port->app || !port->app->type->port_get_stats_count)
Annotation
- Immediate include surface: `linux/bug.h`, `linux/lockdep.h`, `linux/rcupdate.h`, `linux/skbuff.h`, `linux/slab.h`, `nfpcore/nfp_cpp.h`, `nfpcore/nfp_nffw.h`, `nfp_app.h`.
- Detected declarations: `function nfp_check_rhashtable_empty`, `function nfp_app_ndo_init`, `function nfp_app_ndo_uninit`, `function nfp_app_port_get_stats_count`, `function nfp_app_ctrl_msg_alloc`, `function nfp_reprs_get_locked`, `function nfp_app_reprs_set`, `function nfp_app_netdev_feat_change`, `function nfp_app_netdev_event`, `function nfp_app_start`.
- 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.