drivers/net/ethernet/mellanox/mlx4/mlx4.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx4/mlx4.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx4/mlx4.h- Extension
.h- Size
- 43077 bytes
- Lines
- 1491
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/mutex.hlinux/radix-tree.hlinux/rbtree.hlinux/timer.hlinux/semaphore.hlinux/workqueue.hlinux/interrupt.hlinux/spinlock.hnet/devlink.hlinux/rwsem.hlinux/auxiliary_bus.hlinux/notifier.hlinux/mlx4/device.hlinux/mlx4/driver.hlinux/mlx4/doorbell.hlinux/mlx4/cmd.hfw_qos.h
Detected Declarations
struct mlx4_vhcrstruct mlx4_vhcr_cmdstruct mlx4_cmd_infostruct mlx4_bitmapstruct mlx4_buddystruct mlx4_icmstruct mlx4_icm_tablestruct mlx4_mpt_entrystruct mlx4_eq_contextstruct mlx4_cq_contextstruct mlx4_srq_contextstruct mlx4_eq_taskletstruct mlx4_eqstruct mlx4_slave_eqestruct mlx4_slave_event_eq_infostruct mlx4_profilestruct mlx4_fwstruct mlx4_commstruct mlx4_vlan_fltrstruct mlx4_mcast_entrystruct mlx4_promisc_qpstruct mlx4_steer_indexstruct mlx4_slave_statestruct mlx4_vport_statestruct mlx4_vf_admin_statestruct mlx4_vport_oper_statestruct mlx4_vf_oper_statestruct slave_liststruct resource_allocatorstruct mlx4_resource_trackerstruct mlx4_slave_event_eqstruct mlx4_qos_managerstruct mlx4_master_qp0_statestruct mlx4_mfunc_master_ctxstruct mlx4_mfuncstruct mlx4_mgmstruct mlx4_cmdstruct mlx4_vf_immed_vlan_workstruct mlx4_uar_tablestruct mlx4_mr_tablestruct mlx4_cq_tablestruct mlx4_eq_tablestruct mlx4_srq_tablestruct mlx4_qp_tablestruct mlx4_mcg_tablestruct mlx4_catas_errstruct mlx4_mac_tablestruct mlx4_roce_gid_entry
Annotated Snippet
struct mlx4_vhcr {
u64 in_param;
u64 out_param;
u32 in_modifier;
u32 errno;
u16 op;
u16 token;
u8 op_modifier;
u8 e_bit;
};
struct mlx4_vhcr_cmd {
__be64 in_param;
__be32 in_modifier;
u32 reserved1;
__be64 out_param;
__be16 token;
u16 reserved;
u8 status;
u8 flags;
__be16 opcode;
};
struct mlx4_cmd_info {
u16 opcode;
bool has_inbox;
bool has_outbox;
bool out_is_imm;
bool encode_slave_id;
int (*verify)(struct mlx4_dev *dev, int slave, struct mlx4_vhcr *vhcr,
struct mlx4_cmd_mailbox *inbox);
int (*wrapper)(struct mlx4_dev *dev, int slave, struct mlx4_vhcr *vhcr,
struct mlx4_cmd_mailbox *inbox,
struct mlx4_cmd_mailbox *outbox,
struct mlx4_cmd_info *cmd);
};
#ifdef CONFIG_MLX4_DEBUG
extern int mlx4_debug_level;
#else /* CONFIG_MLX4_DEBUG */
#define mlx4_debug_level (0)
#endif /* CONFIG_MLX4_DEBUG */
#define mlx4_dbg(mdev, format, ...) \
do { \
if (mlx4_debug_level) \
dev_printk(KERN_DEBUG, \
&(mdev)->persist->pdev->dev, format, \
##__VA_ARGS__); \
} while (0)
#define mlx4_err(mdev, format, ...) \
dev_err(&(mdev)->persist->pdev->dev, format, ##__VA_ARGS__)
#define mlx4_info(mdev, format, ...) \
dev_info(&(mdev)->persist->pdev->dev, format, ##__VA_ARGS__)
#define mlx4_warn(mdev, format, ...) \
dev_warn(&(mdev)->persist->pdev->dev, format, ##__VA_ARGS__)
extern int log_mtts_per_seg;
extern int mlx4_internal_err_reset;
#define MLX4_MAX_NUM_SLAVES (min(MLX4_MAX_NUM_PF + MLX4_MAX_NUM_VF, \
MLX4_MFUNC_MAX))
#define ALL_SLAVES 0xff
struct mlx4_bitmap {
u32 last;
u32 top;
u32 max;
u32 reserved_top;
u32 mask;
u32 avail;
u32 effective_len;
spinlock_t lock;
unsigned long *table;
};
struct mlx4_buddy {
unsigned long **bits;
unsigned int *num_free;
u32 max_order;
spinlock_t lock;
};
struct mlx4_icm;
struct mlx4_icm_table {
u64 virt;
int num_icm;
u32 num_obj;
Annotation
- Immediate include surface: `linux/mutex.h`, `linux/radix-tree.h`, `linux/rbtree.h`, `linux/timer.h`, `linux/semaphore.h`, `linux/workqueue.h`, `linux/interrupt.h`, `linux/spinlock.h`.
- Detected declarations: `struct mlx4_vhcr`, `struct mlx4_vhcr_cmd`, `struct mlx4_cmd_info`, `struct mlx4_bitmap`, `struct mlx4_buddy`, `struct mlx4_icm`, `struct mlx4_icm_table`, `struct mlx4_mpt_entry`, `struct mlx4_eq_context`, `struct mlx4_cq_context`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.