Lines Matching +full:op +full:- +full:mode

1 /*-
89 unsigned char islog2; /* Field contains the base-2 log of the value */
110 "\tfilter mode [<match>] ... get/set global filter mode\n" in usage()
114 "\thashfilter mode [<match>] ... get/set global hashfilter mode\n" in usage()
118 "\tloadboot-cfg <bc.bin> install boot config\n" in usage()
119 "\tloadboot-cfg clear remove boot config\n" in usage()
120 "\tloadcfg <fw-config.txt> install configuration file\n" in usage()
122 "\tloadfw <fw-image.bin> install firmware\n" in usage()
130 "\tsched-class params <param> <val> .. configure TX scheduler class\n" in usage()
131 "\tsched-queue <port> <queue> <class> bind NIC queues to TX Scheduling class\n" in usage()
132 "\tstdio interactive mode\n" in usage()
265 return (val >> shift) & ((1 << len) - 1); in xtract()
273 for ( ; reg_array->name; ++reg_array) in dump_block_regs()
274 if (!reg_array->len) { in dump_block_regs()
275 reg_val = regs[reg_array->addr / 4]; in dump_block_regs()
276 printf("[%#7x] %-47s %#-10x %u\n", reg_array->addr, in dump_block_regs()
277 reg_array->name, reg_val, reg_val); in dump_block_regs()
279 uint32_t v = xtract(reg_val, reg_array->addr, in dump_block_regs()
280 reg_array->len); in dump_block_regs()
282 printf(" %*u:%u %-47s %#-10x %u\n", in dump_block_regs()
283 reg_array->addr < 10 ? 3 : 2, in dump_block_regs()
284 reg_array->addr + reg_array->len - 1, in dump_block_regs()
285 reg_array->addr, reg_array->name, v, v); in dump_block_regs()
306 for ( ; nmodules; nmodules--, modtab++) in dump_regs_table()
307 fprintf(stderr, " %s", modtab->name); in dump_regs_table()
313 for ( ; nmodules; nmodules--, modtab++) { in dump_regs_table()
317 if (!strcmp(argv[i], modtab->name)) in dump_regs_table()
322 dump_block_regs(modtab->ri, regs); in dump_regs_table()
529 do_show_info_header(uint32_t mode) in do_show_info_header() argument
535 switch (mode & i) { in do_show_info_header()
543 if (mode & T4_FILTER_IC_VNIC) in do_show_info_header()
579 * Parse an argument sub-vector as a { <parameter name> <value>[:<mask>] }
580 * ordered tuple. If the parameter name in the argument sub-vector does not
631 * Parse an argument sub-vector as a { <parameter name> <addr>[/<mask>] }
632 * ordered tuple. If the parameter name in the argument sub-vector does not
640 * family -- IPv4 or IPv6 -- of the address[/mask] and return its actual
737 for (m = mask; masksize >= 8; m++, masksize -= 8) in parse_ipaddr()
740 *m = ~0 << (8 - masksize); in parse_ipaddr()
747 * Parse an argument sub-vector as a { <parameter name> <value> } ordered
748 * tuple. If the parameter name in the argument sub-vector does not match the
792 do_show_one_filter_info(struct t4_filter *t, uint32_t mode) in do_show_one_filter_info() argument
796 printf("%4d", t->idx); in do_show_one_filter_info()
797 if (t->hits == UINT64_MAX) in do_show_one_filter_info()
798 printf(" %8s", "-"); in do_show_one_filter_info()
800 printf(" %8ju", t->hits); in do_show_one_filter_info()
806 switch (mode & i) { in do_show_one_filter_info()
808 printf(" %1d/%1d", t->fs.val.fcoe, t->fs.mask.fcoe); in do_show_one_filter_info()
811 printf(" %1d/%1d", t->fs.val.iport, t->fs.mask.iport); in do_show_one_filter_info()
814 if (mode & T4_FILTER_IC_VNIC) { in do_show_one_filter_info()
816 t->fs.val.pfvf_vld, in do_show_one_filter_info()
817 (t->fs.val.vnic >> 13) & 0x7, in do_show_one_filter_info()
818 t->fs.val.vnic & 0x1fff, in do_show_one_filter_info()
819 t->fs.mask.pfvf_vld, in do_show_one_filter_info()
820 (t->fs.mask.vnic >> 13) & 0x7, in do_show_one_filter_info()
821 t->fs.mask.vnic & 0x1fff); in do_show_one_filter_info()
824 t->fs.val.ovlan_vld, t->fs.val.vnic, in do_show_one_filter_info()
825 t->fs.mask.ovlan_vld, t->fs.mask.vnic); in do_show_one_filter_info()
830 t->fs.val.vlan_vld, t->fs.val.vlan, in do_show_one_filter_info()
831 t->fs.mask.vlan_vld, t->fs.mask.vlan); in do_show_one_filter_info()
834 printf(" %02x/%02x", t->fs.val.tos, t->fs.mask.tos); in do_show_one_filter_info()
837 printf(" %02x/%02x", t->fs.val.proto, t->fs.mask.proto); in do_show_one_filter_info()
840 printf(" %04x/%04x", t->fs.val.ethtype, in do_show_one_filter_info()
841 t->fs.mask.ethtype); in do_show_one_filter_info()
844 printf(" %03x/%03x", t->fs.val.macidx, in do_show_one_filter_info()
845 t->fs.mask.macidx); in do_show_one_filter_info()
848 printf(" %1x/%1x", t->fs.val.matchtype, in do_show_one_filter_info()
849 t->fs.mask.matchtype); in do_show_one_filter_info()
852 printf(" %1d/%1d", t->fs.val.frag, t->fs.mask.frag); in do_show_one_filter_info()
863 filters_show_ipaddr(t->fs.type, t->fs.val.dip, t->fs.mask.dip); in do_show_one_filter_info()
864 filters_show_ipaddr(t->fs.type, t->fs.val.sip, t->fs.mask.sip); in do_show_one_filter_info()
866 t->fs.val.dport, t->fs.mask.dport, in do_show_one_filter_info()
867 t->fs.val.sport, t->fs.mask.sport); in do_show_one_filter_info()
872 if (t->fs.action == FILTER_DROP) in do_show_one_filter_info()
874 else if (t->fs.action == FILTER_SWITCH) { in do_show_one_filter_info()
875 printf(" Switch: port=%d", t->fs.eport); in do_show_one_filter_info()
876 if (t->fs.newdmac) in do_show_one_filter_info()
880 t->fs.dmac[0], t->fs.dmac[1], in do_show_one_filter_info()
881 t->fs.dmac[2], t->fs.dmac[3], in do_show_one_filter_info()
882 t->fs.dmac[4], t->fs.dmac[5], in do_show_one_filter_info()
883 t->l2tidx); in do_show_one_filter_info()
884 if (t->fs.newsmac) in do_show_one_filter_info()
888 t->fs.smac[0], t->fs.smac[1], in do_show_one_filter_info()
889 t->fs.smac[2], t->fs.smac[3], in do_show_one_filter_info()
890 t->fs.smac[4], t->fs.smac[5], in do_show_one_filter_info()
891 t->smtidx); in do_show_one_filter_info()
892 if (t->fs.newvlan == VLAN_REMOVE) in do_show_one_filter_info()
894 else if (t->fs.newvlan == VLAN_INSERT) in do_show_one_filter_info()
895 printf(", vlan=insert(%x)", t->fs.vlan); in do_show_one_filter_info()
896 else if (t->fs.newvlan == VLAN_REWRITE) in do_show_one_filter_info()
897 printf(", vlan=rewrite(%x)", t->fs.vlan); in do_show_one_filter_info()
900 if (t->fs.dirsteer == 0) { in do_show_one_filter_info()
902 if (t->fs.maskhash) in do_show_one_filter_info()
903 printf("(region %d)", t->fs.iq << 1); in do_show_one_filter_info()
905 printf("%d", t->fs.iq); in do_show_one_filter_info()
906 if (t->fs.dirsteerhash == 0) in do_show_one_filter_info()
912 if (g.chip_id <= 5 && t->fs.prio) in do_show_one_filter_info()
914 if (t->fs.rpttid) in do_show_one_filter_info()
922 uint32_t mode = 0, header, hpfilter = 0; in show_filters() local
926 /* Get the global filter mode first */ in show_filters()
927 rc = doit(CHELSIO_T4_GET_FILTER_MODE, &mode); in show_filters()
944 do_show_info_header(mode); in show_filters()
948 do_show_one_filter_info(&t, mode); in show_filters()
964 do_show_info_header(mode); in show_filters()
967 do_show_one_filter_info(&t, mode); in show_filters()
976 uint32_t mode = hashfilter; in get_filter_mode() local
979 rc = doit(CHELSIO_T4_GET_FILTER_MODE, &mode); in get_filter_mode()
983 if (mode & T4_FILTER_IPv4) in get_filter_mode()
985 if (mode & T4_FILTER_IPv6) in get_filter_mode()
987 if (mode & T4_FILTER_IP_SADDR) in get_filter_mode()
989 if (mode & T4_FILTER_IP_DADDR) in get_filter_mode()
991 if (mode & T4_FILTER_IP_SPORT) in get_filter_mode()
993 if (mode & T4_FILTER_IP_DPORT) in get_filter_mode()
995 if (mode & T4_FILTER_IP_FRAGMENT) in get_filter_mode()
997 if (mode & T4_FILTER_MPS_HIT_TYPE) in get_filter_mode()
999 if (mode & T4_FILTER_MAC_IDX) in get_filter_mode()
1001 if (mode & T4_FILTER_ETH_TYPE) in get_filter_mode()
1003 if (mode & T4_FILTER_IP_PROTO) in get_filter_mode()
1005 if (mode & T4_FILTER_IP_TOS) in get_filter_mode()
1007 if (mode & T4_FILTER_VLAN) in get_filter_mode()
1009 if (mode & T4_FILTER_VNIC) { in get_filter_mode()
1010 if (mode & T4_FILTER_IC_VNIC) in get_filter_mode()
1012 else if (mode & T4_FILTER_IC_ENCAP) in get_filter_mode()
1017 if (mode & T4_FILTER_PORT) in get_filter_mode()
1019 if (mode & T4_FILTER_FCoE) in get_filter_mode()
1029 uint32_t mode = 0; in set_filter_mode() local
1032 for (; argc; argc--, argv++) { in set_filter_mode()
1039 mode |= T4_FILTER_IP_FRAGMENT; in set_filter_mode()
1041 mode |= T4_FILTER_MPS_HIT_TYPE; in set_filter_mode()
1043 mode |= T4_FILTER_MAC_IDX; in set_filter_mode()
1045 mode |= T4_FILTER_ETH_TYPE; in set_filter_mode()
1047 mode |= T4_FILTER_IP_PROTO; in set_filter_mode()
1049 mode |= T4_FILTER_IP_TOS; in set_filter_mode()
1051 mode |= T4_FILTER_VLAN; in set_filter_mode()
1053 mode |= T4_FILTER_VNIC; in set_filter_mode()
1056 mode |= T4_FILTER_VNIC; in set_filter_mode()
1057 mode |= T4_FILTER_IC_VNIC; in set_filter_mode()
1062 mode |= T4_FILTER_VNIC; in set_filter_mode()
1063 mode |= T4_FILTER_IC_ENCAP; in set_filter_mode()
1068 mode |= T4_FILTER_PORT; in set_filter_mode()
1070 mode |= T4_FILTER_FCoE; in set_filter_mode()
1072 warnx("\"%s\" is not valid while setting filter mode.", in set_filter_mode()
1087 return doit(CHELSIO_T4_SET_FILTER_MASK, &mode); in set_filter_mode()
1089 return doit(CHELSIO_T4_SET_FILTER_MODE, &mode); in set_filter_mode()
1260 else if (!strcmp(argv[start_arg + 1], "dip-dp")) in set_filter()
1262 else if (!strcmp(argv[start_arg + 1], "dip-dp-sip")) in set_filter()
1264 else if (!strcmp(argv[start_arg + 1], "dip-dp-sp")) in set_filter()
1266 else if (!strcmp(argv[start_arg + 1], "sip-sp")) in set_filter()
1268 else if (!strcmp(argv[start_arg + 1], "dip-sip-sp")) in set_filter()
1274 "dip-dp, dip-dp-sip, dip-dp-sp, sip-sp, " in set_filter()
1275 "dip-sip-sp, and all", argv[start_arg + 1]); in set_filter()
1351 warnx("nat params only make sense with valid nat mode"); in set_filter()
1392 /* mode */ in filter_cmd()
1393 if (argc == 1 && strcmp(argv[0], "mode") == 0) in filter_cmd()
1396 /* mode <mode> */ in filter_cmd()
1397 if (strcmp(argv[0], "mode") == 0) in filter_cmd()
1398 return set_filter_mode(argc - 1, argv + 1, hashfilter); in filter_cmd()
1409 idx = (uint32_t) -1; in filter_cmd()
1448 argc--; in filter_cmd()
1457 * Shows the fields of a multi-word structure. The structure is considered to
1458 * consist of @nwords 32-bit words (i.e, it's an (@nwords * 32)-bit structure)
1459 * whose fields are described by @fd. The 32-bit words are given in @words
1460 * starting with the least significant 32-bit word.
1468 for (p = fd; p->name; p++) in show_struct()
1469 w = max(w, strlen(p->name)); in show_struct()
1471 while (fd->name) { in show_struct()
1473 int first_word = fd->start / 32; in show_struct()
1474 int shift = fd->start % 32; in show_struct()
1475 int width = fd->end - fd->start + 1; in show_struct()
1476 unsigned long long mask = (1ULL << width) - 1; in show_struct()
1479 ((uint64_t)words[first_word + 1] << (32 - shift)); in show_struct()
1481 data |= ((uint64_t)words[first_word + 2] << (64 - shift)); in show_struct()
1483 if (fd->islog2) in show_struct()
1485 printf("%-*s ", w, fd->name); in show_struct()
1486 printf(fd->hex ? "%#llx\n" : "%llu\n", data << fd->shift); in show_struct()
1730 if (p->mem_id == SGE_CONTEXT_EGRESS) { in show_t5t6_ctxt()
1731 if (p->data[0] & 2) in show_t5t6_ctxt()
1732 show_struct(p->data, 6, fl_t5); in show_t5t6_ctxt()
1734 show_struct(p->data, 6, egress_t5); in show_t5t6_ctxt()
1736 show_struct(p->data, 6, egress_t6); in show_t5t6_ctxt()
1737 } else if (p->mem_id == SGE_CONTEXT_FLM) in show_t5t6_ctxt()
1738 show_struct(p->data, 3, vers == 5 ? flm_t5 : flm_t6); in show_t5t6_ctxt()
1739 else if (p->mem_id == SGE_CONTEXT_INGRESS) in show_t5t6_ctxt()
1740 show_struct(p->data, 5, vers == 5 ? ingress_t5 : ingress_t6); in show_t5t6_ctxt()
1741 else if (p->mem_id == SGE_CONTEXT_CNM) in show_t5t6_ctxt()
1742 show_struct(p->data, 1, conm_t5); in show_t5t6_ctxt()
1871 if (p->mem_id == SGE_CONTEXT_EGRESS) in show_t4_ctxt()
1872 show_struct(p->data, 6, (p->data[0] & 2) ? fl_t4 : egress_t4); in show_t4_ctxt()
1873 else if (p->mem_id == SGE_CONTEXT_FLM) in show_t4_ctxt()
1874 show_struct(p->data, 3, flm_t4); in show_t4_ctxt()
1875 else if (p->mem_id == SGE_CONTEXT_INGRESS) in show_t4_ctxt()
1876 show_struct(p->data, 5, ingress_t4); in show_t4_ctxt()
1877 else if (p->mem_id == SGE_CONTEXT_CNM) in show_t4_ctxt()
1878 show_struct(p->data, 1, conm_t4); in show_t4_ctxt()
2178 * Display memory as list of 'n' 4-byte values per line.
2187 for (i = 0; len && i < n; i++, buf++, len -= 4) { in show_mem()
2225 * Display TCB as list of 'n' 4-byte values per line.
2235 for (i = 0; len && i < n; i++, buf++, len -= 4) { in show_tcb()
2381 port_idx = t.tp.port - 4; in show_tracers()
2384 port_idx = t.tp.port - 8; in show_tracers()
2387 port_idx = t.tp.port - 12; in show_tracers()
2390 port_idx = t.tp.port - 16; in show_tracers()
2458 * matching). Right now this is a quick-n-dirty implementation that traces the
2484 port = argv[0][2] - '0'; in set_tracer()
2491 port = argv[0][2] - '0'; in set_tracer()
2498 port = argv[0][2] - '0'; in set_tracer()
2557 return set_tracer(idx, argc - 1, argv + 1); in tracer_cmd()
2648 string[i - SFF_8472_VENDOR_START] = i2cd.data[0]; in modinfo()
2657 string[i - SFF_8472_SN_START] = i2cd.data[0]; in modinfo()
2666 string[i - SFF_8472_PN_START] = i2cd.data[0]; in modinfo()
2675 string[i - SFF_8472_REV_START] = i2cd.data[0]; in modinfo()
2696 printf("-"); in modinfo()
2760 struct t4_sched_params op; in sched_class() local
2763 memset(&op, 0xff, sizeof(op)); in sched_class()
2764 op.subcmd = -1; in sched_class()
2765 op.type = -1; in sched_class()
2767 warnx("missing scheduling sub-command"); in sched_class()
2771 op.subcmd = SCHED_CLASS_SUBCMD_CONFIG; in sched_class()
2772 op.u.config.minmax = -1; in sched_class()
2774 op.subcmd = SCHED_CLASS_SUBCMD_PARAMS; in sched_class()
2775 op.u.params.level = op.u.params.mode = op.u.params.rateunit = in sched_class()
2776 op.u.params.ratemode = op.u.params.channel = in sched_class()
2777 op.u.params.cl = op.u.params.minrate = op.u.params.maxrate = in sched_class()
2778 op.u.params.weight = op.u.params.pktsize = -1; in sched_class()
2780 warnx("invalid scheduling sub-command \"%s\"", argv[0]); in sched_class()
2798 op.type = SCHED_CLASS_TYPE_PACKET; in sched_class()
2807 if (op.subcmd == SCHED_CLASS_SUBCMD_CONFIG) { in sched_class()
2809 op.u.config.minmax = (int8_t)l; in sched_class()
2820 if (op.subcmd != SCHED_CLASS_SUBCMD_PARAMS) in sched_class()
2824 if (!strcmp(args[1], "cl-rl")) in sched_class()
2825 op.u.params.level = SCHED_CLASS_LEVEL_CL_RL; in sched_class()
2826 else if (!strcmp(args[1], "cl-wrr")) in sched_class()
2827 op.u.params.level = SCHED_CLASS_LEVEL_CL_WRR; in sched_class()
2828 else if (!strcmp(args[1], "ch-rl")) in sched_class()
2829 op.u.params.level = SCHED_CLASS_LEVEL_CH_RL; in sched_class()
2835 } else if (!strcmp(args[0], "mode")) { in sched_class()
2837 op.u.params.mode = SCHED_CLASS_MODE_CLASS; in sched_class()
2839 op.u.params.mode = SCHED_CLASS_MODE_FLOW; in sched_class()
2841 warnx("invalid mode parameter \"%s\"", args[1]); in sched_class()
2844 } else if (!strcmp(args[0], "rate-unit")) { in sched_class()
2846 op.u.params.rateunit = SCHED_CLASS_RATEUNIT_BITS; in sched_class()
2848 op.u.params.rateunit = SCHED_CLASS_RATEUNIT_PKTS; in sched_class()
2850 warnx("invalid rate-unit parameter \"%s\"", in sched_class()
2854 } else if (!strcmp(args[0], "rate-mode")) { in sched_class()
2856 op.u.params.ratemode = SCHED_CLASS_RATEMODE_REL; in sched_class()
2858 op.u.params.ratemode = SCHED_CLASS_RATEMODE_ABS; in sched_class()
2860 warnx("invalid rate-mode parameter \"%s\"", in sched_class()
2865 op.u.params.channel = (int8_t)l; in sched_class()
2867 op.u.params.cl = (int8_t)l; in sched_class()
2868 else if (!get_sched_param("min-rate", args, &l)) in sched_class()
2869 op.u.params.minrate = (int32_t)l; in sched_class()
2870 else if (!get_sched_param("max-rate", args, &l)) in sched_class()
2871 op.u.params.maxrate = (int32_t)l; in sched_class()
2873 op.u.params.weight = (int16_t)l; in sched_class()
2874 else if (!get_sched_param("pkt-size", args, &l)) in sched_class()
2875 op.u.params.pktsize = (int16_t)l; in sched_class()
2889 if (op.type < 0) { in sched_class()
2893 if (op.subcmd == SCHED_CLASS_SUBCMD_CONFIG) { in sched_class()
2894 if (op.u.config.minmax < 0) { in sched_class()
2899 if (op.subcmd == SCHED_CLASS_SUBCMD_PARAMS) { in sched_class()
2900 if (op.u.params.level < 0) { in sched_class()
2904 if (op.u.params.mode < 0 && in sched_class()
2905 op.u.params.level == SCHED_CLASS_LEVEL_CL_RL) { in sched_class()
2906 warnx("sched params \"mode\" parameter missing"); in sched_class()
2909 if (op.u.params.rateunit < 0 && in sched_class()
2910 (op.u.params.level == SCHED_CLASS_LEVEL_CL_RL || in sched_class()
2911 op.u.params.level == SCHED_CLASS_LEVEL_CH_RL)) { in sched_class()
2912 warnx("sched params \"rate-unit\" parameter missing"); in sched_class()
2915 if (op.u.params.ratemode < 0 && in sched_class()
2916 (op.u.params.level == SCHED_CLASS_LEVEL_CL_RL || in sched_class()
2917 op.u.params.level == SCHED_CLASS_LEVEL_CH_RL)) { in sched_class()
2918 warnx("sched params \"rate-mode\" parameter missing"); in sched_class()
2921 if (op.u.params.channel < 0) { in sched_class()
2925 if (op.u.params.cl < 0 && in sched_class()
2926 (op.u.params.level == SCHED_CLASS_LEVEL_CL_RL || in sched_class()
2927 op.u.params.level == SCHED_CLASS_LEVEL_CL_WRR)) { in sched_class()
2931 if (op.u.params.maxrate < 0 && in sched_class()
2932 (op.u.params.level == SCHED_CLASS_LEVEL_CL_RL || in sched_class()
2933 op.u.params.level == SCHED_CLASS_LEVEL_CH_RL)) { in sched_class()
2934 warnx("sched params \"max-rate\" missing for " in sched_class()
2935 "rate-limit level"); in sched_class()
2938 if (op.u.params.level == SCHED_CLASS_LEVEL_CL_WRR && in sched_class()
2939 (op.u.params.weight < 1 || op.u.params.weight > 99)) { in sched_class()
2941 "(not 1-99) for weighted-round-robin level"); in sched_class()
2944 if (op.u.params.pktsize < 0 && in sched_class()
2945 op.u.params.level == SCHED_CLASS_LEVEL_CL_RL) { in sched_class()
2946 warnx("sched params \"pkt-size\" missing for " in sched_class()
2947 "rate-limit level"); in sched_class()
2950 if (op.u.params.mode == SCHED_CLASS_MODE_FLOW && in sched_class()
2951 op.u.params.ratemode != SCHED_CLASS_RATEMODE_ABS) { in sched_class()
2952 warnx("sched params mode flow needs rate-mode absolute"); in sched_class()
2955 if (op.u.params.ratemode == SCHED_CLASS_RATEMODE_REL && in sched_class()
2956 !in_range(op.u.params.maxrate, 1, 100)) { in sched_class()
2957 warnx("sched params \"max-rate\" takes " in sched_class()
2958 "percentage value(1-100) for rate-mode relative"); in sched_class()
2961 if (op.u.params.ratemode == SCHED_CLASS_RATEMODE_ABS && in sched_class()
2962 !in_range(op.u.params.maxrate, 1, 100000000)) { in sched_class()
2963 warnx("sched params \"max-rate\" takes " in sched_class()
2964 "value(1-100000000) for rate-mode absolute"); in sched_class()
2967 if (op.u.params.maxrate > 0 && in sched_class()
2968 op.u.params.maxrate < op.u.params.minrate) { in sched_class()
2969 warnx("sched params \"max-rate\" is less than " in sched_class()
2970 "\"min-rate\""); in sched_class()
2976 warnx("%d error%s in sched-class command", errs, in sched_class()
2981 return doit(CHELSIO_T4_SCHED_CLASS, &op); in sched_class()
2987 struct t4_sched_queue op = {0}; in sched_queue() local
3002 op.port = (uint8_t)val; in sched_queue()
3005 op.queue = -1; in sched_queue()
3008 if (*p || val < -1) { in sched_queue()
3012 op.queue = (int8_t)val; in sched_queue()
3016 op.cl = -1; in sched_queue()
3019 if (*p || val < -1) { in sched_queue()
3023 op.cl = (int8_t)val; in sched_queue()
3026 return doit(CHELSIO_T4_SCHED_QUEUE, &op); in sched_queue()
3045 os->offload = (*pneg + 1) & 1; in parse_offload_settings_word()
3048 os->rx_coalesce = (*pneg + 1) & 1; in parse_offload_settings_word()
3051 os->tstamp = (*pneg + 1) & 1; in parse_offload_settings_word()
3054 os->sack = (*pneg + 1) & 1; in parse_offload_settings_word()
3057 os->nagle = (*pneg + 1) & 1; in parse_offload_settings_word()
3060 os->ecn = (*pneg + 1) & 1; in parse_offload_settings_word()
3063 os->ddp = (*pneg + 1) & 1; in parse_offload_settings_word()
3066 os->tls = (*pneg + 1) & 1; in parse_offload_settings_word()
3092 os->cong_algo = 0; in parse_offload_settings_word()
3094 os->cong_algo = 1; in parse_offload_settings_word()
3096 os->cong_algo = 2; in parse_offload_settings_word()
3098 os->cong_algo = 3; in parse_offload_settings_word()
3104 val = -1; in parse_offload_settings_word()
3106 /* (nsched_cls - 1) is spelled 15 here. */ in parse_offload_settings_word()
3113 os->sched_class = val; in parse_offload_settings_word()
3131 os->txq = val; in parse_offload_settings_word()
3132 os->rxq = val; in parse_offload_settings_word()
3134 os->txq = val; in parse_offload_settings_word()
3136 os->rxq = val; in parse_offload_settings_word()
3141 val = -1; in parse_offload_settings_word()
3149 os->mss = val; in parse_offload_settings_word()
3167 .rx_coalesce = -1, in parse_offload_settings()
3168 .cong_algo = -1, in parse_offload_settings()
3169 .sched_class = -1, in parse_offload_settings()
3170 .tstamp = -1, in parse_offload_settings()
3171 .sack = -1, in parse_offload_settings()
3172 .nagle = -1, in parse_offload_settings()
3173 .ecn = -1, in parse_offload_settings()
3174 .ddp = -1, in parse_offload_settings()
3175 .tls = -1, in parse_offload_settings()
3178 .mss = -1, in parse_offload_settings()
3222 llen--; in isempty_line()
3238 /* check for special strings: "-", "all", "any" */ in special_offload_rule()
3239 if (*str == '-') { in special_offload_rule()
3255 * A rule has 3 parts: an open-type, a match expression, and offload settings.
3257 * [<open-type>] <expr> => <settings>
3271 s = &line[llen - 1]; in parse_offload_policy_line()
3273 *s-- = '\0'; in parse_offload_policy_line()
3274 llen--; in parse_offload_policy_line()
3289 r->open_type = *line; in parse_offload_policy_line()
3292 warnx("invalid socket-type \"%c\" on line %zd.", *line, lno); in parse_offload_policy_line()
3298 r->open_type, lno); in parse_offload_policy_line()
3319 * <expr> is either a special name (all, any) or a pcap-filter(7). in parse_offload_policy_line()
3320 * In case of a special name the bpf_prog stays all-zero. in parse_offload_policy_line()
3323 if (pcap_compile(pd, &r->bpf_prog, expr, 1, in parse_offload_policy_line()
3332 if (parse_offload_settings(settings, &r->settings) != 0) { in parse_offload_policy_line()
3335 pcap_freecode(&r->bpf_prog); in parse_offload_policy_line()
3344 * Note that op itself is not dynamically allocated.
3347 free_offload_policy(struct t4_offload_policy *op) in free_offload_policy() argument
3351 for (i = 0; i < op->nrules; i++) { in free_offload_policy()
3354 * for an rule that matches on 'any/all/-'. in free_offload_policy()
3356 pcap_freecode(&op->rule[i].bpf_prog); in free_offload_policy()
3358 free(op->rule); in free_offload_policy()
3359 op->nrules = 0; in free_offload_policy()
3360 op->rule = NULL; in free_offload_policy()
3366 * Fills up op->nrules and op->rule.
3369 parse_offload_policy(const char *fname, struct t4_offload_policy *op) in parse_offload_policy() argument
3394 op->nrules = 0; in parse_offload_policy()
3395 op->rule = NULL; in parse_offload_policy()
3398 while ((llen = getline(&line, &lcap, fp)) != -1) { in parse_offload_policy()
3405 if (op->nrules == maxrules) { in parse_offload_policy()
3407 r = realloc(op->rule, in parse_offload_policy()
3415 op->rule = r; in parse_offload_policy()
3418 r = &op->rule[op->nrules]; in parse_offload_policy()
3425 op->nrules++; in parse_offload_policy()
3436 if (op->nrules == 0) { in parse_offload_policy()
3444 free_offload_policy(op); in parse_offload_policy()
3455 struct t4_offload_policy op = {0}; in load_offload_policy() local
3463 /* op.nrules is 0 and that means clear policy */ in load_offload_policy()
3464 return (doit(CHELSIO_T4_SET_OFLD_POLICY, &op)); in load_offload_policy()
3467 rc = parse_offload_policy(fname, &op); in load_offload_policy()
3473 rc = doit(CHELSIO_T4_SET_OFLD_POLICY, &op); in load_offload_policy()
3474 free_offload_policy(&op); in load_offload_policy()
3545 int rc = -1; in run_cmd()
3549 argc--; in run_cmd()
3576 else if (!strcmp(cmd, "sched-class")) in run_cmd()
3578 else if (!strcmp(cmd, "sched-queue")) in run_cmd()
3584 else if (!strcmp(cmd, "loadboot-cfg")) in run_cmd()
3662 if (len < 2 || isdigit(s[0]) || !isdigit(s[len - 1])) in open_nexus_device()
3664 for (num = s + len - 1; isdigit(*num); num--) in open_nexus_device()
3703 int rc = -1; in main()
3708 if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) { in main()
3722 argc -= 2; in main()