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.

Dependency Surface

Detected Declarations

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

Implementation Notes