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)) { |
---|
.. | .. |
---|
617 | 632 | } |
---|
618 | 633 | |
---|
619 | 634 | param.band = chan_info->band; |
---|
620 | | - err = wldev_iovar_getbuf(dev, "bw_cap", ¶m, sizeof(param), |
---|
| 635 | + err = wl_ext_iovar_getbuf(dev, "bw_cap", ¶m, sizeof(param), |
---|
621 | 636 | iovar_buf, WLC_IOCTL_SMLEN, NULL); |
---|
622 | 637 | if (err) { |
---|
623 | 638 | if (err != BCME_UNSUPPORTED) { |
---|
624 | | - AEXT_TRACE(dev->name, "bw_cap failed, %d\n", err); |
---|
| 639 | + AEXT_ERROR(dev->name, "bw_cap failed, %d\n", err); |
---|
625 | 640 | return err; |
---|
626 | 641 | } else { |
---|
627 | 642 | err = wl_ext_iovar_getint(dev, "mimo_bw_cap", &bw_cap); |
---|
.. | .. |
---|
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; |
---|
.. | .. |
---|
681 | 694 | static int |
---|
682 | 695 | wl_ext_channel(struct net_device *dev, char* command, int total_len) |
---|
683 | 696 | { |
---|
684 | | - struct dhd_pub *dhd = dhd_get_pub(dev); |
---|
685 | 697 | struct wl_chan_info chan_info; |
---|
686 | | - char chan[16]=""; |
---|
687 | | - int ret, bytes_written = 0; |
---|
688 | | - chanspec_t chanspec; |
---|
689 | | - u32 fw_chanspec = 0; |
---|
690 | | - |
---|
691 | | - /* get: dhd_priv channel |
---|
692 | | - * set: dhd_priv channel [6|36|2g6|5g36|6g5] |
---|
693 | | - */ |
---|
| 698 | + int ret; |
---|
| 699 | + char band[16]=""; |
---|
| 700 | + int channel = 0; |
---|
| 701 | + channel_info_t ci; |
---|
| 702 | + int bytes_written = 0; |
---|
| 703 | + chanspec_t fw_chspec; |
---|
694 | 704 | |
---|
695 | 705 | AEXT_TRACE(dev->name, "cmd %s", command); |
---|
696 | 706 | |
---|
697 | | - sscanf(command, "%*s %s", chan); |
---|
698 | | - memset(&chan_info, 0, sizeof(struct wl_chan_info)); |
---|
699 | | - if (strnicmp(chan, "2g", strlen("2g")) == 0) { |
---|
700 | | - chan_info.band = WLC_BAND_2G; |
---|
701 | | - chan_info.chan = (int)simple_strtol(chan+2, NULL, 10); |
---|
702 | | - } |
---|
703 | | - else if (strnicmp(chan, "5g", strlen("5g")) == 0) { |
---|
704 | | - chan_info.band = WLC_BAND_5G; |
---|
705 | | - chan_info.chan = (int)simple_strtol(chan+2, NULL, 10); |
---|
| 707 | + sscanf(command, "%*s %d %s", &channel, band); |
---|
| 708 | + if (strnicmp(band, "band=auto", strlen("band=auto")) == 0) { |
---|
| 709 | + chan_info.band = WLC_BAND_AUTO; |
---|
706 | 710 | } |
---|
707 | 711 | #ifdef WL_6G_BAND |
---|
708 | | - else if (strnicmp(chan, "6g", strlen("6g")) == 0) { |
---|
| 712 | + else if (strnicmp(band, "band=6g", strlen("band=6g")) == 0) { |
---|
709 | 713 | chan_info.band = WLC_BAND_6G; |
---|
710 | | - chan_info.chan = (int)simple_strtol(chan+2, NULL, 10); |
---|
711 | 714 | } |
---|
712 | 715 | #endif /* WL_6G_BAND */ |
---|
713 | | - else if (strlen(chan)) { |
---|
714 | | - chan_info.chan = (int)simple_strtol(chan, NULL, 10); |
---|
715 | | - if (chan_info.chan <= CH_MAX_2G_CHANNEL) |
---|
716 | | - chan_info.band = WLC_BAND_2G; |
---|
717 | | - else |
---|
718 | | - chan_info.band = WLC_BAND_5G; |
---|
| 716 | + else if (strnicmp(band, "band=5g", strlen("band=5g")) == 0) { |
---|
| 717 | + chan_info.band = WLC_BAND_5G; |
---|
| 718 | + } |
---|
| 719 | + else if (strnicmp(band, "band=2g", strlen("band=2g")) == 0) { |
---|
| 720 | + chan_info.band = WLC_BAND_2G; |
---|
719 | 721 | } |
---|
720 | 722 | |
---|
721 | | - if (chan_info.chan > 0) { |
---|
722 | | - ret = wl_ext_set_chanspec(dev, &chan_info, &chanspec); |
---|
| 723 | + if (channel > 0) { |
---|
| 724 | + chan_info.chan = channel; |
---|
| 725 | + ret = wl_ext_set_chanspec(dev, &chan_info, &fw_chspec); |
---|
723 | 726 | } else { |
---|
724 | | - ret = wl_ext_iovar_getint(dev, "chanspec", (s32 *)&fw_chanspec); |
---|
725 | | - if (ret == BCME_OK) { |
---|
726 | | - chanspec = fw_chanspec; |
---|
727 | | - chanspec = wl_ext_chspec_driver_to_host(dhd, chanspec); |
---|
728 | | - chan_info.band = CHSPEC2WLC_BAND(chanspec); |
---|
729 | | - chan_info.chan = wf_chspec_ctlchan(chanspec); |
---|
730 | | - if (chan_info.band == WLC_BAND_6G) { |
---|
731 | | - bytes_written = snprintf(command, total_len, |
---|
732 | | - "channel 6g%d", chan_info.chan); |
---|
733 | | - } else { |
---|
734 | | - bytes_written = snprintf(command, total_len, |
---|
735 | | - "channel %d", chan_info.chan); |
---|
736 | | - } |
---|
| 727 | + if (!(ret = wl_ext_ioctl(dev, WLC_GET_CHANNEL, &ci, |
---|
| 728 | + sizeof(channel_info_t), FALSE))) { |
---|
| 729 | + AEXT_TRACE(dev->name, "hw_channel %d\n", ci.hw_channel); |
---|
| 730 | + AEXT_TRACE(dev->name, "target_channel %d\n", ci.target_channel); |
---|
| 731 | + AEXT_TRACE(dev->name, "scan_channel %d\n", ci.scan_channel); |
---|
| 732 | + bytes_written = snprintf(command, sizeof(channel_info_t)+2, |
---|
| 733 | + "channel %d", ci.hw_channel); |
---|
| 734 | + AEXT_TRACE(dev->name, "command result is %s\n", command); |
---|
737 | 735 | ret = bytes_written; |
---|
738 | 736 | } |
---|
739 | 737 | } |
---|
.. | .. |
---|
746 | 744 | { |
---|
747 | 745 | int ret, i; |
---|
748 | 746 | int bytes_written = -1; |
---|
749 | | - wl_uint32_list_t *list = NULL; |
---|
750 | | - chanspec_t chspec; |
---|
751 | | - u32 channel; |
---|
| 747 | + u8 valid_chan_list[sizeof(u32)*(WL_NUMCHANNELS + 1)]; |
---|
| 748 | + wl_uint32_list_t *list; |
---|
752 | 749 | |
---|
753 | 750 | AEXT_TRACE(dev->name, "cmd %s", command); |
---|
754 | 751 | |
---|
755 | | - list = kzalloc(sizeof(u32)*(MAX_CTRL_CHANSPECS + 1), GFP_KERNEL); |
---|
756 | | - if (list == NULL) { |
---|
757 | | - AEXT_ERROR(dev->name, "kzalloc failed\n"); |
---|
758 | | - ret = -ENOMEM; |
---|
759 | | - goto exit; |
---|
760 | | - } |
---|
761 | | - |
---|
762 | | - ret = wl_construct_ctl_chanspec_list(dev, list); |
---|
763 | | - if (ret < 0) { |
---|
| 752 | + memset(valid_chan_list, 0, sizeof(valid_chan_list)); |
---|
| 753 | + list = (wl_uint32_list_t *)(void *) valid_chan_list; |
---|
| 754 | + list->count = htod32(WL_NUMCHANNELS); |
---|
| 755 | + ret = wl_ext_ioctl(dev, WLC_GET_VALID_CHANNELS, valid_chan_list, |
---|
| 756 | + sizeof(valid_chan_list), 0); |
---|
| 757 | + if (ret<0) { |
---|
764 | 758 | AEXT_ERROR(dev->name, "get channels failed with %d\n", ret); |
---|
765 | | - goto exit; |
---|
766 | 759 | } else { |
---|
767 | | - bytes_written = 0; |
---|
768 | | - for (i = 0; i < list->count; i++) { |
---|
769 | | - chspec = list->element[i]; |
---|
770 | | - channel = wf_chspec_ctlchan(chspec); |
---|
771 | | -#ifdef WL_6G_BAND |
---|
772 | | - if (CHSPEC_IS6G(chspec) && (channel >= CH_MIN_6G_CHANNEL) && |
---|
773 | | - (channel <= CH_MAX_6G_CHANNEL)) { |
---|
774 | | - bytes_written += snprintf(command+bytes_written, total_len, "6g%d ", |
---|
775 | | - channel); |
---|
776 | | - } else |
---|
777 | | -#endif |
---|
778 | | - { |
---|
779 | | - bytes_written += snprintf(command+bytes_written, total_len, "%d ", |
---|
780 | | - channel); |
---|
781 | | - } |
---|
| 760 | + bytes_written = snprintf(command, total_len, "channels"); |
---|
| 761 | + for (i = 0; i < dtoh32(list->count); i++) { |
---|
| 762 | + bytes_written += snprintf(command+bytes_written, total_len, " %d", |
---|
| 763 | + dtoh32(list->element[i])); |
---|
782 | 764 | } |
---|
783 | 765 | AEXT_TRACE(dev->name, "command result is %s\n", command); |
---|
784 | 766 | ret = bytes_written; |
---|
785 | 767 | } |
---|
786 | 768 | |
---|
787 | | -exit: |
---|
788 | | - if (list) |
---|
789 | | - kfree(list); |
---|
790 | 769 | return ret; |
---|
791 | 770 | } |
---|
792 | 771 | |
---|
.. | .. |
---|
884 | 863 | return ret; |
---|
885 | 864 | } |
---|
886 | 865 | |
---|
887 | | -#ifdef BTC_WAR |
---|
888 | | -extern int btc_war; |
---|
889 | | -static int |
---|
890 | | -wl_ext_btc_war(struct net_device *dev, char *command, int total_len) |
---|
891 | | -{ |
---|
892 | | - int user_btc_war = 0; |
---|
893 | | - bool enable = FALSE; |
---|
894 | | - |
---|
895 | | - sscanf(command, "%*s %d", &user_btc_war); |
---|
896 | | - |
---|
897 | | - AEXT_TRACE(dev->name, "btc_war=%d, user_btc_war=%d\n", |
---|
898 | | - btc_war, user_btc_war); |
---|
899 | | - |
---|
900 | | - if (btc_war >= 0) { |
---|
901 | | - btc_war = user_btc_war; |
---|
902 | | - if (btc_war > 0) |
---|
903 | | - enable = TRUE; |
---|
904 | | - wl_ext_btc_config(dev, enable); |
---|
905 | | - } |
---|
906 | | - |
---|
907 | | - return 0; |
---|
908 | | -} |
---|
909 | | -#endif /* BTC_WAR */ |
---|
910 | | - |
---|
911 | 866 | s32 |
---|
912 | 867 | wl_ext_connect(struct net_device *dev, struct wl_conn_info *conn_info) |
---|
913 | 868 | { |
---|
.. | .. |
---|
918 | 873 | s32 err = 0; |
---|
919 | 874 | u32 chan_cnt = 0; |
---|
920 | 875 | s8 *iovar_buf = NULL; |
---|
| 876 | + int ioctl_ver = 0; |
---|
921 | 877 | char sec[64]; |
---|
| 878 | + |
---|
| 879 | + wl_ext_get_ioctl_ver(dev, &ioctl_ver); |
---|
922 | 880 | |
---|
923 | 881 | if (dhd->conf->chip == BCM43362_CHIP_ID) |
---|
924 | 882 | goto set_ssid; |
---|
.. | .. |
---|
975 | 933 | ext_join_params->assoc.chanspec_list[0] &= WL_CHANSPEC_CHAN_MASK; |
---|
976 | 934 | ext_join_params->assoc.chanspec_list[0] |= chspec; |
---|
977 | 935 | ext_join_params->assoc.chanspec_list[0] = |
---|
978 | | - wl_ext_chspec_host_to_driver(dhd, |
---|
| 936 | + wl_ext_chspec_host_to_driver(ioctl_ver, |
---|
979 | 937 | ext_join_params->assoc.chanspec_list[0]); |
---|
980 | 938 | } |
---|
981 | 939 | ext_join_params->assoc.chanspec_num = htod32(ext_join_params->assoc.chanspec_num); |
---|
.. | .. |
---|
1012 | 970 | else |
---|
1013 | 971 | memcpy(&join_params.params.bssid, ðer_bcast, ETH_ALEN); |
---|
1014 | 972 | |
---|
1015 | | - 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); |
---|
1016 | 974 | AEXT_TRACE(dev->name, "join_param_size %zu\n", join_params_size); |
---|
1017 | 975 | |
---|
1018 | 976 | if (join_params.ssid.SSID_len < IEEE80211_MAX_SSID_LEN) { |
---|
.. | .. |
---|
1129 | 1087 | return FALSE; |
---|
1130 | 1088 | } |
---|
1131 | 1089 | |
---|
1132 | | -bool |
---|
1133 | | -wl_ext_passive_chan(struct net_device *dev, struct wl_chan_info *chan_info) |
---|
1134 | | -{ |
---|
1135 | | - struct dhd_pub *dhd = dhd_get_pub(dev); |
---|
1136 | | - u32 chanspec; |
---|
1137 | | - s32 ret = BCME_OK; |
---|
1138 | | - |
---|
1139 | | - chanspec = wf_create_chspec_from_primary(chan_info->chan, |
---|
1140 | | - WL_CHANSPEC_BW_20, wl_ext_wlcband_to_chanspec_band(chan_info->band)); |
---|
1141 | | - |
---|
1142 | | - chanspec = wl_ext_chspec_host_to_driver(dhd, chanspec); |
---|
1143 | | - |
---|
1144 | | - ret = wldev_iovar_getint(dev, "per_chan_info", &chanspec); |
---|
1145 | | - if (!ret) { |
---|
1146 | | - if (chanspec & WL_CHAN_PASSIVE) |
---|
1147 | | - return TRUE; |
---|
1148 | | - } else { |
---|
1149 | | - if (chan_info->band == WLC_BAND_5G && chan_info->chan >= 52 && chan_info->chan <= 144) |
---|
1150 | | - return TRUE; |
---|
1151 | | - } |
---|
1152 | | - |
---|
1153 | | - return FALSE; |
---|
1154 | | -} |
---|
1155 | | - |
---|
1156 | 1090 | uint16 |
---|
1157 | 1091 | wl_ext_get_default_chan(struct net_device *dev, |
---|
1158 | 1092 | uint16 *chan_2g, uint16 *chan_5g, bool nodfs) |
---|
.. | .. |
---|
1183 | 1117 | chan_info.band = WLC_BAND_5G; |
---|
1184 | 1118 | chan_info.chan = chan_tmp; |
---|
1185 | 1119 | if (wl_ext_dfs_chan(&chan_info) && nodfs) |
---|
1186 | | - continue; |
---|
1187 | | - else if (wl_ext_passive_chan(dev, &chan_info)) |
---|
1188 | 1120 | continue; |
---|
1189 | 1121 | else |
---|
1190 | 1122 | *chan_5g = chan_tmp; |
---|
.. | .. |
---|
1265 | 1197 | |
---|
1266 | 1198 | return ret; |
---|
1267 | 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 |
---|
1268 | 1263 | |
---|
1269 | 1264 | #ifdef WLEASYMESH |
---|
1270 | 1265 | #define CMD_EASYMESH "EASYMESH" |
---|
.. | .. |
---|
1480 | 1475 | int total_len) |
---|
1481 | 1476 | { |
---|
1482 | 1477 | struct dhd_pub *dhd = dhd_get_pub(dev); |
---|
1483 | | - wl_mkeep_alive_pkt_v1_t *mkeep_alive_pktp; |
---|
| 1478 | + wl_mkeep_alive_pkt_t *mkeep_alive_pktp; |
---|
1484 | 1479 | int ret = -1, i, ifidx, id, period=-1; |
---|
1485 | 1480 | char *packet = NULL, *buf = NULL; |
---|
1486 | 1481 | int bytes_written = 0; |
---|
.. | .. |
---|
1508 | 1503 | ret = wl_ext_iovar_getbuf(dev, "mkeep_alive", &id, sizeof(id), buf, |
---|
1509 | 1504 | total_len, NULL); |
---|
1510 | 1505 | if (!ret) { |
---|
1511 | | - mkeep_alive_pktp = (wl_mkeep_alive_pkt_v1_t *) buf; |
---|
| 1506 | + mkeep_alive_pktp = (wl_mkeep_alive_pkt_t *) buf; |
---|
1512 | 1507 | bytes_written += snprintf(command+bytes_written, total_len, |
---|
1513 | 1508 | "Id :%d\n" |
---|
1514 | 1509 | "Period (msec) :%d\n" |
---|
.. | .. |
---|
1716 | 1711 | wl_ext_recal(struct net_device *dev, char *data, char *command, |
---|
1717 | 1712 | int total_len) |
---|
1718 | 1713 | { |
---|
1719 | | - struct dhd_pub *dhd = dhd_get_pub(dev); |
---|
1720 | 1714 | int ret = 0, i, nchan, nssid = 0; |
---|
1721 | | - int params_size = WL_SCAN_PARAMS_V1_FIXED_SIZE + WL_NUMCHANNELS * sizeof(uint16); |
---|
1722 | | - 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; |
---|
1723 | 1718 | char *p; |
---|
1724 | 1719 | |
---|
1725 | 1720 | AEXT_TRACE(dev->name, "Enter\n"); |
---|
1726 | 1721 | |
---|
1727 | 1722 | if (data) { |
---|
1728 | 1723 | params_size += WL_SCAN_PARAMS_SSID_MAX * sizeof(wlc_ssid_t); |
---|
1729 | | - params = (wl_scan_params_v1_t *) kzalloc(params_size, GFP_KERNEL); |
---|
| 1724 | + params = (wl_scan_params_t *) kzalloc(params_size, GFP_KERNEL); |
---|
1730 | 1725 | if (params == NULL) { |
---|
1731 | 1726 | ret = -ENOMEM; |
---|
1732 | 1727 | goto exit; |
---|
1733 | 1728 | } |
---|
1734 | 1729 | memset(params, 0, params_size); |
---|
| 1730 | + |
---|
| 1731 | + wl_ext_get_ioctl_ver(dev, &ioctl_ver); |
---|
1735 | 1732 | |
---|
1736 | 1733 | memcpy(¶ms->bssid, ðer_bcast, ETHER_ADDR_LEN); |
---|
1737 | 1734 | params->bss_type = DOT11_BSSTYPE_ANY; |
---|
.. | .. |
---|
1753 | 1750 | params->home_time = htod32(params->home_time); |
---|
1754 | 1751 | |
---|
1755 | 1752 | for (i = 0; i < nchan; i++) { |
---|
1756 | | - wl_ext_chspec_host_to_driver(dhd, params->channel_list[i]); |
---|
| 1753 | + wl_ext_chspec_host_to_driver(ioctl_ver, params->channel_list[i]); |
---|
1757 | 1754 | } |
---|
1758 | 1755 | |
---|
1759 | 1756 | p = (char*)params->channel_list + nchan * sizeof(uint16); |
---|
.. | .. |
---|
2530 | 2527 | } csi_list_t; |
---|
2531 | 2528 | |
---|
2532 | 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 |
---|
2533 | 2546 | wl_ext_csi(struct net_device *dev, char *data, char *command, int total_len) |
---|
2534 | 2547 | { |
---|
2535 | 2548 | csi_config_t csi, *csip; |
---|
.. | .. |
---|
2548 | 2561 | |
---|
2549 | 2562 | if (data) { |
---|
2550 | 2563 | sscanf(data, "%s %d", mac, &period); |
---|
2551 | | - ret = bcm_ether_atoe(mac, &ea); |
---|
| 2564 | + ret = wl_ether_atoe(mac, &ea); |
---|
2552 | 2565 | if (!ret) { |
---|
2553 | 2566 | AEXT_ERROR(dev->name, "rejecting mac=%s, ret=%d\n", mac, ret); |
---|
2554 | 2567 | goto exit; |
---|
.. | .. |
---|
2646 | 2659 | return bytes_written; |
---|
2647 | 2660 | } |
---|
2648 | 2661 | |
---|
2649 | | -static int |
---|
2650 | | -wl_ext_disable_5g_band(struct net_device *dev, char *data, char *command, |
---|
2651 | | - int total_len) |
---|
2652 | | -{ |
---|
2653 | | -#ifdef WL_CFG80211 |
---|
2654 | | - struct bcm_cfg80211 *cfg = wl_get_cfg(dev); |
---|
2655 | | -#endif |
---|
2656 | | - int ret = -1; |
---|
2657 | | - int val; |
---|
2658 | | - |
---|
2659 | | - if (data) { |
---|
2660 | | - val = (int)simple_strtol(data, NULL, 0); |
---|
2661 | | - ret = wl_ext_iovar_setint(dev, "disable_5g_band", val); |
---|
2662 | | -#ifdef WL_CFG80211 |
---|
2663 | | - if (!ret) |
---|
2664 | | - wl_update_wiphybands(cfg, true); |
---|
2665 | | -#endif |
---|
2666 | | - } else { |
---|
2667 | | - ret = wl_ext_iovar_getint(dev, "disable_5g_band", &val); |
---|
2668 | | - if (!ret) { |
---|
2669 | | - ret = snprintf(command, total_len, "%d", val); |
---|
2670 | | - AEXT_TRACE(dev->name, "command result is %s\n", command); |
---|
2671 | | - } |
---|
2672 | | - } |
---|
2673 | | - |
---|
2674 | | - return ret; |
---|
2675 | | -} |
---|
2676 | | - |
---|
2677 | 2662 | typedef int (wl_ext_tpl_parse_t)(struct net_device *dev, char *data, char *command, |
---|
2678 | 2663 | int total_len); |
---|
2679 | 2664 | |
---|
.. | .. |
---|
2726 | 2711 | {WLC_GET_VAR, WLC_SET_VAR, "csi", wl_ext_csi}, |
---|
2727 | 2712 | #endif /* CSI_SUPPORT */ |
---|
2728 | 2713 | {WLC_GET_VAR, WLC_SET_VAR, "country", wl_ext_get_country}, |
---|
2729 | | - {WLC_GET_VAR, WLC_SET_VAR, "disable_5g_band", wl_ext_disable_5g_band}, |
---|
2730 | 2714 | }; |
---|
2731 | 2715 | |
---|
2732 | 2716 | /* |
---|
.. | .. |
---|
2868 | 2852 | else if (strnicmp(command, CMD_MONITOR, strlen(CMD_MONITOR)) == 0) { |
---|
2869 | 2853 | *bytes_written = wl_ext_monitor(net, command, total_len); |
---|
2870 | 2854 | } |
---|
2871 | | -#ifdef BTC_WAR |
---|
2872 | | - else if (strnicmp(command, CMD_BTC_WAR, strlen(CMD_BTC_WAR)) == 0) { |
---|
2873 | | - *bytes_written = wl_ext_btc_war(net, command, total_len); |
---|
2874 | | - } |
---|
2875 | | -#endif /* BTC_WAR */ |
---|
2876 | 2855 | else if (strnicmp(command, CMD_SET_SUSPEND_BCN_LI_DTIM, strlen(CMD_SET_SUSPEND_BCN_LI_DTIM)) == 0) { |
---|
2877 | 2856 | int bcn_li_dtim; |
---|
2878 | 2857 | bcn_li_dtim = (int)simple_strtol((command + strlen(CMD_SET_SUSPEND_BCN_LI_DTIM) + 1), NULL, 10); |
---|
.. | .. |
---|
2966 | 2945 | return -ENOMEM; |
---|
2967 | 2946 | } |
---|
2968 | 2947 | |
---|
2969 | | - err = wldev_iovar_getbuf(dev, "chan_info_list", NULL, |
---|
| 2948 | + err = wl_ext_iovar_getbuf(dev, "chan_info_list", NULL, |
---|
2970 | 2949 | 0, list, LOCAL_BUF_LEN, NULL); |
---|
2971 | 2950 | if (err == BCME_UNSUPPORTED) { |
---|
2972 | 2951 | err = wl_ext_iovar_getbuf(dev, "chanspecs", NULL, |
---|
.. | .. |
---|
3041 | 3020 | s32 err = BCME_OK; |
---|
3042 | 3021 | |
---|
3043 | 3022 | param.band = band; |
---|
3044 | | - err = wldev_iovar_getbuf(net, "bw_cap", ¶m, sizeof(param), buf, |
---|
| 3023 | + err = wl_ext_iovar_getbuf(net, "bw_cap", ¶m, sizeof(param), buf, |
---|
3045 | 3024 | sizeof(buf), NULL); |
---|
3046 | 3025 | if (err) { |
---|
3047 | 3026 | if (err != BCME_UNSUPPORTED) { |
---|
3048 | | - AEXT_TRACE(net->name, "bw_cap failed, %d\n", err); |
---|
| 3027 | + AEXT_ERROR(net->name, "bw_cap failed, %d\n", err); |
---|
3049 | 3028 | return err; |
---|
3050 | 3029 | } else { |
---|
3051 | 3030 | err = wl_ext_iovar_getint(net, "mimo_bw_cap", &bw_cap); |
---|
.. | .. |
---|
3079 | 3058 | #if defined(BSSCACHE) |
---|
3080 | 3059 | wl_bss_cache_ctrl_t *bss_cache_ctrl, |
---|
3081 | 3060 | #else |
---|
3082 | | - wl_scan_results_v109_t *bss_list, |
---|
| 3061 | + wl_scan_results_t *bss_list, |
---|
3083 | 3062 | #endif /* BSSCACHE */ |
---|
3084 | | - 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) |
---|
3085 | 3064 | { |
---|
3086 | | - struct dhd_pub *dhd = dhd_get_pub(net); |
---|
3087 | 3065 | struct wl_bss_info *bi = NULL; /* must be initialized */ |
---|
3088 | | - struct wl_chan_info chan_info; |
---|
3089 | 3066 | s32 i, j; |
---|
3090 | 3067 | #if defined(BSSCACHE) |
---|
3091 | 3068 | wl_bss_cache_t *node; |
---|
.. | .. |
---|
3096 | 3073 | s32 distance_6g; |
---|
3097 | 3074 | #endif /* WL_6G_BAND */ |
---|
3098 | 3075 | s32 cen_ch, distance, distance_2g, distance_5g, chanspec, min_ap=999; |
---|
3099 | | - wl_uint32_list_t *list = NULL; |
---|
| 3076 | + u8 valid_chan_list[sizeof(u32)*(MAX_CTRL_CHANSPECS + 1)]; |
---|
| 3077 | + wl_uint32_list_t *list; |
---|
3100 | 3078 | int ret; |
---|
3101 | 3079 | chanspec_t chspec; |
---|
3102 | 3080 | u32 channel; |
---|
.. | .. |
---|
3111 | 3089 | memset(six_g_band8, -1, sizeof(six_g_band8)); |
---|
3112 | 3090 | #endif /* WL_6G_BAND */ |
---|
3113 | 3091 | |
---|
3114 | | - list = kzalloc(sizeof(u32)*(MAX_CTRL_CHANSPECS + 1), GFP_KERNEL); |
---|
3115 | | - if (list == NULL) { |
---|
3116 | | - AEXT_ERROR(net->name, "kzalloc failed\n"); |
---|
3117 | | - ret = -ENOMEM; |
---|
3118 | | - goto exit; |
---|
3119 | | - } |
---|
| 3092 | + memset(valid_chan_list, 0, sizeof(valid_chan_list)); |
---|
| 3093 | + list = (wl_uint32_list_t *)(void *) valid_chan_list; |
---|
3120 | 3094 | |
---|
3121 | 3095 | ret = wl_construct_ctl_chanspec_list(net, list); |
---|
3122 | 3096 | if (ret < 0) { |
---|
3123 | 3097 | AEXT_ERROR(net->name, "get channels failed with %d\n", ret); |
---|
3124 | | - goto exit; |
---|
| 3098 | + return 0; |
---|
3125 | 3099 | } else { |
---|
3126 | 3100 | for (i = 0; i < list->count; i++) { |
---|
3127 | 3101 | chspec = list->element[i]; |
---|
3128 | 3102 | channel = wf_chspec_ctlchan(chspec); |
---|
3129 | | - chan_info.band = CHSPEC2WLC_BAND(chspec); |
---|
3130 | | - chan_info.chan = channel; |
---|
3131 | | - if (wl_ext_passive_chan(net, &chan_info)) { |
---|
3132 | | - continue; |
---|
3133 | | - } |
---|
3134 | 3103 | if (CHSPEC_IS2G(chspec) && (channel >= CH_MIN_2G_CHANNEL) && |
---|
3135 | | - (channel <= CH_MAX_2G_CHANNEL)) { |
---|
| 3104 | + (channel <= CH_MAX_2G_CHANNEL)) { |
---|
3136 | 3105 | b_band[channel-1] = 0; |
---|
3137 | 3106 | } |
---|
3138 | 3107 | #ifdef WL_6G_BAND |
---|
3139 | 3108 | else if (CHSPEC_IS6G(chspec) && (channel >= CH_MIN_6G_CHANNEL) && |
---|
3140 | | - (channel <= CH_MAX_6G_CHANNEL)) { |
---|
| 3109 | + (channel <= CH_MAX_6G_CHANNEL)) { |
---|
3141 | 3110 | if (channel <= 93) |
---|
3142 | 3111 | six_g_band5[(channel-1)/4] = 0; |
---|
3143 | 3112 | else if (channel >= 97 && channel <= 109) |
---|
.. | .. |
---|
3173 | 3142 | #if defined(BSSCACHE) |
---|
3174 | 3143 | bi = node->results.bss_info; |
---|
3175 | 3144 | #else |
---|
3176 | | - 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; |
---|
3177 | 3146 | #endif /* BSSCACHE */ |
---|
3178 | | - chanspec = wl_ext_chspec_driver_to_host(dhd, bi->chanspec); |
---|
| 3147 | + chanspec = wl_ext_chspec_driver_to_host(ioctl_ver, bi->chanspec); |
---|
3179 | 3148 | cen_ch = CHSPEC_CHANNEL(bi->chanspec); |
---|
3180 | 3149 | distance = 0; |
---|
3181 | 3150 | if (CHSPEC_IS20(chanspec)) |
---|
.. | .. |
---|
3198 | 3167 | else if (CHSPEC_IS6G(chanspec)) { |
---|
3199 | 3168 | distance += distance_6g; |
---|
3200 | 3169 | if (cen_ch <= 93) { |
---|
3201 | | - for (j=0; j<ARRAYSIZE(six_g_band5); j++) { |
---|
| 3170 | + for (j=0; j<ARRAYSIZE(a_band1); j++) { |
---|
3202 | 3171 | if (six_g_band5[j] >= 0 && abs(cen_ch-(93+j*4)) <= distance) |
---|
3203 | 3172 | six_g_band5[j] += 1; |
---|
3204 | 3173 | } |
---|
3205 | 3174 | } |
---|
3206 | 3175 | else if (channel >= 97 && channel <= 109) { |
---|
3207 | | - for (j=0; j<ARRAYSIZE(six_g_band6); j++) { |
---|
| 3176 | + for (j=0; j<ARRAYSIZE(a_band4); j++) { |
---|
3208 | 3177 | if (six_g_band6[j] >= 0 && abs(cen_ch-(97+j*4)) <= distance) |
---|
3209 | 3178 | six_g_band6[j] += 1; |
---|
3210 | 3179 | } |
---|
3211 | 3180 | } |
---|
3212 | 3181 | else if (channel >= 117 && channel <= 181) { |
---|
3213 | | - for (j=0; j<ARRAYSIZE(six_g_band7); j++) { |
---|
| 3182 | + for (j=0; j<ARRAYSIZE(a_band4); j++) { |
---|
3214 | 3183 | if (six_g_band7[j] >= 0 && abs(cen_ch-(117+j*4)) <= distance) |
---|
3215 | 3184 | six_g_band7[j] += 1; |
---|
3216 | 3185 | } |
---|
3217 | 3186 | } |
---|
3218 | 3187 | else if (channel >= 189 && channel <= 221) { |
---|
3219 | | - for (j=0; j<ARRAYSIZE(six_g_band8); j++) { |
---|
| 3188 | + for (j=0; j<ARRAYSIZE(a_band4); j++) { |
---|
3220 | 3189 | if (six_g_band8[j] >= 0 && abs(cen_ch-(189+j*4)) <= distance) |
---|
3221 | 3190 | six_g_band8[j] += 1; |
---|
3222 | 3191 | } |
---|
.. | .. |
---|
3346 | 3315 | } |
---|
3347 | 3316 | |
---|
3348 | 3317 | exit: |
---|
3349 | | - if (list) |
---|
3350 | | - kfree(list); |
---|
3351 | | - return ret; |
---|
| 3318 | + return 0; |
---|
3352 | 3319 | } |
---|
3353 | 3320 | #endif /* WL_CFG80211 || WL_ESCAN */ |
---|
3354 | 3321 | |
---|
.. | .. |
---|
3384 | 3351 | memset(reqbuf, 0, CHANSPEC_BUF_SIZE); |
---|
3385 | 3352 | |
---|
3386 | 3353 | acs_band = wl_ext_wlcband_to_chanspec_band(band); |
---|
3387 | | - if (acs_band == INVCHANSPEC) { |
---|
| 3354 | + if ((uint32)acs_band == WLC_BAND_INVALID) { |
---|
3388 | 3355 | acs_band = WL_CHANSPEC_BAND_2G; |
---|
3389 | 3356 | } |
---|
3390 | 3357 | |
---|
.. | .. |
---|
3449 | 3416 | kfree(reqbuf); |
---|
3450 | 3417 | } |
---|
3451 | 3418 | |
---|
3452 | | - return chosen; |
---|
| 3419 | + return channel; |
---|
3453 | 3420 | } |
---|
3454 | 3421 | #endif /* WL_CFG80211 */ |
---|
3455 | 3422 | |
---|
.. | .. |
---|
3459 | 3426 | { |
---|
3460 | 3427 | int ret = -1, i, cnt = 0; |
---|
3461 | 3428 | int retry = 0, retry_max, retry_interval = 250, up = 1; |
---|
3462 | | - wl_scan_info_t *scan_info = NULL; |
---|
3463 | | - |
---|
3464 | | - scan_info = kmalloc(sizeof(wl_scan_info_t), GFP_KERNEL); |
---|
3465 | | - if (scan_info == NULL) { |
---|
3466 | | - AEXT_ERROR(dev->name, "kzalloc failed\n"); |
---|
3467 | | - ret = -ENOMEM; |
---|
3468 | | - goto exit; |
---|
3469 | | - } |
---|
| 3429 | + wl_scan_info_t scan_info; |
---|
3470 | 3430 | |
---|
3471 | 3431 | retry_max = WL_ESCAN_TIMER_INTERVAL_MS/retry_interval; |
---|
3472 | 3432 | ret = wldev_ioctl_get(dev, WLC_GET_UP, &up, sizeof(s32)); |
---|
3473 | 3433 | if (ret < 0 || up == 0) { |
---|
3474 | 3434 | ret = wldev_ioctl_set(dev, WLC_UP, &up, sizeof(s32)); |
---|
3475 | 3435 | } |
---|
3476 | | - memset(scan_info, 0, sizeof(wl_scan_info_t)); |
---|
| 3436 | + memset(&scan_info, 0, sizeof(wl_scan_info_t)); |
---|
3477 | 3437 | if (band == WLC_BAND_2G || band == WLC_BAND_AUTO) { |
---|
3478 | 3438 | for (i=0; i<13; i++) { |
---|
3479 | | - scan_info->channels.channel[i+cnt] = wf_create_chspec_from_primary(i+1, |
---|
| 3439 | + scan_info.channels.channel[i+cnt] = wf_create_chspec_from_primary(i+1, |
---|
3480 | 3440 | WL_CHANSPEC_BW_20, WL_CHANSPEC_BAND_2G); |
---|
3481 | 3441 | } |
---|
3482 | 3442 | cnt += 13; |
---|
3483 | 3443 | } |
---|
3484 | 3444 | if (band == WLC_BAND_5G || band == WLC_BAND_AUTO) { |
---|
3485 | 3445 | for (i=0; i<4; i++) { |
---|
3486 | | - scan_info->channels.channel[i+cnt] = wf_create_chspec_from_primary(36+i*4, |
---|
| 3446 | + scan_info.channels.channel[i+cnt] = wf_create_chspec_from_primary(36+i*4, |
---|
3487 | 3447 | WL_CHANSPEC_BW_20, WL_CHANSPEC_BAND_5G); |
---|
3488 | 3448 | } |
---|
3489 | 3449 | cnt += 4; |
---|
3490 | 3450 | for (i=0; i<4; i++) { |
---|
3491 | | - scan_info->channels.channel[i+cnt] = wf_create_chspec_from_primary(149+i*4, |
---|
| 3451 | + scan_info.channels.channel[i+cnt] = wf_create_chspec_from_primary(149+i*4, |
---|
3492 | 3452 | WL_CHANSPEC_BW_20, WL_CHANSPEC_BAND_5G); |
---|
3493 | 3453 | } |
---|
3494 | 3454 | cnt += 4; |
---|
.. | .. |
---|
3496 | 3456 | #ifdef WL_6G_BAND |
---|
3497 | 3457 | if (band == WLC_BAND_6G || band == WLC_BAND_AUTO) { |
---|
3498 | 3458 | for (i=0; i<59; i++) { |
---|
3499 | | - scan_info->channels.channel[i+cnt] = wf_create_chspec_from_primary(1+i*4, |
---|
| 3459 | + scan_info.channels.channel[i+cnt] = wf_create_chspec_from_primary(1+i*4, |
---|
3500 | 3460 | WL_CHANSPEC_BW_20, WL_CHANSPEC_BAND_6G); |
---|
3501 | 3461 | } |
---|
3502 | 3462 | cnt += 59; |
---|
.. | .. |
---|
3504 | 3464 | #endif /* WL_6G_BAND */ |
---|
3505 | 3465 | if (band == WLC_BAND_2G) |
---|
3506 | 3466 | fast_scan = FALSE; |
---|
3507 | | - scan_info->channels.count = cnt; |
---|
| 3467 | + scan_info.channels.count = cnt; |
---|
3508 | 3468 | if (fast_scan) |
---|
3509 | | - scan_info->scan_time = 40; |
---|
3510 | | - scan_info->bcast_ssid = TRUE; |
---|
| 3469 | + scan_info.scan_time = 40; |
---|
| 3470 | + scan_info.bcast_ssid = TRUE; |
---|
3511 | 3471 | retry = retry_max; |
---|
3512 | 3472 | while (retry--) { |
---|
3513 | | - ret = wl_escan_set_scan(dev, scan_info); |
---|
| 3473 | + ret = wl_escan_set_scan(dev, &scan_info); |
---|
3514 | 3474 | if (!ret) |
---|
3515 | 3475 | break; |
---|
3516 | 3476 | OSL_SLEEP(retry_interval); |
---|
.. | .. |
---|
3520 | 3480 | ret = -1; |
---|
3521 | 3481 | } |
---|
3522 | 3482 | |
---|
3523 | | -exit: |
---|
3524 | | - if (scan_info) |
---|
3525 | | - kfree(scan_info); |
---|
3526 | 3483 | return ret; |
---|
3527 | 3484 | } |
---|
3528 | 3485 | |
---|
3529 | | -static int |
---|
| 3486 | +int |
---|
3530 | 3487 | wl_ext_drv_apcs(struct net_device *dev, uint32 band) |
---|
3531 | 3488 | { |
---|
3532 | | - int ret = 0, chanspec = 0; |
---|
| 3489 | + int ret = 0, channel = 0; |
---|
3533 | 3490 | struct dhd_pub *dhd = dhd_get_pub(dev); |
---|
3534 | 3491 | struct wl_escan_info *escan = NULL; |
---|
3535 | 3492 | int retry = 0, retry_max, retry_interval = 250; |
---|
.. | .. |
---|
3544 | 3501 | retry = retry_max; |
---|
3545 | 3502 | while (retry--) { |
---|
3546 | 3503 | if (escan->escan_state == ESCAN_STATE_IDLE) { |
---|
3547 | | - if (band == WLC_BAND_5G) { |
---|
3548 | | - chanspec = wf_create_chspec_from_primary(wf_chspec_primary20_chan(escan->best_5g_ch), |
---|
3549 | | - WL_CHANSPEC_BW_20, WL_CHANSPEC_BAND_5G); |
---|
3550 | | - } |
---|
| 3504 | + if (band == WLC_BAND_5G) |
---|
| 3505 | + channel = escan->best_5g_ch; |
---|
3551 | 3506 | #ifdef WL_6G_BAND |
---|
3552 | | - else if (band == WLC_BAND_6G) { |
---|
3553 | | - chanspec = wf_create_chspec_from_primary(wf_chspec_primary20_chan(escan->best_6g_ch), |
---|
3554 | | - WL_CHANSPEC_BW_20, WL_CHANSPEC_BAND_6G); |
---|
3555 | | - } |
---|
| 3507 | + else if (band == WLC_BAND_6G) |
---|
| 3508 | + channel = escan->best_6g_ch; |
---|
3556 | 3509 | #endif /* WL_6G_BAND */ |
---|
3557 | | - else { |
---|
3558 | | - chanspec = wf_create_chspec_from_primary(wf_chspec_primary20_chan(escan->best_2g_ch), |
---|
3559 | | - WL_CHANSPEC_BW_20, WL_CHANSPEC_BAND_2G); |
---|
3560 | | - } |
---|
3561 | | - WL_MSG(dev->name, "selected channel = %d(0x%x)\n", |
---|
3562 | | - wf_chspec_ctlchan(chanspec), chanspec); |
---|
| 3510 | + else |
---|
| 3511 | + channel = escan->best_2g_ch; |
---|
| 3512 | + WL_MSG(dev->name, "selected channel = %d\n", channel); |
---|
3563 | 3513 | goto done; |
---|
3564 | 3514 | } |
---|
3565 | 3515 | AEXT_INFO(dev->name, "escan_state=%d, %d tried, ret = %d\n", |
---|
.. | .. |
---|
3570 | 3520 | done: |
---|
3571 | 3521 | escan->autochannel = 0; |
---|
3572 | 3522 | |
---|
3573 | | - return chanspec; |
---|
| 3523 | + return channel; |
---|
3574 | 3524 | } |
---|
3575 | 3525 | #endif /* WL_ESCAN */ |
---|
3576 | 3526 | |
---|
3577 | 3527 | int |
---|
3578 | 3528 | wl_ext_autochannel(struct net_device *dev, uint acs, uint32 band) |
---|
3579 | 3529 | { |
---|
3580 | | - int chosen = 0; |
---|
3581 | | - uint16 chan_2g, chan_5g, channel; |
---|
| 3530 | + int channel = 0; |
---|
| 3531 | + uint16 chan_2g, chan_5g; |
---|
3582 | 3532 | |
---|
3583 | | - AEXT_INFO(dev->name, "acs=0x%x, band=%s\n", acs, WLCBAND2STR(band)); |
---|
| 3533 | + AEXT_INFO(dev->name, "acs=0x%x, band=%d \n", acs, band); |
---|
3584 | 3534 | |
---|
3585 | 3535 | #ifdef WL_CFG80211 |
---|
3586 | 3536 | if (acs & ACS_FW_BIT) { |
---|
3587 | 3537 | int ret = 0; |
---|
3588 | 3538 | ret = wldev_ioctl_get(dev, WLC_GET_CHANNEL_SEL, &channel, sizeof(channel)); |
---|
3589 | | - chosen = 0; |
---|
| 3539 | + channel = 0; |
---|
3590 | 3540 | if (ret != BCME_UNSUPPORTED) |
---|
3591 | | - chosen = wl_ext_fw_apcs(dev, band); |
---|
3592 | | - if (chosen) |
---|
3593 | | - return chosen; |
---|
| 3541 | + channel = wl_ext_fw_apcs(dev, band); |
---|
| 3542 | + if (channel) |
---|
| 3543 | + return channel; |
---|
3594 | 3544 | } |
---|
3595 | 3545 | #endif |
---|
3596 | 3546 | |
---|
3597 | 3547 | #ifdef WL_ESCAN |
---|
3598 | 3548 | if (acs & ACS_DRV_BIT) |
---|
3599 | | - chosen = wl_ext_drv_apcs(dev, band); |
---|
| 3549 | + channel = wl_ext_drv_apcs(dev, band); |
---|
3600 | 3550 | #endif /* WL_ESCAN */ |
---|
3601 | 3551 | |
---|
3602 | | - if (chosen == 0) { |
---|
| 3552 | + if (channel == 0) { |
---|
3603 | 3553 | wl_ext_get_default_chan(dev, &chan_2g, &chan_5g, TRUE); |
---|
3604 | 3554 | if (band == WLC_BAND_5G) { |
---|
3605 | | - chosen = wf_create_chspec_from_primary(wf_chspec_primary20_chan(chan_5g), |
---|
3606 | | - WL_CHANSPEC_BW_20, WL_CHANSPEC_BAND_5G); |
---|
3607 | 3555 | channel = chan_5g; |
---|
3608 | 3556 | } else { |
---|
3609 | | - chosen = wf_create_chspec_from_primary(wf_chspec_primary20_chan(chan_2g), |
---|
3610 | | - WL_CHANSPEC_BW_20, WL_CHANSPEC_BAND_2G); |
---|
3611 | 3557 | channel = chan_2g; |
---|
3612 | 3558 | } |
---|
3613 | | - AEXT_ERROR(dev->name, "ACS failed. Fall back to default channel (%s-%d) \n", |
---|
3614 | | - CHSPEC2BANDSTR(chosen), channel); |
---|
| 3559 | + AEXT_ERROR(dev->name, "ACS failed. Fall back to default channel (%d) \n", channel); |
---|
3615 | 3560 | } |
---|
3616 | 3561 | |
---|
3617 | | - return chosen; |
---|
| 3562 | + return channel; |
---|
3618 | 3563 | } |
---|
3619 | 3564 | |
---|
3620 | 3565 | #if defined(RSSIAVG) |
---|
.. | .. |
---|
3812 | 3757 | |
---|
3813 | 3758 | void |
---|
3814 | 3759 | wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, |
---|
3815 | | - wl_scan_results_v109_t *ss_list) |
---|
| 3760 | + wl_scan_results_t *ss_list) |
---|
3816 | 3761 | { |
---|
3817 | 3762 | wl_rssi_cache_t *node, *prev, *leaf, **rssi_head; |
---|
3818 | | - wl_bss_info_v109_t *bi = NULL; |
---|
| 3763 | + wl_bss_info_t *bi = NULL; |
---|
3819 | 3764 | int i, j, k; |
---|
3820 | 3765 | struct osl_timespec now, timeout; |
---|
3821 | 3766 | |
---|
.. | .. |
---|
3841 | 3786 | node = *rssi_head; |
---|
3842 | 3787 | prev = NULL; |
---|
3843 | 3788 | k = 0; |
---|
3844 | | - 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; |
---|
3845 | 3790 | for (;node;) { |
---|
3846 | 3791 | if (!memcmp(&node->BSSID, &bi->BSSID, ETHER_ADDR_LEN)) { |
---|
3847 | 3792 | AEXT_INFO("wlan", "Update %d with BSSID %pM, RSSI=%3d, SSID \"%s\"\n", |
---|
.. | .. |
---|
4167 | 4112 | #if defined(RSSIAVG) |
---|
4168 | 4113 | wl_rssi_cache_ctrl_t *rssi_cache_ctrl, |
---|
4169 | 4114 | #endif /* RSSIAVG */ |
---|
4170 | | - wl_scan_results_v109_t *ss_list) |
---|
| 4115 | + wl_scan_results_t *ss_list) |
---|
4171 | 4116 | { |
---|
4172 | 4117 | wl_bss_cache_t *node, *node_target = NULL, *prev, *leaf, **bss_head; |
---|
4173 | 4118 | wl_bss_cache_t *node_rssi_prev = NULL, *node_rssi = NULL; |
---|
4174 | | - wl_bss_info_v109_t *bi = NULL; |
---|
| 4119 | + wl_bss_info_t *bi = NULL; |
---|
4175 | 4120 | int i, k=0, bss_num = 0; |
---|
4176 | 4121 | struct osl_timespec now, timeout; |
---|
4177 | 4122 | int16 rssi_min; |
---|
.. | .. |
---|
4206 | 4151 | prev = NULL; |
---|
4207 | 4152 | node_target = NULL; |
---|
4208 | 4153 | node_rssi_prev = NULL; |
---|
4209 | | - 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; |
---|
4210 | 4155 | |
---|
4211 | 4156 | // find the bss with same BSSID |
---|
4212 | 4157 | for (;node;) { |
---|