blob: 31541b8e99c31349ed39d9c7815f8bae417238d3 [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>",
developerfd40db22021-04-29 10:08:25 +080033 };
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
developerfd40db22021-04-29 10:08:25 +080043int main(int argc, char **argv)
44{
developer175704f2021-06-22 17:33:53 +080045 const char *cmd, *subcmd;
46 int if_idx, ret = 0;
developerfd40db22021-04-29 10:08:25 +080047
48 progname = argv[0];
developer175704f2021-06-22 17:33:53 +080049 if (argc < 4)
developerfd40db22021-04-29 10:08:25 +080050 usage();
51
developer175704f2021-06-22 17:33:53 +080052 if_idx = if_nametoindex(argv[1]);
53 if (!if_idx) {
developerfd40db22021-04-29 10:08:25 +080054 fprintf(stderr, "%s\n", strerror(errno));
55 return 2;
56 }
57
58 cmd = argv[2];
developer175704f2021-06-22 17:33:53 +080059 subcmd = argv[3];
60 argv += 4;
61 argc -= 4;
developerfd40db22021-04-29 10:08:25 +080062
developer175704f2021-06-22 17:33:53 +080063 if (!strncmp(cmd, "dump", 4)) {
64 if (!strncmp(subcmd, "csi", 3))
65 ret = mt76_csi_dump(if_idx, argc, argv);
developere53f0872021-07-23 11:13:49 +080066 else if (!strncmp(subcmd, "amnt", 4))
67 ret = mt76_amnt_dump(if_idx, argc, argv);
developer175704f2021-06-22 17:33:53 +080068 } else if (!strncmp(cmd, "set", 3)) {
69 if (!strncmp(subcmd, "csi", 3))
70 ret = mt76_csi_set(if_idx, argc, argv);
developere53f0872021-07-23 11:13:49 +080071 else if (!strncmp(subcmd, "amnt", 4))
72 ret = mt76_amnt_set(if_idx, argc, argv);
developer5f18e6c2021-07-28 11:55:08 +080073 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);
developer175704f2021-06-22 17:33:53 +080077 } else {
developerfd40db22021-04-29 10:08:25 +080078 usage();
developer175704f2021-06-22 17:33:53 +080079 }
developerfd40db22021-04-29 10:08:25 +080080
81 return ret;
82}