PERFORCE change 132531 for review
Steve Wise
swise at FreeBSD.org
Fri Jan 4 14:06:58 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=132531
Change 132531 by swise at swise:vic10:iwarp on 2008/01/04 22:06:24
Add tcb dump to cxgbtool.
Affected files ...
.. //depot/projects/iwarp/usr.sbin/cxgbtool/cxgbtool.c#3 edit
Differences ...
==== //depot/projects/iwarp/usr.sbin/cxgbtool/cxgbtool.c#3 (text+ko) ====
@@ -858,26 +858,25 @@
}
#endif
-#ifdef notyet
static int get_tcb2(unsigned int tcb_idx, const char *iff_name)
{
uint64_t *d;
unsigned int i;
- struct toetool_mem_range *op;
+ struct ch_mem_range op;
- op = malloc(sizeof(*op) + TCB_SIZE);
- if (!op)
+ op.buf = malloc(TCB_SIZE);
+ if (!op.buf)
err(1, "get TCB");
+ memset(op.buf, 0xaa, TCB_SIZE);
- op->cmd = TOETOOL_GET_MEM;
- op->mem_id = MEM_CM;
- op->addr = tcb_idx * TCB_SIZE;
- op->len = TCB_SIZE;
+ op.mem_id = MEM_CM;
+ op.addr = tcb_idx * TCB_SIZE;
+ op.len = TCB_SIZE;
- if (doit(iff_name, op) < 0)
+ if (doit(iff_name, CHELSIO_GET_MEM, &op) < 0)
err(1, "get TCB");
- for (d = (uint64_t *)op->buf, i = 0; i < TCB_SIZE / 32; i++) {
+ for (d = (uint64_t *)op.buf, i = 0; i < TCB_SIZE / 32; i++) {
printf("%2u:", i);
printf(" %08x %08x %08x %08x", (uint32_t)d[1],
(uint32_t)(d[1] >> 32), (uint32_t)d[0],
@@ -888,7 +887,7 @@
(uint32_t)(d[0] >> 32));
d += 2;
}
- free(op);
+ free(op.buf);
return 0;
}
@@ -900,19 +899,23 @@
if (argc != start_arg + 1) return -1;
- op.cmd = TOETOOL_GET_TCB;
if (get_int_arg(argv[start_arg], &op.tcb_index))
return -1;
+#if 0
+ op.cmd = CHELSIO_GET_TCB;
/*
* If this operation isn't directly supported by the driver we may
* still be able to read TCBs using the generic memory dump operation.
*/
- if (doit(iff_name, &op) < 0) {
+ if (doit(iff_name, CHELSIO_GET_TCB, &op) < 0) {
if (errno != EOPNOTSUPP)
err(1, "get TCB");
return get_tcb2(op.tcb_index, iff_name);
}
+#else
+ return get_tcb2(op.tcb_index, iff_name);
+#endif
for (d = op.tcb_data, i = 0; i < TCB_WORDS; i += 8) {
int j;
@@ -924,7 +927,7 @@
}
return 0;
}
-#endif
+
#ifdef WRC
/*
* The following defines, typedefs and structures are defined in the FW and
@@ -1862,8 +1865,6 @@
r = conf_pm(argc, argv, 3, iff_name);
else if (!strcmp(argv[2], "tcam"))
r = conf_tcam(argc, argv, 3, iff_name);
- else if (!strcmp(argv[2], "tcb"))
- r = get_tcb(argc, argv, 3, iff_name);
#endif
#ifdef WRC
else if (!strcmp(argv[2], "wrc"))
@@ -1873,6 +1874,8 @@
else if (!strcmp(argv[2], "regdump"))
r = dump_regs(argc, argv, 3, iff_name);
#ifdef CHELSIO_INTERNAL
+ else if (!strcmp(argv[2], "tcb"))
+ r = get_tcb(argc, argv, 3, iff_name);
else if (!strcmp(argv[2], "memdump"))
r = dump_mc7(argc, argv, 3, iff_name);
else if (!strcmp(argv[2], "meminfo"))
More information about the p4-projects
mailing list