old mode 100644new mode 100755| .. | .. |
|---|
| 519 | 519 | * role to station type while bringing down the interface |
|---|
| 520 | 520 | */ |
|---|
| 521 | 521 | if (p2p_ndev->ieee80211_ptr->iftype == NL80211_IFTYPE_STATION) { |
|---|
| 522 | | - WL_DBG_MEM(("%s, Change to GC base role\n", p2p_ndev->name)); |
|---|
| 522 | + WL_DBG_MEM(("%s, Change to GC base role\n", __FUNCTION__)); |
|---|
| 523 | 523 | return WL_IF_TYPE_P2P_GC; |
|---|
| 524 | 524 | } |
|---|
| 525 | 525 | |
|---|
| .. | .. |
|---|
| 888 | 888 | WL_DBG(("%s:Mac addr" MACDBG "\n", |
|---|
| 889 | 889 | __FUNCTION__, MAC2STRDBG(mac_addr))); |
|---|
| 890 | 890 | |
|---|
| 891 | | -#if defined(SPECIFIC_MAC_GEN_SCHEME) |
|---|
| 892 | 891 | if ((wl_iftype == WL_IF_TYPE_P2P_DISC) || (wl_iftype == WL_IF_TYPE_AP) || |
|---|
| 893 | 892 | (wl_iftype == WL_IF_TYPE_P2P_GO) || (wl_iftype == WL_IF_TYPE_P2P_GC)) { |
|---|
| 894 | 893 | /* Avoid invoking release mac addr code for interfaces using |
|---|
| .. | .. |
|---|
| 896 | 895 | */ |
|---|
| 897 | 896 | return BCME_OK; |
|---|
| 898 | 897 | } |
|---|
| 899 | | -#else |
|---|
| 900 | | - if (wl_iftype == WL_IF_TYPE_P2P_DISC) { |
|---|
| 901 | | - return BCME_OK; |
|---|
| 902 | | - } |
|---|
| 903 | | -#endif /* SPECIFIC_MAC_GEN_SCHEME */ |
|---|
| 904 | 898 | |
|---|
| 905 | 899 | /* Fetch last two bytes of mac address */ |
|---|
| 906 | 900 | org_toggle_bytes = ntoh16(*((u16 *)&ndev->dev_addr[4])); |
|---|
| .. | .. |
|---|
| 957 | 951 | * released. Ensure to call wl_release_vif_macaddress to free up |
|---|
| 958 | 952 | * the mac address. |
|---|
| 959 | 953 | */ |
|---|
| 960 | | -#if defined(SPECIFIC_MAC_GEN_SCHEME) |
|---|
| 954 | +#if defined (SPECIFIC_MAC_GEN_SCHEME) |
|---|
| 961 | 955 | if (wl_iftype == WL_IF_TYPE_P2P_DISC || wl_iftype == WL_IF_TYPE_AP) { |
|---|
| 962 | 956 | mac_addr[0] |= 0x02; |
|---|
| 963 | 957 | } else if ((wl_iftype == WL_IF_TYPE_P2P_GO) || (wl_iftype == WL_IF_TYPE_P2P_GC)) { |
|---|
| .. | .. |
|---|
| 968 | 962 | if (wl_iftype == WL_IF_TYPE_P2P_DISC) { |
|---|
| 969 | 963 | mac_addr[0] |= 0x02; |
|---|
| 970 | 964 | } |
|---|
| 971 | | -#endif /* SPECIFIC_MAC_GEN_SCHEME */ |
|---|
| 965 | +#endif /* SEPCIFIC_MAC_GEN_SCHEME */ |
|---|
| 972 | 966 | else { |
|---|
| 973 | 967 | /* For locally administered mac addresses, we keep the |
|---|
| 974 | 968 | * OUI part constant and just work on the last two bytes. |
|---|
| .. | .. |
|---|
| 1337 | 1331 | if (is_p2p_group_iface(ndev->ieee80211_ptr) && (type == NL80211_IFTYPE_STATION)) { |
|---|
| 1338 | 1332 | /* For role downgrade cases, we keep interface role as GC */ |
|---|
| 1339 | 1333 | netinfo->iftype = WL_IF_TYPE_P2P_GC; |
|---|
| 1340 | | - WL_DBG_MEM(("[%s] Set base role to GC, current role" |
|---|
| 1334 | + WL_DBG_MEM(("[%s] Set base role to GC, current role" |
|---|
| 1341 | 1335 | "ndev->ieee80211_ptr->iftype = %d\n", |
|---|
| 1342 | | - ndev->name, ndev->ieee80211_ptr->iftype)); |
|---|
| 1336 | + __FUNCTION__, ndev->ieee80211_ptr->iftype)); |
|---|
| 1343 | 1337 | } else { |
|---|
| 1344 | 1338 | netinfo->iftype = wl_iftype; |
|---|
| 1345 | 1339 | } |
|---|
| .. | .. |
|---|
| 1544 | 1538 | s32 |
|---|
| 1545 | 1539 | wl_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev, |
|---|
| 1546 | 1540 | struct ieee80211_channel *chan, |
|---|
| 1547 | | -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) |
|---|
| 1548 | | - enum nl80211_channel_type channel_type |
|---|
| 1549 | | -#else |
|---|
| 1550 | | - enum nl80211_chan_width width |
|---|
| 1551 | | -#endif |
|---|
| 1552 | | -) |
|---|
| 1541 | + enum nl80211_channel_type channel_type) |
|---|
| 1553 | 1542 | { |
|---|
| 1554 | 1543 | chanspec_t chspec = INVCHANSPEC; |
|---|
| 1555 | 1544 | chanspec_t cur_chspec = INVCHANSPEC; |
|---|
| 1556 | | - u32 band_width = WL_CHANSPEC_BW_20, bw = WL_CHANSPEC_BW_20; |
|---|
| 1545 | + u32 bw = WL_CHANSPEC_BW_20; |
|---|
| 1557 | 1546 | s32 err = BCME_OK; |
|---|
| 1558 | 1547 | struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); |
|---|
| 1559 | 1548 | #if defined(CUSTOM_SET_CPUCORE) || defined(APSTA_RESTRICTED_CHANNEL) |
|---|
| .. | .. |
|---|
| 1562 | 1551 | u16 center_freq = chan->center_freq; |
|---|
| 1563 | 1552 | |
|---|
| 1564 | 1553 | dev = ndev_to_wlc_ndev(dev, cfg); |
|---|
| 1565 | | - |
|---|
| 1566 | | -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) |
|---|
| 1567 | | - switch (channel_type) { |
|---|
| 1568 | | - case NL80211_CHAN_HT40MINUS: |
|---|
| 1569 | | - /* secondary channel is below the control channel */ |
|---|
| 1570 | | - band_width = WL_CHANSPEC_BW_40; |
|---|
| 1571 | | - break; |
|---|
| 1572 | | - case NL80211_CHAN_HT40PLUS: |
|---|
| 1573 | | - /* secondary channel is above the control channel */ |
|---|
| 1574 | | - band_width = WL_CHANSPEC_BW_40; |
|---|
| 1575 | | - break; |
|---|
| 1576 | | - default: |
|---|
| 1577 | | - band_width = WL_CHANSPEC_BW_20; |
|---|
| 1578 | | - } |
|---|
| 1579 | | -#else |
|---|
| 1580 | | - switch (width) |
|---|
| 1581 | | - { |
|---|
| 1582 | | - case NL80211_CHAN_WIDTH_160: |
|---|
| 1583 | | - band_width = WL_CHANSPEC_BW_160; |
|---|
| 1584 | | - break; |
|---|
| 1585 | | - case NL80211_CHAN_WIDTH_80P80: |
|---|
| 1586 | | - case NL80211_CHAN_WIDTH_80: |
|---|
| 1587 | | - band_width = WL_CHANSPEC_BW_80; |
|---|
| 1588 | | - break; |
|---|
| 1589 | | - case NL80211_CHAN_WIDTH_40: |
|---|
| 1590 | | - band_width = WL_CHANSPEC_BW_40; |
|---|
| 1591 | | - break; |
|---|
| 1592 | | - default: |
|---|
| 1593 | | - band_width = WL_CHANSPEC_BW_20; |
|---|
| 1594 | | - break; |
|---|
| 1595 | | - } |
|---|
| 1596 | | -#endif |
|---|
| 1597 | | - |
|---|
| 1598 | 1554 | #ifdef WL_EXT_IAPSTA |
|---|
| 1599 | 1555 | if (dev->ieee80211_ptr->iftype == NL80211_IFTYPE_AP || |
|---|
| 1600 | 1556 | dev->ieee80211_ptr->iftype == NL80211_IFTYPE_P2P_GO) { |
|---|
| .. | .. |
|---|
| 1615 | 1571 | #endif |
|---|
| 1616 | 1572 | chspec = wl_freq_to_chanspec(center_freq); |
|---|
| 1617 | 1573 | |
|---|
| 1618 | | - WL_MSG(dev->name, "netdev_ifidx(%d) chan_width(%d) target channel(%s-%d %sMHz)\n", |
|---|
| 1619 | | - dev->ifindex, width, CHSPEC2BANDSTR(chspec), |
|---|
| 1620 | | - CHSPEC_CHANNEL(chspec), WLCWIDTH2STR(band_width)); |
|---|
| 1574 | + WL_MSG(dev->name, "netdev_ifidx(%d), chan_type(%d) target channel(%s-%d) \n", |
|---|
| 1575 | + dev->ifindex, channel_type, CHSPEC2BANDSTR(chspec), CHSPEC_CHANNEL(chspec)); |
|---|
| 1621 | 1576 | |
|---|
| 1622 | 1577 | #ifdef WL_P2P_6G |
|---|
| 1623 | 1578 | if (!(cfg->p2p_6g_enabled)) { |
|---|
| .. | .. |
|---|
| 1629 | 1584 | #ifdef WL_P2P_6G |
|---|
| 1630 | 1585 | } |
|---|
| 1631 | 1586 | #endif /* WL_P2P_6G */ |
|---|
| 1587 | + |
|---|
| 1588 | +#ifdef NOT_YET |
|---|
| 1589 | + switch (channel_type) { |
|---|
| 1590 | + case NL80211_CHAN_HT40MINUS: |
|---|
| 1591 | + /* secondary channel is below the control channel */ |
|---|
| 1592 | + chspec = CH40MHZ_CHSPEC(CHSPEC_CHANNEL(chspec), WL_CHANSPEC_CTL_SB_UPPER); |
|---|
| 1593 | + break; |
|---|
| 1594 | + case NL80211_CHAN_HT40PLUS: |
|---|
| 1595 | + /* secondary channel is above the control channel */ |
|---|
| 1596 | + chspec = CH40MHZ_CHSPEC(CHSPEC_CHANNEL(chspec), WL_CHANSPEC_CTL_SB_LOWER); |
|---|
| 1597 | + break; |
|---|
| 1598 | + default: |
|---|
| 1599 | + chspec = CH20MHZ_CHSPEC(CHSPEC_CHANNEL(chspec)); |
|---|
| 1600 | + |
|---|
| 1601 | + } |
|---|
| 1602 | +#endif /* NOT_YET */ |
|---|
| 1632 | 1603 | |
|---|
| 1633 | 1604 | #if defined(APSTA_RESTRICTED_CHANNEL) |
|---|
| 1634 | 1605 | /* Some customer platform used limited number of channels |
|---|
| .. | .. |
|---|
| 1671 | 1642 | if (err < 0) { |
|---|
| 1672 | 1643 | WL_ERR(("Failed to get bandwidth information, err=%d\n", err)); |
|---|
| 1673 | 1644 | return err; |
|---|
| 1674 | | - } else if (bw < band_width) { |
|---|
| 1675 | | - WL_ERR(("capability force band_width=0x%X to be 0x%X\n", band_width, bw)); |
|---|
| 1676 | | - band_width = bw; |
|---|
| 1677 | 1645 | } |
|---|
| 1678 | | -#ifdef HOSTAPD_BW_SUPPORT |
|---|
| 1679 | | - WL_MSG(dev->name, "hostapd bw(%sMHz) <= chip bw(%sMHz)\n", |
|---|
| 1680 | | - wf_chspec_to_bw_str(band_width), wf_chspec_to_bw_str(bw)); |
|---|
| 1681 | | -#else |
|---|
| 1682 | | - WL_MSG(dev->name, "hostapd bw(%sMHz) => chip bw(%sMHz)\n", |
|---|
| 1683 | | - wf_chspec_to_bw_str(band_width), wf_chspec_to_bw_str(bw)); |
|---|
| 1684 | | - band_width = bw; |
|---|
| 1685 | | -#endif |
|---|
| 1686 | 1646 | |
|---|
| 1687 | 1647 | /* In case of 5G downgrade BW to 80MHz as 160MHz channels falls in DFS */ |
|---|
| 1688 | 1648 | if (CHSPEC_IS5G(chspec) && (bw == WL_CHANSPEC_BW_160)) { |
|---|
| .. | .. |
|---|
| 1690 | 1650 | } |
|---|
| 1691 | 1651 | set_channel: |
|---|
| 1692 | 1652 | cur_chspec = wf_create_chspec_from_primary(wf_chspec_primary20_chan(chspec), |
|---|
| 1693 | | - band_width, CHSPEC_BAND(chspec)); |
|---|
| 1653 | + bw, CHSPEC_BAND(chspec)); |
|---|
| 1694 | 1654 | #ifdef WL_6G_BAND |
|---|
| 1695 | 1655 | if (cfg->acs_chspec && |
|---|
| 1696 | 1656 | CHSPEC_IS6G(cfg->acs_chspec) && |
|---|
| .. | .. |
|---|
| 2809 | 2769 | dhd_pub_t *dhd = (dhd_pub_t *)(cfg->pub); |
|---|
| 2810 | 2770 | #endif /* WLEASYMESH */ |
|---|
| 2811 | 2771 | |
|---|
| 2812 | | - new_chip = dhd_conf_new_chip_check(cfg->pub); |
|---|
| 2772 | + new_chip = wl_new_chip_check(dev); |
|---|
| 2813 | 2773 | |
|---|
| 2814 | 2774 | if ((bssidx = wl_get_bssidx_by_wdev(cfg, dev->ieee80211_ptr)) < 0) { |
|---|
| 2815 | 2775 | WL_ERR(("Find p2p index from wdev(%p) failed\n", dev->ieee80211_ptr)); |
|---|
| .. | .. |
|---|
| 3718 | 3678 | * hardcoded values in 'wl_cfg80211_set_channel()'. |
|---|
| 3719 | 3679 | */ |
|---|
| 3720 | 3680 | #if ((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) && !defined(WL_COMPAT_WIRELESS)) |
|---|
| 3721 | | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) |
|---|
| 3722 | | - if (!dev->ieee80211_ptr->u.ap.preset_chandef.chan) |
|---|
| 3723 | | -#else |
|---|
| 3724 | | - if (!dev->ieee80211_ptr->preset_chandef.chan) |
|---|
| 3725 | | -#endif |
|---|
| 3726 | | - { |
|---|
| 3681 | + if (!dev->ieee80211_ptr->preset_chandef.chan) { |
|---|
| 3727 | 3682 | WL_ERR(("chan is NULL\n")); |
|---|
| 3728 | 3683 | err = -EINVAL; |
|---|
| 3729 | 3684 | goto fail; |
|---|
| 3730 | 3685 | } |
|---|
| 3731 | 3686 | if ((err = wl_cfg80211_set_channel(wiphy, dev, |
|---|
| 3732 | | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) |
|---|
| 3733 | | - dev->ieee80211_ptr->u.ap.preset_chandef.chan, |
|---|
| 3734 | | -#else |
|---|
| 3735 | | - dev->ieee80211_ptr->preset_chandef.chan, |
|---|
| 3736 | | -#endif /* CFG80211_BKPORT_MLO */ |
|---|
| 3737 | | - info->chandef.width) < 0)) { |
|---|
| 3687 | + dev->ieee80211_ptr->preset_chandef.chan, |
|---|
| 3688 | + NL80211_CHAN_HT20) < 0)) { |
|---|
| 3738 | 3689 | WL_ERR(("Set channel failed \n")); |
|---|
| 3739 | 3690 | goto fail; |
|---|
| 3740 | 3691 | } |
|---|
| .. | .. |
|---|
| 3828 | 3779 | if (err) { |
|---|
| 3829 | 3780 | WL_ERR(("ADD/SET beacon failed\n")); |
|---|
| 3830 | 3781 | wl_flush_fw_log_buffer(dev, FW_LOGSET_MASK_ALL); |
|---|
| 3831 | | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) |
|---|
| 3832 | | - wl_cfg80211_stop_ap(wiphy, dev, 0); |
|---|
| 3833 | | -#else |
|---|
| 3834 | 3782 | wl_cfg80211_stop_ap(wiphy, dev); |
|---|
| 3835 | | -#endif /* CFG80211_BKPORT_MLO */ |
|---|
| 3836 | 3783 | if (dev_role == NL80211_IFTYPE_AP) { |
|---|
| 3837 | 3784 | #ifdef WL_EXT_IAPSTA |
|---|
| 3838 | 3785 | if (!wl_ext_iapsta_iftype_enabled(dev, WL_IF_TYPE_AP)) { |
|---|
| .. | .. |
|---|
| 3873 | 3820 | s32 |
|---|
| 3874 | 3821 | wl_cfg80211_stop_ap( |
|---|
| 3875 | 3822 | struct wiphy *wiphy, |
|---|
| 3876 | | - struct net_device *dev |
|---|
| 3877 | | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) |
|---|
| 3878 | | - , unsigned int link_id |
|---|
| 3879 | | -#endif /* CFG80211_BKPORT_MLO */ |
|---|
| 3880 | | - ) |
|---|
| 3823 | + struct net_device *dev) |
|---|
| 3881 | 3824 | { |
|---|
| 3882 | 3825 | int err = 0; |
|---|
| 3883 | 3826 | u32 dev_role = 0; |
|---|
| .. | .. |
|---|
| 4561 | 4504 | (reason == WLC_E_REASON_INITIAL_ASSOC) && |
|---|
| 4562 | 4505 | (wl_get_mode_by_netdev(cfg, ndev) == WL_MODE_AP)) { |
|---|
| 4563 | 4506 | if (!wl_get_drv_status(cfg, AP_CREATED, ndev)) { |
|---|
| 4564 | | - char chan_str[64]; |
|---|
| 4565 | 4507 | /* AP/GO brought up successfull in firmware */ |
|---|
| 4566 | | - wl_ext_get_chan_str(ndev, chan_str, sizeof(chan_str)); |
|---|
| 4567 | | - WL_MSG(ndev->name, "AP/GO Link up (%s)\n", chan_str); |
|---|
| 4508 | + WL_MSG(ndev->name, "AP/GO Link up\n"); |
|---|
| 4568 | 4509 | wl_set_drv_status(cfg, AP_CREATED, ndev); |
|---|
| 4569 | 4510 | if (delayed_work_pending(&cfg->ap_work)) { |
|---|
| 4570 | 4511 | cancel_delayed_work_sync(&cfg->ap_work); |
|---|
| .. | .. |
|---|
| 5144 | 5085 | } |
|---|
| 5145 | 5086 | #endif /* WL_CFG80211_ACL */ |
|---|
| 5146 | 5087 | |
|---|
| 5088 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) |
|---|
| 5147 | 5089 | int wl_chspec_chandef(chanspec_t chanspec, |
|---|
| 5148 | | - struct cfg80211_chan_def *chandef, struct wiphy *wiphy) |
|---|
| 5090 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) |
|---|
| 5091 | + struct cfg80211_chan_def *chandef, |
|---|
| 5092 | +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && (LINUX_VERSION_CODE <= (3, 7, 0))) |
|---|
| 5093 | + struct chan_info *chaninfo, |
|---|
| 5094 | +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) */ |
|---|
| 5095 | + struct wiphy *wiphy) |
|---|
| 5149 | 5096 | { |
|---|
| 5150 | 5097 | uint16 freq = 0; |
|---|
| 5098 | + int chan_type = 0; |
|---|
| 5099 | + int channel = 0; |
|---|
| 5151 | 5100 | struct ieee80211_channel *chan; |
|---|
| 5152 | 5101 | |
|---|
| 5153 | 5102 | if (!chandef) { |
|---|
| 5154 | 5103 | return -1; |
|---|
| 5155 | | - } else { |
|---|
| 5156 | | - memset(chandef, 0, sizeof(*chandef)); |
|---|
| 5157 | 5104 | } |
|---|
| 5158 | | - |
|---|
| 5159 | | -#if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) |
|---|
| 5160 | | - chandef->center_freq1 = wl_channel_to_frequency(CHSPEC_CHANNEL(chanspec), CHSPEC_BAND(chanspec)); |
|---|
| 5161 | | - freq = wl_channel_to_frequency(wf_chspec_primary20_chan(chanspec), CHSPEC_BAND(chanspec)); |
|---|
| 5162 | | - chandef->chan = ieee80211_get_channel(wiphy, freq); |
|---|
| 5163 | | - chandef->center_freq2 = 0; |
|---|
| 5105 | + channel = CHSPEC_CHANNEL(chanspec); |
|---|
| 5164 | 5106 | |
|---|
| 5165 | 5107 | switch (CHSPEC_BW(chanspec)) { |
|---|
| 5166 | 5108 | case WL_CHANSPEC_BW_20: |
|---|
| 5167 | | - chandef->width = NL80211_CHAN_WIDTH_20; |
|---|
| 5109 | + chan_type = NL80211_CHAN_HT20; |
|---|
| 5168 | 5110 | break; |
|---|
| 5169 | | - |
|---|
| 5170 | 5111 | case WL_CHANSPEC_BW_40: |
|---|
| 5171 | | - chandef->width = NL80211_CHAN_WIDTH_40; |
|---|
| 5112 | + { |
|---|
| 5113 | + if (CHSPEC_SB_UPPER(chanspec)) { |
|---|
| 5114 | + channel += CH_10MHZ_APART; |
|---|
| 5115 | + } else { |
|---|
| 5116 | + channel -= CH_10MHZ_APART; |
|---|
| 5117 | + } |
|---|
| 5118 | + } |
|---|
| 5119 | + chan_type = NL80211_CHAN_HT40PLUS; |
|---|
| 5172 | 5120 | break; |
|---|
| 5173 | 5121 | |
|---|
| 5122 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) |
|---|
| 5174 | 5123 | case WL_CHANSPEC_BW_80: |
|---|
| 5175 | | - chandef->width = NL80211_CHAN_WIDTH_80; |
|---|
| 5176 | | - break; |
|---|
| 5177 | | - |
|---|
| 5178 | 5124 | case WL_CHANSPEC_BW_8080: |
|---|
| 5179 | 5125 | { |
|---|
| 5180 | | - /* XXX Left as is but need proper calculation for center_freq2 is used */ |
|---|
| 5181 | | - int chan_type = 0; |
|---|
| 5182 | | - int channel = 0; |
|---|
| 5183 | 5126 | uint16 sb = CHSPEC_CTL_SB(chanspec); |
|---|
| 5184 | 5127 | |
|---|
| 5185 | 5128 | if (sb == WL_CHANSPEC_CTL_SB_LL) { |
|---|
| .. | .. |
|---|
| 5197 | 5140 | chan_type = NL80211_CHAN_HT40MINUS; |
|---|
| 5198 | 5141 | else if (sb == WL_CHANSPEC_CTL_SB_UL || sb == WL_CHANSPEC_CTL_SB_UU) |
|---|
| 5199 | 5142 | chan_type = NL80211_CHAN_HT40PLUS; |
|---|
| 5200 | | - freq = wl_channel_to_frequency(channel, CHSPEC_BAND(chanspec)); |
|---|
| 5201 | | - chan = ieee80211_get_channel(wiphy, freq); |
|---|
| 5202 | | - cfg80211_chandef_create(chandef, chan, chan_type); |
|---|
| 5203 | | - return 0; |
|---|
| 5204 | | - break; |
|---|
| 5205 | 5143 | } |
|---|
| 5206 | | - |
|---|
| 5144 | + break; |
|---|
| 5207 | 5145 | case WL_CHANSPEC_BW_160: |
|---|
| 5208 | | - chandef->width = NL80211_CHAN_WIDTH_160; |
|---|
| 5209 | | - break; |
|---|
| 5210 | | - default: |
|---|
| 5211 | | - chandef->width = NL80211_CHAN_WIDTH_20; |
|---|
| 5212 | | - break; |
|---|
| 5213 | | - } |
|---|
| 5214 | | - |
|---|
| 5215 | | -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && \ |
|---|
| 5216 | | - (LINUX_VERSION_CODE <= KERNEL_VERSION (3, 7, 0))) |
|---|
| 5217 | | - |
|---|
| 5218 | | - int chan_type = 0; |
|---|
| 5219 | | - int channel = 0; |
|---|
| 5220 | | - channel = CHSPEC_CHANNEL(chanspec); |
|---|
| 5221 | | - switch (CHSPEC_BW(chanspec)) { |
|---|
| 5222 | | - case WL_CHANSPEC_BW_20: |
|---|
| 5146 | + channel = wf_chspec_primary20_chan(chanspec); |
|---|
| 5147 | + /* Using base chan_type as kernel does not define chan_type for 160 MHz */ |
|---|
| 5223 | 5148 | chan_type = NL80211_CHAN_HT20; |
|---|
| 5224 | 5149 | break; |
|---|
| 5225 | | - case WL_CHANSPEC_BW_40: |
|---|
| 5226 | | - if (CHSPEC_SB_UPPER(chanspec)) { |
|---|
| 5227 | | - channel += CH_10MHZ_APART; |
|---|
| 5228 | | - } else { |
|---|
| 5229 | | - channel -= CH_10MHZ_APART; |
|---|
| 5230 | | - } |
|---|
| 5231 | | - chan_type = NL80211_CHAN_HT40PLUS; |
|---|
| 5232 | | - break; |
|---|
| 5233 | | - |
|---|
| 5150 | +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) */ |
|---|
| 5234 | 5151 | default: |
|---|
| 5235 | 5152 | chan_type = NL80211_CHAN_HT20; |
|---|
| 5236 | 5153 | break; |
|---|
| 5237 | | - } |
|---|
| 5238 | 5154 | |
|---|
| 5155 | + } |
|---|
| 5239 | 5156 | freq = wl_channel_to_frequency(channel, CHSPEC_BAND(chanspec)); |
|---|
| 5240 | 5157 | chan = ieee80211_get_channel(wiphy, freq); |
|---|
| 5241 | 5158 | WL_DBG(("channel:%d freq:%d chan_type: %d chan_ptr:%p \n", |
|---|
| .. | .. |
|---|
| 5247 | 5164 | return -EINVAL; |
|---|
| 5248 | 5165 | } |
|---|
| 5249 | 5166 | |
|---|
| 5250 | | - chandef->freq = freq; |
|---|
| 5251 | | - chandef->chan_type = chan_type; |
|---|
| 5167 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) |
|---|
| 5168 | + cfg80211_chandef_create(chandef, chan, chan_type); |
|---|
| 5169 | +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && (LINUX_VERSION_CODE <= (3, 7, 0))) |
|---|
| 5170 | + chaninfo->freq = freq; |
|---|
| 5171 | + chaninfo->chan_type = chan_type; |
|---|
| 5252 | 5172 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) */ |
|---|
| 5253 | | - |
|---|
| 5254 | 5173 | return 0; |
|---|
| 5255 | 5174 | } |
|---|
| 5256 | 5175 | |
|---|
| 5257 | | -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) |
|---|
| 5258 | 5176 | void |
|---|
| 5259 | 5177 | wl_cfg80211_ch_switch_notify(struct net_device *dev, uint16 chanspec, struct wiphy *wiphy) |
|---|
| 5260 | 5178 | { |
|---|
| 5261 | 5179 | u32 freq; |
|---|
| 5180 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) |
|---|
| 5262 | 5181 | struct cfg80211_chan_def chandef; |
|---|
| 5182 | +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && (LINUX_VERSION_CODE <= (3, 7, 0))) |
|---|
| 5183 | + struct chan_info chaninfo; |
|---|
| 5184 | +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) */ |
|---|
| 5263 | 5185 | |
|---|
| 5264 | 5186 | if (!wiphy) { |
|---|
| 5265 | 5187 | WL_ERR(("wiphy is null\n")); |
|---|
| .. | .. |
|---|
| 5274 | 5196 | } |
|---|
| 5275 | 5197 | #endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION (3, 18, 0)) */ |
|---|
| 5276 | 5198 | |
|---|
| 5277 | | - if (wl_chspec_chandef(chanspec, &chandef, wiphy)) { |
|---|
| 5199 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) |
|---|
| 5200 | + if (wl_chspec_chandef(chanspec, &chandef, wiphy)) |
|---|
| 5201 | +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && (LINUX_VERSION_CODE <= (3, 7, 0))) |
|---|
| 5202 | + if (wl_chspec_chandef(chanspec, &chaninfo, wiphy)) |
|---|
| 5203 | +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) */ |
|---|
| 5204 | + { |
|---|
| 5278 | 5205 | WL_ERR(("chspec_chandef failed\n")); |
|---|
| 5279 | 5206 | return; |
|---|
| 5280 | 5207 | } |
|---|
| 5281 | | - |
|---|
| 5282 | 5208 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) |
|---|
| 5283 | 5209 | freq = chandef.chan ? chandef.chan->center_freq : chandef.center_freq1; |
|---|
| 5284 | | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) |
|---|
| 5285 | | - cfg80211_ch_switch_notify(dev, &chandef, 0); |
|---|
| 5286 | | -#else |
|---|
| 5287 | 5210 | cfg80211_ch_switch_notify(dev, &chandef); |
|---|
| 5288 | | -#endif /* CFG80211_BKPORT_MLO */ |
|---|
| 5289 | 5211 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && (LINUX_VERSION_CODE <= (3, 7, 0))) |
|---|
| 5290 | | - freq = chandef.freq; |
|---|
| 5291 | | - cfg80211_ch_switch_notify(dev, freq, chandef.chan_type); |
|---|
| 5212 | + freq = chan_info.freq; |
|---|
| 5213 | + cfg80211_ch_switch_notify(dev, freq, chan_info.chan_type); |
|---|
| 5292 | 5214 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) */ |
|---|
| 5293 | 5215 | |
|---|
| 5294 | 5216 | WL_MSG(dev->name, "Channel switch notification for freq: %d chanspec: 0x%x\n", |
|---|