drivers/net/ethernet/netronome/nfp/abm/main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/abm/main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/netronome/nfp/abm/main.c- Extension
.c- Size
- 13606 bytes
- Lines
- 558
- 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/bitfield.hlinux/bitmap.hlinux/etherdevice.hlinux/lockdep.hlinux/netdevice.hlinux/rcupdate.hlinux/rtnetlink.hlinux/slab.h../nfpcore/nfp.h../nfpcore/nfp_cpp.h../nfpcore/nfp_nsp.h../nfp_app.h../nfp_main.h../nfp_net.h../nfp_net_repr.h../nfp_port.hmain.h
Detected Declarations
function nfp_abm_portidfunction nfp_abm_setup_tcfunction nfp_abm_repr_getfunction nfp_abm_spawn_reprfunction nfp_abm_kill_reprfunction nfp_abm_kill_reprsfunction nfp_abm_kill_reprs_allfunction nfp_abm_eswitch_mode_getfunction nfp_abm_eswitch_set_legacyfunction nfp_abm_eswitch_clean_upfunction nfp_abm_eswitch_set_switchdevfunction list_for_each_entryfunction nfp_abm_eswitch_mode_setfunction nfp_abm_vnic_set_macfunction nfp_abm_vnic_allocfunction nfp_abm_vnic_freefunction nfp_abm_vnic_initfunction nfp_abm_port_get_statsfunction nfp_abm_port_get_stats_countfunction nfp_abm_port_get_stats_stringsfunction nfp_abm_fw_init_resetfunction nfp_abm_initfunction nfp_abm_clean
Annotated Snippet
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright (C) 2018 Netronome Systems, Inc. */
#include <linux/bitfield.h>
#include <linux/bitmap.h>
#include <linux/etherdevice.h>
#include <linux/lockdep.h>
#include <linux/netdevice.h>
#include <linux/rcupdate.h>
#include <linux/rtnetlink.h>
#include <linux/slab.h>
#include "../nfpcore/nfp.h"
#include "../nfpcore/nfp_cpp.h"
#include "../nfpcore/nfp_nsp.h"
#include "../nfp_app.h"
#include "../nfp_main.h"
#include "../nfp_net.h"
#include "../nfp_net_repr.h"
#include "../nfp_port.h"
#include "main.h"
static u32 nfp_abm_portid(enum nfp_repr_type rtype, unsigned int id)
{
return FIELD_PREP(NFP_ABM_PORTID_TYPE, rtype) |
FIELD_PREP(NFP_ABM_PORTID_ID, id);
}
static int
nfp_abm_setup_tc(struct nfp_app *app, struct net_device *netdev,
enum tc_setup_type type, void *type_data)
{
struct nfp_repr *repr = netdev_priv(netdev);
struct nfp_port *port;
port = nfp_port_from_netdev(netdev);
if (!port || port->type != NFP_PORT_PF_PORT)
return -EOPNOTSUPP;
switch (type) {
case TC_SETUP_ROOT_QDISC:
return nfp_abm_setup_root(netdev, repr->app_priv, type_data);
case TC_SETUP_QDISC_MQ:
return nfp_abm_setup_tc_mq(netdev, repr->app_priv, type_data);
case TC_SETUP_QDISC_RED:
return nfp_abm_setup_tc_red(netdev, repr->app_priv, type_data);
case TC_SETUP_QDISC_GRED:
return nfp_abm_setup_tc_gred(netdev, repr->app_priv, type_data);
case TC_SETUP_BLOCK:
return nfp_abm_setup_cls_block(netdev, repr, type_data);
default:
return -EOPNOTSUPP;
}
}
static struct net_device *
nfp_abm_repr_get(struct nfp_app *app, u32 port_id, bool *redir_egress)
{
enum nfp_repr_type rtype;
struct nfp_reprs *reprs;
u8 port;
rtype = FIELD_GET(NFP_ABM_PORTID_TYPE, port_id);
port = FIELD_GET(NFP_ABM_PORTID_ID, port_id);
reprs = rcu_dereference(app->reprs[rtype]);
if (!reprs)
return NULL;
if (port >= reprs->num_reprs)
return NULL;
return rcu_dereference(reprs->reprs[port]);
}
static int
nfp_abm_spawn_repr(struct nfp_app *app, struct nfp_abm_link *alink,
enum nfp_port_type ptype)
{
struct net_device *netdev;
enum nfp_repr_type rtype;
struct nfp_reprs *reprs;
struct nfp_repr *repr;
struct nfp_port *port;
unsigned int txqs;
int err;
if (ptype == NFP_PORT_PHYS_PORT) {
rtype = NFP_REPR_TYPE_PHYS_PORT;
txqs = 1;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitmap.h`, `linux/etherdevice.h`, `linux/lockdep.h`, `linux/netdevice.h`, `linux/rcupdate.h`, `linux/rtnetlink.h`, `linux/slab.h`.
- Detected declarations: `function nfp_abm_portid`, `function nfp_abm_setup_tc`, `function nfp_abm_repr_get`, `function nfp_abm_spawn_repr`, `function nfp_abm_kill_repr`, `function nfp_abm_kill_reprs`, `function nfp_abm_kill_reprs_all`, `function nfp_abm_eswitch_mode_get`, `function nfp_abm_eswitch_set_legacy`, `function nfp_abm_eswitch_clean_up`.
- 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.