1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (C) 2020 Chelsio Communications. All rights reserved. */
4 #ifndef __CHCR_KTLS_H__
5 #define __CHCR_KTLS_H__
7 #ifdef CONFIG_CHELSIO_TLS_DEVICE
13 #include "chcr_common.h"
15 #define CHCR_TCB_STATE_CLOSED 0
17 enum chcr_ktls_conn_state {
21 struct chcr_ktls_info {
23 spinlock_t lock; /* state machine lock */
25 struct l2t_entry *l2te;
26 struct net_device *netdev;
31 u32 tcp_start_seq_number;
32 enum chcr_ktls_conn_state connection_state;
39 struct chcr_ktls_ofld_ctx_tx {
40 struct tls_offload_context_tx base;
41 struct chcr_ktls_info *chcr_info;
44 static inline struct chcr_ktls_ofld_ctx_tx *
45 chcr_get_ktls_tx_context(struct tls_context *tls_ctx)
47 BUILD_BUG_ON(sizeof(struct chcr_ktls_ofld_ctx_tx) >
48 TLS_OFFLOAD_CONTEXT_SIZE_TX);
49 return container_of(tls_offload_ctx_tx(tls_ctx),
50 struct chcr_ktls_ofld_ctx_tx,
54 static inline int chcr_get_first_rx_qid(struct adapter *adap)
56 /* u_ctx is saved in adap, fetch it */
57 struct uld_ctx *u_ctx = adap->uld[CXGB4_ULD_CRYPTO].handle;
61 return u_ctx->lldi.rxq_ids[0];
64 void chcr_enable_ktls(struct adapter *adap);
65 void chcr_disable_ktls(struct adapter *adap);
66 #endif /* CONFIG_CHELSIO_TLS_DEVICE */
67 #endif /* __CHCR_KTLS_H__ */