drivers/net/ethernet/mellanox/mlxsw/cmd.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlxsw/cmd.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlxsw/cmd.h- Extension
.h- Size
- 43727 bytes
- Lines
- 1320
- 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
item.h
Detected Declarations
struct mlxsw_coreenum mlxsw_cmd_opcodeenum mlxsw_cmd_statusenum mlxsw_cmd_mbox_config_profile_flood_modeenum mlxsw_cmd_mbox_config_profile_lag_modeenum mlxsw_cmd_mbox_config_profile_cqe_time_stamp_typeenum mlxsw_cmd_mbox_sw2hw_dq_sdq_lpenum mlxsw_cmd_mbox_sw2hw_cq_cqe_verfunction mlxsw_cmd_mbox_freefunction mlxsw_cmd_mbox_zerofunction mlxsw_cmd_exec_infunction mlxsw_cmd_exec_outfunction mlxsw_cmd_exec_nonefunction mlxsw_cmd_query_fwfunction mlxsw_cmd_boardinfofunction mlxsw_cmd_query_aq_capfunction mappedfunction mlxsw_cmd_unmap_fafunction mlxsw_cmd_query_resourcesfunction mlxsw_cmd_config_profile_setfunction mlxsw_cmd_access_regfunction __mlxsw_cmd_sw2hw_dqfunction mlxsw_cmd_sw2hw_sdqfunction mlxsw_cmd_sw2hw_rdqfunction __mlxsw_cmd_hw2sw_dqfunction mlxsw_cmd_hw2sw_sdqfunction mlxsw_cmd_hw2sw_rdqfunction errorfunction mlxsw_cmd_2err_sdqfunction mlxsw_cmd_2err_rdqfunction __mlxsw_cmd_query_dqfunction mlxsw_cmd_query_sdqfunction mlxsw_cmd_query_rdqfunction mlxsw_cmd_sw2hw_cqfunction mlxsw_cmd_hw2sw_cqfunction mlxsw_cmd_query_cqfunction mlxsw_cmd_sw2hw_eqfunction mlxsw_cmd_hw2sw_eqfunction mlxsw_cmd_query_eq
Annotated Snippet
#ifndef _MLXSW_CMD_H
#define _MLXSW_CMD_H
#include "item.h"
#define MLXSW_CMD_MBOX_SIZE 4096
static inline char *mlxsw_cmd_mbox_alloc(void)
{
return kzalloc(MLXSW_CMD_MBOX_SIZE, GFP_KERNEL);
}
static inline void mlxsw_cmd_mbox_free(char *mbox)
{
kfree(mbox);
}
static inline void mlxsw_cmd_mbox_zero(char *mbox)
{
memset(mbox, 0, MLXSW_CMD_MBOX_SIZE);
}
struct mlxsw_core;
int mlxsw_cmd_exec(struct mlxsw_core *mlxsw_core, u16 opcode, u8 opcode_mod,
u32 in_mod, bool out_mbox_direct, bool reset_ok,
char *in_mbox, size_t in_mbox_size,
char *out_mbox, size_t out_mbox_size);
static inline int mlxsw_cmd_exec_in(struct mlxsw_core *mlxsw_core, u16 opcode,
u8 opcode_mod, u32 in_mod, char *in_mbox,
size_t in_mbox_size)
{
return mlxsw_cmd_exec(mlxsw_core, opcode, opcode_mod, in_mod, false,
false, in_mbox, in_mbox_size, NULL, 0);
}
static inline int mlxsw_cmd_exec_out(struct mlxsw_core *mlxsw_core, u16 opcode,
u8 opcode_mod, u32 in_mod,
bool out_mbox_direct,
char *out_mbox, size_t out_mbox_size)
{
return mlxsw_cmd_exec(mlxsw_core, opcode, opcode_mod, in_mod,
out_mbox_direct, false, NULL, 0,
out_mbox, out_mbox_size);
}
static inline int mlxsw_cmd_exec_none(struct mlxsw_core *mlxsw_core, u16 opcode,
u8 opcode_mod, u32 in_mod)
{
return mlxsw_cmd_exec(mlxsw_core, opcode, opcode_mod, in_mod, false,
false, NULL, 0, NULL, 0);
}
enum mlxsw_cmd_opcode {
MLXSW_CMD_OPCODE_QUERY_FW = 0x004,
MLXSW_CMD_OPCODE_QUERY_BOARDINFO = 0x006,
MLXSW_CMD_OPCODE_QUERY_AQ_CAP = 0x003,
MLXSW_CMD_OPCODE_MAP_FA = 0xFFF,
MLXSW_CMD_OPCODE_UNMAP_FA = 0xFFE,
MLXSW_CMD_OPCODE_CONFIG_PROFILE = 0x100,
MLXSW_CMD_OPCODE_ACCESS_REG = 0x040,
MLXSW_CMD_OPCODE_SW2HW_DQ = 0x201,
MLXSW_CMD_OPCODE_HW2SW_DQ = 0x202,
MLXSW_CMD_OPCODE_2ERR_DQ = 0x01E,
MLXSW_CMD_OPCODE_QUERY_DQ = 0x022,
MLXSW_CMD_OPCODE_SW2HW_CQ = 0x016,
MLXSW_CMD_OPCODE_HW2SW_CQ = 0x017,
MLXSW_CMD_OPCODE_QUERY_CQ = 0x018,
MLXSW_CMD_OPCODE_SW2HW_EQ = 0x013,
MLXSW_CMD_OPCODE_HW2SW_EQ = 0x014,
MLXSW_CMD_OPCODE_QUERY_EQ = 0x015,
MLXSW_CMD_OPCODE_QUERY_RESOURCES = 0x101,
};
static inline const char *mlxsw_cmd_opcode_str(u16 opcode)
{
switch (opcode) {
case MLXSW_CMD_OPCODE_QUERY_FW:
return "QUERY_FW";
case MLXSW_CMD_OPCODE_QUERY_BOARDINFO:
return "QUERY_BOARDINFO";
case MLXSW_CMD_OPCODE_QUERY_AQ_CAP:
return "QUERY_AQ_CAP";
case MLXSW_CMD_OPCODE_MAP_FA:
return "MAP_FA";
case MLXSW_CMD_OPCODE_UNMAP_FA:
return "UNMAP_FA";
case MLXSW_CMD_OPCODE_CONFIG_PROFILE:
return "CONFIG_PROFILE";
Annotation
- Immediate include surface: `item.h`.
- Detected declarations: `struct mlxsw_core`, `enum mlxsw_cmd_opcode`, `enum mlxsw_cmd_status`, `enum mlxsw_cmd_mbox_config_profile_flood_mode`, `enum mlxsw_cmd_mbox_config_profile_lag_mode`, `enum mlxsw_cmd_mbox_config_profile_cqe_time_stamp_type`, `enum mlxsw_cmd_mbox_sw2hw_dq_sdq_lp`, `enum mlxsw_cmd_mbox_sw2hw_cq_cqe_ver`, `function mlxsw_cmd_mbox_free`, `function mlxsw_cmd_mbox_zero`.
- 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.