drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c- Extension
.c- Size
- 27124 bytes
- Lines
- 1121
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/unaligned.hlinux/bitfield.hlinux/delay.hlinux/firmware.hlinux/kernel.hlinux/kthread.hlinux/overflow.hlinux/sizes.hlinux/slab.hnfp.hnfp_cpp.hnfp_nsp.h
Detected Declarations
struct nfp_nsp_dma_bufstruct nfp_nspstruct nfp_nsp_command_argstruct nfp_nsp_command_buf_argstruct eeprom_bufenum nfp_nsp_cmdfunction nfp_nsp_config_modifiedfunction nfp_nsp_config_set_modifiedfunction nfp_nsp_config_idxfunction nfp_nsp_config_set_statefunction nfp_nsp_config_clear_statefunction nfp_nsp_print_extended_errorfunction nfp_nsp_checkfunction nfp_nsp_openfunction nfp_nsp_closefunction nfp_nsp_get_abi_ver_majorfunction nfp_nsp_get_abi_ver_minorfunction nfp_nsp_wait_regfunction __nfp_nsp_commandfunction nfp_nsp_commandfunction nfp_nsp_command_buf_deffunction nfp_nsp_command_buf_dma_sgfunction nfp_nsp_command_buf_dmafunction nfp_nsp_command_buffunction nfp_nsp_waitfunction nfp_nsp_device_soft_resetfunction nfp_nsp_mac_reinitfunction nfp_nsp_load_fw_extended_msgfunction nfp_nsp_load_fwfunction nfp_nsp_write_flashfunction nfp_nsp_read_eth_tablefunction nfp_nsp_write_eth_tablefunction nfp_nsp_read_identifyfunction nfp_nsp_read_sensorsfunction nfp_nsp_load_stored_fwfunction __nfp_nsp_hwinfo_lookupfunction nfp_nsp_hwinfo_lookupfunction nfp_nsp_hwinfo_lookup_optionalfunction nfp_nsp_hwinfo_setfunction nfp_nsp_fw_loadedfunction nfp_nsp_versionsfunction __nfp_nsp_module_eepromfunction nfp_nsp_read_module_eepromfunction nfp_nsp_read_media
Annotated Snippet
struct nfp_nsp_dma_buf {
__le32 chunk_cnt;
__le32 reserved[3];
struct {
__le32 size;
__le32 reserved;
__le64 addr;
} descs[];
};
static const struct {
int code;
const char *msg;
} nsp_errors[] = {
{ 6010, "could not map to phy for port" },
{ 6011, "not an allowed rate/lanes for port" },
{ 6012, "not an allowed rate/lanes for port" },
{ 6013, "high/low error, change other port first" },
{ 6014, "config not found in flash" },
};
struct nfp_nsp {
struct nfp_cpp *cpp;
struct nfp_resource *res;
struct {
u16 major;
u16 minor;
} ver;
/* Eth table config state */
bool modified;
unsigned int idx;
void *entries;
};
/**
* struct nfp_nsp_command_arg - NFP command argument structure
* @code: NFP SP Command Code
* @dma: @buf points to a host buffer, not NSP buffer
* @timeout_sec:Timeout value to wait for completion in seconds
* @option: NFP SP Command Argument
* @buf: NFP SP Buffer Address
* @error_cb: Callback for interpreting option if error occurred
* @error_quiet:Don't print command error/warning. Protocol errors are still
* logged.
*/
struct nfp_nsp_command_arg {
u16 code;
bool dma;
unsigned int timeout_sec;
u32 option;
u64 buf;
void (*error_cb)(struct nfp_nsp *state, u32 ret_val);
bool error_quiet;
};
/**
* struct nfp_nsp_command_buf_arg - NFP command with buffer argument structure
* @arg: NFP command argument structure
* @in_buf: Buffer with data for input
* @in_size: Size of @in_buf
* @out_buf: Buffer for output data
* @out_size: Size of @out_buf
*/
struct nfp_nsp_command_buf_arg {
struct nfp_nsp_command_arg arg;
const void *in_buf;
unsigned int in_size;
void *out_buf;
unsigned int out_size;
};
struct nfp_cpp *nfp_nsp_cpp(struct nfp_nsp *state)
{
return state->cpp;
}
bool nfp_nsp_config_modified(struct nfp_nsp *state)
{
return state->modified;
}
void nfp_nsp_config_set_modified(struct nfp_nsp *state, bool modified)
{
state->modified = modified;
}
void *nfp_nsp_config_entries(struct nfp_nsp *state)
{
return state->entries;
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/bitfield.h`, `linux/delay.h`, `linux/firmware.h`, `linux/kernel.h`, `linux/kthread.h`, `linux/overflow.h`, `linux/sizes.h`.
- Detected declarations: `struct nfp_nsp_dma_buf`, `struct nfp_nsp`, `struct nfp_nsp_command_arg`, `struct nfp_nsp_command_buf_arg`, `struct eeprom_buf`, `enum nfp_nsp_cmd`, `function nfp_nsp_config_modified`, `function nfp_nsp_config_set_modified`, `function nfp_nsp_config_idx`, `function nfp_nsp_config_set_state`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.