drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c- Extension
.c- Size
- 5252 bytes
- Lines
- 227
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hen.hlib/mlx5.hlib/crypto.hen_accel/ktls.hen_accel/ktls_utils.hen_accel/fs_tcp.h
Detected Declarations
function mlx5_ktls_destroy_keyfunction mlx5e_ktls_addfunction mlx5e_ktls_delfunction mlx5e_ktls_resyncfunction mlx5e_is_ktls_rxfunction mlx5e_ktls_build_netdevfunction mlx5e_ktls_set_feature_rxfunction mlx5e_ktls_init_rxfunction mlx5e_ktls_cleanup_rxfunction mlx5e_tls_debugfs_initfunction mlx5e_ktls_initfunction mlx5e_ktls_cleanup
Annotated Snippet
if (!err && !priv->ktls_rx_was_enabled) {
priv->ktls_rx_was_enabled = true;
mlx5e_safe_reopen_channels(priv);
}
} else {
mlx5e_accel_fs_tcp_destroy(priv->fs);
}
mutex_unlock(&priv->state_lock);
return err;
}
int mlx5e_ktls_init_rx(struct mlx5e_priv *priv)
{
int err;
if (!mlx5e_is_ktls_rx(priv->mdev))
return 0;
priv->tls->rx_wq = create_singlethread_workqueue("mlx5e_tls_rx");
if (!priv->tls->rx_wq)
return -ENOMEM;
if (priv->netdev->features & NETIF_F_HW_TLS_RX) {
err = mlx5e_accel_fs_tcp_create(priv->fs);
if (err) {
destroy_workqueue(priv->tls->rx_wq);
return err;
}
priv->ktls_rx_was_enabled = true;
}
return 0;
}
void mlx5e_ktls_cleanup_rx(struct mlx5e_priv *priv)
{
if (!mlx5e_is_ktls_rx(priv->mdev))
return;
if (priv->netdev->features & NETIF_F_HW_TLS_RX)
mlx5e_accel_fs_tcp_destroy(priv->fs);
destroy_workqueue(priv->tls->rx_wq);
}
static void mlx5e_tls_debugfs_init(struct mlx5e_tls *tls,
struct dentry *dfs_root)
{
if (IS_ERR_OR_NULL(dfs_root))
return;
tls->debugfs.dfs = debugfs_create_dir("tls", dfs_root);
}
int mlx5e_ktls_init(struct mlx5e_priv *priv)
{
struct mlx5e_tls *tls;
if (!mlx5e_is_ktls_device(priv->mdev))
return 0;
tls = kzalloc_obj(*tls);
if (!tls)
return -ENOMEM;
tls->mdev = priv->mdev;
priv->tls = tls;
mlx5e_tls_debugfs_init(tls, priv->dfs_root);
return 0;
}
void mlx5e_ktls_cleanup(struct mlx5e_priv *priv)
{
struct mlx5e_tls *tls = priv->tls;
if (!mlx5e_is_ktls_device(priv->mdev))
return;
debugfs_remove_recursive(tls->debugfs.dfs);
tls->debugfs.dfs = NULL;
kfree(priv->tls);
priv->tls = NULL;
}
Annotation
- Immediate include surface: `linux/debugfs.h`, `en.h`, `lib/mlx5.h`, `lib/crypto.h`, `en_accel/ktls.h`, `en_accel/ktls_utils.h`, `en_accel/fs_tcp.h`.
- Detected declarations: `function mlx5_ktls_destroy_key`, `function mlx5e_ktls_add`, `function mlx5e_ktls_del`, `function mlx5e_ktls_resync`, `function mlx5e_is_ktls_rx`, `function mlx5e_ktls_build_netdev`, `function mlx5e_ktls_set_feature_rx`, `function mlx5e_ktls_init_rx`, `function mlx5e_ktls_cleanup_rx`, `function mlx5e_tls_debugfs_init`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.