drivers/net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/en/pcie_cong_event.c- Extension
.c- Size
- 10014 bytes
- Lines
- 386
- 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
../devlink.hen.hpcie_cong_event.h
Detected Declarations
struct mlx5e_pcie_cong_threshstruct mlx5e_pcie_cong_statsstruct mlx5e_pcie_cong_eventfunction MLX5E_DECLARE_STATS_GRP_OP_NUM_STATSfunction MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATSfunction MLX5E_DECLARE_STATS_GRP_OP_FILL_STATSfunction mlx5_cmd_pcie_cong_event_setfunction mlx5_cmd_pcie_cong_event_destroyfunction mlx5_cmd_pcie_cong_event_queryfunction mlx5e_pcie_cong_event_workfunction mlx5e_pcie_cong_event_handlerfunction mlx5e_pcie_cong_get_thresh_configfunction mlx5e_thresh_config_validatefunction mlx5e_pcie_cong_event_initfunction mlx5e_pcie_cong_event_cleanup
Annotated Snippet
struct mlx5e_pcie_cong_thresh {
u16 inbound_high;
u16 inbound_low;
u16 outbound_high;
u16 outbound_low;
};
struct mlx5e_pcie_cong_stats {
u32 pci_bw_inbound_high;
u32 pci_bw_inbound_low;
u32 pci_bw_outbound_high;
u32 pci_bw_outbound_low;
u32 pci_bw_stale_event;
};
struct mlx5e_pcie_cong_event {
u64 obj_id;
struct mlx5e_priv *priv;
/* For event notifier and workqueue. */
struct work_struct work;
struct mlx5_nb nb;
/* Stores last read state. */
u8 state;
/* For ethtool stats group. */
struct mlx5e_pcie_cong_stats stats;
};
static const struct counter_desc mlx5e_pcie_cong_stats_desc[] = {
{ MLX5E_DECLARE_STAT(struct mlx5e_pcie_cong_stats,
pci_bw_inbound_high) },
{ MLX5E_DECLARE_STAT(struct mlx5e_pcie_cong_stats,
pci_bw_inbound_low) },
{ MLX5E_DECLARE_STAT(struct mlx5e_pcie_cong_stats,
pci_bw_outbound_high) },
{ MLX5E_DECLARE_STAT(struct mlx5e_pcie_cong_stats,
pci_bw_outbound_low) },
{ MLX5E_DECLARE_STAT(struct mlx5e_pcie_cong_stats,
pci_bw_stale_event) },
};
#define NUM_PCIE_CONG_COUNTERS ARRAY_SIZE(mlx5e_pcie_cong_stats_desc)
static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(pcie_cong)
{
return priv->cong_event ? NUM_PCIE_CONG_COUNTERS : 0;
}
static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(pcie_cong) {}
static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(pcie_cong)
{
if (!priv->cong_event)
return;
for (int i = 0; i < NUM_PCIE_CONG_COUNTERS; i++)
ethtool_puts(data, mlx5e_pcie_cong_stats_desc[i].format);
}
static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(pcie_cong)
{
if (!priv->cong_event)
return;
for (int i = 0; i < NUM_PCIE_CONG_COUNTERS; i++) {
u32 ctr = MLX5E_READ_CTR32_CPU(&priv->cong_event->stats,
mlx5e_pcie_cong_stats_desc,
i);
mlx5e_ethtool_put_stat(data, ctr);
}
}
MLX5E_DEFINE_STATS_GRP(pcie_cong, 0);
static int
mlx5_cmd_pcie_cong_event_set(struct mlx5_core_dev *dev,
const struct mlx5e_pcie_cong_thresh *config,
u64 *obj_id)
{
u32 in[MLX5_ST_SZ_DW(pcie_cong_event_cmd_in)] = {};
u32 out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)];
void *cong_obj;
void *hdr;
int err;
Annotation
- Immediate include surface: `../devlink.h`, `en.h`, `pcie_cong_event.h`.
- Detected declarations: `struct mlx5e_pcie_cong_thresh`, `struct mlx5e_pcie_cong_stats`, `struct mlx5e_pcie_cong_event`, `function MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS`, `function MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS`, `function MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS`, `function mlx5_cmd_pcie_cong_event_set`, `function mlx5_cmd_pcie_cong_event_destroy`, `function mlx5_cmd_pcie_cong_event_query`, `function mlx5e_pcie_cong_event_work`.
- 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.