2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2018 Chelsio Communications, Inc.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #ifndef __tcb_common_h
33 #define __tcb_common_h
35 /* ANSI C standard includes */
52 #ifndef __variable_sizes
54 /* windows has _UI64_MAX. C99 has ULLONG_MAX, but I don't compile
55 with C99 for portability with windows, so the ui64 is a guess.
56 I'll add an assert to cl_main to confirm these sizes are accurate.
58 #ifdef _UI64_MAX /* windows */
59 #if (_UI64_MAX == 0xFFFFFFFFFFFFFFFF)
61 typedef unsigned __int64 ui64;
63 #else /*else of #ifdef _UI64_MAX */
64 typedef long long int si64;
65 typedef unsigned long long int ui64;
66 #endif /*endif of #ifdef _UI64_MAX */
67 #endif /* endif of #ifndef __variable_sizes */
72 typedef struct tcb_var {
124 /* from tp/src/tp.h */
125 #define PM_MODE_PASS 0
126 #define PM_MODE_DDP 1
127 #define PM_MODE_ISCSI 2
128 #define PM_MODE_IWARP 3
129 #define PM_MODE_RDDP 4
130 #define PM_MODE_IANDP 5
131 #define PM_MODE_FCOE 6
132 #define PM_MODE_USER 7
133 #define PM_MODE_TLS 8
134 #define PM_MODE_DTLS 9
138 #define SEQ_ADD(a,b) (((a)+(b)) & 0xFFFFFFFF)
139 #define SEQ_SUB(a,b) (((a)-(b)) & 0xFFFFFFFF)
141 ///* functions needed by the tcbshowtN.c code */
142 extern unsigned val(char *name);
143 extern ui64 val64(char *name);
144 extern void PR(char *fmt, ...);
145 extern char *spr_tcp_state(unsigned state);
146 extern char *spr_ip_version(unsigned ipver);
147 extern char *spr_cctrl_sel(unsigned cctrl_sel0,unsigned cctrl_sel1);
148 extern char *spr_ulp_type(unsigned ulp_type);
151 extern unsigned parse_tcb( _TCBVAR *base_tvp, unsigned char *buf);
152 extern void display_tcb(_TCBVAR *tvp,unsigned char *buf,int aux);
153 extern void parse_n_display_xcb(unsigned char *buf);
155 extern void swizzle_tcb(unsigned char *buf);
156 extern void set_tidtype(unsigned int tidtype);
157 extern void set_tcb_info(unsigned int tidtype, unsigned int cardtype);
158 extern void set_print_style(unsigned int prntstyl);
160 #endif /* __tcb_common_h */