PERFORCE change 126387 for review
Kip Macy
kmacy at FreeBSD.org
Thu Sep 13 16:48:31 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=126387
Change 126387 by kmacy at kmacy_home:ethng on 2007/09/13 23:47:39
add support for WRC
Affected files ...
.. //depot/projects/ethng/src/usr.sbin/cxgbtool/Makefile#2 edit
.. //depot/projects/ethng/src/usr.sbin/cxgbtool/cxgbtool.c#2 edit
Differences ...
==== //depot/projects/ethng/src/usr.sbin/cxgbtool/Makefile#2 (text+ko) ====
@@ -4,7 +4,7 @@
SRCS= cxgbtool.c
NO_MAN=
CFLAGS+= -I${.CURDIR}/../../sys/dev/cxgb -I.
-CFLAGS+= -DCONFIG_T3_REGS -DCHELSIO_INTERNAL
+CFLAGS+= -DCONFIG_T3_REGS -DCHELSIO_INTERNAL -DWRC
install:
==== //depot/projects/ethng/src/usr.sbin/cxgbtool/cxgbtool.c#2 (text+ko) ====
@@ -68,6 +68,41 @@
#include <common/cxgb_regs.h>
#include "version.h"
+struct toetool_reg {
+ uint32_t cmd;
+ uint32_t addr;
+ uint32_t val;
+};
+
+struct toetool_mtus {
+ uint32_t cmd;
+ uint32_t nmtus;
+ uint16_t mtus[NMTUS];
+};
+
+struct toetool_pm {
+ uint32_t cmd;
+ uint32_t tx_pg_sz;
+ uint32_t tx_num_pg;
+ uint32_t rx_pg_sz;
+ uint32_t rx_num_pg;
+ uint32_t pm_total;
+};
+
+struct toetool_tcam {
+ uint32_t cmd;
+ uint32_t tcam_size;
+ uint32_t nservers;
+ uint32_t nroutes;
+ uint32_t nfilters;
+};
+
+struct toetool_tcb {
+ uint32_t cmd;
+ uint32_t tcb_index;
+ uint32_t tcb_data[TCB_WORDS];
+};
+
struct reg_info {
const char *name;
uint16_t addr;
@@ -75,6 +110,80 @@
};
+struct toetool_tcam_word {
+ uint32_t cmd;
+ uint32_t addr;
+ uint32_t buf[3];
+};
+
+
+struct toetool_cntxt {
+ uint32_t cmd;
+ uint32_t cntxt_type;
+ uint32_t cntxt_id;
+ uint32_t data[4];
+};
+
+struct toetool_desc {
+ uint32_t cmd;
+ uint32_t queue_num;
+ uint32_t idx;
+ uint32_t size;
+ uint8_t data[128];
+};
+
+struct toetool_proto {
+ uint32_t cmd;
+ uint32_t data[5 * 128];
+};
+
+struct toetool_qset_params {
+ uint32_t cmd;
+ uint32_t qset_idx;
+ int32_t txq_size[3];
+ int32_t rspq_size;
+ int32_t fl_size[2];
+ int32_t intr_lat;
+ int32_t polling;
+ int32_t lro;
+ int32_t cong_thres;
+ int32_t vector;
+ int32_t qnum;
+};
+
+struct toetool_trace {
+ uint32_t cmd;
+ uint32_t sip;
+ uint32_t sip_mask;
+ uint32_t dip;
+ uint32_t dip_mask;
+ uint16_t sport;
+ uint16_t sport_mask;
+ uint16_t dport;
+ uint16_t dport_mask;
+ uint32_t vlan:12;
+ uint32_t vlan_mask:12;
+ uint32_t intf:4;
+ uint32_t intf_mask:4;
+ uint8_t proto;
+ uint8_t proto_mask;
+ uint8_t invert_match:1;
+ uint8_t config_tx:1;
+ uint8_t config_rx:1;
+ uint8_t trace_tx:1;
+ uint8_t trace_rx:1;
+};
+
+struct toetool_pktsched_params {
+ uint32_t cmd;
+ uint8_t sched;
+ uint8_t idx;
+ uint8_t min;
+ uint8_t max;
+ uint8_t binding;
+};
+
+
#include "reg_defs.c"
#if defined(CONFIG_T3_REGS)
# include "reg_defs_t3.c"
@@ -447,7 +556,7 @@
if (revision == 0)
return dump_regs_t3(argc, argv, start_arg,
(uint32_t *)regs.data, is_pcie);
- if (revision == 2)
+ if (revision == 2 || revision == 3)
return dump_regs_t3b(argc, argv, start_arg,
(uint32_t *)regs.data, is_pcie);
}
@@ -562,14 +671,14 @@
if (argc == start_arg) {
op.cmd = TOETOOL_GETMTUTAB;
- op.nmtus = MAX_NMTUS;
+ op.nmtus = NMTUS;
if (doit(iff_name, &op) < 0)
err(1, "get MTU table");
for (i = 0; i < op.nmtus; ++i)
printf("%u ", op.mtus[i]);
printf("\n");
- } else if (argc <= start_arg + MAX_NMTUS) {
+ } else if (argc <= start_arg + NMTUS) {
op.cmd = TOETOOL_SETMTUTAB;
op.nmtus = argc - start_arg;
@@ -830,14 +939,10 @@
#define FBUF_WRAP_FSZ (FBUF_WRAP_SZ >> 3)
#define MEM_CM_WRC_SIZE WRC_SIZE
-typedef char int8_t;
-typedef short int16_t;
-typedef int int32_t;
typedef long long _s64;
typedef unsigned char _u8;
typedef unsigned short _u16;
typedef unsigned int _uint32_t;
-typedef unsigned long long uint64_t;
enum fw_ri_mpa_attrs {
FW_RI_MPA_RX_MARKER_ENABLE = 0x1,
@@ -1005,7 +1110,7 @@
static void print_wrc(unsigned int wrc_idx, struct wrc *p)
{
- u32 *buf = (u32 *)p;
+ uint32_t *buf = (uint32_t *)p;
unsigned int i, j;
printf("WRC STATE (raw)\n");
@@ -1094,7 +1199,7 @@
static int get_wrc(int argc, char *argv[], int start_arg, const char *iff_name)
{
- struct toetool_mem_range *op;
+ struct ch_mem_range op;
uint64_t *p;
uint32_t *buf;
unsigned int idx, i = 0;
@@ -1105,34 +1210,33 @@
if (get_int_arg(argv[start_arg], &idx))
return -1;
- op = malloc(sizeof(*op) + MEM_CM_WRC_SIZE);
- if (!op)
+ op.buf =malloc(MEM_CM_WRC_SIZE);
+ if (!op.buf)
err(1, "get_wrc: malloc failed");
- op->cmd = TOETOOL_GET_MEM;
- op->mem_id = MEM_CM;
- op->addr = read_reg(iff_name, 0x28c) + CM_WRCONTEXT_OFFSET +
+ buf = (uint32_t *)op.buf;
+ op.mem_id = MEM_CM;
+ op.addr = read_reg(iff_name, 0x28c) + CM_WRCONTEXT_OFFSET +
idx * MEM_CM_WRC_SIZE;
- op->len = MEM_CM_WRC_SIZE;
- buf = (uint32_t *)op->buf;
+ op.len = MEM_CM_WRC_SIZE;
- if (doit(iff_name, op) < 0)
+ if (doit(iff_name, CHELSIO_GET_MEM, &op) < 0)
err(1, "get_wrc");
-
+
/* driver manges with the data... put it back into the the FW's view
*/
- for (p = (uint64_t *)op->buf;
- p < (uint64_t *)(op->buf + MEM_CM_WRC_SIZE); p++) {
+ for (p = (uint64_t *)op.buf;
+ p < (uint64_t *)(op.buf + MEM_CM_WRC_SIZE); p++) {
uint64_t flit = *p;
buf[i++] = htonl((uint32_t)(flit >> 32));
buf[i++] = htonl((uint32_t)flit);
}
- print_wrc(idx, (struct wrc *)op->buf);
- print_wrc_zero(idx, (struct wrc *)op->buf);
- print_wrc_history((struct wrc *)op->buf);
+ print_wrc(idx, (struct wrc *)op.buf);
+ print_wrc_zero(idx, (struct wrc *)op.buf);
+ print_wrc_history((struct wrc *)op.buf);
- free(op);
+ free(buf);
return 0;
}
#endif
@@ -1737,7 +1841,8 @@
}
}
- if (argc < 3) usage(stderr);
+ if (argc < 3)
+ usage(stderr);
iff_name = argv[1];
if (!strcmp(argv[2], "reg"))
@@ -1757,11 +1862,12 @@
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"))
+ else if (!strcmp(argv[2], "wrc"))
r = get_wrc(argc, argv, 3, iff_name);
#endif
-#endif
+
else if (!strcmp(argv[2], "regdump"))
r = dump_regs(argc, argv, 3, iff_name);
#ifdef CHELSIO_INTERNAL
More information about the p4-projects
mailing list