developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 1 | /* Copyright (C) 2021 Mediatek Inc. */ |
| 2 | #define _GNU_SOURCE |
| 3 | |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 4 | #include <net/if.h> |
| 5 | |
| 6 | #include "mt76-vendor.h" |
| 7 | |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 8 | static const char *progname; |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 9 | struct unl unl; |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 10 | |
| 11 | void usage(void) |
| 12 | { |
| 13 | static const char *const commands[] = { |
developer | dbc4357 | 2021-06-23 17:20:30 +0800 | [diff] [blame] | 14 | "set csi ctrl=<opt1>,<opt2>,<opt3>,<opt4> (macaddr=<macaddr>)", |
| 15 | "set csi interval=<interval (us)>", |
| 16 | "dump csi <packet num> <filename>", |
developer | e53f087 | 2021-07-23 11:13:49 +0800 | [diff] [blame] | 17 | |
| 18 | "set amnt <index>(0x0~0xf) <mac addr>(xx:xx:xx:xx:xx:xx)", |
developer | 5f18e6c | 2021-07-28 11:55:08 +0800 | [diff] [blame] | 19 | "dump amnt <index> (0x0~0xf or 0xff)", |
| 20 | |
| 21 | "set ap_rfeatures he_gi=<val>", |
| 22 | "set ap_rfeatures he_ltf=<val>", |
developer | 13aaa77 | 2021-09-27 18:09:26 +0800 | [diff] [blame] | 23 | "set ap_rfeatures trig_type=<enable>,<val> (val: 0-7)", |
| 24 | "set ap_rfeatures ack_policy=<val> (val: 0-4)", |
developer | 5f18e6c | 2021-07-28 11:55:08 +0800 | [diff] [blame] | 25 | "set ap_wireless fixed_mcs=<val>", |
developer | 507ff0c | 2021-07-30 14:51:55 +0800 | [diff] [blame] | 26 | "set ap_wireless ofdma=<val> (0: disable, 1: DL, 2: UL)", |
developer | b72be59 | 2021-08-16 10:58:59 +0800 | [diff] [blame] | 27 | "set ap_wireless nusers_ofdma=<val>", |
| 28 | "set ap_wireless ppdu_type=<val> (0: SU, 1: MU, 4: LEGACY)", |
developer | 786d929 | 2021-09-22 11:03:21 +0800 | [diff] [blame] | 29 | "set ap_wireless add_ba_req_bufsize=<val>", |
| 30 | "set ap_wireless mimo=<val> (0: DL, 1: UL)", |
developer | 13aaa77 | 2021-09-27 18:09:26 +0800 | [diff] [blame] | 31 | "set ap_wireless ampdu=<enable>", |
| 32 | "set ap_wireless amsdu=<enable>", |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 33 | }; |
| 34 | int i; |
| 35 | |
| 36 | fprintf(stderr, "Usage:\n"); |
| 37 | for (i = 0; i < ARRAY_SIZE(commands); i++) |
| 38 | printf(" %s wlanX %s\n", progname, commands[i]); |
| 39 | |
| 40 | exit(1); |
| 41 | } |
| 42 | |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 43 | int main(int argc, char **argv) |
| 44 | { |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 45 | const char *cmd, *subcmd; |
| 46 | int if_idx, ret = 0; |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 47 | |
| 48 | progname = argv[0]; |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 49 | if (argc < 4) |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 50 | usage(); |
| 51 | |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 52 | if_idx = if_nametoindex(argv[1]); |
| 53 | if (!if_idx) { |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 54 | fprintf(stderr, "%s\n", strerror(errno)); |
| 55 | return 2; |
| 56 | } |
| 57 | |
| 58 | cmd = argv[2]; |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 59 | subcmd = argv[3]; |
| 60 | argv += 4; |
| 61 | argc -= 4; |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 62 | |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 63 | if (!strncmp(cmd, "dump", 4)) { |
| 64 | if (!strncmp(subcmd, "csi", 3)) |
| 65 | ret = mt76_csi_dump(if_idx, argc, argv); |
developer | e53f087 | 2021-07-23 11:13:49 +0800 | [diff] [blame] | 66 | else if (!strncmp(subcmd, "amnt", 4)) |
| 67 | ret = mt76_amnt_dump(if_idx, argc, argv); |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 68 | } else if (!strncmp(cmd, "set", 3)) { |
| 69 | if (!strncmp(subcmd, "csi", 3)) |
| 70 | ret = mt76_csi_set(if_idx, argc, argv); |
developer | e53f087 | 2021-07-23 11:13:49 +0800 | [diff] [blame] | 71 | else if (!strncmp(subcmd, "amnt", 4)) |
| 72 | ret = mt76_amnt_set(if_idx, argc, argv); |
developer | 5f18e6c | 2021-07-28 11:55:08 +0800 | [diff] [blame] | 73 | else if (!strncmp(subcmd, "ap_rfeatures", 12)) |
| 74 | ret = mt76_ap_rfeatures_set(if_idx, argc, argv); |
| 75 | else if (!strncmp(subcmd, "ap_wireless", 11)) |
| 76 | ret = mt76_ap_wireless_set(if_idx, argc, argv); |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 77 | } else { |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 78 | usage(); |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 79 | } |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 80 | |
| 81 | return ret; |
| 82 | } |