drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c- Extension
.c- Size
- 21816 bytes
- Lines
- 809
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
net/inet6_hashtables.hen_accel/en_accel.hen_accel/ktls.hen_accel/ktls_txrx.hen_accel/ktls_utils.hen_accel/fs_tcp.h
Detected Declarations
struct accel_rulestruct mlx5e_ktls_rx_resync_bufstruct mlx5e_ktls_rx_resync_ctxstruct mlx5e_ktls_offload_context_rxstruct mlx5e_ktls_resync_respfunction mlx5e_ktls_priv_rx_putfunction mlx5e_ktls_priv_rx_getfunction mlx5e_ktls_rx_resync_destroy_resp_listfunction mlx5e_ktls_rx_resync_create_resp_listfunction accel_rule_handle_workfunction accel_rule_initfunction icosq_fill_wifunction post_static_paramsfunction post_progress_paramsfunction post_rx_param_wqesfunction mlx5e_set_ktls_rx_priv_ctxfunction mlx5e_get_ktls_rx_priv_ctxfunction resync_post_get_progress_paramsfunction resync_handle_workfunction resync_initfunction resync_handle_seq_matchfunction mlx5e_ktls_handle_get_psv_completionfunction resync_queue_get_psvfunction resync_update_snfunction mlx5e_ktls_rx_resyncfunction mlx5e_ktls_rx_resync_async_request_cancelfunction mlx5e_ktls_handle_rx_skbfunction mlx5e_ktls_handle_ctx_completionfunction mlx5e_ktls_sk_get_rxqfunction mlx5e_ktls_add_rxfunction mlx5e_ktls_del_rxfunction mlx5e_ktls_rx_handle_resync_list
Annotated Snippet
struct accel_rule {
struct work_struct work;
struct mlx5e_priv *priv;
struct mlx5_flow_handle *rule;
};
#define PROGRESS_PARAMS_WRITE_UNIT 64
#define PROGRESS_PARAMS_PADDED_SIZE \
(ALIGN(sizeof(struct mlx5_wqe_tls_progress_params_seg), \
PROGRESS_PARAMS_WRITE_UNIT))
struct mlx5e_ktls_rx_resync_buf {
union {
struct mlx5_wqe_tls_progress_params_seg progress;
u8 pad[PROGRESS_PARAMS_PADDED_SIZE];
} ____cacheline_aligned_in_smp;
dma_addr_t dma_addr;
struct mlx5e_ktls_offload_context_rx *priv_rx;
};
enum {
MLX5E_PRIV_RX_FLAG_DELETING,
MLX5E_NUM_PRIV_RX_FLAGS,
};
struct mlx5e_ktls_rx_resync_ctx {
struct tls_offload_resync_async core;
struct work_struct work;
struct mlx5e_priv *priv;
refcount_t refcnt;
__be64 sw_rcd_sn_be;
u32 seq;
};
struct mlx5e_ktls_offload_context_rx {
union mlx5e_crypto_info crypto_info;
struct accel_rule rule;
struct sock *sk;
struct mlx5e_rq_stats *rq_stats;
struct mlx5e_tls_sw_stats *sw_stats;
struct completion add_ctx;
struct mlx5e_tir tir;
struct mlx5_crypto_dek *dek;
u32 rxq;
DECLARE_BITMAP(flags, MLX5E_NUM_PRIV_RX_FLAGS);
/* resync */
spinlock_t lock; /* protects resync fields */
struct mlx5e_ktls_rx_resync_ctx resync;
struct list_head list;
};
static bool mlx5e_ktls_priv_rx_put(struct mlx5e_ktls_offload_context_rx *priv_rx)
{
if (!refcount_dec_and_test(&priv_rx->resync.refcnt))
return false;
kfree(priv_rx);
return true;
}
static void mlx5e_ktls_priv_rx_get(struct mlx5e_ktls_offload_context_rx *priv_rx)
{
refcount_inc(&priv_rx->resync.refcnt);
}
struct mlx5e_ktls_resync_resp {
/* protects list changes */
spinlock_t lock;
struct list_head list;
};
void mlx5e_ktls_rx_resync_destroy_resp_list(struct mlx5e_ktls_resync_resp *resp_list)
{
kvfree(resp_list);
}
struct mlx5e_ktls_resync_resp *
mlx5e_ktls_rx_resync_create_resp_list(void)
{
struct mlx5e_ktls_resync_resp *resp_list;
resp_list = kvzalloc_obj(*resp_list);
if (!resp_list)
return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&resp_list->list);
spin_lock_init(&resp_list->lock);
return resp_list;
Annotation
- Immediate include surface: `net/inet6_hashtables.h`, `en_accel/en_accel.h`, `en_accel/ktls.h`, `en_accel/ktls_txrx.h`, `en_accel/ktls_utils.h`, `en_accel/fs_tcp.h`.
- Detected declarations: `struct accel_rule`, `struct mlx5e_ktls_rx_resync_buf`, `struct mlx5e_ktls_rx_resync_ctx`, `struct mlx5e_ktls_offload_context_rx`, `struct mlx5e_ktls_resync_resp`, `function mlx5e_ktls_priv_rx_put`, `function mlx5e_ktls_priv_rx_get`, `function mlx5e_ktls_rx_resync_destroy_resp_list`, `function mlx5e_ktls_rx_resync_create_resp_list`, `function accel_rule_handle_work`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.