old mode 100644new mode 100755| .. | .. |
|---|
| 1571 | 1571 | #endif |
|---|
| 1572 | 1572 | chspec = wl_freq_to_chanspec(center_freq); |
|---|
| 1573 | 1573 | |
|---|
| 1574 | | - WL_MSG(dev->name, "netdev_ifidx(%d) chan_type(%d) target channel(%s-%d %sMHz)\n", |
|---|
| 1575 | | - dev->ifindex, channel_type, CHSPEC2BANDSTR(chspec), |
|---|
| 1576 | | - CHSPEC_CHANNEL(chspec), wf_chspec_to_bw_str(chspec)); |
|---|
| 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)); |
|---|
| 1577 | 1576 | |
|---|
| 1578 | 1577 | #ifdef WL_P2P_6G |
|---|
| 1579 | 1578 | if (!(cfg->p2p_6g_enabled)) { |
|---|
| .. | .. |
|---|
| 2770 | 2769 | dhd_pub_t *dhd = (dhd_pub_t *)(cfg->pub); |
|---|
| 2771 | 2770 | #endif /* WLEASYMESH */ |
|---|
| 2772 | 2771 | |
|---|
| 2773 | | - new_chip = dhd_conf_new_chip_check(cfg->pub); |
|---|
| 2772 | + new_chip = wl_new_chip_check(dev); |
|---|
| 2774 | 2773 | |
|---|
| 2775 | 2774 | if ((bssidx = wl_get_bssidx_by_wdev(cfg, dev->ieee80211_ptr)) < 0) { |
|---|
| 2776 | 2775 | WL_ERR(("Find p2p index from wdev(%p) failed\n", dev->ieee80211_ptr)); |
|---|
| .. | .. |
|---|
| 3679 | 3678 | * hardcoded values in 'wl_cfg80211_set_channel()'. |
|---|
| 3680 | 3679 | */ |
|---|
| 3681 | 3680 | #if ((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) && !defined(WL_COMPAT_WIRELESS)) |
|---|
| 3682 | | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) |
|---|
| 3683 | | - if (!dev->ieee80211_ptr->u.ap.preset_chandef.chan) |
|---|
| 3684 | | -#else |
|---|
| 3685 | | - if (!dev->ieee80211_ptr->preset_chandef.chan) |
|---|
| 3686 | | -#endif |
|---|
| 3687 | | - { |
|---|
| 3681 | + if (!dev->ieee80211_ptr->preset_chandef.chan) { |
|---|
| 3688 | 3682 | WL_ERR(("chan is NULL\n")); |
|---|
| 3689 | 3683 | err = -EINVAL; |
|---|
| 3690 | 3684 | goto fail; |
|---|
| 3691 | 3685 | } |
|---|
| 3692 | 3686 | if ((err = wl_cfg80211_set_channel(wiphy, dev, |
|---|
| 3693 | | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) |
|---|
| 3694 | | - dev->ieee80211_ptr->u.ap.preset_chandef.chan, |
|---|
| 3695 | | -#else |
|---|
| 3696 | | - dev->ieee80211_ptr->preset_chandef.chan, |
|---|
| 3697 | | -#endif |
|---|
| 3698 | | - NL80211_CHAN_HT20) < 0)) { |
|---|
| 3687 | + dev->ieee80211_ptr->preset_chandef.chan, |
|---|
| 3688 | + NL80211_CHAN_HT20) < 0)) { |
|---|
| 3699 | 3689 | WL_ERR(("Set channel failed \n")); |
|---|
| 3700 | 3690 | goto fail; |
|---|
| 3701 | 3691 | } |
|---|
| .. | .. |
|---|
| 3789 | 3779 | if (err) { |
|---|
| 3790 | 3780 | WL_ERR(("ADD/SET beacon failed\n")); |
|---|
| 3791 | 3781 | wl_flush_fw_log_buffer(dev, FW_LOGSET_MASK_ALL); |
|---|
| 3792 | | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) |
|---|
| 3793 | | - wl_cfg80211_stop_ap(wiphy, dev, 0); |
|---|
| 3794 | | -#else |
|---|
| 3795 | 3782 | wl_cfg80211_stop_ap(wiphy, dev); |
|---|
| 3796 | | -#endif |
|---|
| 3797 | 3783 | if (dev_role == NL80211_IFTYPE_AP) { |
|---|
| 3798 | 3784 | #ifdef WL_EXT_IAPSTA |
|---|
| 3799 | 3785 | if (!wl_ext_iapsta_iftype_enabled(dev, WL_IF_TYPE_AP)) { |
|---|
| .. | .. |
|---|
| 3834 | 3820 | s32 |
|---|
| 3835 | 3821 | wl_cfg80211_stop_ap( |
|---|
| 3836 | 3822 | struct wiphy *wiphy, |
|---|
| 3837 | | - struct net_device *dev |
|---|
| 3838 | | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) |
|---|
| 3839 | | - , unsigned int link_id |
|---|
| 3840 | | -#endif |
|---|
| 3841 | | - ) |
|---|
| 3823 | + struct net_device *dev) |
|---|
| 3842 | 3824 | { |
|---|
| 3843 | 3825 | int err = 0; |
|---|
| 3844 | 3826 | u32 dev_role = 0; |
|---|
| .. | .. |
|---|
| 4522 | 4504 | (reason == WLC_E_REASON_INITIAL_ASSOC) && |
|---|
| 4523 | 4505 | (wl_get_mode_by_netdev(cfg, ndev) == WL_MODE_AP)) { |
|---|
| 4524 | 4506 | if (!wl_get_drv_status(cfg, AP_CREATED, ndev)) { |
|---|
| 4525 | | - char chan_str[64]; |
|---|
| 4526 | 4507 | /* AP/GO brought up successfull in firmware */ |
|---|
| 4527 | | - wl_ext_get_chan_str(ndev, chan_str, sizeof(chan_str)); |
|---|
| 4528 | | - WL_MSG(ndev->name, "AP/GO Link up (%s)\n", chan_str); |
|---|
| 4508 | + WL_MSG(ndev->name, "AP/GO Link up\n"); |
|---|
| 4529 | 4509 | wl_set_drv_status(cfg, AP_CREATED, ndev); |
|---|
| 4530 | 4510 | if (delayed_work_pending(&cfg->ap_work)) { |
|---|
| 4531 | 4511 | cancel_delayed_work_sync(&cfg->ap_work); |
|---|
| .. | .. |
|---|
| 5105 | 5085 | } |
|---|
| 5106 | 5086 | #endif /* WL_CFG80211_ACL */ |
|---|
| 5107 | 5087 | |
|---|
| 5088 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) |
|---|
| 5108 | 5089 | int wl_chspec_chandef(chanspec_t chanspec, |
|---|
| 5109 | | - 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) |
|---|
| 5110 | 5096 | { |
|---|
| 5111 | 5097 | uint16 freq = 0; |
|---|
| 5098 | + int chan_type = 0; |
|---|
| 5099 | + int channel = 0; |
|---|
| 5112 | 5100 | struct ieee80211_channel *chan; |
|---|
| 5113 | 5101 | |
|---|
| 5114 | 5102 | if (!chandef) { |
|---|
| 5115 | 5103 | return -1; |
|---|
| 5116 | | - } else { |
|---|
| 5117 | | - memset(chandef, 0, sizeof(*chandef)); |
|---|
| 5118 | 5104 | } |
|---|
| 5119 | | - |
|---|
| 5120 | | -#if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) |
|---|
| 5121 | | - chandef->center_freq1 = wl_channel_to_frequency(CHSPEC_CHANNEL(chanspec), CHSPEC_BAND(chanspec)); |
|---|
| 5122 | | - freq = wl_channel_to_frequency(wf_chspec_primary20_chan(chanspec), CHSPEC_BAND(chanspec)); |
|---|
| 5123 | | - chandef->chan = ieee80211_get_channel(wiphy, freq); |
|---|
| 5124 | | - chandef->center_freq2 = 0; |
|---|
| 5105 | + channel = CHSPEC_CHANNEL(chanspec); |
|---|
| 5125 | 5106 | |
|---|
| 5126 | 5107 | switch (CHSPEC_BW(chanspec)) { |
|---|
| 5127 | 5108 | case WL_CHANSPEC_BW_20: |
|---|
| 5128 | | - chandef->width = NL80211_CHAN_WIDTH_20; |
|---|
| 5109 | + chan_type = NL80211_CHAN_HT20; |
|---|
| 5129 | 5110 | break; |
|---|
| 5130 | | - |
|---|
| 5131 | 5111 | case WL_CHANSPEC_BW_40: |
|---|
| 5132 | | - 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; |
|---|
| 5133 | 5120 | break; |
|---|
| 5134 | 5121 | |
|---|
| 5122 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) |
|---|
| 5135 | 5123 | case WL_CHANSPEC_BW_80: |
|---|
| 5136 | | - chandef->width = NL80211_CHAN_WIDTH_80; |
|---|
| 5137 | | - break; |
|---|
| 5138 | | - |
|---|
| 5139 | 5124 | case WL_CHANSPEC_BW_8080: |
|---|
| 5140 | 5125 | { |
|---|
| 5141 | | - /* XXX Left as is but need proper calculation for center_freq2 is used */ |
|---|
| 5142 | | - int chan_type = 0; |
|---|
| 5143 | | - int channel = 0; |
|---|
| 5144 | 5126 | uint16 sb = CHSPEC_CTL_SB(chanspec); |
|---|
| 5145 | 5127 | |
|---|
| 5146 | 5128 | if (sb == WL_CHANSPEC_CTL_SB_LL) { |
|---|
| .. | .. |
|---|
| 5158 | 5140 | chan_type = NL80211_CHAN_HT40MINUS; |
|---|
| 5159 | 5141 | else if (sb == WL_CHANSPEC_CTL_SB_UL || sb == WL_CHANSPEC_CTL_SB_UU) |
|---|
| 5160 | 5142 | chan_type = NL80211_CHAN_HT40PLUS; |
|---|
| 5161 | | - freq = wl_channel_to_frequency(channel, CHSPEC_BAND(chanspec)); |
|---|
| 5162 | | - chan = ieee80211_get_channel(wiphy, freq); |
|---|
| 5163 | | - cfg80211_chandef_create(chandef, chan, chan_type); |
|---|
| 5164 | | - return 0; |
|---|
| 5165 | | - break; |
|---|
| 5166 | 5143 | } |
|---|
| 5167 | | - |
|---|
| 5144 | + break; |
|---|
| 5168 | 5145 | case WL_CHANSPEC_BW_160: |
|---|
| 5169 | | - chandef->width = NL80211_CHAN_WIDTH_160; |
|---|
| 5170 | | - break; |
|---|
| 5171 | | - default: |
|---|
| 5172 | | - chandef->width = NL80211_CHAN_WIDTH_20; |
|---|
| 5173 | | - break; |
|---|
| 5174 | | - } |
|---|
| 5175 | | - |
|---|
| 5176 | | -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && \ |
|---|
| 5177 | | - (LINUX_VERSION_CODE <= KERNEL_VERSION (3, 7, 0))) |
|---|
| 5178 | | - |
|---|
| 5179 | | - int chan_type = 0; |
|---|
| 5180 | | - int channel = 0; |
|---|
| 5181 | | - channel = CHSPEC_CHANNEL(chanspec); |
|---|
| 5182 | | - switch (CHSPEC_BW(chanspec)) { |
|---|
| 5183 | | - 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 */ |
|---|
| 5184 | 5148 | chan_type = NL80211_CHAN_HT20; |
|---|
| 5185 | 5149 | break; |
|---|
| 5186 | | - case WL_CHANSPEC_BW_40: |
|---|
| 5187 | | - if (CHSPEC_SB_UPPER(chanspec)) { |
|---|
| 5188 | | - channel += CH_10MHZ_APART; |
|---|
| 5189 | | - } else { |
|---|
| 5190 | | - channel -= CH_10MHZ_APART; |
|---|
| 5191 | | - } |
|---|
| 5192 | | - chan_type = NL80211_CHAN_HT40PLUS; |
|---|
| 5193 | | - break; |
|---|
| 5194 | | - |
|---|
| 5150 | +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) */ |
|---|
| 5195 | 5151 | default: |
|---|
| 5196 | 5152 | chan_type = NL80211_CHAN_HT20; |
|---|
| 5197 | 5153 | break; |
|---|
| 5198 | | - } |
|---|
| 5199 | 5154 | |
|---|
| 5155 | + } |
|---|
| 5200 | 5156 | freq = wl_channel_to_frequency(channel, CHSPEC_BAND(chanspec)); |
|---|
| 5201 | 5157 | chan = ieee80211_get_channel(wiphy, freq); |
|---|
| 5202 | 5158 | WL_DBG(("channel:%d freq:%d chan_type: %d chan_ptr:%p \n", |
|---|
| .. | .. |
|---|
| 5208 | 5164 | return -EINVAL; |
|---|
| 5209 | 5165 | } |
|---|
| 5210 | 5166 | |
|---|
| 5211 | | - chandef->freq = freq; |
|---|
| 5212 | | - 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; |
|---|
| 5213 | 5172 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) */ |
|---|
| 5214 | | - |
|---|
| 5215 | 5173 | return 0; |
|---|
| 5216 | 5174 | } |
|---|
| 5217 | 5175 | |
|---|
| 5218 | | -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) |
|---|
| 5219 | 5176 | void |
|---|
| 5220 | 5177 | wl_cfg80211_ch_switch_notify(struct net_device *dev, uint16 chanspec, struct wiphy *wiphy) |
|---|
| 5221 | 5178 | { |
|---|
| 5222 | 5179 | u32 freq; |
|---|
| 5180 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) |
|---|
| 5223 | 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)) */ |
|---|
| 5224 | 5185 | |
|---|
| 5225 | 5186 | if (!wiphy) { |
|---|
| 5226 | 5187 | WL_ERR(("wiphy is null\n")); |
|---|
| .. | .. |
|---|
| 5235 | 5196 | } |
|---|
| 5236 | 5197 | #endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION (3, 18, 0)) */ |
|---|
| 5237 | 5198 | |
|---|
| 5238 | | - 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 | + { |
|---|
| 5239 | 5205 | WL_ERR(("chspec_chandef failed\n")); |
|---|
| 5240 | 5206 | return; |
|---|
| 5241 | 5207 | } |
|---|
| 5242 | | - |
|---|
| 5243 | 5208 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) |
|---|
| 5244 | 5209 | freq = chandef.chan ? chandef.chan->center_freq : chandef.center_freq1; |
|---|
| 5245 | | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) |
|---|
| 5246 | | - cfg80211_ch_switch_notify(dev, &chandef, 0); |
|---|
| 5247 | | -#else |
|---|
| 5248 | 5210 | cfg80211_ch_switch_notify(dev, &chandef); |
|---|
| 5249 | | -#endif |
|---|
| 5250 | 5211 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && (LINUX_VERSION_CODE <= (3, 7, 0))) |
|---|
| 5251 | | - freq = chandef.freq; |
|---|
| 5252 | | - 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); |
|---|
| 5253 | 5214 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) */ |
|---|
| 5254 | 5215 | |
|---|
| 5255 | 5216 | WL_MSG(dev->name, "Channel switch notification for freq: %d chanspec: 0x%x\n", |
|---|