developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 1 | From 2c3c314405d088440feccf8fb596849d99cce6f8 Mon Sep 17 00:00:00 2001 |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 2 | From: Evelyn Tsai <evelyn.tsai@mediatek.com> |
| 3 | Date: Fri, 16 Dec 2022 03:57:11 +0800 |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 12/38] hostapd: mtk: Add amsdu set get ctrl |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 5 | |
| 6 | --- |
| 7 | hostapd/config_file.c | 9 +++ |
| 8 | hostapd/ctrl_iface.c | 26 +++++++ |
| 9 | hostapd/hostapd_cli.c | 9 +++ |
| 10 | src/ap/ap_config.c | 1 + |
| 11 | src/ap/ap_config.h | 1 + |
| 12 | src/ap/ap_drv_ops.c | 14 ++++ |
| 13 | src/ap/ap_drv_ops.h | 2 + |
| 14 | src/ap/hostapd.c | 2 + |
| 15 | src/common/mtk_vendor.h | 17 ++++- |
| 16 | src/drivers/driver.h | 9 +++ |
| 17 | src/drivers/driver_nl80211.c | 114 ++++++++++++++++++++++++++++++ |
| 18 | src/drivers/driver_nl80211.h | 1 + |
| 19 | src/drivers/driver_nl80211_capa.c | 3 + |
| 20 | 13 files changed, 207 insertions(+), 1 deletion(-) |
| 21 | |
| 22 | diff --git a/hostapd/config_file.c b/hostapd/config_file.c |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 23 | index 50e2993..0b2f3dc 100644 |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 24 | --- a/hostapd/config_file.c |
| 25 | +++ b/hostapd/config_file.c |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 26 | @@ -4863,6 +4863,15 @@ static int hostapd_config_fill(struct hostapd_config *conf, |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 27 | u8 en = strtol(pos, NULL, 10); |
| 28 | |
| 29 | conf->dfs_detect_mode = en; |
| 30 | + } else if (os_strcmp(buf, "amsdu") == 0) { |
| 31 | + int val = atoi(pos); |
| 32 | + if (val < 0 || val > 1) { |
| 33 | + wpa_printf(MSG_ERROR, |
| 34 | + "Line %d: invalid amsdu value", |
| 35 | + line); |
| 36 | + return 1; |
| 37 | + } |
| 38 | + conf->amsdu = val; |
| 39 | } else { |
| 40 | wpa_printf(MSG_ERROR, |
| 41 | "Line %d: unknown configuration item '%s'", |
| 42 | diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c |
developer | dfb5098 | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 43 | index 2399979..c54cbb9 100644 |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 44 | --- a/hostapd/ctrl_iface.c |
| 45 | +++ b/hostapd/ctrl_iface.c |
developer | dfb5098 | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 46 | @@ -3659,6 +3659,30 @@ hostapd_ctrl_iface_set_offchan_ctrl(struct hostapd_data *hapd, char *cmd, |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | |
| 50 | +static int |
| 51 | +hostapd_ctrl_iface_get_amsdu(struct hostapd_data *hapd, char *buf, |
| 52 | + size_t buflen) |
| 53 | +{ |
| 54 | + u8 amsdu; |
| 55 | + int ret; |
| 56 | + char *pos, *end; |
| 57 | + |
| 58 | + pos = buf; |
| 59 | + end = buf + buflen; |
| 60 | + |
| 61 | + if (hostapd_drv_amsdu_dump(hapd, &amsdu) == 0) { |
| 62 | + hapd->iconf->amsdu = amsdu; |
| 63 | + ret = os_snprintf(pos, end - pos, "[hostapd_cli] AMSDU: %u\n", |
| 64 | + hapd->iconf->amsdu); |
| 65 | + } |
| 66 | + |
| 67 | + if (os_snprintf_error(end - pos, ret)) |
| 68 | + return 0; |
| 69 | + |
| 70 | + return ret; |
| 71 | +} |
| 72 | + |
| 73 | + |
| 74 | static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, |
| 75 | char *buf, char *reply, |
| 76 | int reply_size, |
developer | dfb5098 | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 77 | @@ -4230,6 +4254,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 78 | reply, reply_size); |
| 79 | } else if (os_strncmp(buf, "SET_OFFCHAN_CTRL", 16) == 0) { |
| 80 | reply_len = hostapd_ctrl_iface_set_offchan_ctrl(hapd, buf + 16, reply, reply_size); |
| 81 | + } else if (os_strncmp(buf, "GET_AMSDU", 9) == 0) { |
| 82 | + reply_len = hostapd_ctrl_iface_get_amsdu(hapd, reply, reply_size); |
| 83 | } else { |
| 84 | os_memcpy(reply, "UNKNOWN COMMAND\n", 16); |
| 85 | reply_len = 16; |
| 86 | diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c |
developer | dfb5098 | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 87 | index 4fa2d32..d593730 100644 |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 88 | --- a/hostapd/hostapd_cli.c |
| 89 | +++ b/hostapd/hostapd_cli.c |
developer | 505c943 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 90 | @@ -1613,6 +1613,13 @@ static int hostapd_cli_cmd_get_ibf(struct wpa_ctrl *ctrl, int argc, |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | |
| 94 | +static int hostapd_cli_cmd_get_amsdu(struct wpa_ctrl *ctrl, int argc, |
| 95 | + char *argv[]) |
| 96 | +{ |
| 97 | + return hostapd_cli_cmd(ctrl, "GET_AMSDU", 0, NULL, NULL); |
| 98 | +} |
| 99 | + |
| 100 | + |
| 101 | struct hostapd_cli_cmd { |
| 102 | const char *cmd; |
| 103 | int (*handler)(struct wpa_ctrl *ctrl, int argc, char *argv[]); |
developer | 505c943 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 104 | @@ -1820,6 +1827,8 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = { |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 105 | "<tx type(0/1/2)> <interval> = runtime set inband discovery" }, |
| 106 | { "get_ibf", hostapd_cli_cmd_get_ibf, NULL, |
| 107 | " = show iBF state (enabled/disabled)"}, |
| 108 | + { "get_amsdu", hostapd_cli_cmd_get_amsdu, NULL, |
| 109 | + " = show AMSDU state"}, |
| 110 | { NULL, NULL, NULL, NULL } |
| 111 | }; |
| 112 | |
| 113 | diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c |
developer | dfb5098 | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 114 | index c9b9683..f519a76 100644 |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 115 | --- a/src/ap/ap_config.c |
| 116 | +++ b/src/ap/ap_config.c |
developer | 8bff647 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 117 | @@ -300,6 +300,7 @@ struct hostapd_config * hostapd_config_defaults(void) |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 118 | conf->edcca_compensation = EDCCA_DEFAULT_COMPENSATION; |
| 119 | conf->three_wire_enable = THREE_WIRE_MODE_DISABLE; |
| 120 | conf->ibf_enable = IBF_DEFAULT_ENABLE; |
| 121 | + conf->amsdu = 1; |
| 122 | |
| 123 | return conf; |
| 124 | } |
| 125 | diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 126 | index 6576d79..9f3cea2 100644 |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 127 | --- a/src/ap/ap_config.h |
| 128 | +++ b/src/ap/ap_config.h |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 129 | @@ -1201,6 +1201,7 @@ struct hostapd_config { |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 130 | u8 three_wire_enable; |
| 131 | u8 ibf_enable; |
| 132 | u8 dfs_detect_mode; |
| 133 | + u8 amsdu; |
| 134 | }; |
| 135 | |
| 136 | enum three_wire_mode { |
| 137 | diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c |
developer | dfb5098 | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 138 | index 41e76aa..a7226cf 100644 |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 139 | --- a/src/ap/ap_drv_ops.c |
| 140 | +++ b/src/ap/ap_drv_ops.c |
developer | 8bff647 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 141 | @@ -1199,4 +1199,18 @@ int hostapd_drv_ibf_dump(struct hostapd_data *hapd, u8 *ibf_enable) |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 142 | if (!hapd->driver || !hapd->driver->ibf_dump) |
| 143 | return 0; |
| 144 | return hapd->driver->ibf_dump(hapd->drv_priv, ibf_enable); |
| 145 | +} |
| 146 | + |
| 147 | +int hostapd_drv_amsdu_ctrl(struct hostapd_data *hapd) |
| 148 | +{ |
| 149 | + if (!hapd->driver || !hapd->driver->amsdu_ctrl) |
| 150 | + return 0; |
| 151 | + return hapd->driver->amsdu_ctrl(hapd->drv_priv, hapd->iconf->amsdu); |
| 152 | +} |
| 153 | + |
| 154 | +int hostapd_drv_amsdu_dump(struct hostapd_data *hapd, u8 *amsdu) |
| 155 | +{ |
| 156 | + if (!hapd->driver || !hapd->driver->amsdu_dump) |
| 157 | + return 0; |
| 158 | + return hapd->driver->amsdu_dump(hapd->drv_priv, amsdu); |
| 159 | } |
| 160 | \ No newline at end of file |
| 161 | diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 162 | index 2958661..88bc430 100644 |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 163 | --- a/src/ap/ap_drv_ops.h |
| 164 | +++ b/src/ap/ap_drv_ops.h |
developer | 505c943 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 165 | @@ -153,6 +153,8 @@ int hostapd_drv_mu_dump(struct hostapd_data *hapd, u8 *mu_onoff); |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 166 | int hostapd_drv_three_wire_ctrl(struct hostapd_data *hapd); |
| 167 | int hostapd_drv_ibf_ctrl(struct hostapd_data *hapd); |
| 168 | int hostapd_drv_ibf_dump(struct hostapd_data *hapd, u8 *ibf_enable); |
| 169 | +int hostapd_drv_amsdu_ctrl(struct hostapd_data *hapd); |
| 170 | +int hostapd_drv_amsdu_dump(struct hostapd_data *hapd, u8 *amsdu); |
| 171 | |
| 172 | #include "drivers/driver.h" |
| 173 | |
| 174 | diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 175 | index 227580e..a166de4 100644 |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 176 | --- a/src/ap/hostapd.c |
| 177 | +++ b/src/ap/hostapd.c |
developer | dfb5098 | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 178 | @@ -2523,6 +2523,8 @@ dfs_offload: |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 179 | goto fail; |
| 180 | if (hostapd_drv_ibf_ctrl(hapd) < 0) |
| 181 | goto fail; |
| 182 | + if (hostapd_drv_amsdu_ctrl(hapd) < 0) |
| 183 | + goto fail; |
| 184 | |
| 185 | wpa_printf(MSG_DEBUG, "%s: Setup of interface done.", |
| 186 | iface->bss[0]->conf->iface); |
| 187 | diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h |
developer | dfb5098 | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 188 | index 9811f26..7b4d7c1 100644 |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 189 | --- a/src/common/mtk_vendor.h |
| 190 | +++ b/src/common/mtk_vendor.h |
developer | 8bff647 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 191 | @@ -170,7 +170,6 @@ enum mtk_vendor_attr_wireless_ctrl { |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 192 | MTK_VENDOR_ATTR_WIRELESS_CTRL_NUSERS_OFDMA, |
| 193 | MTK_VENDOR_ATTR_WIRELESS_CTRL_BA_BUFFER_SIZE, |
| 194 | MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO, |
| 195 | - MTK_VENDOR_ATTR_WIRELESS_CTRL_AMPDU, |
| 196 | MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU, |
| 197 | MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT, |
| 198 | |
developer | 8bff647 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 199 | @@ -180,6 +179,22 @@ enum mtk_vendor_attr_wireless_ctrl { |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 200 | NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL - 1 |
| 201 | }; |
| 202 | |
| 203 | +enum mtk_vendor_attr_wireless_dump { |
| 204 | + MTK_VENDOR_ATTR_WIRELESS_DUMP_UNSPEC, |
| 205 | + |
| 206 | + MTK_VENDOR_ATTR_WIRELESS_DUMP_AMSDU, |
| 207 | + |
| 208 | + /* keep last */ |
| 209 | + NUM_MTK_VENDOR_ATTRS_WIRELESS_DUMP, |
| 210 | + MTK_VENDOR_ATTR_WIRELESS_DUMP_MAX = |
| 211 | + NUM_MTK_VENDOR_ATTRS_WIRELESS_DUMP - 1 |
| 212 | +}; |
| 213 | + |
| 214 | +static const struct nla_policy |
| 215 | +wireless_dump_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_DUMP] = { |
| 216 | + [MTK_VENDOR_ATTR_WIRELESS_DUMP_AMSDU] = { .type = NLA_U8 }, |
| 217 | +}; |
| 218 | + |
| 219 | enum mtk_vendor_attr_rfeature_ctrl { |
| 220 | MTK_VENDOR_ATTR_RFEATURE_CTRL_UNSPEC, |
| 221 | |
| 222 | diff --git a/src/drivers/driver.h b/src/drivers/driver.h |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 223 | index 0a99078..38f6e8b 100644 |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 224 | --- a/src/drivers/driver.h |
| 225 | +++ b/src/drivers/driver.h |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 226 | @@ -5146,6 +5146,15 @@ struct wpa_driver_ops { |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 227 | * |
| 228 | */ |
developer | 52278a1 | 2023-03-02 20:22:29 +0800 | [diff] [blame] | 229 | int (*ibf_dump)(void *priv, u8 *ibf_enable); |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 230 | + |
| 231 | + /** |
| 232 | + * amsdu_ctrl - enable/disable amsdu |
| 233 | + * amsdu_dump - get current amsdu status |
| 234 | + * @priv: Private driver interface data |
| 235 | + * |
| 236 | + */ |
| 237 | + int (*amsdu_ctrl)(void *priv, u8 amsdu); |
| 238 | + int (*amsdu_dump)(void *priv, u8 *amsdu); |
| 239 | }; |
| 240 | |
| 241 | /** |
| 242 | diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 243 | index a05e047..808db17 100644 |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 244 | --- a/src/drivers/driver_nl80211.c |
| 245 | +++ b/src/drivers/driver_nl80211.c |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 246 | @@ -14165,6 +14165,118 @@ fail: |
developer | 52278a1 | 2023-03-02 20:22:29 +0800 | [diff] [blame] | 247 | return -ENOBUFS; |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | +static int nl80211_enable_amsdu(void *priv, u8 amsdu) |
| 251 | +{ |
| 252 | + struct i802_bss *bss = priv; |
| 253 | + struct wpa_driver_nl80211_data *drv = bss->drv; |
| 254 | + struct nl_msg *msg; |
| 255 | + struct nlattr *data; |
| 256 | + int ret; |
| 257 | + |
| 258 | + if (!drv->mtk_wireless_vendor_cmd_avail) { |
| 259 | + wpa_printf(MSG_INFO, |
| 260 | + "nl80211: Driver does not support setting ap wireless control"); |
| 261 | + return 0; |
| 262 | + } |
| 263 | + |
| 264 | + msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR); |
| 265 | + if (!msg) |
| 266 | + goto fail; |
| 267 | + |
| 268 | + if (nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_MTK) || |
| 269 | + nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD, MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL)) |
| 270 | + goto fail; |
| 271 | + |
| 272 | + data = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA); |
| 273 | + if (!data) |
| 274 | + goto fail; |
| 275 | + |
| 276 | + nla_put_u8(msg, MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU, amsdu); |
| 277 | + |
| 278 | + nla_nest_end(msg, data); |
| 279 | + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); |
| 280 | + if (ret) { |
| 281 | + wpa_printf(MSG_ERROR, "Failed to set amsdu. ret=%d (%s)", ret, strerror(-ret)); |
| 282 | + } |
| 283 | + |
| 284 | + return ret; |
| 285 | + |
| 286 | +fail: |
| 287 | + nlmsg_free(msg); |
| 288 | + return -ENOBUFS; |
| 289 | +} |
| 290 | + |
| 291 | +static int dump_amsdu_handler(struct nl_msg *msg, void *arg) |
| 292 | +{ |
| 293 | + u8 *amsdu = (u8 *) arg; |
| 294 | + struct nlattr *tb[NL80211_ATTR_MAX + 1]; |
| 295 | + struct nlattr *tb_vendor[MTK_VENDOR_ATTR_WIRELESS_DUMP_MAX + 1]; |
| 296 | + struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg)); |
| 297 | + struct nlattr *nl_vend, *attr_amsdu; |
| 298 | + |
| 299 | + nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), |
| 300 | + genlmsg_attrlen(gnlh, 0), NULL); |
| 301 | + |
| 302 | + nl_vend = tb[NL80211_ATTR_VENDOR_DATA]; |
| 303 | + if (!nl_vend) |
| 304 | + return NL_SKIP; |
| 305 | + |
| 306 | + nla_parse(tb_vendor, MTK_VENDOR_ATTR_WIRELESS_DUMP_MAX, |
| 307 | + nla_data(nl_vend), nla_len(nl_vend), NULL); |
| 308 | + |
| 309 | + attr_amsdu = tb_vendor[MTK_VENDOR_ATTR_WIRELESS_DUMP_AMSDU]; |
| 310 | + if (!attr_amsdu ){ |
| 311 | + wpa_printf(MSG_ERROR, "nl80211: cannot find vendor attributes"); |
| 312 | + return NL_SKIP; |
| 313 | + } |
| 314 | + |
| 315 | + *amsdu = nla_get_u8(attr_amsdu); |
| 316 | + |
| 317 | + return NL_SKIP; |
| 318 | +} |
| 319 | + |
| 320 | +static int |
| 321 | +nl80211_dump_amsdu(void *priv, u8 *amsdu) |
| 322 | +{ |
| 323 | + struct i802_bss *bss = priv; |
| 324 | + struct wpa_driver_nl80211_data *drv = bss->drv; |
| 325 | + struct nl_msg *msg; |
| 326 | + struct nlattr *data; |
| 327 | + int ret; |
| 328 | + |
| 329 | + if (!drv->mtk_wireless_vendor_cmd_avail) { |
| 330 | + wpa_printf(MSG_INFO, |
| 331 | + "nl80211: Driver does not support ap_wireless control"); |
| 332 | + return 0; |
| 333 | + } |
| 334 | + |
| 335 | + msg = nl80211_drv_msg(drv, NLM_F_DUMP, NL80211_CMD_VENDOR); |
| 336 | + if (!msg) |
| 337 | + goto fail; |
| 338 | + |
| 339 | + if (nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_MTK) || |
| 340 | + nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD, MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL)) |
| 341 | + goto fail; |
| 342 | + |
| 343 | + data = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA); |
| 344 | + if (!data) |
| 345 | + goto fail; |
| 346 | + |
| 347 | + nla_nest_end(msg, data); |
| 348 | + |
| 349 | + ret = send_and_recv_msgs(drv, msg, dump_amsdu_handler, amsdu, NULL, NULL); |
| 350 | + |
| 351 | + if (ret) { |
| 352 | + wpa_printf(MSG_ERROR, "Failed to dump amsdu. ret=%d (%s)", ret, strerror(-ret)); |
| 353 | + } |
| 354 | + |
| 355 | + return ret; |
| 356 | + |
| 357 | +fail: |
| 358 | + nlmsg_free(msg); |
| 359 | + return -ENOBUFS; |
| 360 | +} |
| 361 | + |
| 362 | const struct wpa_driver_ops wpa_driver_nl80211_ops = { |
| 363 | .name = "nl80211", |
| 364 | .desc = "Linux nl80211/cfg80211", |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 365 | @@ -14329,4 +14441,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = { |
developer | 52278a1 | 2023-03-02 20:22:29 +0800 | [diff] [blame] | 366 | .three_wire_ctrl = nl80211_enable_three_wire, |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 367 | .ibf_ctrl = nl80211_ibf_enable, |
| 368 | .ibf_dump = nl80211_ibf_dump, |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 369 | + .amsdu_ctrl = nl80211_enable_amsdu, |
| 370 | + .amsdu_dump = nl80211_dump_amsdu, |
| 371 | }; |
| 372 | diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h |
developer | dfb5098 | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 373 | index 4e64e7d..0100314 100644 |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 374 | --- a/src/drivers/driver_nl80211.h |
| 375 | +++ b/src/drivers/driver_nl80211.h |
developer | 8bff647 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 376 | @@ -206,6 +206,7 @@ struct wpa_driver_nl80211_data { |
developer | e0a1e0e | 2023-02-24 11:26:12 +0800 | [diff] [blame] | 377 | unsigned int mtk_mu_vendor_cmd_avail:1; |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 378 | unsigned int mtk_3wire_vendor_cmd_avail:1; |
| 379 | unsigned int mtk_ibf_vendor_cmd_avail:1; |
| 380 | + unsigned int mtk_wireless_vendor_cmd_avail:1; |
| 381 | |
| 382 | u64 vendor_scan_cookie; |
| 383 | u64 remain_on_chan_cookie; |
| 384 | diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c |
developer | dfb5098 | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 385 | index 7ad15ba..f14706d 100644 |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 386 | --- a/src/drivers/driver_nl80211_capa.c |
| 387 | +++ b/src/drivers/driver_nl80211_capa.c |
developer | 8bff647 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 388 | @@ -1122,6 +1122,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg) |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 389 | case MTK_NL80211_VENDOR_SUBCMD_IBF_CTRL: |
| 390 | drv->mtk_ibf_vendor_cmd_avail = 1; |
| 391 | break; |
| 392 | + case MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL: |
| 393 | + drv->mtk_wireless_vendor_cmd_avail = 1; |
| 394 | + break; |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | -- |
developer | dfb5098 | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 399 | 2.18.0 |
developer | 1c2c7d4 | 2023-01-18 18:20:58 +0800 | [diff] [blame] | 400 | |