drivers/net/ethernet/mellanox/mlx5/core/lib/sd.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/lib/sd.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/lib/sd.h- Extension
.h- Size
- 2336 bytes
- Lines
- 72
- 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/types.h
Detected Declarations
struct mlx5_sdfunction mlx5_sd_is_supportedfunction mlx5_sd_get_devcomfunction mlx5_sd_eswitch_mode_set
Annotated Snippet
#ifndef __MLX5_LIB_SD_H__
#define __MLX5_LIB_SD_H__
#include <linux/types.h>
#define MLX5_SD_MAX_GROUP_SZ 2
struct mlx5_sd;
struct mlx5_core_dev *mlx5_sd_get_primary(struct mlx5_core_dev *dev);
bool mlx5_sd_is_primary(struct mlx5_core_dev *dev);
int mlx5_sd_pf_num_get(struct mlx5_core_dev *dev);
struct mlx5_core_dev *mlx5_sd_primary_get_peer(struct mlx5_core_dev *primary, int idx);
int mlx5_sd_ch_ix_get_dev_ix(struct mlx5_core_dev *dev, int ch_ix);
int mlx5_sd_ch_ix_get_vec_ix(struct mlx5_core_dev *dev, int ch_ix);
struct mlx5_core_dev *mlx5_sd_ch_ix_get_dev(struct mlx5_core_dev *primary, int ch_ix);
struct auxiliary_device *mlx5_sd_get_adev(struct mlx5_core_dev *dev,
struct auxiliary_device *adev,
int idx);
void mlx5_sd_put_adev(struct auxiliary_device *actual_adev,
struct auxiliary_device *adev);
#ifdef CONFIG_MLX5_CORE_EN
bool mlx5_sd_is_supported(struct mlx5_core_dev *dev);
#else
static inline bool mlx5_sd_is_supported(struct mlx5_core_dev *dev)
{
return false;
}
#endif
int mlx5_sd_init(struct mlx5_core_dev *dev);
void mlx5_sd_cleanup(struct mlx5_core_dev *dev);
#ifdef CONFIG_MLX5_CORE_EN
struct mlx5_devcom_comp_dev *mlx5_sd_get_devcom(struct mlx5_core_dev *dev);
#else
static inline struct mlx5_devcom_comp_dev *
mlx5_sd_get_devcom(struct mlx5_core_dev *dev)
{
return NULL;
}
#endif
#ifdef CONFIG_MLX5_ESWITCH
void mlx5_sd_eswitch_mode_set(struct mlx5_core_dev *dev, u16 mlx5_mode);
#else
static inline void
mlx5_sd_eswitch_mode_set(struct mlx5_core_dev *dev, u16 mlx5_mode) { return; }
#endif
#define mlx5_sd_for_each_dev_from_to(i, primary, ix_from, to, pos) \
for (i = ix_from; \
(pos = mlx5_sd_primary_get_peer(primary, i)) && pos != (to); i++)
#define mlx5_sd_for_each_dev(i, primary, pos) \
mlx5_sd_for_each_dev_from_to(i, primary, 0, NULL, pos)
#define mlx5_sd_for_each_dev_to(i, primary, to, pos) \
mlx5_sd_for_each_dev_from_to(i, primary, 0, to, pos)
#define mlx5_sd_for_each_secondary(i, primary, pos) \
mlx5_sd_for_each_dev_from_to(i, primary, 1, NULL, pos)
#define mlx5_sd_for_each_secondary_to(i, primary, to, pos) \
mlx5_sd_for_each_dev_from_to(i, primary, 1, to, pos)
#endif /* __MLX5_LIB_SD_H__ */
Annotation
- Immediate include surface: `linux/types.h`.
- Detected declarations: `struct mlx5_sd`, `function mlx5_sd_is_supported`, `function mlx5_sd_get_devcom`, `function mlx5_sd_eswitch_mode_set`.
- 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.