drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c- Extension
.c- Size
- 25490 bytes
- Lines
- 959
- 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_accel/ktls.hen_accel/ktls_txrx.hen_accel/ktls_utils.h
Detected Declarations
struct mlx5e_dump_wqestruct mlx5e_ktls_offload_context_txstruct mlx5e_async_ctxstruct mlx5e_bulk_async_ctxstruct mlx5e_tls_tx_poolstruct tx_sync_infoenum mlx5e_ktls_sync_retvalfunction mlx5e_ktls_dumps_num_wqesfunction mlx5e_ktls_get_stop_roomfunction mlx5e_ktls_set_tiscfunction mlx5e_ktls_create_tisfunction mlx5e_ktls_create_tis_cbfunction mlx5e_ktls_destroy_tis_cbfunction mlx5e_set_ktls_tx_priv_ctxfunction mlx5e_get_ktls_tx_priv_ctxfunction mlx5e_bulk_async_cleanupfunction create_tis_callbackfunction destroy_tis_callbackfunction mlx5e_tls_priv_tx_initfunction mlx5e_tls_priv_tx_cleanupfunction mlx5e_tls_priv_tx_list_cleanupfunction create_workfunction destroy_workfunction mlx5e_tls_tx_pool_list_cleanupfunction mlx5e_tls_tx_pool_cleanupfunction pool_pushfunction mlx5e_ktls_add_txfunction mlx5e_ktls_del_txfunction tx_fill_wifunction mlx5e_ktls_tx_offload_test_and_clear_pendingfunction post_static_paramsfunction post_progress_paramsfunction tx_post_fence_nopfunction mlx5e_ktls_tx_post_param_wqesfunction tx_sync_info_getfunction tx_post_resync_paramsfunction tx_post_resync_dumpfunction mlx5e_ktls_tx_handle_resync_dump_compfunction mlx5e_ktls_tx_handle_ooofunction mlx5e_ktls_handle_tx_skbfunction mlx5e_tls_tx_debugfs_initfunction mlx5e_ktls_init_txfunction mlx5e_ktls_cleanup_tx
Annotated Snippet
struct mlx5e_dump_wqe {
struct mlx5_wqe_ctrl_seg ctrl;
struct mlx5_wqe_data_seg data;
};
#define MLX5E_KTLS_DUMP_WQEBBS \
(DIV_ROUND_UP(sizeof(struct mlx5e_dump_wqe), MLX5_SEND_WQE_BB))
static u8
mlx5e_ktls_dumps_num_wqes(struct mlx5e_params *params, unsigned int nfrags,
unsigned int sync_len)
{
/* Given the MTU and sync_len, calculates an upper bound for the
* number of DUMP WQEs needed for the TX resync of a record.
*/
return nfrags + DIV_ROUND_UP(sync_len, MLX5E_SW2HW_MTU(params, params->sw_mtu));
}
u16 mlx5e_ktls_get_stop_room(struct mlx5_core_dev *mdev, struct mlx5e_params *params)
{
u16 num_dumps, stop_room = 0;
if (!mlx5e_is_ktls_tx(mdev))
return 0;
num_dumps = mlx5e_ktls_dumps_num_wqes(params, MAX_SKB_FRAGS, TLS_MAX_PAYLOAD_SIZE);
stop_room += mlx5e_stop_room_for_wqe(mdev, MLX5E_TLS_SET_STATIC_PARAMS_WQEBBS);
stop_room += mlx5e_stop_room_for_wqe(mdev, MLX5E_TLS_SET_PROGRESS_PARAMS_WQEBBS);
stop_room += num_dumps * mlx5e_stop_room_for_wqe(mdev, MLX5E_KTLS_DUMP_WQEBBS);
stop_room += 1; /* fence nop */
return stop_room;
}
static void mlx5e_ktls_set_tisc(struct mlx5_core_dev *mdev, void *tisc)
{
MLX5_SET(tisc, tisc, tls_en, 1);
MLX5_SET(tisc, tisc, pd, mdev->mlx5e_res.hw_objs.pdn);
MLX5_SET(tisc, tisc, transport_domain, mdev->mlx5e_res.hw_objs.td.tdn);
}
static int mlx5e_ktls_create_tis(struct mlx5_core_dev *mdev, u32 *tisn)
{
u32 in[MLX5_ST_SZ_DW(create_tis_in)] = {};
mlx5e_ktls_set_tisc(mdev, MLX5_ADDR_OF(create_tis_in, in, ctx));
return mlx5_core_create_tis(mdev, in, tisn);
}
static int mlx5e_ktls_create_tis_cb(struct mlx5_core_dev *mdev,
struct mlx5_async_ctx *async_ctx,
u32 *out, int outlen,
mlx5_async_cbk_t callback,
struct mlx5_async_work *context)
{
u32 in[MLX5_ST_SZ_DW(create_tis_in)] = {};
mlx5e_ktls_set_tisc(mdev, MLX5_ADDR_OF(create_tis_in, in, ctx));
MLX5_SET(create_tis_in, in, opcode, MLX5_CMD_OP_CREATE_TIS);
return mlx5_cmd_exec_cb(async_ctx, in, sizeof(in),
out, outlen, callback, context);
}
static int mlx5e_ktls_destroy_tis_cb(struct mlx5_core_dev *mdev, u32 tisn,
struct mlx5_async_ctx *async_ctx,
u32 *out, int outlen,
mlx5_async_cbk_t callback,
struct mlx5_async_work *context)
{
u32 in[MLX5_ST_SZ_DW(destroy_tis_in)] = {};
MLX5_SET(destroy_tis_in, in, opcode, MLX5_CMD_OP_DESTROY_TIS);
MLX5_SET(destroy_tis_in, in, tisn, tisn);
return mlx5_cmd_exec_cb(async_ctx, in, sizeof(in),
out, outlen, callback, context);
}
struct mlx5e_ktls_offload_context_tx {
/* fast path */
u32 expected_seq;
u32 tisn;
bool ctx_post_pending;
/* control / resync */
struct list_head list_node; /* member of the pool */
union mlx5e_crypto_info crypto_info;
struct tls_offload_context_tx *tx_ctx;
Annotation
- Immediate include surface: `linux/debugfs.h`, `en_accel/ktls.h`, `en_accel/ktls_txrx.h`, `en_accel/ktls_utils.h`.
- Detected declarations: `struct mlx5e_dump_wqe`, `struct mlx5e_ktls_offload_context_tx`, `struct mlx5e_async_ctx`, `struct mlx5e_bulk_async_ctx`, `struct mlx5e_tls_tx_pool`, `struct tx_sync_info`, `enum mlx5e_ktls_sync_retval`, `function mlx5e_ktls_dumps_num_wqes`, `function mlx5e_ktls_get_stop_room`, `function mlx5e_ktls_set_tisc`.
- 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.