drivers/net/ethernet/mellanox/mlx5/core/sf/cmd.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/sf/cmd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/sf/cmd.c- Extension
.c- Size
- 1629 bytes
- Lines
- 50
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mlx5/driver.hpriv.h
Detected Declarations
function mlx5_cmd_alloc_sffunction mlx5_cmd_dealloc_sffunction mlx5_cmd_sf_enable_hcafunction mlx5_cmd_sf_disable_hca
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
/* Copyright (c) 2020 Mellanox Technologies Ltd */
#include <linux/mlx5/driver.h>
#include "priv.h"
int mlx5_cmd_alloc_sf(struct mlx5_core_dev *dev, u16 function_id)
{
u32 out[MLX5_ST_SZ_DW(alloc_sf_out)] = {};
u32 in[MLX5_ST_SZ_DW(alloc_sf_in)] = {};
MLX5_SET(alloc_sf_in, in, opcode, MLX5_CMD_OP_ALLOC_SF);
MLX5_SET(alloc_sf_in, in, function_id, function_id);
return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
}
int mlx5_cmd_dealloc_sf(struct mlx5_core_dev *dev, u16 function_id)
{
u32 out[MLX5_ST_SZ_DW(dealloc_sf_out)] = {};
u32 in[MLX5_ST_SZ_DW(dealloc_sf_in)] = {};
MLX5_SET(dealloc_sf_in, in, opcode, MLX5_CMD_OP_DEALLOC_SF);
MLX5_SET(dealloc_sf_in, in, function_id, function_id);
return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
}
int mlx5_cmd_sf_enable_hca(struct mlx5_core_dev *dev, u16 func_id)
{
u32 out[MLX5_ST_SZ_DW(enable_hca_out)] = {};
u32 in[MLX5_ST_SZ_DW(enable_hca_in)] = {};
MLX5_SET(enable_hca_in, in, opcode, MLX5_CMD_OP_ENABLE_HCA);
MLX5_SET(enable_hca_in, in, function_id, func_id);
MLX5_SET(enable_hca_in, in, embedded_cpu_function, 0);
return mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out));
}
int mlx5_cmd_sf_disable_hca(struct mlx5_core_dev *dev, u16 func_id)
{
u32 out[MLX5_ST_SZ_DW(disable_hca_out)] = {};
u32 in[MLX5_ST_SZ_DW(disable_hca_in)] = {};
MLX5_SET(disable_hca_in, in, opcode, MLX5_CMD_OP_DISABLE_HCA);
MLX5_SET(disable_hca_in, in, function_id, func_id);
MLX5_SET(enable_hca_in, in, embedded_cpu_function, 0);
return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
}
Annotation
- Immediate include surface: `linux/mlx5/driver.h`, `priv.h`.
- Detected declarations: `function mlx5_cmd_alloc_sf`, `function mlx5_cmd_dealloc_sf`, `function mlx5_cmd_sf_enable_hca`, `function mlx5_cmd_sf_disable_hca`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.