blob: e0bf9d9943fce400d283bed1f9a65d3a6d0ea57b [file] [log] [blame]
developerfd40db22021-04-29 10:08:25 +08001/* Copyright (C) 2021 Mediatek Inc. */
2#define _GNU_SOURCE
3
developerfd40db22021-04-29 10:08:25 +08004#include <net/if.h>
5
6#include "mt76-vendor.h"
7
developerfd40db22021-04-29 10:08:25 +08008static const char *progname;
developer175704f2021-06-22 17:33:53 +08009struct unl unl;
developerfd40db22021-04-29 10:08:25 +080010
11void usage(void)
12{
13 static const char *const commands[] = {
developerdbc43572021-06-23 17:20:30 +080014 "set csi ctrl=<opt1>,<opt2>,<opt3>,<opt4> (macaddr=<macaddr>)",
15 "set csi interval=<interval (us)>",
16 "dump csi <packet num> <filename>",
developere53f0872021-07-23 11:13:49 +080017
18 "set amnt <index>(0x0~0xf) <mac addr>(xx:xx:xx:xx:xx:xx)",
developer5f18e6c2021-07-28 11:55:08 +080019 "dump amnt <index> (0x0~0xf or 0xff)",
20
21 "set ap_rfeatures he_gi=<val>",
22 "set ap_rfeatures he_ltf=<val>",
developer13aaa772021-09-27 18:09:26 +080023 "set ap_rfeatures trig_type=<enable>,<val> (val: 0-7)",
24 "set ap_rfeatures ack_policy=<val> (val: 0-4)",
developer5f18e6c2021-07-28 11:55:08 +080025 "set ap_wireless fixed_mcs=<val>",
developer507ff0c2021-07-30 14:51:55 +080026 "set ap_wireless ofdma=<val> (0: disable, 1: DL, 2: UL)",
developerb72be592021-08-16 10:58:59 +080027 "set ap_wireless nusers_ofdma=<val>",
28 "set ap_wireless ppdu_type=<val> (0: SU, 1: MU, 4: LEGACY)",
developer786d9292021-09-22 11:03:21 +080029 "set ap_wireless add_ba_req_bufsize=<val>",
30 "set ap_wireless mimo=<val> (0: DL, 1: UL)",
developer13aaa772021-09-27 18:09:26 +080031 "set ap_wireless ampdu=<enable>",
32 "set ap_wireless amsdu=<enable>",
developer07ede8d2021-11-16 18:31:21 +080033 "set ap_wireless cert=<enable>",
developer7f1a58f2022-05-26 16:00:32 -070034
developer57de9b72023-02-20 11:15:54 +080035 "set mu onoff=<val> (bitmap- UL MU-MIMO(bit3), DL MU-MIMO(bit2), UL OFDMA(bit1), DL OFDMA(bit0))",
developer29b831d2022-06-21 10:01:42 -070036
37 "dump phy_capa",
developerfd40db22021-04-29 10:08:25 +080038 };
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
developerfd40db22021-04-29 10:08:25 +080048int main(int argc, char **argv)
49{
developer175704f2021-06-22 17:33:53 +080050 const char *cmd, *subcmd;
51 int if_idx, ret = 0;
developerfd40db22021-04-29 10:08:25 +080052
53 progname = argv[0];
developer175704f2021-06-22 17:33:53 +080054 if (argc < 4)
developerfd40db22021-04-29 10:08:25 +080055 usage();
56
developer175704f2021-06-22 17:33:53 +080057 if_idx = if_nametoindex(argv[1]);
58 if (!if_idx) {
developerfd40db22021-04-29 10:08:25 +080059 fprintf(stderr, "%s\n", strerror(errno));
60 return 2;
61 }
62
63 cmd = argv[2];
developer175704f2021-06-22 17:33:53 +080064 subcmd = argv[3];
65 argv += 4;
66 argc -= 4;
developerfd40db22021-04-29 10:08:25 +080067
developer175704f2021-06-22 17:33:53 +080068 if (!strncmp(cmd, "dump", 4)) {
69 if (!strncmp(subcmd, "csi", 3))
70 ret = mt76_csi_dump(if_idx, argc, argv);
developere53f0872021-07-23 11:13:49 +080071 else if (!strncmp(subcmd, "amnt", 4))
72 ret = mt76_amnt_dump(if_idx, argc, argv);
developer29b831d2022-06-21 10:01:42 -070073 else if (!strncmp(subcmd, "phy_capa", 4))
74 ret = mt76_phy_capa_dump(if_idx, argc, argv);
developer175704f2021-06-22 17:33:53 +080075 } else if (!strncmp(cmd, "set", 3)) {
76 if (!strncmp(subcmd, "csi", 3))
77 ret = mt76_csi_set(if_idx, argc, argv);
developere53f0872021-07-23 11:13:49 +080078 else if (!strncmp(subcmd, "amnt", 4))
79 ret = mt76_amnt_set(if_idx, argc, argv);
developer5f18e6c2021-07-28 11:55:08 +080080 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);
developer57de9b72023-02-20 11:15:54 +080084 else if (!strncmp(subcmd, "mu", 2))
85 ret = mt76_mu_onoff_set(if_idx, argc, argv);
developer175704f2021-06-22 17:33:53 +080086 } else {
developerfd40db22021-04-29 10:08:25 +080087 usage();
developer175704f2021-06-22 17:33:53 +080088 }
developerfd40db22021-04-29 10:08:25 +080089
90 return ret;
91}