From bedbef8ad3e75a304af6361af235302bcc61d06b Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Tue, 14 May 2024 06:39:01 +0000 Subject: [PATCH] 修改内核路径 --- kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgvif.c | 139 ++++++++++++++++----------------------------- 1 files changed, 50 insertions(+), 89 deletions(-) diff --git a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgvif.c b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgvif.c old mode 100644 new mode 100755 index f5d6910..e3b6001 --- a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgvif.c +++ b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfgvif.c @@ -1571,9 +1571,8 @@ #endif chspec = wl_freq_to_chanspec(center_freq); - WL_MSG(dev->name, "netdev_ifidx(%d) chan_type(%d) target channel(%s-%d %sMHz)\n", - dev->ifindex, channel_type, CHSPEC2BANDSTR(chspec), - CHSPEC_CHANNEL(chspec), wf_chspec_to_bw_str(chspec)); + WL_MSG(dev->name, "netdev_ifidx(%d), chan_type(%d) target channel(%s-%d) \n", + dev->ifindex, channel_type, CHSPEC2BANDSTR(chspec), CHSPEC_CHANNEL(chspec)); #ifdef WL_P2P_6G if (!(cfg->p2p_6g_enabled)) { @@ -2770,7 +2769,7 @@ dhd_pub_t *dhd = (dhd_pub_t *)(cfg->pub); #endif /* WLEASYMESH */ - new_chip = dhd_conf_new_chip_check(cfg->pub); + new_chip = wl_new_chip_check(dev); if ((bssidx = wl_get_bssidx_by_wdev(cfg, dev->ieee80211_ptr)) < 0) { WL_ERR(("Find p2p index from wdev(%p) failed\n", dev->ieee80211_ptr)); @@ -3679,23 +3678,14 @@ * hardcoded values in 'wl_cfg80211_set_channel()'. */ #if ((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) && !defined(WL_COMPAT_WIRELESS)) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) - if (!dev->ieee80211_ptr->u.ap.preset_chandef.chan) -#else - if (!dev->ieee80211_ptr->preset_chandef.chan) -#endif - { + if (!dev->ieee80211_ptr->preset_chandef.chan) { WL_ERR(("chan is NULL\n")); err = -EINVAL; goto fail; } if ((err = wl_cfg80211_set_channel(wiphy, dev, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) - dev->ieee80211_ptr->u.ap.preset_chandef.chan, -#else - dev->ieee80211_ptr->preset_chandef.chan, -#endif - NL80211_CHAN_HT20) < 0)) { + dev->ieee80211_ptr->preset_chandef.chan, + NL80211_CHAN_HT20) < 0)) { WL_ERR(("Set channel failed \n")); goto fail; } @@ -3789,11 +3779,7 @@ if (err) { WL_ERR(("ADD/SET beacon failed\n")); wl_flush_fw_log_buffer(dev, FW_LOGSET_MASK_ALL); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) - wl_cfg80211_stop_ap(wiphy, dev, 0); -#else wl_cfg80211_stop_ap(wiphy, dev); -#endif if (dev_role == NL80211_IFTYPE_AP) { #ifdef WL_EXT_IAPSTA if (!wl_ext_iapsta_iftype_enabled(dev, WL_IF_TYPE_AP)) { @@ -3834,11 +3820,7 @@ s32 wl_cfg80211_stop_ap( struct wiphy *wiphy, - struct net_device *dev -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) - , unsigned int link_id -#endif - ) + struct net_device *dev) { int err = 0; u32 dev_role = 0; @@ -4522,10 +4504,8 @@ (reason == WLC_E_REASON_INITIAL_ASSOC) && (wl_get_mode_by_netdev(cfg, ndev) == WL_MODE_AP)) { if (!wl_get_drv_status(cfg, AP_CREATED, ndev)) { - char chan_str[64]; /* AP/GO brought up successfull in firmware */ - wl_ext_get_chan_str(ndev, chan_str, sizeof(chan_str)); - WL_MSG(ndev->name, "AP/GO Link up (%s)\n", chan_str); + WL_MSG(ndev->name, "AP/GO Link up\n"); wl_set_drv_status(cfg, AP_CREATED, ndev); if (delayed_work_pending(&cfg->ap_work)) { cancel_delayed_work_sync(&cfg->ap_work); @@ -5105,42 +5085,44 @@ } #endif /* WL_CFG80211_ACL */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) int wl_chspec_chandef(chanspec_t chanspec, - struct cfg80211_chan_def *chandef, struct wiphy *wiphy) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) + struct cfg80211_chan_def *chandef, +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && (LINUX_VERSION_CODE <= (3, 7, 0))) + struct chan_info *chaninfo, +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) */ + struct wiphy *wiphy) { uint16 freq = 0; + int chan_type = 0; + int channel = 0; struct ieee80211_channel *chan; if (!chandef) { return -1; - } else { - memset(chandef, 0, sizeof(*chandef)); } - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) - chandef->center_freq1 = wl_channel_to_frequency(CHSPEC_CHANNEL(chanspec), CHSPEC_BAND(chanspec)); - freq = wl_channel_to_frequency(wf_chspec_primary20_chan(chanspec), CHSPEC_BAND(chanspec)); - chandef->chan = ieee80211_get_channel(wiphy, freq); - chandef->center_freq2 = 0; + channel = CHSPEC_CHANNEL(chanspec); switch (CHSPEC_BW(chanspec)) { case WL_CHANSPEC_BW_20: - chandef->width = NL80211_CHAN_WIDTH_20; + chan_type = NL80211_CHAN_HT20; break; - case WL_CHANSPEC_BW_40: - chandef->width = NL80211_CHAN_WIDTH_40; + { + if (CHSPEC_SB_UPPER(chanspec)) { + channel += CH_10MHZ_APART; + } else { + channel -= CH_10MHZ_APART; + } + } + chan_type = NL80211_CHAN_HT40PLUS; break; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) case WL_CHANSPEC_BW_80: - chandef->width = NL80211_CHAN_WIDTH_80; - break; - case WL_CHANSPEC_BW_8080: { - /* XXX Left as is but need proper calculation for center_freq2 is used */ - int chan_type = 0; - int channel = 0; uint16 sb = CHSPEC_CTL_SB(chanspec); if (sb == WL_CHANSPEC_CTL_SB_LL) { @@ -5158,45 +5140,19 @@ chan_type = NL80211_CHAN_HT40MINUS; else if (sb == WL_CHANSPEC_CTL_SB_UL || sb == WL_CHANSPEC_CTL_SB_UU) chan_type = NL80211_CHAN_HT40PLUS; - freq = wl_channel_to_frequency(channel, CHSPEC_BAND(chanspec)); - chan = ieee80211_get_channel(wiphy, freq); - cfg80211_chandef_create(chandef, chan, chan_type); - return 0; - break; } - + break; case WL_CHANSPEC_BW_160: - chandef->width = NL80211_CHAN_WIDTH_160; - break; - default: - chandef->width = NL80211_CHAN_WIDTH_20; - break; - } - -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && \ - (LINUX_VERSION_CODE <= KERNEL_VERSION (3, 7, 0))) - - int chan_type = 0; - int channel = 0; - channel = CHSPEC_CHANNEL(chanspec); - switch (CHSPEC_BW(chanspec)) { - case WL_CHANSPEC_BW_20: + channel = wf_chspec_primary20_chan(chanspec); + /* Using base chan_type as kernel does not define chan_type for 160 MHz */ chan_type = NL80211_CHAN_HT20; break; - case WL_CHANSPEC_BW_40: - if (CHSPEC_SB_UPPER(chanspec)) { - channel += CH_10MHZ_APART; - } else { - channel -= CH_10MHZ_APART; - } - chan_type = NL80211_CHAN_HT40PLUS; - break; - +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) */ default: chan_type = NL80211_CHAN_HT20; break; - } + } freq = wl_channel_to_frequency(channel, CHSPEC_BAND(chanspec)); chan = ieee80211_get_channel(wiphy, freq); WL_DBG(("channel:%d freq:%d chan_type: %d chan_ptr:%p \n", @@ -5208,19 +5164,24 @@ return -EINVAL; } - chandef->freq = freq; - chandef->chan_type = chan_type; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) + cfg80211_chandef_create(chandef, chan, chan_type); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && (LINUX_VERSION_CODE <= (3, 7, 0))) + chaninfo->freq = freq; + chaninfo->chan_type = chan_type; #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) */ - return 0; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) void wl_cfg80211_ch_switch_notify(struct net_device *dev, uint16 chanspec, struct wiphy *wiphy) { u32 freq; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) struct cfg80211_chan_def chandef; +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && (LINUX_VERSION_CODE <= (3, 7, 0))) + struct chan_info chaninfo; +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) */ if (!wiphy) { WL_ERR(("wiphy is null\n")); @@ -5235,21 +5196,21 @@ } #endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION (3, 18, 0)) */ - if (wl_chspec_chandef(chanspec, &chandef, wiphy)) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) + if (wl_chspec_chandef(chanspec, &chandef, wiphy)) +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && (LINUX_VERSION_CODE <= (3, 7, 0))) + if (wl_chspec_chandef(chanspec, &chaninfo, wiphy)) +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) */ + { WL_ERR(("chspec_chandef failed\n")); return; } - #if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) freq = chandef.chan ? chandef.chan->center_freq : chandef.center_freq1; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) - cfg80211_ch_switch_notify(dev, &chandef, 0); -#else cfg80211_ch_switch_notify(dev, &chandef); -#endif #elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && (LINUX_VERSION_CODE <= (3, 7, 0))) - freq = chandef.freq; - cfg80211_ch_switch_notify(dev, freq, chandef.chan_type); + freq = chan_info.freq; + cfg80211_ch_switch_notify(dev, freq, chan_info.chan_type); #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) */ WL_MSG(dev->name, "Channel switch notification for freq: %d chanspec: 0x%x\n", -- Gitblit v1.6.2