2 * SPDX-License-Identifier: BSD-2-Clause
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
30 #ifndef __tcb_common_h
31 #define __tcb_common_h
33 /* ANSI C standard includes */
50 #ifndef __variable_sizes
52 /* windows has _UI64_MAX. C99 has ULLONG_MAX, but I don't compile
53 with C99 for portability with windows, so the ui64 is a guess.
54 I'll add an assert to cl_main to confirm these sizes are accurate.
56 #ifdef _UI64_MAX /* windows */
57 #if (_UI64_MAX == 0xFFFFFFFFFFFFFFFF)
59 typedef unsigned __int64 ui64;
61 #else /*else of #ifdef _UI64_MAX */
62 typedef long long int si64;
63 typedef unsigned long long int ui64;
64 #endif /*endif of #ifdef _UI64_MAX */
65 #endif /* endif of #ifndef __variable_sizes */
70 typedef struct tcb_var {
122 /* from tp/src/tp.h */
123 #define PM_MODE_PASS 0
124 #define PM_MODE_DDP 1
125 #define PM_MODE_ISCSI 2
126 #define PM_MODE_IWARP 3
127 #define PM_MODE_RDDP 4
128 #define PM_MODE_IANDP 5
129 #define PM_MODE_FCOE 6
130 #define PM_MODE_USER 7
131 #define PM_MODE_TLS 8
132 #define PM_MODE_DTLS 9
136 #define SEQ_ADD(a,b) (((a)+(b)) & 0xFFFFFFFF)
137 #define SEQ_SUB(a,b) (((a)-(b)) & 0xFFFFFFFF)
139 ///* functions needed by the tcbshowtN.c code */
140 extern unsigned val(char *name);
141 extern ui64 val64(char *name);
142 extern void PR(char *fmt, ...);
143 extern char *spr_tcp_state(unsigned state);
144 extern char *spr_ip_version(unsigned ipver);
145 extern char *spr_cctrl_sel(unsigned cctrl_sel0,unsigned cctrl_sel1);
146 extern char *spr_ulp_type(unsigned ulp_type);
149 extern unsigned parse_tcb( _TCBVAR *base_tvp, unsigned char *buf);
150 extern void display_tcb(_TCBVAR *tvp,unsigned char *buf,int aux);
151 extern void parse_n_display_xcb(unsigned char *buf);
153 extern void swizzle_tcb(unsigned char *buf);
154 extern void set_tidtype(unsigned int tidtype);
155 extern void set_tcb_info(unsigned int tidtype, unsigned int cardtype);
156 extern void set_print_style(unsigned int prntstyl);
158 #endif /* __tcb_common_h */