xref: /freebsd/usr.sbin/cxgbetool/tcbshowt4.c (revision dd41de95a84d979615a2ef11df6850622bf6184e)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2018 Chelsio Communications, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
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.
15  *
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
26  * SUCH DAMAGE.
27  */
28 
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
31 
32 /* Auto-generated file.  Avoid direct editing.     */
33 /* Edits will be lost when file regenerated.       */
34 #include <stdio.h>
35 #include "tcb_common.h"
36 
37 void t4_display_tcb_aux_0 (_TCBVAR *tvp, int aux)
38 {
39 
40 
41 
42 
43 
44 
45 
46   PR("STATE:\n");
47   PR("  %-12s (%-2u), %s, lock_tid %u, init %u\n",
48 	      spr_tcp_state(val("t_state")),
49 	      val("t_state"),
50 	      spr_ip_version(val("ip_version")),
51 	      val("lock_tid"),
52 	      val("init")
53 	     );
54   PR("  l2t_ix 0x%x, smac sel 0x%x, tos 0x%x\n",
55 	      val("l2t_ix"),
56 	      val("smac_sel"),
57 	      val("tos")
58 	      );
59   PR("  maxseg %u, recv_scaleflag %u, recv_tstmp %u, recv_sack %u\n",
60 	      val("t_maxseg"),   val("recv_scale"),
61 	      val("recv_tstmp"), val("recv_sack"));
62 
63 
64   PR("TIMERS:\n"); /* **************************************** */
65   PR("  timer    %u,  dack_timer      %u\n",
66 	   val("timer"), val("dack_timer"));
67   PR("  mod_schd: tx: %u, rx: %u, reason 0x%1x\n",
68 	      val("mod_schd_tx"),
69 	      val("mod_schd_rx"),
70 	      ((val("mod_schd_reason2")<<2) | (val("mod_schd_reason1")<<1) |
71 	       val("mod_schd_reason0"))
72 	      );
73 
74 
75   PR("  max_rt   %-2u, rxtshift        %u, keepalive   %u\n",
76 	   val("max_rt"),  val("t_rxtshift"),
77 	   val("keepalive"));
78   PR("  timestamp_offset 0x%x,  timestamp 0x%x\n",
79 	   val("timestamp_offset"),val("timestamp"));
80 
81 
82   PR("  t_rtt_ts_recent_age %u  t_rttseq_recent %u\n",
83 	   val("t_rtt_ts_recent_age"), val("t_rtseq_recent"));
84   PR("  t_srtt %u, t_rttvar %u\n",
85 	   val("t_srtt"),val("t_rttvar"));
86 
87 
88 
89 
90 
91 
92   PR("TRANSMIT BUFFER:\n");   /* *************************** */
93   PR("  snd_una %u, snd_nxt %u, snd_max %u, tx_max %u\n",
94 	      val("snd_una"),val("snd_nxt"),
95 	      val("snd_max"),val("tx_max"));
96   PR("  core_fin %u, tx_hdr_offset %u\n",
97 	      val("core_fin"), SEQ_SUB(val("tx_max"),val("snd_una"))
98 	     );
99   if (val("recv_scale") && !val("active_open")) {
100     PR("  rcv_adv    %-5u << %-2u == %u (recv_scaleflag %u rcv_scale %u active open %u)\n",
101 		val("rcv_adv"), val("rcv_scale"),
102 		val("rcv_adv") << val("rcv_scale"),
103 		val("recv_scale"), val("rcv_scale"), val("active_open"));
104   } else {
105     PR("  rcv_adv    %-5u (rcv_scale %-2u recv_scaleflag %u active_open %u)\n",
106 		val("rcv_adv"), val("rcv_scale"),
107 		val("recv_scale"), val("active_open"));
108   }
109 
110   PR("  snd_cwnd   %-5u  snd_ssthresh %u  snd_rec %u\n",
111 	      val("snd_cwnd")    , val("snd_ssthresh"), val("snd_rec")
112 	     );
113 
114 
115 
116 
117   PR("  cctrl: sel %s, ecn %u, ece %u, cwr %u, rfr %u\n",
118 	      spr_cctrl_sel(val("cctrl_sel0"),val("cctrl_sel1")),
119 	      val("cctrl_ecn"), val("cctrl_ece"), val("cctrl_cwr"),
120 	      val("cctrl_rfr"));
121   PR("  t_dupacks %u, dupack_count_odd %u, fast_recovery %u\n",
122 	      val("t_dupacks"), val("dupack_count_odd"),val("fast_recovery"));
123   PR("  core_more    %u, core_urg,       %u  core_push   %u,",
124 	      val("core_more"),val("core_urg"),val("core_push"));
125   PR("  core_flush %u\n",val("core_flush"));
126   PR("  nagle        %u, ssws_disable    %u, turbo       %u,",
127 	      val("nagle"), val("ssws_disabled"), val("turbo"));
128   PR("  tx_pdu_out %u\n",val("tx_pdu_out"));
129   PR("  tx_pace_auto %u, tx_pace_fixed   %u, tx_queue    %u",
130 	      val("tx_pace_auto"),val("tx_pace_fixed"),val("tx_queue"));
131 
132 
133   PR("   tx_quiesce %u\n",val("tx_quiesce"));
134   PR("  tx_channel   %u, tx_channel1     %u, tx_channel0 %u\n",
135 	      val("tx_channel"),
136 	      (val("tx_channel")>>1)&1,
137 	      val("tx_channel")&1
138 	      );
139 
140 
141 
142 
143   PR("  tx_hdr_ptr   0x%-6x   tx_last_ptr 0x%-6x  tx_compact %u\n",
144 	      val("tx_hdr_ptr"),val("tx_last_ptr"),val("tx_compact"));
145 
146 
147 
148 
149   PR("RECEIVE BUFFER:\n");  /* *************************** */
150   PR("  last_ack_sent %-10u                      rx_compact %u\n",
151 	      val("ts_last_ack_sent"),val("rx_compact"));
152   PR("  rcv_nxt       %-10u  hdr_off %-10u\n",
153 	      val("rcv_nxt"), val("rx_hdr_offset"));
154   PR("  frag0_idx     %-10u  length  %-10u  frag0_ptr  0x%-8x\n",
155 	      val("rx_frag0_start_idx"),
156 	      val("rx_frag0_len"),
157 	      val("rx_ptr"));
158   PR("  frag1_idx     %-10u  length  %-10u  ",
159 	      val("rx_frag1_start_idx_offset"),
160 	      val("rx_frag1_len"));
161 
162 
163 
164 
165   if (val("ulp_type")!=4) { /* RDMA has FRAG1 idx && len, but no ptr?  Should I not display frag1 at all? */
166     PR("frag1_ptr  0x%-8x\n",val("rx_frag1_ptr"));
167   } else {
168     PR("\n");
169   }
170 
171 
172   if (val("ulp_type") !=6 && val("ulp_type") != 5 && val("ulp_type") !=4) {
173     PR("  frag2_idx     %-10u  length  %-10u  frag2_ptr  0x%-8x\n",
174 		val("rx_frag2_start_idx_offset"),
175 		val("rx_frag2_len"),
176 		val("rx_frag2_ptr"));
177     PR("  frag3_idx     %-10u  length  %-10u  frag3_ptr  0x%-8x\n",
178 		val("rx_frag3_start_idx_offset"),
179 		val("rx_frag3_len"),
180 		val("rx_frag3_ptr"));
181   }
182 
183 
184 
185 
186 
187 
188   PR("  peer_fin %u,   rx_pdu_out %u, pdu_len %u\n",
189 	      val("peer_fin"),val("rx_pdu_out"), val("pdu_len"));
190 
191 
192 
193 
194   if (val("recv_scale")) {
195     PR("  rcv_wnd %u >> snd_scale %u == %u, recv_scaleflag = %u\n",
196 		val("rcv_wnd"), val("snd_scale"),
197 		val("rcv_wnd") >> val("snd_scale"),
198 		val("recv_scale"));
199   } else {
200     PR("  rcv_wnd %u.  (snd_scale %u, recv_scaleflag = %u)\n",
201 		val("rcv_wnd"), val("snd_scale"),
202 		val("recv_scale"));
203   }
204 
205 
206 
207 
208  PR("  dack_mss   %u dack       %u,  dack_not_acked: %u\n",
209 	      val("dack_mss"),val("dack"),val("dack_not_acked"));
210   PR("  rcv_coal   %u rcv_co_psh %u rcv_co_last_psh  %u heart %u\n",
211 	      val("rcv_coalesce_enable"),
212 	      val("rcv_coalesce_push"),
213 	      val("rcv_coalesce_last_psh"),
214 	      val("rcv_coalesce_heartbeat"));
215 
216   PR("  rx_channel %u rx_quiesce %u rx_flow_ctrl_dis %u,",
217 	      val("rx_channel"), val("rx_quiesce"),
218 	      val("rx_flow_control_disable"));
219   PR("  rx_flow_ctrl_ddp %u\n",
220 	      val("rx_flow_control_ddp"));
221 
222 
223   PR("MISCELANEOUS:\n");  /* *************************** */
224   PR("  pend_ctl: 0x%1x, unused_flags: 0x%x,  main_slush: 0x%x\n",
225 	      ((val("pend_ctl2")<<2) | (val("pend_ctl1")<<1) |
226 	       val("pend_ctl0")),
227 	      val("unused"),val("main_slush"));
228   PR("  Migrating %u, ask_mode %u, non_offload %u, rss_info %u\n",
229 	      val("migrating"),
230 	      val("ask_mode"), val("non_offload"), val("rss_info"));
231   PR("  ULP: ulp_type %u (%s), ulp_raw %u\n",
232 	      val("ulp_type"), spr_ulp_type(val("ulp_type")),val("ulp_raw"));
233   PR("  RDMA: error   %u, flm_err %u\n",
234 	      val("rdma_error"), val("rdma_flm_error"));
235 
236 
237 }
238 void t4_display_tcb_aux_1 (_TCBVAR *tvp, int aux)
239 {
240 
241 
242 
243   PR("    aux1_slush0: 0x%x aux1_slush1 0x%x\n",
244 	      val("aux1_slush0"), val("aux1_slush1"));
245   PR("    pdu_hdr_len %u\n",val("pdu_hdr_len"));
246 
247 
248 
249 }
250 void t4_display_tcb_aux_2 (_TCBVAR *tvp, int aux)
251 {
252 
253 
254 
255 
256   PR("    qp_id %u, pd_id %u, stag %u\n",
257 	       val("qp_id"), val("pd_id"),val("stag"));
258   PR("    irs_ulp %u, iss_ulp %u\n",
259 	      val("irs_ulp"),val("iss_ulp"));
260   PR("    tx_pdu_len %u\n",
261 	      val("tx_pdu_len"));
262   PR("    cq_idx_sq %u, cq_idx_rq %u\n",
263 	      val("cq_idx_sq"),val("cq_idx_rq"));
264   PR("    rq_start %u, rq_MSN %u, rq_max_off %u, rq_write_ptr %u\n",
265 	      val("rq_start"),val("rq_msn"),val("rq_max_offset"),
266 	      val("rq_write_ptr"));
267   PR("    L_valid %u, rdmap opcode %u\n",
268 	      val("ord_l_bit_vld"),val("rdmap_opcode"));
269   PR("    tx_flush: %u, tx_oos_rxmt %u, tx_oos_txmt %u\n",
270 	      val("tx_flush"),val("tx_oos_rxmt"),val("tx_oos_txmt"));
271 
272 
273 
274 
275 }
276 void t4_display_tcb_aux_3 (_TCBVAR *tvp, int aux)
277 {
278 
279 
280 
281 
282   PR("  aux3_slush: 0x%x, unused: buf0 0x%x, buf1: 0x%x, main: 0x%x\n",
283 	      val("aux3_slush"),val("ddp_buf0_unused"),val("ddp_buf1_unused"),
284 	      val("ddp_main_unused"));
285 
286 
287 
288 
289 
290   PR("  DDP: DDPOFF  ActBuf  IndOut  WaitFrag  Rx2Tx  BufInf\n");
291   PR("         %u       %u       %u        %u        %u      %u\n",
292 	      val("ddp_off"),val("ddp_active_buf"),val("ddp_indicate_out"),
293 	      val("ddp_wait_frag"),val("ddp_rx2tx"),val("ddp_buf_inf")
294 	     );
295 
296 
297 
298 
299 
300   PR("        Ind  PshfEn PushDis Flush NoInvalidate\n");
301   PR("   Buf0: %u      %u       %u    %u       %u\n",
302 	      val("ddp_buf0_indicate"),
303 	      val("ddp_pshf_enable_0"), val("ddp_push_disable_0"),
304 	      val("ddp_buf0_flush"),  val("ddp_psh_no_invalidate0")
305 	       );
306   PR("   Buf1: %u      %u       %u    %u       %u\n",
307 	      val("ddp_buf1_indicate"),
308 	      val("ddp_pshf_enable_1"), val("ddp_push_disable_1"),
309 	      val("ddp_buf1_flush"),  val("ddp_psh_no_invalidate1")
310 	       );
311 
312 
313 
314 
315 
316 
317 
318 
319 
320 
321   PR("        Valid  Offset   Length    Tag\n");
322   PR("   Buf0:  %u    0x%6.6x 0x%6.6x  0x%8.8x",
323 	      val("ddp_buf0_valid"),val("rx_ddp_buf0_offset"),
324 	      val("rx_ddp_buf0_len"),val("rx_ddp_buf0_tag")
325 
326 
327 	       );
328   if      (0==val("ddp_off") && 1==val("ddp_buf0_valid") && 0==val("ddp_active_buf")) {
329     PR("   (Active)\n");
330   } else {
331     PR(" (Inactive)\n");
332   }
333 
334 
335   PR("   Buf1:  %u    0x%6.6x 0x%6.6x  0x%8.8x",
336 	      val("ddp_buf1_valid"),val("rx_ddp_buf1_offset"),
337 	      val("rx_ddp_buf1_len"),val("rx_ddp_buf1_tag")
338 
339 
340 	       );
341 
342 
343   if      (0==val("ddp_off") && 1==val("ddp_buf1_valid") && 1==val("ddp_active_buf")) {
344     PR("   (Active)\n");
345   } else {
346     PR(" (Inactive)\n");
347   }
348 
349 
350 
351 
352 
353 
354   if    (1==val("ddp_off")) {
355     PR("   DDP is off (which also disables indicate)\n");
356   } else if (1==val("ddp_buf0_valid") && 0==val("ddp_active_buf")) {
357     PR("   Data being DDP'ed to buf 0, ");
358     PR("which has %u - %u = %u bytes of space left\n",
359 		val("rx_ddp_buf0_len"),val("rx_ddp_buf0_offset"),
360 		val("rx_ddp_buf0_len")-val("rx_ddp_buf0_offset")
361 	       );
362     if (1==val("ddp_buf1_valid")) {
363       PR("   And buf1, which is also valid, has %u - %u = %u bytes of space left\n",
364 		  val("rx_ddp_buf1_len"),val("rx_ddp_buf1_offset"),
365 		  val("rx_ddp_buf1_len")-val("rx_ddp_buf1_offset")
366 		 );
367     }
368   } else if (1==val("ddp_buf1_valid") && 1==val("ddp_active_buf")) {
369     PR("   Data being DDP'ed to buf 1, ");
370     PR("which has %u - %u = %u bytes of space left\n",
371 		val("rx_ddp_buf1_len"),val("rx_ddp_buf1_offset"),
372 		val("rx_ddp_buf1_len")-val("rx_ddp_buf1_offset")
373 	       );
374     if (1==val("ddp_buf0_valid")) {
375       PR("   And buf0, which is also valid, has %u - %u = %u bytes of space left\n",
376 		  val("rx_ddp_buf0_len"),val("rx_ddp_buf0_offset"),
377 		  val("rx_ddp_buf0_len")-val("rx_ddp_buf0_offset")
378 		 );
379     }
380   } else if (0==val("ddp_buf0_valid") && 1==val("ddp_buf1_valid") && 0==val("ddp_active_buf")) {
381     PR("   !!! Invalid DDP buf 1 valid, but buf 0 active.\n");
382   } else if (1==val("ddp_buf0_valid") && 0==val("ddp_buf1_valid") && 1==val("ddp_active_buf")) {
383     PR("   !!! Invalid DDP buf 0 valid, but buf 1 active.\n");
384   } else {
385     PR("   DDP is enabled, but no buffers are active && valid.\n");
386 
387 
388 
389 
390     if (0==val("ddp_indicate_out")) {
391       if (0==val("ddp_buf0_indicate") && 0==val("ddp_buf1_indicate")) {
392 	PR("   0 length Indicate buffers ");
393 	if (0==val("rx_hdr_offset")) {
394 	  PR("will cause new data to be held in PMRX.\n");
395 	} else {
396 	  PR("is causing %u bytes to be held in PMRX\n",
397 		      val("rx_hdr_offset"));
398 	}
399       } else {
400 	PR("   Data being indicated to host\n");
401       }
402     } else if (1==val("ddp_indicate_out")) {
403       PR("   Indicate is off, which ");
404       if (0==val("rx_hdr_offset")) {
405 	PR("will cause new data to be held in PMRX.\n");
406       } else {
407 	PR("is causing %u bytes to be held in PMRX\n",
408 		    val("rx_hdr_offset"));
409       }
410     }
411   }
412 
413 
414 
415 
416 }
417