drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c
Extension
.c
Size
4492 bytes
Lines
133
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

static inline MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(ipsec_hw) {}

static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(ipsec_hw)
{
	unsigned int i;

	if (!priv->ipsec)
		return;

	for (i = 0; i < NUM_IPSEC_HW_COUNTERS; i++)
		ethtool_puts(data, mlx5e_ipsec_hw_stats_desc[i].format);
}

static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(ipsec_hw)
{
	int i;

	if (!priv->ipsec)
		return;

	mlx5e_accel_ipsec_fs_read_stats(priv, &priv->ipsec->hw_stats);
	for (i = 0; i < NUM_IPSEC_HW_COUNTERS; i++)
		mlx5e_ethtool_put_stat(
			data,
			MLX5E_READ_CTR_ATOMIC64(&priv->ipsec->hw_stats,
						mlx5e_ipsec_hw_stats_desc, i));
}

static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(ipsec_sw)
{
	return priv->ipsec ? NUM_IPSEC_SW_COUNTERS : 0;
}

static inline MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(ipsec_sw) {}

static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(ipsec_sw)
{
	unsigned int i;

	if (priv->ipsec)
		for (i = 0; i < NUM_IPSEC_SW_COUNTERS; i++)
			ethtool_puts(data, mlx5e_ipsec_sw_stats_desc[i].format);
}

static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(ipsec_sw)
{
	int i;

	if (priv->ipsec)
		for (i = 0; i < NUM_IPSEC_SW_COUNTERS; i++)
			mlx5e_ethtool_put_stat(
				data, MLX5E_READ_CTR_ATOMIC64(
					      &priv->ipsec->sw_stats,
					      mlx5e_ipsec_sw_stats_desc, i));
}

MLX5E_DEFINE_STATS_GRP(ipsec_hw, 0);
MLX5E_DEFINE_STATS_GRP(ipsec_sw, 0);

Annotation

Implementation Notes