old mode 100644new mode 100755| .. | .. |
|---|
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 2 | | - |
|---|
| 3 | 2 | #include <linux/module.h> |
|---|
| 4 | 3 | #include <linux/netdevice.h> |
|---|
| 5 | 4 | #include <net/netlink.h> |
|---|
| .. | .. |
|---|
| 32 | 31 | #ifdef WL_ESCAN |
|---|
| 33 | 32 | #include <wl_escan.h> |
|---|
| 34 | 33 | #endif /* WL_ESCAN */ |
|---|
| 35 | | - |
|---|
| 36 | | -uint android_msg_level = ANDROID_ERROR_LEVEL | ANDROID_MSG_LEVEL; |
|---|
| 37 | 34 | |
|---|
| 38 | 35 | #define AEXT_ERROR(name, arg1, args...) \ |
|---|
| 39 | 36 | do { \ |
|---|
| .. | .. |
|---|
| 83 | 80 | #define CMD_ROAM_TRIGGER "ROAM_TRIGGER" |
|---|
| 84 | 81 | #define CMD_PM "PM" |
|---|
| 85 | 82 | #define CMD_MONITOR "MONITOR" |
|---|
| 86 | | -#ifdef BTC_WAR |
|---|
| 87 | | -#define CMD_BTC_WAR "BTC_WAR" |
|---|
| 88 | | -#endif /* BTC_WAR */ |
|---|
| 89 | 83 | #define CMD_SET_SUSPEND_BCN_LI_DTIM "SET_SUSPEND_BCN_LI_DTIM" |
|---|
| 90 | 84 | #define CMD_WLMSGLEVEL "WLMSGLEVEL" |
|---|
| 91 | 85 | #ifdef WL_EXT_IAPSTA |
|---|
| .. | .. |
|---|
| 323 | 317 | } |
|---|
| 324 | 318 | |
|---|
| 325 | 319 | chanspec_t |
|---|
| 326 | | -wl_ext_chspec_host_to_driver(struct dhd_pub *dhd, chanspec_t chanspec) |
|---|
| 320 | +wl_ext_chspec_host_to_driver(int ioctl_ver, chanspec_t chanspec) |
|---|
| 327 | 321 | { |
|---|
| 328 | | - if (dhd->conf->ioctl_ver == 1) { |
|---|
| 322 | + if (ioctl_ver == 1) { |
|---|
| 329 | 323 | chanspec = wl_ext_chspec_to_legacy(chanspec); |
|---|
| 330 | 324 | if (chanspec == INVCHANSPEC) { |
|---|
| 331 | 325 | return chanspec; |
|---|
| .. | .. |
|---|
| 337 | 331 | } |
|---|
| 338 | 332 | |
|---|
| 339 | 333 | static void |
|---|
| 340 | | -wl_ext_ch_to_chanspec(struct dhd_pub *dhd, int ch, |
|---|
| 334 | +wl_ext_ch_to_chanspec(int ioctl_ver, int ch, |
|---|
| 341 | 335 | struct wl_join_params *join_params, size_t *join_params_size) |
|---|
| 342 | 336 | { |
|---|
| 343 | 337 | chanspec_t chanspec = 0; |
|---|
| .. | .. |
|---|
| 360 | 354 | join_params->params.chanspec_list[0] &= WL_CHANSPEC_CHAN_MASK; |
|---|
| 361 | 355 | join_params->params.chanspec_list[0] |= chanspec; |
|---|
| 362 | 356 | join_params->params.chanspec_list[0] = |
|---|
| 363 | | - wl_ext_chspec_host_to_driver(dhd, |
|---|
| 357 | + wl_ext_chspec_host_to_driver(ioctl_ver, |
|---|
| 364 | 358 | join_params->params.chanspec_list[0]); |
|---|
| 365 | 359 | |
|---|
| 366 | 360 | join_params->params.chanspec_num = |
|---|
| .. | .. |
|---|
| 405 | 399 | } |
|---|
| 406 | 400 | |
|---|
| 407 | 401 | chanspec_t |
|---|
| 408 | | -wl_ext_chspec_driver_to_host(struct dhd_pub *dhd, chanspec_t chanspec) |
|---|
| 402 | +wl_ext_chspec_driver_to_host(int ioctl_ver, chanspec_t chanspec) |
|---|
| 409 | 403 | { |
|---|
| 410 | 404 | chanspec = dtohchanspec(chanspec); |
|---|
| 411 | | - if (dhd->conf->ioctl_ver == 1) { |
|---|
| 405 | + if (ioctl_ver == 1) { |
|---|
| 412 | 406 | chanspec = wl_ext_chspec_from_legacy(chanspec); |
|---|
| 413 | 407 | } |
|---|
| 414 | 408 | |
|---|
| .. | .. |
|---|
| 419 | 413 | chanspec_band_t |
|---|
| 420 | 414 | wl_ext_wlcband_to_chanspec_band(int band) |
|---|
| 421 | 415 | { |
|---|
| 422 | | - chanspec_band_t chanspec_band = INVCHANSPEC; |
|---|
| 416 | + chanspec_band_t chanspec_band = WLC_BAND_INVALID; |
|---|
| 423 | 417 | |
|---|
| 424 | 418 | switch (band) { |
|---|
| 425 | 419 | #ifdef WL_6G_BAND |
|---|
| .. | .. |
|---|
| 434 | 428 | chanspec_band = WL_CHANSPEC_BAND_2G; |
|---|
| 435 | 429 | break; |
|---|
| 436 | 430 | default: |
|---|
| 437 | | - AEXT_ERROR("wlan", "Invalid Frequency Band\n"); |
|---|
| 438 | 431 | break; |
|---|
| 439 | 432 | } |
|---|
| 440 | 433 | return chanspec_band; |
|---|
| .. | .. |
|---|
| 556 | 549 | } |
|---|
| 557 | 550 | } |
|---|
| 558 | 551 | |
|---|
| 552 | +int |
|---|
| 553 | +wl_ext_get_ioctl_ver(struct net_device *dev, int *ioctl_ver) |
|---|
| 554 | +{ |
|---|
| 555 | + int ret = 0; |
|---|
| 556 | + s32 val = 0; |
|---|
| 557 | + |
|---|
| 558 | + val = 1; |
|---|
| 559 | + ret = wl_ext_ioctl(dev, WLC_GET_VERSION, &val, sizeof(val), 0); |
|---|
| 560 | + if (ret) { |
|---|
| 561 | + return ret; |
|---|
| 562 | + } |
|---|
| 563 | + val = dtoh32(val); |
|---|
| 564 | + if (val != WLC_IOCTL_VERSION && val != 1) { |
|---|
| 565 | + AEXT_ERROR(dev->name, "Version mismatch, please upgrade. Got %d, expected %d or 1\n", |
|---|
| 566 | + val, WLC_IOCTL_VERSION); |
|---|
| 567 | + return BCME_VERSION; |
|---|
| 568 | + } |
|---|
| 569 | + *ioctl_ver = val; |
|---|
| 570 | + |
|---|
| 571 | + return ret; |
|---|
| 572 | +} |
|---|
| 573 | + |
|---|
| 559 | 574 | void |
|---|
| 560 | 575 | wl_ext_bss_iovar_war(struct net_device *ndev, s32 *val) |
|---|
| 561 | 576 | { |
|---|
| .. | .. |
|---|
| 596 | 611 | wl_ext_set_chanspec(struct net_device *dev, struct wl_chan_info *chan_info, |
|---|
| 597 | 612 | chanspec_t *ret_chspec) |
|---|
| 598 | 613 | { |
|---|
| 599 | | - struct dhd_pub *dhd = dhd_get_pub(dev); |
|---|
| 600 | 614 | s32 _chan = chan_info->chan; |
|---|
| 601 | 615 | chanspec_t chspec = 0; |
|---|
| 602 | 616 | chanspec_t fw_chspec = 0; |
|---|
| .. | .. |
|---|
| 609 | 623 | u32 bw_cap; |
|---|
| 610 | 624 | } param = {0, 0}; |
|---|
| 611 | 625 | chanspec_band_t chanspec_band = 0; |
|---|
| 626 | + int ioctl_ver; |
|---|
| 612 | 627 | |
|---|
| 613 | 628 | if ((chan_info->band != WLC_BAND_2G) && (chan_info->band != WLC_BAND_5G) && |
|---|
| 614 | 629 | (chan_info->band != WLC_BAND_6G)) { |
|---|
| .. | .. |
|---|
| 641 | 656 | chanspec_band = wl_ext_wlcband_to_chanspec_band(chan_info->band); |
|---|
| 642 | 657 | chspec = wf_create_chspec_from_primary(chan_info->chan, bw, chanspec_band); |
|---|
| 643 | 658 | if (wf_chspec_valid(chspec)) { |
|---|
| 644 | | - fw_chspec = wl_ext_chspec_host_to_driver(dhd, chspec); |
|---|
| 659 | + wl_ext_get_ioctl_ver(dev, &ioctl_ver); |
|---|
| 660 | + fw_chspec = wl_ext_chspec_host_to_driver(ioctl_ver, chspec); |
|---|
| 645 | 661 | if (fw_chspec != INVCHANSPEC) { |
|---|
| 646 | 662 | if ((err = wl_ext_iovar_setint(dev, "chanspec", fw_chspec)) == BCME_BADCHAN) { |
|---|
| 647 | 663 | if (bw == WL_CHANSPEC_BW_80) |
|---|
| .. | .. |
|---|
| 651 | 667 | } else if (err) { |
|---|
| 652 | 668 | AEXT_ERROR(dev->name, "failed to set chanspec error %d\n", err); |
|---|
| 653 | 669 | } else |
|---|
| 654 | | - WL_MSG(dev->name, "channel %s-%d(0x%x %sMHz)\n", |
|---|
| 655 | | - CHSPEC2BANDSTR(chspec), chan_info->chan, chspec, |
|---|
| 656 | | - CHSPEC_IS20(chspec)?"20": |
|---|
| 657 | | - CHSPEC_IS40(chspec)?"40": |
|---|
| 658 | | - CHSPEC_IS80(chspec)?"80":"160"); |
|---|
| 670 | + WL_MSG(dev->name, "channel %s-%d(0x%x)\n", |
|---|
| 671 | + CHSPEC2BANDSTR(chspec), chan_info->chan, chspec); |
|---|
| 659 | 672 | } else { |
|---|
| 660 | 673 | AEXT_ERROR(dev->name, "failed to convert host chanspec to fw chanspec\n"); |
|---|
| 661 | 674 | err = BCME_ERROR; |
|---|
| .. | .. |
|---|
| 706 | 719 | else if (strnicmp(band, "band=2g", strlen("band=2g")) == 0) { |
|---|
| 707 | 720 | chan_info.band = WLC_BAND_2G; |
|---|
| 708 | 721 | } |
|---|
| 709 | | - else if (channel <= CH_MAX_2G_CHANNEL) |
|---|
| 710 | | - chan_info.band = WLC_BAND_2G; |
|---|
| 711 | | - else |
|---|
| 712 | | - chan_info.band = WLC_BAND_5G; |
|---|
| 713 | 722 | |
|---|
| 714 | 723 | if (channel > 0) { |
|---|
| 715 | 724 | chan_info.chan = channel; |
|---|
| .. | .. |
|---|
| 854 | 863 | return ret; |
|---|
| 855 | 864 | } |
|---|
| 856 | 865 | |
|---|
| 857 | | -#ifdef BTC_WAR |
|---|
| 858 | | -extern int btc_war; |
|---|
| 859 | | -static int |
|---|
| 860 | | -wl_ext_btc_war(struct net_device *dev, char *command, int total_len) |
|---|
| 861 | | -{ |
|---|
| 862 | | - int user_btc_war = 0; |
|---|
| 863 | | - bool enable = FALSE; |
|---|
| 864 | | - |
|---|
| 865 | | - sscanf(command, "%*s %d", &user_btc_war); |
|---|
| 866 | | - |
|---|
| 867 | | - AEXT_TRACE(dev->name, "btc_war=%d, user_btc_war=%d\n", |
|---|
| 868 | | - btc_war, user_btc_war); |
|---|
| 869 | | - |
|---|
| 870 | | - if (btc_war >= 0) { |
|---|
| 871 | | - btc_war = user_btc_war; |
|---|
| 872 | | - if (btc_war > 0) |
|---|
| 873 | | - enable = TRUE; |
|---|
| 874 | | - wl_ext_btc_config(dev, enable); |
|---|
| 875 | | - } |
|---|
| 876 | | - |
|---|
| 877 | | - return 0; |
|---|
| 878 | | -} |
|---|
| 879 | | -#endif /* BTC_WAR */ |
|---|
| 880 | | - |
|---|
| 881 | 866 | s32 |
|---|
| 882 | 867 | wl_ext_connect(struct net_device *dev, struct wl_conn_info *conn_info) |
|---|
| 883 | 868 | { |
|---|
| .. | .. |
|---|
| 888 | 873 | s32 err = 0; |
|---|
| 889 | 874 | u32 chan_cnt = 0; |
|---|
| 890 | 875 | s8 *iovar_buf = NULL; |
|---|
| 876 | + int ioctl_ver = 0; |
|---|
| 891 | 877 | char sec[64]; |
|---|
| 878 | + |
|---|
| 879 | + wl_ext_get_ioctl_ver(dev, &ioctl_ver); |
|---|
| 892 | 880 | |
|---|
| 893 | 881 | if (dhd->conf->chip == BCM43362_CHIP_ID) |
|---|
| 894 | 882 | goto set_ssid; |
|---|
| .. | .. |
|---|
| 945 | 933 | ext_join_params->assoc.chanspec_list[0] &= WL_CHANSPEC_CHAN_MASK; |
|---|
| 946 | 934 | ext_join_params->assoc.chanspec_list[0] |= chspec; |
|---|
| 947 | 935 | ext_join_params->assoc.chanspec_list[0] = |
|---|
| 948 | | - wl_ext_chspec_host_to_driver(dhd, |
|---|
| 936 | + wl_ext_chspec_host_to_driver(ioctl_ver, |
|---|
| 949 | 937 | ext_join_params->assoc.chanspec_list[0]); |
|---|
| 950 | 938 | } |
|---|
| 951 | 939 | ext_join_params->assoc.chanspec_num = htod32(ext_join_params->assoc.chanspec_num); |
|---|
| .. | .. |
|---|
| 982 | 970 | else |
|---|
| 983 | 971 | memcpy(&join_params.params.bssid, ðer_bcast, ETH_ALEN); |
|---|
| 984 | 972 | |
|---|
| 985 | | - wl_ext_ch_to_chanspec(dhd, conn_info->channel, &join_params, &join_params_size); |
|---|
| 973 | + wl_ext_ch_to_chanspec(ioctl_ver, conn_info->channel, &join_params, &join_params_size); |
|---|
| 986 | 974 | AEXT_TRACE(dev->name, "join_param_size %zu\n", join_params_size); |
|---|
| 987 | 975 | |
|---|
| 988 | 976 | if (join_params.ssid.SSID_len < IEEE80211_MAX_SSID_LEN) { |
|---|
| .. | .. |
|---|
| 1099 | 1087 | return FALSE; |
|---|
| 1100 | 1088 | } |
|---|
| 1101 | 1089 | |
|---|
| 1102 | | -bool |
|---|
| 1103 | | -wl_ext_passive_chan(struct net_device *dev, struct wl_chan_info *chan_info) |
|---|
| 1104 | | -{ |
|---|
| 1105 | | - struct dhd_pub *dhd = dhd_get_pub(dev); |
|---|
| 1106 | | - u32 chanspec; |
|---|
| 1107 | | - s32 ret = BCME_OK; |
|---|
| 1108 | | - |
|---|
| 1109 | | - chanspec = wf_create_chspec_from_primary(chan_info->chan, |
|---|
| 1110 | | - WL_CHANSPEC_BW_20, wl_ext_wlcband_to_chanspec_band(chan_info->band)); |
|---|
| 1111 | | - |
|---|
| 1112 | | - chanspec = wl_ext_chspec_host_to_driver(dhd, chanspec); |
|---|
| 1113 | | - |
|---|
| 1114 | | - ret = wldev_iovar_getint(dev, "per_chan_info", &chanspec); |
|---|
| 1115 | | - if (!ret) { |
|---|
| 1116 | | - if (chanspec & WL_CHAN_PASSIVE) |
|---|
| 1117 | | - return TRUE; |
|---|
| 1118 | | - } else { |
|---|
| 1119 | | - if (chan_info->band == WLC_BAND_5G && chan_info->chan >= 52 && chan_info->chan <= 144) |
|---|
| 1120 | | - return TRUE; |
|---|
| 1121 | | - } |
|---|
| 1122 | | - |
|---|
| 1123 | | - return FALSE; |
|---|
| 1124 | | -} |
|---|
| 1125 | | - |
|---|
| 1126 | 1090 | uint16 |
|---|
| 1127 | 1091 | wl_ext_get_default_chan(struct net_device *dev, |
|---|
| 1128 | 1092 | uint16 *chan_2g, uint16 *chan_5g, bool nodfs) |
|---|
| .. | .. |
|---|
| 1153 | 1117 | chan_info.band = WLC_BAND_5G; |
|---|
| 1154 | 1118 | chan_info.chan = chan_tmp; |
|---|
| 1155 | 1119 | if (wl_ext_dfs_chan(&chan_info) && nodfs) |
|---|
| 1156 | | - continue; |
|---|
| 1157 | | - else if (wl_ext_passive_chan(dev, &chan_info)) |
|---|
| 1158 | 1120 | continue; |
|---|
| 1159 | 1121 | else |
|---|
| 1160 | 1122 | *chan_5g = chan_tmp; |
|---|
| .. | .. |
|---|
| 1235 | 1197 | |
|---|
| 1236 | 1198 | return ret; |
|---|
| 1237 | 1199 | } |
|---|
| 1200 | + |
|---|
| 1201 | +#ifdef WL_CFG80211 |
|---|
| 1202 | +bool |
|---|
| 1203 | +wl_legacy_chip_check(struct net_device *net) |
|---|
| 1204 | +{ |
|---|
| 1205 | + struct dhd_pub *dhd = dhd_get_pub(net); |
|---|
| 1206 | + uint chip; |
|---|
| 1207 | + |
|---|
| 1208 | + chip = dhd_conf_get_chip(dhd); |
|---|
| 1209 | + |
|---|
| 1210 | + if (chip == BCM43362_CHIP_ID || chip == BCM4330_CHIP_ID || |
|---|
| 1211 | + chip == BCM4334_CHIP_ID || chip == BCM43340_CHIP_ID || |
|---|
| 1212 | + chip == BCM43341_CHIP_ID || chip == BCM4324_CHIP_ID || |
|---|
| 1213 | + chip == BCM4335_CHIP_ID || chip == BCM4339_CHIP_ID || |
|---|
| 1214 | + chip == BCM4354_CHIP_ID || chip == BCM4356_CHIP_ID || |
|---|
| 1215 | + chip == BCM4371_CHIP_ID || |
|---|
| 1216 | + chip == BCM43430_CHIP_ID || |
|---|
| 1217 | + chip == BCM4345_CHIP_ID || chip == BCM43454_CHIP_ID || |
|---|
| 1218 | + chip == BCM4359_CHIP_ID || |
|---|
| 1219 | + chip == BCM43143_CHIP_ID || chip == BCM43242_CHIP_ID || |
|---|
| 1220 | + chip == BCM43569_CHIP_ID) { |
|---|
| 1221 | + return true; |
|---|
| 1222 | + } |
|---|
| 1223 | + |
|---|
| 1224 | + return false; |
|---|
| 1225 | +} |
|---|
| 1226 | + |
|---|
| 1227 | +bool |
|---|
| 1228 | +wl_new_chip_check(struct net_device *net) |
|---|
| 1229 | +{ |
|---|
| 1230 | + struct dhd_pub *dhd = dhd_get_pub(net); |
|---|
| 1231 | + uint chip; |
|---|
| 1232 | + |
|---|
| 1233 | + chip = dhd_conf_get_chip(dhd); |
|---|
| 1234 | + |
|---|
| 1235 | + if (chip == BCM4359_CHIP_ID || chip == BCM43012_CHIP_ID || |
|---|
| 1236 | + chip == BCM43751_CHIP_ID || chip == BCM43752_CHIP_ID) { |
|---|
| 1237 | + return true; |
|---|
| 1238 | + } |
|---|
| 1239 | + |
|---|
| 1240 | + return false; |
|---|
| 1241 | +} |
|---|
| 1242 | + |
|---|
| 1243 | +bool |
|---|
| 1244 | +wl_extsae_chip(struct dhd_pub *dhd) |
|---|
| 1245 | +{ |
|---|
| 1246 | + uint chip; |
|---|
| 1247 | + |
|---|
| 1248 | + chip = dhd_conf_get_chip(dhd); |
|---|
| 1249 | + |
|---|
| 1250 | + if (chip == BCM43362_CHIP_ID || chip == BCM4330_CHIP_ID || |
|---|
| 1251 | + chip == BCM4334_CHIP_ID || chip == BCM43340_CHIP_ID || |
|---|
| 1252 | + chip == BCM43341_CHIP_ID || chip == BCM4324_CHIP_ID || |
|---|
| 1253 | + chip == BCM4335_CHIP_ID || chip == BCM4339_CHIP_ID || |
|---|
| 1254 | + chip == BCM4354_CHIP_ID || chip == BCM4356_CHIP_ID || |
|---|
| 1255 | + chip == BCM43143_CHIP_ID || chip == BCM43242_CHIP_ID || |
|---|
| 1256 | + chip == BCM43569_CHIP_ID) { |
|---|
| 1257 | + return false; |
|---|
| 1258 | + } |
|---|
| 1259 | + |
|---|
| 1260 | + return true; |
|---|
| 1261 | +} |
|---|
| 1262 | +#endif |
|---|
| 1238 | 1263 | |
|---|
| 1239 | 1264 | #ifdef WLEASYMESH |
|---|
| 1240 | 1265 | #define CMD_EASYMESH "EASYMESH" |
|---|
| .. | .. |
|---|
| 1450 | 1475 | int total_len) |
|---|
| 1451 | 1476 | { |
|---|
| 1452 | 1477 | struct dhd_pub *dhd = dhd_get_pub(dev); |
|---|
| 1453 | | - wl_mkeep_alive_pkt_v1_t *mkeep_alive_pktp; |
|---|
| 1478 | + wl_mkeep_alive_pkt_t *mkeep_alive_pktp; |
|---|
| 1454 | 1479 | int ret = -1, i, ifidx, id, period=-1; |
|---|
| 1455 | 1480 | char *packet = NULL, *buf = NULL; |
|---|
| 1456 | 1481 | int bytes_written = 0; |
|---|
| .. | .. |
|---|
| 1478 | 1503 | ret = wl_ext_iovar_getbuf(dev, "mkeep_alive", &id, sizeof(id), buf, |
|---|
| 1479 | 1504 | total_len, NULL); |
|---|
| 1480 | 1505 | if (!ret) { |
|---|
| 1481 | | - mkeep_alive_pktp = (wl_mkeep_alive_pkt_v1_t *) buf; |
|---|
| 1506 | + mkeep_alive_pktp = (wl_mkeep_alive_pkt_t *) buf; |
|---|
| 1482 | 1507 | bytes_written += snprintf(command+bytes_written, total_len, |
|---|
| 1483 | 1508 | "Id :%d\n" |
|---|
| 1484 | 1509 | "Period (msec) :%d\n" |
|---|
| .. | .. |
|---|
| 1686 | 1711 | wl_ext_recal(struct net_device *dev, char *data, char *command, |
|---|
| 1687 | 1712 | int total_len) |
|---|
| 1688 | 1713 | { |
|---|
| 1689 | | - struct dhd_pub *dhd = dhd_get_pub(dev); |
|---|
| 1690 | 1714 | int ret = 0, i, nchan, nssid = 0; |
|---|
| 1691 | | - int params_size = WL_SCAN_PARAMS_V1_FIXED_SIZE + WL_NUMCHANNELS * sizeof(uint16); |
|---|
| 1692 | | - wl_scan_params_v1_t *params = NULL; |
|---|
| 1715 | + int params_size = WL_SCAN_PARAMS_FIXED_SIZE + WL_NUMCHANNELS * sizeof(uint16); |
|---|
| 1716 | + wl_scan_params_t *params = NULL; |
|---|
| 1717 | + int ioctl_ver; |
|---|
| 1693 | 1718 | char *p; |
|---|
| 1694 | 1719 | |
|---|
| 1695 | 1720 | AEXT_TRACE(dev->name, "Enter\n"); |
|---|
| 1696 | 1721 | |
|---|
| 1697 | 1722 | if (data) { |
|---|
| 1698 | 1723 | params_size += WL_SCAN_PARAMS_SSID_MAX * sizeof(wlc_ssid_t); |
|---|
| 1699 | | - params = (wl_scan_params_v1_t *) kzalloc(params_size, GFP_KERNEL); |
|---|
| 1724 | + params = (wl_scan_params_t *) kzalloc(params_size, GFP_KERNEL); |
|---|
| 1700 | 1725 | if (params == NULL) { |
|---|
| 1701 | 1726 | ret = -ENOMEM; |
|---|
| 1702 | 1727 | goto exit; |
|---|
| 1703 | 1728 | } |
|---|
| 1704 | 1729 | memset(params, 0, params_size); |
|---|
| 1730 | + |
|---|
| 1731 | + wl_ext_get_ioctl_ver(dev, &ioctl_ver); |
|---|
| 1705 | 1732 | |
|---|
| 1706 | 1733 | memcpy(¶ms->bssid, ðer_bcast, ETHER_ADDR_LEN); |
|---|
| 1707 | 1734 | params->bss_type = DOT11_BSSTYPE_ANY; |
|---|
| .. | .. |
|---|
| 1723 | 1750 | params->home_time = htod32(params->home_time); |
|---|
| 1724 | 1751 | |
|---|
| 1725 | 1752 | for (i = 0; i < nchan; i++) { |
|---|
| 1726 | | - wl_ext_chspec_host_to_driver(dhd, params->channel_list[i]); |
|---|
| 1753 | + wl_ext_chspec_host_to_driver(ioctl_ver, params->channel_list[i]); |
|---|
| 1727 | 1754 | } |
|---|
| 1728 | 1755 | |
|---|
| 1729 | 1756 | p = (char*)params->channel_list + nchan * sizeof(uint16); |
|---|
| .. | .. |
|---|
| 2500 | 2527 | } csi_list_t; |
|---|
| 2501 | 2528 | |
|---|
| 2502 | 2529 | static int |
|---|
| 2530 | +wl_ether_atoe(const char *a, struct ether_addr *n) |
|---|
| 2531 | +{ |
|---|
| 2532 | + char *c = NULL; |
|---|
| 2533 | + int i = 0; |
|---|
| 2534 | + |
|---|
| 2535 | + memset(n, 0, ETHER_ADDR_LEN); |
|---|
| 2536 | + for (;;) { |
|---|
| 2537 | + n->octet[i++] = (uint8)strtoul(a, &c, 16); |
|---|
| 2538 | + if (!*c++ || i == ETHER_ADDR_LEN) |
|---|
| 2539 | + break; |
|---|
| 2540 | + a = c; |
|---|
| 2541 | + } |
|---|
| 2542 | + return (i == ETHER_ADDR_LEN); |
|---|
| 2543 | +} |
|---|
| 2544 | + |
|---|
| 2545 | +static int |
|---|
| 2503 | 2546 | wl_ext_csi(struct net_device *dev, char *data, char *command, int total_len) |
|---|
| 2504 | 2547 | { |
|---|
| 2505 | 2548 | csi_config_t csi, *csip; |
|---|
| .. | .. |
|---|
| 2518 | 2561 | |
|---|
| 2519 | 2562 | if (data) { |
|---|
| 2520 | 2563 | sscanf(data, "%s %d", mac, &period); |
|---|
| 2521 | | - ret = bcm_ether_atoe(mac, &ea); |
|---|
| 2564 | + ret = wl_ether_atoe(mac, &ea); |
|---|
| 2522 | 2565 | if (!ret) { |
|---|
| 2523 | 2566 | AEXT_ERROR(dev->name, "rejecting mac=%s, ret=%d\n", mac, ret); |
|---|
| 2524 | 2567 | goto exit; |
|---|
| .. | .. |
|---|
| 2616 | 2659 | return bytes_written; |
|---|
| 2617 | 2660 | } |
|---|
| 2618 | 2661 | |
|---|
| 2619 | | -static int |
|---|
| 2620 | | -wl_ext_disable_5g_band(struct net_device *dev, char *data, char *command, |
|---|
| 2621 | | - int total_len) |
|---|
| 2622 | | -{ |
|---|
| 2623 | | -#ifdef WL_CFG80211 |
|---|
| 2624 | | - struct bcm_cfg80211 *cfg = wl_get_cfg(dev); |
|---|
| 2625 | | -#endif |
|---|
| 2626 | | - int ret = -1; |
|---|
| 2627 | | - int val; |
|---|
| 2628 | | - |
|---|
| 2629 | | - if (data) { |
|---|
| 2630 | | - val = (int)simple_strtol(data, NULL, 0); |
|---|
| 2631 | | - ret = wl_ext_iovar_setint(dev, "disable_5g_band", val); |
|---|
| 2632 | | -#ifdef WL_CFG80211 |
|---|
| 2633 | | - if (!ret) |
|---|
| 2634 | | - wl_update_wiphybands(cfg, true); |
|---|
| 2635 | | -#endif |
|---|
| 2636 | | - } else { |
|---|
| 2637 | | - ret = wl_ext_iovar_getint(dev, "disable_5g_band", &val); |
|---|
| 2638 | | - if (!ret) { |
|---|
| 2639 | | - ret = snprintf(command, total_len, "%d", val); |
|---|
| 2640 | | - AEXT_TRACE(dev->name, "command result is %s\n", command); |
|---|
| 2641 | | - } |
|---|
| 2642 | | - } |
|---|
| 2643 | | - |
|---|
| 2644 | | - return ret; |
|---|
| 2645 | | -} |
|---|
| 2646 | | - |
|---|
| 2647 | 2662 | typedef int (wl_ext_tpl_parse_t)(struct net_device *dev, char *data, char *command, |
|---|
| 2648 | 2663 | int total_len); |
|---|
| 2649 | 2664 | |
|---|
| .. | .. |
|---|
| 2696 | 2711 | {WLC_GET_VAR, WLC_SET_VAR, "csi", wl_ext_csi}, |
|---|
| 2697 | 2712 | #endif /* CSI_SUPPORT */ |
|---|
| 2698 | 2713 | {WLC_GET_VAR, WLC_SET_VAR, "country", wl_ext_get_country}, |
|---|
| 2699 | | - {WLC_GET_VAR, WLC_SET_VAR, "disable_5g_band", wl_ext_disable_5g_band}, |
|---|
| 2700 | 2714 | }; |
|---|
| 2701 | 2715 | |
|---|
| 2702 | 2716 | /* |
|---|
| .. | .. |
|---|
| 2838 | 2852 | else if (strnicmp(command, CMD_MONITOR, strlen(CMD_MONITOR)) == 0) { |
|---|
| 2839 | 2853 | *bytes_written = wl_ext_monitor(net, command, total_len); |
|---|
| 2840 | 2854 | } |
|---|
| 2841 | | -#ifdef BTC_WAR |
|---|
| 2842 | | - else if (strnicmp(command, CMD_BTC_WAR, strlen(CMD_BTC_WAR)) == 0) { |
|---|
| 2843 | | - *bytes_written = wl_ext_btc_war(net, command, total_len); |
|---|
| 2844 | | - } |
|---|
| 2845 | | -#endif /* BTC_WAR */ |
|---|
| 2846 | 2855 | else if (strnicmp(command, CMD_SET_SUSPEND_BCN_LI_DTIM, strlen(CMD_SET_SUSPEND_BCN_LI_DTIM)) == 0) { |
|---|
| 2847 | 2856 | int bcn_li_dtim; |
|---|
| 2848 | 2857 | bcn_li_dtim = (int)simple_strtol((command + strlen(CMD_SET_SUSPEND_BCN_LI_DTIM) + 1), NULL, 10); |
|---|
| .. | .. |
|---|
| 2936 | 2945 | return -ENOMEM; |
|---|
| 2937 | 2946 | } |
|---|
| 2938 | 2947 | |
|---|
| 2939 | | - err = wldev_iovar_getbuf(dev, "chan_info_list", NULL, |
|---|
| 2948 | + err = wl_ext_iovar_getbuf(dev, "chan_info_list", NULL, |
|---|
| 2940 | 2949 | 0, list, LOCAL_BUF_LEN, NULL); |
|---|
| 2941 | 2950 | if (err == BCME_UNSUPPORTED) { |
|---|
| 2942 | 2951 | err = wl_ext_iovar_getbuf(dev, "chanspecs", NULL, |
|---|
| .. | .. |
|---|
| 3049 | 3058 | #if defined(BSSCACHE) |
|---|
| 3050 | 3059 | wl_bss_cache_ctrl_t *bss_cache_ctrl, |
|---|
| 3051 | 3060 | #else |
|---|
| 3052 | | - wl_scan_results_v109_t *bss_list, |
|---|
| 3061 | + wl_scan_results_t *bss_list, |
|---|
| 3053 | 3062 | #endif /* BSSCACHE */ |
|---|
| 3054 | | - int *best_2g_ch, int *best_5g_ch, int *best_6g_ch) |
|---|
| 3063 | + int ioctl_ver, int *best_2g_ch, int *best_5g_ch, int *best_6g_ch) |
|---|
| 3055 | 3064 | { |
|---|
| 3056 | | - struct dhd_pub *dhd = dhd_get_pub(net); |
|---|
| 3057 | 3065 | struct wl_bss_info *bi = NULL; /* must be initialized */ |
|---|
| 3058 | | - struct wl_chan_info chan_info; |
|---|
| 3059 | 3066 | s32 i, j; |
|---|
| 3060 | 3067 | #if defined(BSSCACHE) |
|---|
| 3061 | 3068 | wl_bss_cache_t *node; |
|---|
| .. | .. |
|---|
| 3093 | 3100 | for (i = 0; i < list->count; i++) { |
|---|
| 3094 | 3101 | chspec = list->element[i]; |
|---|
| 3095 | 3102 | channel = wf_chspec_ctlchan(chspec); |
|---|
| 3096 | | - chan_info.band = CHSPEC2WLC_BAND(chspec); |
|---|
| 3097 | | - chan_info.chan = channel; |
|---|
| 3098 | | - if (wl_ext_passive_chan(net, &chan_info)) { |
|---|
| 3099 | | - continue; |
|---|
| 3100 | | - } |
|---|
| 3101 | 3103 | if (CHSPEC_IS2G(chspec) && (channel >= CH_MIN_2G_CHANNEL) && |
|---|
| 3102 | | - (channel <= CH_MAX_2G_CHANNEL)) { |
|---|
| 3104 | + (channel <= CH_MAX_2G_CHANNEL)) { |
|---|
| 3103 | 3105 | b_band[channel-1] = 0; |
|---|
| 3104 | 3106 | } |
|---|
| 3105 | 3107 | #ifdef WL_6G_BAND |
|---|
| 3106 | 3108 | else if (CHSPEC_IS6G(chspec) && (channel >= CH_MIN_6G_CHANNEL) && |
|---|
| 3107 | | - (channel <= CH_MAX_6G_CHANNEL)) { |
|---|
| 3109 | + (channel <= CH_MAX_6G_CHANNEL)) { |
|---|
| 3108 | 3110 | if (channel <= 93) |
|---|
| 3109 | 3111 | six_g_band5[(channel-1)/4] = 0; |
|---|
| 3110 | 3112 | else if (channel >= 97 && channel <= 109) |
|---|
| .. | .. |
|---|
| 3140 | 3142 | #if defined(BSSCACHE) |
|---|
| 3141 | 3143 | bi = node->results.bss_info; |
|---|
| 3142 | 3144 | #else |
|---|
| 3143 | | - bi = bi ? (wl_bss_info_v109_t *)((uintptr)bi + dtoh32(bi->length)) : bss_list->bss_info; |
|---|
| 3145 | + bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : bss_list->bss_info; |
|---|
| 3144 | 3146 | #endif /* BSSCACHE */ |
|---|
| 3145 | | - chanspec = wl_ext_chspec_driver_to_host(dhd, bi->chanspec); |
|---|
| 3147 | + chanspec = wl_ext_chspec_driver_to_host(ioctl_ver, bi->chanspec); |
|---|
| 3146 | 3148 | cen_ch = CHSPEC_CHANNEL(bi->chanspec); |
|---|
| 3147 | 3149 | distance = 0; |
|---|
| 3148 | 3150 | if (CHSPEC_IS20(chanspec)) |
|---|
| .. | .. |
|---|
| 3165 | 3167 | else if (CHSPEC_IS6G(chanspec)) { |
|---|
| 3166 | 3168 | distance += distance_6g; |
|---|
| 3167 | 3169 | if (cen_ch <= 93) { |
|---|
| 3168 | | - for (j=0; j<ARRAYSIZE(six_g_band5); j++) { |
|---|
| 3170 | + for (j=0; j<ARRAYSIZE(a_band1); j++) { |
|---|
| 3169 | 3171 | if (six_g_band5[j] >= 0 && abs(cen_ch-(93+j*4)) <= distance) |
|---|
| 3170 | 3172 | six_g_band5[j] += 1; |
|---|
| 3171 | 3173 | } |
|---|
| 3172 | 3174 | } |
|---|
| 3173 | 3175 | else if (channel >= 97 && channel <= 109) { |
|---|
| 3174 | | - for (j=0; j<ARRAYSIZE(six_g_band6); j++) { |
|---|
| 3176 | + for (j=0; j<ARRAYSIZE(a_band4); j++) { |
|---|
| 3175 | 3177 | if (six_g_band6[j] >= 0 && abs(cen_ch-(97+j*4)) <= distance) |
|---|
| 3176 | 3178 | six_g_band6[j] += 1; |
|---|
| 3177 | 3179 | } |
|---|
| 3178 | 3180 | } |
|---|
| 3179 | 3181 | else if (channel >= 117 && channel <= 181) { |
|---|
| 3180 | | - for (j=0; j<ARRAYSIZE(six_g_band7); j++) { |
|---|
| 3182 | + for (j=0; j<ARRAYSIZE(a_band4); j++) { |
|---|
| 3181 | 3183 | if (six_g_band7[j] >= 0 && abs(cen_ch-(117+j*4)) <= distance) |
|---|
| 3182 | 3184 | six_g_band7[j] += 1; |
|---|
| 3183 | 3185 | } |
|---|
| 3184 | 3186 | } |
|---|
| 3185 | 3187 | else if (channel >= 189 && channel <= 221) { |
|---|
| 3186 | | - for (j=0; j<ARRAYSIZE(six_g_band8); j++) { |
|---|
| 3188 | + for (j=0; j<ARRAYSIZE(a_band4); j++) { |
|---|
| 3187 | 3189 | if (six_g_band8[j] >= 0 && abs(cen_ch-(189+j*4)) <= distance) |
|---|
| 3188 | 3190 | six_g_band8[j] += 1; |
|---|
| 3189 | 3191 | } |
|---|
| .. | .. |
|---|
| 3349 | 3351 | memset(reqbuf, 0, CHANSPEC_BUF_SIZE); |
|---|
| 3350 | 3352 | |
|---|
| 3351 | 3353 | acs_band = wl_ext_wlcband_to_chanspec_band(band); |
|---|
| 3352 | | - if (acs_band == INVCHANSPEC) { |
|---|
| 3354 | + if ((uint32)acs_band == WLC_BAND_INVALID) { |
|---|
| 3353 | 3355 | acs_band = WL_CHANSPEC_BAND_2G; |
|---|
| 3354 | 3356 | } |
|---|
| 3355 | 3357 | |
|---|
| .. | .. |
|---|
| 3755 | 3757 | |
|---|
| 3756 | 3758 | void |
|---|
| 3757 | 3759 | wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, |
|---|
| 3758 | | - wl_scan_results_v109_t *ss_list) |
|---|
| 3760 | + wl_scan_results_t *ss_list) |
|---|
| 3759 | 3761 | { |
|---|
| 3760 | 3762 | wl_rssi_cache_t *node, *prev, *leaf, **rssi_head; |
|---|
| 3761 | | - wl_bss_info_v109_t *bi = NULL; |
|---|
| 3763 | + wl_bss_info_t *bi = NULL; |
|---|
| 3762 | 3764 | int i, j, k; |
|---|
| 3763 | 3765 | struct osl_timespec now, timeout; |
|---|
| 3764 | 3766 | |
|---|
| .. | .. |
|---|
| 3784 | 3786 | node = *rssi_head; |
|---|
| 3785 | 3787 | prev = NULL; |
|---|
| 3786 | 3788 | k = 0; |
|---|
| 3787 | | - bi = bi ? (wl_bss_info_v109_t *)((uintptr)bi + dtoh32(bi->length)) : ss_list->bss_info; |
|---|
| 3789 | + bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : ss_list->bss_info; |
|---|
| 3788 | 3790 | for (;node;) { |
|---|
| 3789 | 3791 | if (!memcmp(&node->BSSID, &bi->BSSID, ETHER_ADDR_LEN)) { |
|---|
| 3790 | 3792 | AEXT_INFO("wlan", "Update %d with BSSID %pM, RSSI=%3d, SSID \"%s\"\n", |
|---|
| .. | .. |
|---|
| 4110 | 4112 | #if defined(RSSIAVG) |
|---|
| 4111 | 4113 | wl_rssi_cache_ctrl_t *rssi_cache_ctrl, |
|---|
| 4112 | 4114 | #endif /* RSSIAVG */ |
|---|
| 4113 | | - wl_scan_results_v109_t *ss_list) |
|---|
| 4115 | + wl_scan_results_t *ss_list) |
|---|
| 4114 | 4116 | { |
|---|
| 4115 | 4117 | wl_bss_cache_t *node, *node_target = NULL, *prev, *leaf, **bss_head; |
|---|
| 4116 | 4118 | wl_bss_cache_t *node_rssi_prev = NULL, *node_rssi = NULL; |
|---|
| 4117 | | - wl_bss_info_v109_t *bi = NULL; |
|---|
| 4119 | + wl_bss_info_t *bi = NULL; |
|---|
| 4118 | 4120 | int i, k=0, bss_num = 0; |
|---|
| 4119 | 4121 | struct osl_timespec now, timeout; |
|---|
| 4120 | 4122 | int16 rssi_min; |
|---|
| .. | .. |
|---|
| 4149 | 4151 | prev = NULL; |
|---|
| 4150 | 4152 | node_target = NULL; |
|---|
| 4151 | 4153 | node_rssi_prev = NULL; |
|---|
| 4152 | | - bi = bi ? (wl_bss_info_v109_t *)((uintptr)bi + dtoh32(bi->length)) : ss_list->bss_info; |
|---|
| 4154 | + bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : ss_list->bss_info; |
|---|
| 4153 | 4155 | |
|---|
| 4154 | 4156 | // find the bss with same BSSID |
|---|
| 4155 | 4157 | for (;node;) { |
|---|