drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h- Extension
.h- Size
- 19779 bytes
- Lines
- 535
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/kernel.hlinux/sched.hlinux/if_link.hlinux/firmware.hlinux/mlx5/cq.hlinux/mlx5/fs.hlinux/mlx5/driver.hlib/devcom.h
Detected Declarations
struct mlx5_cmd_allow_other_vhca_access_attrstruct mlx5_cmd_alias_obj_create_attrstruct mlx5_port_eth_protostruct mlx5_module_eeprom_query_paramsstruct mlx5_link_infoenum mlx5_semaphore_space_addressfunction mlx5_printkfunction mlx5_flexible_inlenfunction mlx5_st_createfunction mlx5_st_destroyfunction mlx5e_initfunction mlx5e_cleanupfunction mlx5_rescan_driversfunction mlx5_core_is_sffunction mlx5_sf_coredev_to_adevfunction mlx5_sriov_get_vf_total_msixfunction mlx5_core_ec_vf_vport_basefunction mlx5_core_ec_sriov_enabledfunction mlx5_core_is_ec_vf_vportfunction mlx5_vport_to_func_idfunction mlx5_max_eq_cap_getfunction mlx5_pcie_cong_event_supported
Annotated Snippet
struct mlx5_cmd_allow_other_vhca_access_attr {
u16 obj_type;
u32 obj_id;
u8 access_key[ACCESS_KEY_LEN];
};
struct mlx5_cmd_alias_obj_create_attr {
u32 obj_id;
u16 vhca_id;
u8 vhca_id_type;
u16 obj_type;
u8 access_key[ACCESS_KEY_LEN];
};
struct mlx5_port_eth_proto {
u32 cap;
u32 admin;
u32 oper;
};
struct mlx5_module_eeprom_query_params {
u16 size;
u16 offset;
u16 i2c_address;
u32 page;
u32 bank;
u32 module_number;
};
struct mlx5_link_info {
u32 speed;
u32 lanes;
};
static inline void mlx5_printk(struct mlx5_core_dev *dev, int level, const char *format, ...)
{
struct device *device = dev->device;
struct va_format vaf;
va_list args;
if (WARN_ONCE(level < LOGLEVEL_EMERG || level > LOGLEVEL_DEBUG,
"Level %d is out of range, set to default level\n", level))
level = LOGLEVEL_DEFAULT;
va_start(args, format);
vaf.fmt = format;
vaf.va = &args;
dev_printk_emit(level, device, "%s %s: %pV", dev_driver_string(device), dev_name(device),
&vaf);
va_end(args);
}
#define mlx5_log(__dev, level, format, ...) \
mlx5_printk(__dev, level, "%s:%d:(pid %d): " format, \
__func__, __LINE__, current->pid, \
##__VA_ARGS__)
static inline struct device *mlx5_core_dma_dev(struct mlx5_core_dev *dev)
{
return &dev->pdev->dev;
}
enum {
MLX5_CMD_DATA, /* print command payload only */
MLX5_CMD_TIME, /* print command execution time */
};
enum {
MLX5_DRIVER_STATUS_ABORTED = 0xfe,
MLX5_DRIVER_SYND = 0xbadd00de,
};
enum mlx5_semaphore_space_address {
MLX5_SEMAPHORE_SPACE_DOMAIN = 0xA,
MLX5_SEMAPHORE_SW_RESET = 0x20,
};
#define MLX5_DEFAULT_PROF 2
#define MLX5_SF_PROF 3
#define MLX5_NUM_FW_CMD_THREADS 8
#define MLX5_DEV_MAX_WQS MLX5_NUM_FW_CMD_THREADS
static inline int mlx5_flexible_inlen(struct mlx5_core_dev *dev, size_t fixed,
size_t item_size, size_t num_items,
const char *func, int line)
{
int inlen;
if (fixed > INT_MAX || item_size > INT_MAX || num_items > INT_MAX) {
Annotation
- Immediate include surface: `linux/types.h`, `linux/kernel.h`, `linux/sched.h`, `linux/if_link.h`, `linux/firmware.h`, `linux/mlx5/cq.h`, `linux/mlx5/fs.h`, `linux/mlx5/driver.h`.
- Detected declarations: `struct mlx5_cmd_allow_other_vhca_access_attr`, `struct mlx5_cmd_alias_obj_create_attr`, `struct mlx5_port_eth_proto`, `struct mlx5_module_eeprom_query_params`, `struct mlx5_link_info`, `enum mlx5_semaphore_space_address`, `function mlx5_printk`, `function mlx5_flexible_inlen`, `function mlx5_st_create`, `function mlx5_st_destroy`.
- 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.