FreeBSD kernel CXGBE device code
t4_tls.h
Go to the documentation of this file.
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2017-2018 Chelsio Communications, Inc.
5 * All rights reserved.
6 * Written by: John Baldwin <jhb@FreeBSD.org>, Atul Gupta
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD$
30 *
31 */
32
33#ifndef __T4_TLS_H__
34#define __T4_TLS_H__
35
36#ifdef _KERNEL
37
38/* Timeouts for handshake timer in seconds. */
39#define TLS_SRV_HELLO_DONE 9
40#define TLS_SRV_HELLO_RD_TM 5
41#define TLS_SRV_HELLO_BKOFF_TM 15
42
43#define CONTENT_TYPE_CCS 20
44#define CONTENT_TYPE_ALERT 21
45#define CONTENT_TYPE_HANDSHAKE 22
46#define CONTENT_TYPE_APP_DATA 23
47#define CONTENT_TYPE_HEARTBEAT 24
48#define CONTENT_TYPE_KEY_CONTEXT 32
49#define CONTENT_TYPE_ERROR 127
50
51#define TLS_HEADER_LENGTH 5
52#define TP_TX_PG_SZ 65536
53#define FC_TP_PLEN_MAX 17408
54
55enum {
59};
60
61enum {
66 CPL_TX_TLS_SFO_TYPE_HEARTBEAT, /* XXX: Shouldn't this be "CUSTOM"? */
67};
68
69struct tls_scmd {
72};
73
75 unsigned int frag_size;
79 uint64_t tx_seq_no;
80 uint16_t rx_version;
81 unsigned short fcplenmax;
82 unsigned short adjusted_plen;
83 unsigned short expn_per_ulp;
84 unsigned short pdus_per_ulp;
86 u_int iv_len;
87 unsigned int tx_key_info_size;
88 struct callout handshake_timer;
89};
90
91struct tls_hdr {
96
101
105} __packed;
106
107/* res_to_mac_error fields */
108#define S_TLSRX_HDR_PKT_INTERNAL_ERROR 4
109#define M_TLSRX_HDR_PKT_INTERNAL_ERROR 0x1
110#define V_TLSRX_HDR_PKT_INTERNAL_ERROR(x) \
111 ((x) << S_TLSRX_HDR_PKT_INTERNAL_ERROR)
112#define G_TLSRX_HDR_PKT_INTERNAL_ERROR(x) \
113(((x) >> S_TLSRX_HDR_PKT_INTERNAL_ERROR) & M_TLSRX_HDR_PKT_INTERNAL_ERROR)
114#define F_TLSRX_HDR_PKT_INTERNAL_ERROR V_TLSRX_HDR_PKT_INTERNAL_ERROR(1U)
115
116#define S_TLSRX_HDR_PKT_SPP_ERROR 3
117#define M_TLSRX_HDR_PKT_SPP_ERROR 0x1
118#define V_TLSRX_HDR_PKT_SPP_ERROR(x) ((x) << S_TLSRX_HDR_PKT_SPP_ERROR)
119#define G_TLSRX_HDR_PKT_SPP_ERROR(x) \
120(((x) >> S_TLSRX_HDR_PKT_SPP_ERROR) & M_TLSRX_HDR_PKT_SPP_ERROR)
121#define F_TLSRX_HDR_PKT_SPP_ERROR V_TLSRX_HDR_PKT_SPP_ERROR(1U)
122
123#define S_TLSRX_HDR_PKT_CCDX_ERROR 2
124#define M_TLSRX_HDR_PKT_CCDX_ERROR 0x1
125#define V_TLSRX_HDR_PKT_CCDX_ERROR(x) ((x) << S_TLSRX_HDR_PKT_CCDX_ERROR)
126#define G_TLSRX_HDR_PKT_CCDX_ERROR(x) \
127(((x) >> S_TLSRX_HDR_PKT_CCDX_ERROR) & M_TLSRX_HDR_PKT_CCDX_ERROR)
128#define F_TLSRX_HDR_PKT_CCDX_ERROR V_TLSRX_HDR_PKT_CCDX_ERROR(1U)
129
130#define S_TLSRX_HDR_PKT_PAD_ERROR 1
131#define M_TLSRX_HDR_PKT_PAD_ERROR 0x1
132#define V_TLSRX_HDR_PKT_PAD_ERROR(x) ((x) << S_TLSRX_HDR_PKT_PAD_ERROR)
133#define G_TLSRX_HDR_PKT_PAD_ERROR(x) \
134(((x) >> S_TLSRX_HDR_PKT_PAD_ERROR) & M_TLSRX_HDR_PKT_PAD_ERROR)
135#define F_TLSRX_HDR_PKT_PAD_ERROR V_TLSRX_HDR_PKT_PAD_ERROR(1U)
136
137#define S_TLSRX_HDR_PKT_MAC_ERROR 0
138#define M_TLSRX_HDR_PKT_MAC_ERROR 0x1
139#define V_TLSRX_HDR_PKT_MAC_ERROR(x) ((x) << S_TLSRX_HDR_PKT_MAC_ERROR)
140#define G_TLSRX_HDR_PKT_MAC_ERROR(x) \
141(((x) >> S_TLSRX_HDR_PKT_MAC_ERROR) & M_TLSRX_HDR_PKT_MAC_ERROR)
142#define F_TLSRX_HDR_PKT_MAC_ERROR V_TLSRX_HDR_PKT_MAC_ERROR(1U)
143
144#define M_TLSRX_HDR_PKT_ERROR 0x1F
145
146#endif /* _KERNEL */
147
148#endif /* !__T4_TLS_H__ */
uint32_t __be32
Definition: osdep.h:69
uint64_t __be64
Definition: osdep.h:70
uint8_t __u8
Definition: osdep.h:63
uint16_t __be16
Definition: osdep.h:68
Definition: t4_tls.h:91
__be16 length
Definition: t4_tls.h:94
__be16 version
Definition: t4_tls.h:93
__u8 type
Definition: t4_tls.h:92
int rx_key_addr
Definition: t4_tls.h:77
unsigned short fcplenmax
Definition: t4_tls.h:81
uint64_t tx_seq_no
Definition: t4_tls.h:79
struct callout handshake_timer
Definition: t4_tls.h:88
unsigned int tx_key_info_size
Definition: t4_tls.h:87
int tx_key_addr
Definition: t4_tls.h:78
unsigned int frag_size
Definition: t4_tls.h:75
struct tls_scmd scmd0
Definition: t4_tls.h:85
unsigned short pdus_per_ulp
Definition: t4_tls.h:84
uint16_t rx_version
Definition: t4_tls.h:80
u_int iv_len
Definition: t4_tls.h:86
int key_location
Definition: t4_tls.h:76
unsigned short adjusted_plen
Definition: t4_tls.h:82
unsigned short expn_per_ulp
Definition: t4_tls.h:83
__be32 ivgen_hdrlen
Definition: t4_tls.h:71
__be32 seqno_numivs
Definition: t4_tls.h:70
__be16 length
Definition: t4_tls.h:100
__be16 version
Definition: t4_tls.h:99
__be64 tls_seq
Definition: t4_tls.h:102
__u8 res_to_mac_error
Definition: t4_tls.h:104
__be16 reserved1
Definition: t4_tls.h:103
__u8 type
Definition: t4_tls.h:98
@ TLS_SFO_WR_CONTEXTLOC_IMMEDIATE
Definition: t4_tls.h:57
@ TLS_SFO_WR_CONTEXTLOC_DDR
Definition: t4_tls.h:58
@ TLS_SFO_WR_CONTEXTLOC_DSGL
Definition: t4_tls.h:56
struct tls_hdr __packed
@ CPL_TX_TLS_SFO_TYPE_ALERT
Definition: t4_tls.h:63
@ CPL_TX_TLS_SFO_TYPE_HEARTBEAT
Definition: t4_tls.h:66
@ CPL_TX_TLS_SFO_TYPE_HANDSHAKE
Definition: t4_tls.h:64
@ CPL_TX_TLS_SFO_TYPE_DATA
Definition: t4_tls.h:65
@ CPL_TX_TLS_SFO_TYPE_CCS
Definition: t4_tls.h:62