From 83f4db13b687609d0fe189f19e33f1d6f0f51382 Mon Sep 17 00:00:00 2001 From: kmacy Date: Mon, 1 Sep 2008 07:50:04 +0000 Subject: Bring cxgbtool up to date with version 1.5 Obtained from: Chelsio Inc. MFC after: 3 days --- usr.sbin/cxgbtool/cxgbtool.c | 940 ++++++++++++--------------------------- usr.sbin/cxgbtool/reg_defs_t3.c | 2 +- usr.sbin/cxgbtool/reg_defs_t3b.c | 2 +- usr.sbin/cxgbtool/version.h | 6 +- 4 files changed, 280 insertions(+), 670 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/cxgbtool/cxgbtool.c b/usr.sbin/cxgbtool/cxgbtool.c index 6c5effa..b7b7704 100644 --- a/usr.sbin/cxgbtool/cxgbtool.c +++ b/usr.sbin/cxgbtool/cxgbtool.c @@ -1,6 +1,6 @@ /************************************************************************** -Copyright (c) 2007, Chelsio Inc. +Copyright (c) 2007-2008, Chelsio Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -79,6 +79,7 @@ struct reg_info { #if defined(CONFIG_T3_REGS) # include "reg_defs_t3.c" # include "reg_defs_t3b.c" +# include "reg_defs_t3c.c" #endif static const char *progname; @@ -87,44 +88,35 @@ static void __attribute__((noreturn)) usage(FILE *fp) { fprintf(fp, "Usage: %s [operation]\n", progname); fprintf(fp, -#ifdef CHELSIO_INTERNAL - "\treg
[=] read/write register\n" - "\ttpi
[=] read/write TPI register\n" + "\tclearstats clear MAC statistics\n" + "\tcontext show an SGE context\n" + "\tdesc [] dump SGE descriptors\n" + "\tloadboot download boot image\n" + "\tloadfw download firmware\n" "\tmdio \n" "\t [] read/write MDIO register\n" -#endif + "\tmemdump cm|tx|rx dump a mem range\n" + "\tmeminfo show memory info\n" "\tmtus [...] read/write MTU table\n" -#ifdef CHELSIO_INTERNAL + "\tpktsched port set TX port scheduler params\n" + "\tpktsched tunnelq \n" + "\t set TX tunnelq scheduler params\n" + "\tpktsched tx \n" + "\t [ ] ... set Tx HW scheduler\n" "\tpm [ ] read/write PM config\n" - "\ttcam [<#serv> <#routes> <#filters>] read/write TCAM config\n" - "\ttcb read TCB\n" -#endif + "\tproto read proto SRAM\n" + "\tqset read qset parameters\n" + "\tqsets read # of qsets\n" + "\treg
[=] read/write register\n" "\tregdump [] dump registers\n" -#ifdef CHELSIO_INTERNAL "\ttcamdump
show TCAM contents\n" - "\tcontext show an SGE context\n" - "\tdesc [] dump SGE descriptors\n" - "\tmemdump cm|tx|rx dump a mem range\n" - "\tmeminfo show memory info\n" -#endif - "\tup activate TOE\n" - "\tproto [] read/write proto SRAM\n" - "\tloadfw download firmware\n" - "\tqset [ [ ] ...] read/write qset parameters\n" - "\tqsets [<# of qsets>] read/write # of qsets\n" + "\ttcb read TCB\n" "\ttrace tx|rx|all on|off [not]\n" "\t [ [:]] ... write trace parameters\n" - "\tt1powersave [on|off] enable/disable T1xx powersave mode\n" - "\tpktsched port set TX port scheduler params\n" - "\tpktsched tunnelq \n" - "\t set TX tunnelq scheduler params\n" ); exit(fp == stderr ? 1 : 0); } -/* - * Make a TOETOOL ioctl call. - */ static int doit(const char *iff_name, unsigned long cmd, void *data) { @@ -135,7 +127,7 @@ doit(const char *iff_name, unsigned long cmd, void *data) snprintf(buf, 64, "/dev/%s", iff_name); if ((fd = open(buf, O_RDWR)) < 0) - return (EINVAL); + return -1; } return ioctl(fd, cmd, data) < 0 ? -1 : 0; @@ -208,20 +200,20 @@ static int register_io(int argc, char *argv[], int start_arg, static int mdio_io(int argc, char *argv[], int start_arg, const char *iff_name) { struct ifreq ifr; - struct mii_data p; + struct ch_mii_data p; unsigned int cmd, phy_addr, reg, mmd, val; if (argc == start_arg + 3) - cmd = SIOCGMIIREG; + cmd = CHELSIO_GET_MIIREG; else if (argc == start_arg + 4) - cmd = SIOCSMIIREG; + cmd = CHELSIO_SET_MIIREG; else return -1; if (get_int_arg(argv[start_arg], &phy_addr) || get_int_arg(argv[start_arg + 1], &mmd) || get_int_arg(argv[start_arg + 2], ®) || - (cmd == SIOCSMIIREG && get_int_arg(argv[start_arg + 3], &val))) + (cmd == CHELSIO_SET_MIIREG && get_int_arg(argv[start_arg + 3], &val))) return -1; p.phy_id = phy_addr | (mmd << 8); @@ -229,8 +221,8 @@ static int mdio_io(int argc, char *argv[], int start_arg, const char *iff_name) p.val_in = val; if (doit(iff_name, cmd, &p) < 0) - err(1, "MDIO %s", cmd == SIOCGMIIREG ? "read" : "write"); - if (cmd == SIOCGMIIREG) + err(1, "MDIO %s", cmd == CHELSIO_GET_MIIREG ? "read" : "write"); + if (cmd == CHELSIO_GET_MIIREG) printf("%#x [%u]\n", p.val_out, p.val_out); return 0; } @@ -418,19 +410,79 @@ static int dump_regs_t3b(int argc, char *argv[], int start_arg, uint32_t *regs, errx(1, "unknown block \"%s\"", block_name); return 0; } + +static int dump_regs_t3c(int argc, char *argv[], int start_arg, uint32_t *regs, + int is_pcie) +{ + int match = 0; + char *block_name = NULL; + + if (argc == start_arg + 1) + block_name = argv[start_arg]; + else if (argc != start_arg) + return -1; + + if (!block_name || !strcmp(block_name, "sge")) + match += dump_block_regs(t3c_sge3_regs, regs); + if (!block_name || !strcmp(block_name, "pci")) + match += dump_block_regs(is_pcie ? t3c_pcie0_regs : + t3c_pcix1_regs, regs); + if (!block_name || !strcmp(block_name, "t3dbg")) + match += dump_block_regs(t3c_t3dbg_regs, regs); + if (!block_name || !strcmp(block_name, "pmrx")) + match += dump_block_regs(t3c_mc7_pmrx_regs, regs); + if (!block_name || !strcmp(block_name, "pmtx")) + match += dump_block_regs(t3c_mc7_pmtx_regs, regs); + if (!block_name || !strcmp(block_name, "cm")) + match += dump_block_regs(t3c_mc7_cm_regs, regs); + if (!block_name || !strcmp(block_name, "cim")) + match += dump_block_regs(t3c_cim_regs, regs); + if (!block_name || !strcmp(block_name, "tp")) + match += dump_block_regs(t3c_tp1_regs, regs); + if (!block_name || !strcmp(block_name, "ulp_rx")) + match += dump_block_regs(t3c_ulp2_rx_regs, regs); + if (!block_name || !strcmp(block_name, "ulp_tx")) + match += dump_block_regs(t3c_ulp2_tx_regs, regs); + if (!block_name || !strcmp(block_name, "pmrx")) + match += dump_block_regs(t3c_pm1_rx_regs, regs); + if (!block_name || !strcmp(block_name, "pmtx")) + match += dump_block_regs(t3c_pm1_tx_regs, regs); + if (!block_name || !strcmp(block_name, "mps")) + match += dump_block_regs(t3c_mps0_regs, regs); + if (!block_name || !strcmp(block_name, "cplsw")) + match += dump_block_regs(t3c_cpl_switch_regs, regs); + if (!block_name || !strcmp(block_name, "smb")) + match += dump_block_regs(t3c_smb0_regs, regs); + if (!block_name || !strcmp(block_name, "i2c")) + match += dump_block_regs(t3c_i2cm0_regs, regs); + if (!block_name || !strcmp(block_name, "mi1")) + match += dump_block_regs(t3c_mi1_regs, regs); + if (!block_name || !strcmp(block_name, "sf")) + match += dump_block_regs(t3c_sf1_regs, regs); + if (!block_name || !strcmp(block_name, "pl")) + match += dump_block_regs(t3c_pl3_regs, regs); + if (!block_name || !strcmp(block_name, "mc5")) + match += dump_block_regs(t3c_mc5a_regs, regs); + if (!block_name || !strcmp(block_name, "xgmac0")) + match += dump_block_regs(t3c_xgmac0_0_regs, regs); + if (!block_name || !strcmp(block_name, "xgmac1")) + match += dump_block_regs(t3c_xgmac0_1_regs, regs); + if (!match) + errx(1, "unknown block \"%s\"", block_name); + return 0; +} #endif static int dump_regs(int argc, char *argv[], int start_arg, const char *iff_name) { - - int i, vers, revision, is_pcie; - struct ifconf_regs regs; + struct ch_ifconf_regs regs; regs.len = REGDUMP_SIZE; - if ((regs.data = malloc(REGDUMP_SIZE)) == NULL) + /* XXX: This is never freed. Looks like we don't care. */ + if ((regs.data = malloc(regs.len)) == NULL) err(1, "can't malloc"); if (doit(iff_name, CHELSIO_IFCONF_GETREGS, ®s)) @@ -450,9 +502,12 @@ dump_regs(int argc, char *argv[], int start_arg, const char *iff_name) if (revision == 2) return dump_regs_t3b(argc, argv, start_arg, (uint32_t *)regs.data, is_pcie); + if (revision == 4) + return dump_regs_t3c(argc, argv, start_arg, + (uint32_t *)regs.data, is_pcie); } #endif - errx(1, "unknown card type %d", vers); + errx(1, "unknown card type %d.%d", vers, revision); return 0; } @@ -537,9 +592,10 @@ static int t3_meminfo(const uint32_t *regs) static int meminfo(int argc, char *argv[], int start_arg, const char *iff_name) { int vers; - struct ifconf_regs regs; + struct ch_ifconf_regs regs; - if ((regs.data = malloc(REGDUMP_SIZE)) == NULL) + regs.len = REGDUMP_SIZE; + if ((regs.data = malloc(regs.len)) == NULL) err(1, "can't malloc"); if (doit(iff_name, CHELSIO_IFCONF_GETREGS, ®s)) @@ -553,47 +609,41 @@ static int meminfo(int argc, char *argv[], int start_arg, const char *iff_name) return 0; } -#ifdef notyet static int mtu_tab_op(int argc, char *argv[], int start_arg, const char *iff_name) { - struct toetool_mtus op; + struct ch_mtus m; int i; if (argc == start_arg) { - op.cmd = TOETOOL_GETMTUTAB; - op.nmtus = MAX_NMTUS; - - if (doit(iff_name, &op) < 0) + if (doit(iff_name, CHELSIO_GETMTUTAB, &m) < 0) err(1, "get MTU table"); - for (i = 0; i < op.nmtus; ++i) - printf("%u ", op.mtus[i]); + for (i = 0; i < m.nmtus; ++i) + printf("%u ", m.mtus[i]); printf("\n"); - } else if (argc <= start_arg + MAX_NMTUS) { - op.cmd = TOETOOL_SETMTUTAB; - op.nmtus = argc - start_arg; + } else if (argc <= start_arg + NMTUS) { + m.nmtus = argc - start_arg; - for (i = 0; i < op.nmtus; ++i) { + for (i = 0; i < m.nmtus; ++i) { char *p; - unsigned long m = strtoul(argv[start_arg + i], &p, 0); + unsigned long mt = strtoul(argv[start_arg + i], &p, 0); - if (*p || m > 9600) { + if (*p || mt > 9600) { warnx("bad parameter \"%s\"", argv[start_arg + i]); return -1; } - if (i && m < op.mtus[i - 1]) + if (i && mt < m.mtus[i - 1]) errx(1, "MTUs must be in ascending order"); - op.mtus[i] = m; + m.mtus[i] = mt; } - if (doit(iff_name, &op) < 0) + if (doit(iff_name, CHELSIO_SETMTUTAB, &m) < 0) err(1, "set MTU table"); } else return -1; return 0; } -#endif #ifdef CHELSIO_INTERNAL static void show_egress_cntxt(uint32_t data[]) @@ -747,26 +797,31 @@ static int get_sge_desc(int argc, char *argv[], int start_arg, } #endif -#ifdef notyet -static int get_tcb2(unsigned int tcb_idx, const char *iff_name) +static int get_tcb2(int argc, char *argv[], int start_arg, const char *iff_name) { uint64_t *d; unsigned int i; - struct toetool_mem_range *op; + unsigned int tcb_idx; + struct ch_mem_range mr; + + if (argc != start_arg + 1) + return -1; - op = malloc(sizeof(*op) + TCB_SIZE); - if (!op) + if (get_int_arg(argv[start_arg], &tcb_idx)) + return -1; + + mr.buf = calloc(1, TCB_SIZE); + if (!mr.buf) err(1, "get TCB"); - op->cmd = TOETOOL_GET_MEM; - op->mem_id = MEM_CM; - op->addr = tcb_idx * TCB_SIZE; - op->len = TCB_SIZE; + mr.mem_id = MEM_CM; + mr.addr = tcb_idx * TCB_SIZE; + mr.len = TCB_SIZE; - if (doit(iff_name, op) < 0) + if (doit(iff_name, CHELSIO_GET_MEM, &mr) < 0) err(1, "get TCB"); - for (d = (uint64_t *)op->buf, i = 0; i < TCB_SIZE / 32; i++) { + for (d = (uint64_t *)&mr.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], @@ -777,367 +832,10 @@ static int get_tcb2(unsigned int tcb_idx, const char *iff_name) (uint32_t)(d[0] >> 32)); d += 2; } - free(op); - return 0; -} - -static int get_tcb(int argc, char *argv[], int start_arg, const char *iff_name) -{ - int i; - uint32_t *d; - struct toetool_tcb op; - - 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 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 (errno != EOPNOTSUPP) - err(1, "get TCB"); - return get_tcb2(op.tcb_index, iff_name); - } - - for (d = op.tcb_data, i = 0; i < TCB_WORDS; i += 8) { - int j; - - printf("%2u:", 4 * i); - for (j = 0; j < 8; ++j) - printf(" %08x", *d++); - printf("\n"); - } - return 0; -} -#endif -#ifdef WRC -/* - * The following defines, typedefs and structures are defined in the FW and - * should be exported instead of being redefined here (and kept up in sync). - * We'll fix this in the next round of FW cleanup. - */ -#define CM_WRCONTEXT_BASE 0x20300000 -#define CM_WRCONTEXT_OFFSET 0x300000 -#define WRC_SIZE (FW_WR_SIZE * (2 + FW_WR_NUM) + 32 + 4 * 128) -#define FW_WR_SIZE 128 -#define FW_WR_NUM 16 -#define FBUF_SIZE (FW_WR_SIZE * FW_WR_NUM) -#define FBUF_WRAP_SIZE 128 -#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, - FW_RI_MPA_TX_MARKER_ENABLE = 0x2, - FW_RI_MPA_CRC_ENABLE = 0x4, - FW_RI_MPA_IETF_ENABLE = 0x8 -} __attribute__ ((packed)); - -enum fw_ri_qp_caps { - FW_RI_QP_RDMA_READ_ENABLE = 0x01, - FW_RI_QP_RDMA_WRITE_ENABLE = 0x02, - FW_RI_QP_BIND_ENABLE = 0x04, - FW_RI_QP_FAST_REGISTER_ENABLE = 0x08, - FW_RI_QP_STAG0_ENABLE = 0x10 -} __attribute__ ((packed)); - -enum wrc_state { - WRC_STATE_CLOSED, - WRC_STATE_ABORTED, - WRC_STATE_HALFCLOSED, - WRC_STATE_TOE_ESTABLISHED, - WRC_STATE_RDMA_TX_DATA_PEND, - WRC_STATE_RDMA_PEND, - WRC_STATE_RDMA_ESTABLISHED, -}; - -struct _wr { - uint32_t a; - uint32_t b; -}; - -struct fbuf { - uint32_t pp; /* fifo producer pointer */ - uint32_t cp; /* fifo consumer pointer */ - int32_t num_bytes; /* num bytes stored in the fbuf */ - char bufferb[FBUF_SIZE]; /* buffer space in bytes */ - char _wrap[FBUF_WRAP_SIZE]; /* wrap buffer size*/ -}; -struct wrc { - uint32_t wrc_tid; - _u16 wrc_flags; - _u8 wrc_state; - _u8 wrc_credits; - - /* IO */ - _u16 wrc_sge_ec; - _u8 wrc_sge_respQ; - _u8 wrc_port; - _u8 wrc_ulp; - - _u8 wrc_coherency_counter; - - /* REASSEMBLY */ - _u8 wrc_frag_len; - _u8 wrc_frag_credits; - uint32_t wrc_frag; - - union { - struct { - - /* TOE */ - _u8 aborted; - _u8 wrc_num_tx_pages; - _u8 wrc_max_tx_pages; - _u8 wrc_trace_idx; - uint32_t wrc_snd_nxt; - uint32_t wrc_snd_max; - uint32_t wrc_snd_una; - uint32_t wrc_snd_iss; - - /* RI */ - uint32_t wrc_pdid; - uint32_t wrc_scqid; - uint32_t wrc_rcqid; - uint32_t wrc_rq_addr_32a; - _u16 wrc_rq_size; - _u16 wrc_rq_wr_idx; - enum fw_ri_mpa_attrs wrc_mpaattrs; - enum fw_ri_qp_caps wrc_qpcaps; - _u16 wrc_mulpdu_tagged; - _u16 wrc_mulpdu_untagged; - _u16 wrc_ord_max; - _u16 wrc_ird_max; - _u16 wrc_ord; - _u16 wrc_ird; - _u16 wrc_markeroffset; - uint32_t wrc_msn_send; - uint32_t wrc_msn_rdma_read; - uint32_t wrc_msn_rdma_read_req; - _u16 wrc_rdma_read_req_err; - _u8 wrc_ack_mode; - _u8 wrc_sge_ec_credits; - _u16 wrc_maxiolen_tagged; - _u16 wrc_maxiolen_untagged; - uint32_t wrc_mo; - } toe_ri; - - struct { - - } ipmi; - - struct { - uint32_t wrc_pad2[24]; - } pad; - } u __attribute__ ((packed)); - - /* BUFFERING */ - struct fbuf wrc_fbuf __attribute__ ((packed)); -}; -#define wrc_aborted u.toe_ri.aborted -#define wrc_num_tx_pages u.toe_ri.wrc_num_tx_pages -#define wrc_max_tx_pages u.toe_ri.wrc_max_tx_pages -#define wrc_trace_idx u.toe_ri.wrc_trace_idx -#define wrc_snd_nxt u.toe_ri.wrc_snd_nxt -#define wrc_snd_max u.toe_ri.wrc_snd_max -#define wrc_snd_una u.toe_ri.wrc_snd_una -#define wrc_snd_iss u.toe_ri.wrc_snd_iss -#define wrc_pdid u.toe_ri.wrc_pdid -#define wrc_scqid u.toe_ri.wrc_scqid -#define wrc_rcqid u.toe_ri.wrc_rcqid -#define wrc_rq_addr_32a u.toe_ri.wrc_rq_addr_32a -#define wrc_rq_size u.toe_ri.wrc_rq_size -#define wrc_rq_wr_idx u.toe_ri.wrc_rq_wr_idx -#define wrc_mpaattrs u.toe_ri.wrc_mpaattrs -#define wrc_qpcaps u.toe_ri.wrc_qpcaps -#define wrc_mulpdu_tagged u.toe_ri.wrc_mulpdu_tagged -#define wrc_mulpdu_untagged u.toe_ri.wrc_mulpdu_untagged -#define wrc_ord_max u.toe_ri.wrc_ord_max -#define wrc_ird_max u.toe_ri.wrc_ird_max -#define wrc_ord u.toe_ri.wrc_ord -#define wrc_ird u.toe_ri.wrc_ird -#define wrc_markeroffset u.toe_ri.wrc_markeroffset -#define wrc_msn_send u.toe_ri.wrc_msn_send -#define wrc_msn_rdma_read u.toe_ri.wrc_msn_rdma_read -#define wrc_msn_rdma_read_req u.toe_ri.wrc_msn_rdma_read_req -#define wrc_rdma_read_req_err u.toe_ri.wrc_rdma_read_req_err -#define wrc_ack_mode u.toe_ri.wrc_ack_mode -#define wrc_sge_ec_credits u.toe_ri.wrc_sge_ec_credits -#define wrc_maxiolen_tagged u.toe_ri.wrc_maxiolen_tagged -#define wrc_maxiolen_untagged u.toe_ri.wrc_maxiolen_untagged -#define wrc_mo u.toe_ri.wrc_mo - -static void print_wrc_field(char *field, unsigned int value, unsigned int size) -{ - switch(size) { - case 1: - printf(" 1 %s: 0x%02x (%u)\n", field, value, value); - break; - case 2: { - unsigned short host_value = ntohs(value); - printf(" 2 %s: 0x%04x (%u)\n", field, host_value, host_value); - break; - } - case 4: { - unsigned int host_value = ntohl(value); - printf(" 4 %s: 0x%08x (%u)\n", field, host_value, host_value); - break; - } - default: - printf(" unknown size %u for field %s\n", size, field); - } -} - -#define P(field) print_wrc_field(#field, p->wrc_ ## field, sizeof (p->wrc_ ## field)) - -static void print_wrc(unsigned int wrc_idx, struct wrc *p) -{ - u32 *buf = (u32 *)p; - unsigned int i, j; - - printf("WRC STATE (raw)\n"); - for (i = 0; i < 32;) { - printf("[%08x]:", 0x20300000 + wrc_idx * MEM_CM_WRC_SIZE + i * 4); - for (j = 0; j < 8; j++) { - printf(" %08x ", htonl(buf[i++])); - } - printf("\n"); - } - printf("WRC BASIC\n"); - P(tid); P(flags); P(state); P(credits); - printf("WRC IO\n"); - P(sge_ec); P(sge_respQ); P(port); P(ulp); P(coherency_counter); - printf("WRC REASSEMBLY\n"); - P(frag_len); P(frag_credits); P(frag); - printf("WRC TOE\n"); - P(aborted); P(num_tx_pages); P(max_tx_pages); P(trace_idx); P(snd_nxt); - P(snd_max); P(snd_una); P(snd_iss); - printf("WRC RI\n"); - P(pdid); P(scqid); P(rcqid); P(rq_addr_32a); P(rq_size); P(rq_wr_idx); - P(mpaattrs); P(qpcaps); P(mulpdu_tagged); P(mulpdu_untagged); P(ord_max); - P(ird_max); P(ord); P(ird); P(markeroffset); P(msn_send); P(msn_rdma_read); - P(msn_rdma_read_req); P(rdma_read_req_err); P(ack_mode); - P(sge_ec_credits); P(maxiolen_tagged); P(maxiolen_untagged); P(mo); - printf("WRC BUFFERING\n"); - printf(" 4 fbuf.pp: 0x%08x (%u)\n", htonl(p->wrc_fbuf.pp), htonl(p->wrc_fbuf.pp)); - printf(" 4 fbuf.cp: 0x%08x (%u)\n", htonl(p->wrc_fbuf.cp), htonl(p->wrc_fbuf.cp)); - printf(" 4 fbuf.num_bytes: 0x%08x (%d)\n", htonl(p->wrc_fbuf.num_bytes), htonl(p->wrc_fbuf.num_bytes)); - printf("WRC BUFFER (raw)\n"); - for (i = 32; i < (FBUF_SIZE + FBUF_WRAP_SIZE) / 4;) { - printf("[%08x]:", 0x20300000 + wrc_idx * MEM_CM_WRC_SIZE + i * 4); - for (j = 0; j < 4; j++) { - printf(" %08x%08x", htonl(buf[i++]), htonl(buf[i++])); - } - printf("\n"); - } -} - -#undef P - -#define P(field) print_sizeof(#field, ##field, sizeof (p->##field)) - -struct history_e { - uint32_t wr_addr; - uint32_t debug; - uint64_t wr_flit0; - uint64_t wr_flit1; - uint64_t wr_flit2; -}; - -static void print_wrc_zero(unsigned int wrc_idx, struct wrc *p) -{ - uint32_t *buf = - (uint32_t *)((unsigned long)p + FW_WR_SIZE * (2 + FW_WR_NUM)); - unsigned int i; - - printf("WRC ZERO\n"); - printf("[%08x]:", CM_WRCONTEXT_BASE + wrc_idx * MEM_CM_WRC_SIZE + - FW_WR_SIZE * (2 + FW_WR_NUM)); - for (i = 0; i < 4;) - printf(" %08x%08x", htonl(buf[i]), htonl(buf[i++])); - printf("\n"); -} - -static void print_wrc_history(struct wrc *p) -{ - unsigned int i, idx; - struct history_e *e = - (struct history_e *)((unsigned long)p + FW_WR_SIZE * - (2 + FW_WR_NUM) + 32); - printf("WRC WR HISTORY, idx %u\n", p->wrc_trace_idx); - idx = p->wrc_trace_idx; - for (i = 0; i < 16; i++) { - printf("%02u: %08x %08x %08x%08x %08x%08x %08x%08x\n", idx, - htonl(e[idx].wr_addr), htonl(e[idx].debug), - htonl(e[idx].wr_flit0 & 0xFFFFFFFF), - htonl(e[idx].wr_flit0 >> 32), - htonl(e[idx].wr_flit1 & 0xFFFFFFFF), - htonl(e[idx].wr_flit1 >> 32), - htonl(e[idx].wr_flit2 & 0xFFFFFFFF), - htonl(e[idx].wr_flit2 >> 32)); - idx = (idx - 1) & 0xF; - } -} - -static int get_wrc(int argc, char *argv[], int start_arg, const char *iff_name) -{ - struct toetool_mem_range *op; - uint64_t *p; - uint32_t *buf; - unsigned int idx, i = 0; - - if (argc != start_arg + 1) - return -1; - - if (get_int_arg(argv[start_arg], &idx)) - return -1; - - op = malloc(sizeof(*op) + MEM_CM_WRC_SIZE); - if (!op) - 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 + - idx * MEM_CM_WRC_SIZE; - op->len = MEM_CM_WRC_SIZE; - buf = (uint32_t *)op->buf; - - if (doit(iff_name, 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++) { - 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); - - free(op); + free(mr.buf); return 0; } -#endif -#ifdef notyet static int get_pm_page_spec(const char *s, unsigned int *page_size, unsigned int *num_pages) { @@ -1159,80 +857,48 @@ static int get_pm_page_spec(const char *s, unsigned int *page_size, static int conf_pm(int argc, char *argv[], int start_arg, const char *iff_name) { - struct toetool_pm op; + struct ch_pm pm; if (argc == start_arg) { - op.cmd = TOETOOL_GET_PM; - if (doit(iff_name, &op) < 0) + if (doit(iff_name, CHELSIO_GET_PM, &pm) < 0) err(1, "read pm config"); printf("%ux%uKB TX pages, %ux%uKB RX pages, %uKB total memory\n", - op.tx_num_pg, op.tx_pg_sz >> 10, op.rx_num_pg, - op.rx_pg_sz >> 10, op.pm_total >> 10); + pm.tx_num_pg, pm.tx_pg_sz >> 10, pm.rx_num_pg, + pm.rx_pg_sz >> 10, pm.pm_total >> 10); return 0; } if (argc != start_arg + 2) return -1; - if (get_pm_page_spec(argv[start_arg], &op.tx_pg_sz, &op.tx_num_pg)) { + if (get_pm_page_spec(argv[start_arg], &pm.tx_pg_sz, &pm.tx_num_pg)) { warnx("bad parameter \"%s\"", argv[start_arg]); return -1; } - if (get_pm_page_spec(argv[start_arg + 1], &op.rx_pg_sz, - &op.rx_num_pg)) { + if (get_pm_page_spec(argv[start_arg + 1], &pm.rx_pg_sz, + &pm.rx_num_pg)) { warnx("bad parameter \"%s\"", argv[start_arg + 1]); return -1; } - op.cmd = TOETOOL_SET_PM; - if (doit(iff_name, &op) < 0) + if (doit(iff_name, CHELSIO_SET_PM, &pm) < 0) err(1, "pm config"); return 0; } -static int conf_tcam(int argc, char *argv[], int start_arg, - const char *iff_name) -{ - struct toetool_tcam op; - - if (argc == start_arg) { - op.cmd = TOETOOL_GET_TCAM; - op.nfilters = 0; - if (doit(iff_name, &op) < 0) - err(1, "read tcam config"); - printf("%u total entries, %u servers, %u filters, %u routes\n", - op.tcam_size, op.nservers, op.nfilters, op.nroutes); - return 0; - } - - if (argc != start_arg + 3) return -1; - - if (get_int_arg(argv[start_arg], &op.nservers) || - get_int_arg(argv[start_arg + 1], &op.nroutes) || - get_int_arg(argv[start_arg + 2], &op.nfilters)) - return -1; - op.cmd = TOETOOL_SET_TCAM; - if (doit(iff_name, &op) < 0) - err(1, "tcam config"); - return 0; -} -#endif - #ifdef CHELSIO_INTERNAL -#ifdef notyet static int dump_tcam(int argc, char *argv[], int start_arg, const char *iff_name) { unsigned int nwords; - struct toetool_tcam_word op; + struct ch_tcam_word op; if (argc != start_arg + 2) return -1; if (get_int_arg(argv[start_arg], &op.addr) || get_int_arg(argv[start_arg + 1], &nwords)) return -1; - op.cmd = TOETOOL_READ_TCAM_WORD; while (nwords--) { - if (doit(iff_name, &op) < 0) + if (doit(iff_name, CHELSIO_READ_TCAM_WORD, &op) < 0) err(1, "tcam dump"); printf("0x%08x: 0x%02x 0x%08x 0x%08x\n", op.addr, @@ -1241,7 +907,7 @@ static int dump_tcam(int argc, char *argv[], int start_arg, } return 0; } -#endif + static void hexdump_8b(unsigned int start, uint64_t *data, unsigned int len) { int i; @@ -1294,14 +960,13 @@ static int dump_mc7(int argc, char *argv[], int start_arg, } #endif -#ifdef notyet /* Max FW size is 32K including version, +4 bytes for the checksum. */ #define MAX_FW_IMAGE_SIZE (32768 + 4) static int load_fw(int argc, char *argv[], int start_arg, const char *iff_name) { int fd, len; - struct toetool_mem_range *op; + struct ch_mem_range op; const char *fname = argv[start_arg]; if (argc != start_arg + 1) return -1; @@ -1310,68 +975,74 @@ static int load_fw(int argc, char *argv[], int start_arg, const char *iff_name) if (fd < 0) err(1, "load firmware"); - op = malloc(sizeof(*op) + MAX_FW_IMAGE_SIZE + 1); - if (!op) + bzero(&op, sizeof(op)); + op.buf = malloc(MAX_FW_IMAGE_SIZE + 1); + if (!op.buf) err(1, "load firmware"); - len = read(fd, op->buf, MAX_FW_IMAGE_SIZE + 1); - if (len < 0) + op.len = read(fd, op.buf, MAX_FW_IMAGE_SIZE + 1); + if (op.len < 0) err(1, "load firmware"); - if (len > MAX_FW_IMAGE_SIZE) + if (op.len > MAX_FW_IMAGE_SIZE) errx(1, "FW image too large"); - op->cmd = TOETOOL_LOAD_FW; - op->len = len; - - if (doit(iff_name, op) < 0) + if (doit(iff_name, CHELSIO_LOAD_FW, &op) < 0) err(1, "load firmware"); return 0; } +/* Max BOOT size is 255*512 bytes including the BIOS boot ROM basic header */ +#define MAX_BOOT_IMAGE_SIZE (0xff * 512) -static int write_proto_sram(const char *fname, const char *iff_name) +static int load_boot(int argc, char *argv[], + int start_arg, const char *iff_name) { - int i; - char c; - struct toetool_proto op = { .cmd = TOETOOL_SET_PROTO }; - uint32_t *p = op.data; - FILE *fp = fopen(fname, "r"); - - if (!fp) - err(1, "load protocol sram"); - - for (i = 0; i < 128; i++, p += 5) { - int n = fscanf(fp, "%1x%8x%8x%8x%8x", - &p[0], &p[1], &p[2], &p[3], &p[4]); - if (n != 5) - errx(1, "%s: bad line %d", fname, i); - } - if (fscanf(fp, "%1s", &c) != EOF) - errx(1, "%s: protocol sram image has too many lines", fname); - fclose(fp); + int fd, len; + struct ch_mem_range op; + const char *fname = argv[start_arg]; + + if (argc != start_arg + 1) return -1; + + fd = open(fname, O_RDONLY); + if (fd < 0) + err(1, "load boot image"); + + op.buf = malloc(MAX_BOOT_IMAGE_SIZE + 1); + if (!op.buf) + err(1, "load boot image"); + + len = read(fd, op.buf, MAX_BOOT_IMAGE_SIZE + 1); + if (len < 0) + err(1, "load boot image"); + if (len > MAX_BOOT_IMAGE_SIZE) + errx(1, "boot image too large"); + + op.len = len; + + if (doit(iff_name, CHELSIO_LOAD_BOOT, &op) < 0) + err(1, "load boot image"); - if (doit(iff_name, &op) < 0) - err(1, "load protocol sram"); return 0; } static int dump_proto_sram(const char *iff_name) { int i, j; - u8 buf[sizeof(struct ethtool_eeprom) + PROTO_SRAM_SIZE]; - struct ethtool_eeprom *ee = (struct ethtool_eeprom *)buf; - u8 *p = buf + sizeof(struct ethtool_eeprom); - - ee->cmd = ETHTOOL_GEEPROM; - ee->len = PROTO_SRAM_SIZE; - ee->offset = PROTO_SRAM_EEPROM_ADDR; - if (ethtool_call(iff_name, ee)) + uint8_t buf[PROTO_SRAM_SIZE]; + struct ch_eeprom ee; + uint8_t *p = buf; + + bzero(buf, sizeof(buf)); + ee.offset = PROTO_SRAM_EEPROM_ADDR; + ee.data = p; + ee.len = sizeof(buf); + if (doit(iff_name, CHELSIO_GET_EEPROM, &ee)) err(1, "show protocol sram"); for (i = 0; i < PROTO_SRAM_LINES; i++) { for (j = PROTO_SRAM_LINE_NIBBLES - 1; j >= 0; j--) { int nibble_idx = i * PROTO_SRAM_LINE_NIBBLES + j; - u8 nibble = p[nibble_idx / 2]; + uint8_t nibble = p[nibble_idx / 2]; if (nibble_idx & 1) nibble >>= 4; @@ -1387,13 +1058,10 @@ static int dump_proto_sram(const char *iff_name) static int proto_sram_op(int argc, char *argv[], int start_arg, const char *iff_name) { - if (argc == start_arg + 1) - return write_proto_sram(argv[start_arg], iff_name); if (argc == start_arg) return dump_proto_sram(iff_name); return -1; } -#endif static int dump_qset_params(const char *iff_name) { @@ -1403,14 +1071,13 @@ static int dump_qset_params(const char *iff_name) while (doit(iff_name, CHELSIO_GET_QSET_PARAMS, &qp) == 0) { if (!qp.qset_idx) - printf("Qnum TxQ0 TxQ1 TxQ2 RspQ RxQ0 RxQ1" - " Cong Intr Lat Rx Mode\n"); - printf("%4u %6u %6u %6u %6u %6u %6u %5u %9u %s \n", - qp.qset_idx, + printf("Qset TxQ0 TxQ1 TxQ2 RspQ RxQ0 RxQ1" + " Cong Lat IRQ\n"); + printf("%4u %6u %6u %6u %6u %6u %6u %5u %4u %5d\n", + qp.qnum, qp.txq_size[0], qp.txq_size[1], qp.txq_size[2], qp.rspq_size, qp.fl_size[0], qp.fl_size[1], - qp.cong_thres, qp.intr_lat, - qp.polling ? "Polling" : "Interrupt"); + qp.cong_thres, qp.intr_lat, qp.vector); qp.qset_idx++; } if (!qp.qset_idx || (errno && errno != EINVAL)) @@ -1426,68 +1093,7 @@ static int qset_config(int argc, char *argv[], int start_arg, if (argc == start_arg) return dump_qset_params(iff_name); - if (get_int_arg(argv[start_arg++], &qp.qset_idx)) - return -1; - - qp.txq_size[0] = qp.txq_size[1] = qp.txq_size[2] = -1; - qp.fl_size[0] = qp.fl_size[1] = qp.rspq_size = -1; - qp.polling = qp.intr_lat = qp.cong_thres = -1; - - while (start_arg + 2 <= argc) { - int32_t *param = NULL; - - if (!strcmp(argv[start_arg], "txq0")) - param = &qp.txq_size[0]; - else if (!strcmp(argv[start_arg], "txq1")) - param = &qp.txq_size[1]; - else if (!strcmp(argv[start_arg], "txq2")) - param = &qp.txq_size[2]; - else if (!strcmp(argv[start_arg], "rspq")) - param = &qp.rspq_size; - else if (!strcmp(argv[start_arg], "fl0")) - param = &qp.fl_size[0]; - else if (!strcmp(argv[start_arg], "fl1")) - param = &qp.fl_size[1]; - else if (!strcmp(argv[start_arg], "lat")) - param = &qp.intr_lat; - else if (!strcmp(argv[start_arg], "cong")) - param = &qp.cong_thres; - else if (!strcmp(argv[start_arg], "mode")) - param = &qp.polling; - else - errx(1, "unknown qset parameter \"%s\"\n" - "allowed parameters are \"txq0\", \"txq1\", " - "\"txq2\", \"rspq\", \"fl0\", \"fl1\", \"lat\", " - "\"cong\", \"mode\' and \"lro\"", argv[start_arg]); - - start_arg++; - - if (param == &qp.polling) { - if (!strcmp(argv[start_arg], "irq")) - qp.polling = 0; - else if (!strcmp(argv[start_arg], "polling")) - qp.polling = 1; - else - errx(1, "illegal qset mode \"%s\"\n" - "known modes are \"irq\" and \"polling\"", - argv[start_arg]); - } else if (get_int_arg(argv[start_arg], (uint32_t *)param)) - return -1; - start_arg++; - } - if (start_arg != argc) - errx(1, "unknown parameter %s", argv[start_arg]); - -#if 0 - printf("%4u %6d %6d %6d %6d %6d %6d %5d %9d %d\n", op.qset_idx, - op.txq_size[0], op.txq_size[1], op.txq_size[2], - op.rspq_size, op.fl_size[0], op.fl_size[1], op.cong_thres, - op.intr_lat, op.polling); -#endif - if (doit(iff_name, CHELSIO_SET_QSET_PARAMS, &qp) < 0) - err(1, "set qset parameters"); - - return 0; + return -1; } static int qset_num_config(int argc, char *argv[], int start_arg, @@ -1502,14 +1108,7 @@ static int qset_num_config(int argc, char *argv[], int start_arg, return 0; } - if (argc != start_arg + 1) - return -1; - if (get_int_arg(argv[start_arg], ®.val)) - return -1; - - if (doit(iff_name, CHELSIO_SET_QSET_NUM, ®) < 0) - err(1, "set qsets"); - return 0; + return -1; } /* @@ -1635,61 +1234,74 @@ static int trace_config(int argc, char *argv[], int start_arg, if (start_arg != argc) errx(1, "unknown parameter \"%s\"", argv[start_arg]); -#if 0 - printf("sip: %x:%x, dip: %x:%x, sport: %x:%x, dport: %x:%x, " - "interface: %x:%x, vlan: %x:%x, tx_config: %u, rx_config: %u, " - "invert: %u, tx_enable: %u, rx_enable: %u\n", op.sip, - op.sip_mask, op.dip, op.dip_mask, op.sport, op.sport_mask, - op.dport, op.dport_mask, op.intf, op.intf_mask, op.vlan, - op.vlan_mask, op.config_tx, op.config_rx, op.invert_match, - op.trace_tx, op.trace_rx); -#endif if (doit(iff_name, CHELSIO_SET_TRACE_FILTER, &trace) < 0) err(1, "trace"); return 0; } -#ifdef notyet -static int t1_powersave(int argc, char *argv[], int start_arg, - const char *iff_name) +static int get_sched_param(int argc, char *argv[], int pos, unsigned int *valp) { - struct toetool_t1powersave op = { - .cmd = TOETOOL_T1POWERSAVE, - .mode = 0 - }; + if (pos + 1 >= argc) + errx(1, "missing value for %s", argv[pos]); + if (get_int_arg(argv[pos + 1], valp)) + exit(1); + return 0; +} - if (argc == start_arg) - op.mode = 2; /* Check powersave mode */ - - else if (argc == start_arg + 1) { - if (strcmp(argv[start_arg], "on") == 0) - op.mode = 1; - else if (strcmp(argv[start_arg], "off") == 0) - op.mode = 0; - else { - warnx("bad parameter \"%s\"", argv[start_arg]); - return -1; - } - } else { - errx(1, "too many arguments"); +static int tx_sched(int argc, char *argv[], int start_arg, const char *iff_name) +{ + struct ch_hw_sched op; + unsigned int idx, val; + + if (argc < 5 || get_int_arg(argv[start_arg++], &idx)) return -1; - } - if (doit(iff_name, &op) < 0) - err(1, "t1powersave"); + op.sched = idx; + op.mode = op.channel = -1; + op.kbps = op.class_ipg = op.flow_ipg = -1; + + while (argc > start_arg) { + if (!strcmp(argv[start_arg], "mode")) { + if (start_arg + 1 >= argc) + errx(1, "missing value for mode"); + if (!strcmp(argv[start_arg + 1], "class")) + op.mode = 0; + else if (!strcmp(argv[start_arg + 1], "flow")) + op.mode = 1; + else + errx(1, "bad mode \"%s\"", argv[start_arg + 1]); + } else if (!strcmp(argv[start_arg], "channel") && + !get_sched_param(argc, argv, start_arg, &val)) + op.channel = val; + else if (!strcmp(argv[start_arg], "rate") && + !get_sched_param(argc, argv, start_arg, &val)) + op.kbps = val; + else if (!strcmp(argv[start_arg], "ipg") && + !get_sched_param(argc, argv, start_arg, &val)) + op.class_ipg = val; + else if (!strcmp(argv[start_arg], "flowipg") && + !get_sched_param(argc, argv, start_arg, &val)) + op.flow_ipg = val; + else + errx(1, "unknown scheduler parameter \"%s\"", + argv[start_arg]); + start_arg += 2; + } - if (op.mode & 2) - printf("t1powersave is %s\n", (op.mode & 1) ? "on" : "off"); + if (doit(iff_name, CHELSIO_SET_HW_SCHED, &op) < 0) + err(1, "pktsched"); return 0; } -#endif static int pktsched(int argc, char *argv[], int start_arg, const char *iff_name) { - struct ch_pktsched_params pktsched; + struct ch_pktsched_params op; unsigned int idx, min = -1, max, binding = -1; + if (argc < 4) + errx(1, "no scheduler specified"); + if (!strcmp(argv[start_arg], "port")) { if (argc != start_arg + 4) return -1; @@ -1697,7 +1309,7 @@ static int pktsched(int argc, char *argv[], int start_arg, const char *iff_name) get_int_arg(argv[start_arg + 2], &min) || get_int_arg(argv[start_arg + 3], &max)) return -1; - pktsched.sched = 0; + op.sched = 0; } else if (!strcmp(argv[start_arg], "tunnelq")) { if (argc != start_arg + 4) return -1; @@ -1705,20 +1317,30 @@ static int pktsched(int argc, char *argv[], int start_arg, const char *iff_name) get_int_arg(argv[start_arg + 2], &max) || get_int_arg(argv[start_arg + 3], &binding)) return -1; - pktsched.sched = 1; - } else - errx(1, "unknown scheduler \"%s\"; must be one of \"port\"" - " or \"tunnelq\"", argv[start_arg]); - - pktsched.idx = idx; - pktsched.min = min; - pktsched.max = max; - pktsched.binding = binding; - if (doit(iff_name, CHELSIO_SET_PKTSCHED, &pktsched) < 0) + op.sched = 1; + } else if (!strcmp(argv[start_arg], "tx")) + return tx_sched(argc, argv, start_arg + 1, iff_name); + else + errx(1, "unknown scheduler \"%s\"; must be one of \"port\", " + "\"tunnelq\" or \"tx\"", argv[start_arg]); + + op.idx = idx; + op.min = min; + op.max = max; + op.binding = binding; + if (doit(iff_name, CHELSIO_SET_PKTSCHED, &op) < 0) err(1, "pktsched"); return 0; } +static int clear_stats(int argc, char *argv[], int start_arg, + const char *iff_name) +{ + if (doit(iff_name, CHELSIO_CLEAR_STATS, NULL) < 0) + err(1, "clearstats"); + + return 0; +} int main(int argc, char *argv[]) { @@ -1744,27 +1366,14 @@ int main(int argc, char *argv[]) r = register_io(argc, argv, 3, iff_name); else if (!strcmp(argv[2], "mdio")) r = mdio_io(argc, argv, 3, iff_name); -#ifdef notyet - else if (!strcmp(argv[2], "tpi")) - r = tpi_io(argc, argv, 3, iff_name); - else if (!strcmp(argv[2], "up")) - r = device_up(argc, argv, 3, iff_name); else if (!strcmp(argv[2], "mtus")) r = mtu_tab_op(argc, argv, 3, iff_name); else if (!strcmp(argv[2], "pm")) 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); -#ifdef 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 + else if (!strcmp(argv[2], "tcamdump")) + r = dump_tcam(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")) @@ -1773,26 +1382,27 @@ int main(int argc, char *argv[]) r = get_sge_context(argc, argv, 3, iff_name); else if (!strcmp(argv[2], "desc")) r = get_sge_desc(argc, argv, 3, iff_name); -#endif + else if (!strcmp(argv[2], "loadfw")) + r = load_fw(argc, argv, 3, iff_name); + else if (!strcmp(argv[2], "loadboot")) + r = load_boot(argc, argv, 3, iff_name); + else if (!strcmp(argv[2], "proto")) + r = proto_sram_op(argc, argv, 3, iff_name); else if (!strcmp(argv[2], "qset")) r = qset_config(argc, argv, 3, iff_name); else if (!strcmp(argv[2], "qsets")) r = qset_num_config(argc, argv, 3, iff_name); else if (!strcmp(argv[2], "trace")) r = trace_config(argc, argv, 3, iff_name); -#ifdef notyet - else if (!strcmp(argv[2], "tcamdump")) - r = dump_tcam(argc, argv, 3, iff_name); - else if (!strcmp(argv[2], "loadfw")) - r = load_fw(argc, argv, 3, iff_name); - else if (!strcmp(argv[2], "proto")) - r = proto_sram_op(argc, argv, 3, iff_name); - else if (!strcmp(argv[2], "t1powersave")) - r = t1_powersave(argc, argv, 3, iff_name); -#endif else if (!strcmp(argv[2], "pktsched")) r = pktsched(argc, argv, 3, iff_name); + else if (!strcmp(argv[2], "tcb")) + r = get_tcb2(argc, argv, 3, iff_name); + else if (!strcmp(argv[2], "clearstats")) + r = clear_stats(argc, argv, 3, iff_name); + if (r == -1) usage(stderr); + return 0; } diff --git a/usr.sbin/cxgbtool/reg_defs_t3.c b/usr.sbin/cxgbtool/reg_defs_t3.c index f5f8163..ffa4aef 100644 --- a/usr.sbin/cxgbtool/reg_defs_t3.c +++ b/usr.sbin/cxgbtool/reg_defs_t3.c @@ -1302,7 +1302,7 @@ struct reg_info tp1_regs[] = { { "TP_TX_MOD_QUEUE_REQ_MAP", 0x428, 0 }, { "RX_MOD_WEIGHT", 24, 8 }, { "TX_MOD_WEIGHT", 16, 8 }, - { "TX_MOD_TIMER_MODE", 9, 7 }, + { "TX_MOD_TIMER_MODE", 8, 8 }, { "TX_MOD_QUEUE_REQ_MAP", 0, 8 }, { "TP_TX_MOD_QUEUE_WEIGHT1", 0x42c, 0 }, { "TP_TX_MOD_QUEUE_WEIGHT7", 24, 8 }, diff --git a/usr.sbin/cxgbtool/reg_defs_t3b.c b/usr.sbin/cxgbtool/reg_defs_t3b.c index 3adee90..539742c 100644 --- a/usr.sbin/cxgbtool/reg_defs_t3b.c +++ b/usr.sbin/cxgbtool/reg_defs_t3b.c @@ -1351,7 +1351,7 @@ struct reg_info t3b_tp1_regs[] = { { "TP_TX_MOD_QUEUE_REQ_MAP", 0x428, 0 }, { "RX_MOD_WEIGHT", 24, 8 }, { "TX_MOD_WEIGHT", 16, 8 }, - { "TX_MOD_TIMER_MODE", 9, 7 }, + { "TX_MOD_TIMER_MODE", 8, 8 }, { "TX_MOD_QUEUE_REQ_MAP", 0, 8 }, { "TP_TX_MOD_QUEUE_WEIGHT1", 0x42c, 0 }, { "TP_TX_MOD_QUEUE_WEIGHT7", 24, 8 }, diff --git a/usr.sbin/cxgbtool/version.h b/usr.sbin/cxgbtool/version.h index 228c0bf..53fe7aa 100644 --- a/usr.sbin/cxgbtool/version.h +++ b/usr.sbin/cxgbtool/version.h @@ -8,7 +8,7 @@ * * * http://www.chelsio.com * * * - * Copyright (c) 2003 - 2007 Chelsio Communications, Inc. * + * Copyright (c) 2003 - 2008 Chelsio Communications, Inc. * * All rights reserved. * * * * Maintainers: maintainers@chelsio.com * @@ -26,7 +26,7 @@ #define __CXGBTOOL_VERSION_H #define PROGNAME "cxgbtool" -#define VERSION "1.8" -#define COPYRIGHT "Copyright (c) 2004-2007 Chelsio Communications" +#define VERSION "1.15f" +#define COPYRIGHT "Copyright (c) 2004-2008 Chelsio Communications" #endif //__CXGBTOOL_VERSION_H -- cgit v1.1