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 | 07ede8d | 2021-11-16 18:31:21 +0800 | [diff] [blame] | 33 | "set ap_wireless cert=<enable>", |
developer | 7f1a58f | 2022-05-26 16:00:32 -0700 | [diff] [blame] | 34 | |
developer | 57de9b7 | 2023-02-20 11:15:54 +0800 | [diff] [blame] | 35 | "set mu onoff=<val> (bitmap- UL MU-MIMO(bit3), DL MU-MIMO(bit2), UL OFDMA(bit1), DL OFDMA(bit0))", |
developer | 29b831d | 2022-06-21 10:01:42 -0700 | [diff] [blame] | 36 | |
| 37 | "dump phy_capa", |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 38 | }; |
| 39 | int i; |
| 40 | |
| 41 | fprintf(stderr, "Usage:\n"); |
| 42 | for (i = 0; i < ARRAY_SIZE(commands); i++) |
| 43 | printf(" %s wlanX %s\n", progname, commands[i]); |
| 44 | |
| 45 | exit(1); |
| 46 | } |
| 47 | |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 48 | int main(int argc, char **argv) |
| 49 | { |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 50 | const char *cmd, *subcmd; |
| 51 | int if_idx, ret = 0; |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 52 | |
| 53 | progname = argv[0]; |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 54 | if (argc < 4) |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 55 | usage(); |
| 56 | |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 57 | if_idx = if_nametoindex(argv[1]); |
| 58 | if (!if_idx) { |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 59 | fprintf(stderr, "%s\n", strerror(errno)); |
| 60 | return 2; |
| 61 | } |
| 62 | |
| 63 | cmd = argv[2]; |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 64 | subcmd = argv[3]; |
| 65 | argv += 4; |
| 66 | argc -= 4; |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 67 | |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 68 | if (!strncmp(cmd, "dump", 4)) { |
| 69 | if (!strncmp(subcmd, "csi", 3)) |
| 70 | ret = mt76_csi_dump(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_dump(if_idx, argc, argv); |
developer | 29b831d | 2022-06-21 10:01:42 -0700 | [diff] [blame] | 73 | else if (!strncmp(subcmd, "phy_capa", 4)) |
| 74 | ret = mt76_phy_capa_dump(if_idx, argc, argv); |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 75 | } else if (!strncmp(cmd, "set", 3)) { |
| 76 | if (!strncmp(subcmd, "csi", 3)) |
| 77 | ret = mt76_csi_set(if_idx, argc, argv); |
developer | e53f087 | 2021-07-23 11:13:49 +0800 | [diff] [blame] | 78 | else if (!strncmp(subcmd, "amnt", 4)) |
| 79 | ret = mt76_amnt_set(if_idx, argc, argv); |
developer | 5f18e6c | 2021-07-28 11:55:08 +0800 | [diff] [blame] | 80 | else if (!strncmp(subcmd, "ap_rfeatures", 12)) |
| 81 | ret = mt76_ap_rfeatures_set(if_idx, argc, argv); |
| 82 | else if (!strncmp(subcmd, "ap_wireless", 11)) |
| 83 | ret = mt76_ap_wireless_set(if_idx, argc, argv); |
developer | 57de9b7 | 2023-02-20 11:15:54 +0800 | [diff] [blame] | 84 | else if (!strncmp(subcmd, "mu", 2)) |
| 85 | ret = mt76_mu_onoff_set(if_idx, argc, argv); |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 86 | } else { |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 87 | usage(); |
developer | 175704f | 2021-06-22 17:33:53 +0800 | [diff] [blame] | 88 | } |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 89 | |
| 90 | return ret; |
| 91 | } |