diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile index fdeb14e46c73bd..9c0029d3bdb228 100644 --- a/package/kernel/ath10k-ct/Makefile +++ b/package/kernel/ath10k-ct/Makefile @@ -1,21 +1,21 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath10k-ct -PKG_RELEASE:=5 +PKG_RELEASE:=1 PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2022-05-13 -PKG_SOURCE_VERSION:=f808496fcc6b1f68942914117aebf8b3f8d52bb3 -PKG_MIRROR_HASH:=39527b3408696594eda5579521a9fb798417be4dda73fa08e8b3a8c7b0d3f3d9 +PKG_SOURCE_DATE:=2023-06-05 +PKG_SOURCE_VERSION:=fadd0768cbd22248a60efbb219ccefc9d86cd78c +PKG_MIRROR_HASH:=513f62765ba3a2f423099426fbba86b854f3de0ab13ec2ab6e2780577ea75f95 -# Build the 5.15 ath10k-ct driver version. +# Build the 6.4 ath10k-ct driver version. # Probably this should match as closely as # possible to whatever mac80211 backports version is being used. -CT_KVER="-5.15" +CT_KVER="-6.4" PKG_MAINTAINER:=Ben Greear PKG_BUILD_PARALLEL:=1 diff --git a/package/kernel/ath10k-ct/patches/100-api_update.patch b/package/kernel/ath10k-ct/patches/100-api_update.patch deleted file mode 100644 index 5343c29eb9d2dc..00000000000000 --- a/package/kernel/ath10k-ct/patches/100-api_update.patch +++ /dev/null @@ -1,618 +0,0 @@ ---- a/ath10k-5.15/mac.c -+++ b/ath10k-5.15/mac.c -@@ -788,7 +788,7 @@ int ath10k_mac_vif_chan(struct ieee80211 - struct ieee80211_chanctx_conf *conf; - - rcu_read_lock(); -- conf = rcu_dereference(vif->chanctx_conf); -+ conf = rcu_dereference(vif->bss_conf.chanctx_conf); - if (!conf) { - rcu_read_unlock(); - return -ENOENT; -@@ -1764,8 +1764,8 @@ static int ath10k_vdev_start_restart(str - arg.channel.chan_radar = - !!(chandef->chan->flags & IEEE80211_CHAN_RADAR); - } else if (arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { -- arg.ssid = arvif->vif->bss_conf.ssid; -- arg.ssid_len = arvif->vif->bss_conf.ssid_len; -+ arg.ssid = arvif->vif->cfg.ssid; -+ arg.ssid_len = arvif->vif->cfg.ssid_len; - } - - ath10k_dbg(ar, ATH10K_DBG_MAC, -@@ -1890,7 +1890,7 @@ static int ath10k_mac_setup_bcn_tmpl(str - arvif->vdev_type != WMI_VDEV_TYPE_IBSS) - return 0; - -- bcn = ieee80211_beacon_get_template(hw, vif, &offs); -+ bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0); - if (!bcn) { - ath10k_warn(ar, "failed to get beacon template from mac80211\n"); - return -EPERM; -@@ -2083,8 +2083,7 @@ static void ath10k_control_beaconing(str - } - - static void ath10k_control_ibss(struct ath10k_vif *arvif, -- struct ieee80211_bss_conf *info, -- const u8 self_peer[ETH_ALEN]) -+ struct ieee80211_vif *vif) - { - struct ath10k *ar = arvif->ar; - u32 vdev_param; -@@ -2092,7 +2091,7 @@ static void ath10k_control_ibss(struct a - - lockdep_assert_held(&arvif->ar->conf_mutex); - -- if (!info->ibss_joined) { -+ if (!vif->cfg.ibss_joined) { - if (is_zero_ether_addr(arvif->bssid)) - return; - -@@ -2298,7 +2297,7 @@ static void ath10k_mac_vif_ap_csa_count_ - if (arvif->vdev_type != WMI_VDEV_TYPE_AP) - return; - -- if (!vif->csa_active) -+ if (!vif->bss_conf.csa_active) - return; - - if (!arvif->is_up) -@@ -2433,7 +2432,7 @@ static void ath10k_peer_assoc_h_basic(st - lockdep_assert_held(&ar->conf_mutex); - - if (vif->type == NL80211_IFTYPE_STATION) -- aid = vif->bss_conf.aid; -+ aid = vif->cfg.aid; - else - aid = sta->aid; - -@@ -2463,7 +2462,8 @@ static void ath10k_peer_assoc_h_crypto(s - return; - - bss = cfg80211_get_bss(ar->hw->wiphy, def.chan, info->bssid, -- info->ssid_len ? info->ssid : NULL, info->ssid_len, -+ vif->cfg.ssid_len ? vif->cfg.ssid : NULL, -+ vif->cfg.ssid_len, - IEEE80211_BSS_TYPE_ANY, IEEE80211_PRIVACY_ANY); - if (bss) { - const struct cfg80211_bss_ies *ies; -@@ -2521,7 +2521,7 @@ static void ath10k_peer_assoc_h_rates(st - - band = def.chan->band; - sband = ar->hw->wiphy->bands[band]; -- ratemask = sta->supp_rates[band]; -+ ratemask = sta->deflink.supp_rates[band]; - ratemask &= arvif->bitrate_mask.control[band].legacy; - rates = sband->bitrates; - -@@ -2770,7 +2770,7 @@ static void ath10k_peer_assoc_h_ht(struc - struct ieee80211_sta *sta, - struct wmi_peer_assoc_complete_arg *arg) - { -- const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; -+ const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; - struct ath10k_vif *arvif = (void *)vif->drv_priv; - struct cfg80211_chan_def def; - enum nl80211_band band; -@@ -2814,7 +2814,7 @@ static void ath10k_peer_assoc_h_ht(struc - if (ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING) - arg->peer_flags |= ar->wmi.peer_flags->ldbc; - -- if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) { -+ if (sta->deflink.bandwidth >= IEEE80211_STA_RX_BW_40) { - arg->peer_flags |= ar->wmi.peer_flags->bw40; - arg->peer_rate_caps |= WMI_RC_CW40_FLAG; - } -@@ -2883,7 +2883,7 @@ static void ath10k_peer_assoc_h_ht(struc - arg->peer_ht_rates.rates[i] = i; - } else { - arg->peer_ht_rates.num_rates = n; -- arg->peer_num_spatial_streams = min(sta->rx_nss, max_nss); -+ arg->peer_num_spatial_streams = min(sta->deflink.rx_nss, max_nss); - } - - ath10k_dbg(ar, ATH10K_DBG_MAC, "mac ht peer %pM mcs cnt %d nss %d\n", -@@ -3045,7 +3045,7 @@ static void ath10k_peer_assoc_h_vht(stru - struct ieee80211_sta *sta, - struct wmi_peer_assoc_complete_arg *arg) - { -- const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; -+ const struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; - struct ath10k_vif *arvif = (void *)vif->drv_priv; - struct ath10k_hw_params *hw = &ar->hw_params; - struct cfg80211_chan_def def; -@@ -3087,10 +3087,10 @@ static void ath10k_peer_assoc_h_vht(stru - (1U << (IEEE80211_HT_MAX_AMPDU_FACTOR + - ampdu_factor)) - 1); - -- if (sta->bandwidth == IEEE80211_STA_RX_BW_80) -+ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) - arg->peer_flags |= ar->wmi.peer_flags->bw80; - -- if (sta->bandwidth == IEEE80211_STA_RX_BW_160) -+ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) - arg->peer_flags |= ar->wmi.peer_flags->bw160; - - /* Calculate peer NSS capability from VHT capabilities if STA -@@ -3104,7 +3104,7 @@ static void ath10k_peer_assoc_h_vht(stru - vht_mcs_mask[i]) - max_nss = i + 1; - } -- arg->peer_num_spatial_streams = min(sta->rx_nss, max_nss); -+ arg->peer_num_spatial_streams = min(sta->deflink.rx_nss, max_nss); - arg->peer_vht_rates.rx_max_rate = - __le16_to_cpu(vht_cap->vht_mcs.rx_highest); - arg->peer_vht_rates.rx_mcs_set = -@@ -3266,7 +3266,7 @@ static bool ath10k_mac_sta_has_ofdm_only - { - struct ath10k_vif *arvif = (void *)vif->drv_priv; - u32 msk = arvif->bitrate_mask.control[NL80211_BAND_2GHZ].legacy & -- sta->supp_rates[NL80211_BAND_2GHZ]; -+ sta->deflink.supp_rates[NL80211_BAND_2GHZ]; - /* We have 12 bits of legacy rates, first 4 are /b (CCK) rates. */ - return (msk & 0xff0) && !(msk & 0xf); - } -@@ -3276,7 +3276,7 @@ static bool ath10k_mac_sta_has_ofdm_and_ - { - struct ath10k_vif *arvif = (void *)vif->drv_priv; - u32 msk = arvif->bitrate_mask.control[NL80211_BAND_2GHZ].legacy & -- sta->supp_rates[NL80211_BAND_2GHZ]; -+ sta->deflink.supp_rates[NL80211_BAND_2GHZ]; - /* We have 12 bits of legacy rates, first 4 are /b (CCK) rates. */ - return ((msk & 0xf) && (msk & 0xff0)); - } -@@ -3284,8 +3284,10 @@ static bool ath10k_mac_sta_has_ofdm_and_ - static enum wmi_phy_mode ath10k_mac_get_phymode_vht(struct ath10k *ar, - struct ieee80211_sta *sta) - { -- if (sta->bandwidth == IEEE80211_STA_RX_BW_160) { -- switch (sta->vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) { -+ struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; -+ -+ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) { -+ switch (vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) { - case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ: - return MODE_11AC_VHT160; - case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ: -@@ -3296,13 +3298,13 @@ static enum wmi_phy_mode ath10k_mac_get_ - } - } - -- if (sta->bandwidth == IEEE80211_STA_RX_BW_80) -+ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) - return MODE_11AC_VHT80; - -- if (sta->bandwidth == IEEE80211_STA_RX_BW_40) -+ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) - return MODE_11AC_VHT40; - -- if (sta->bandwidth == IEEE80211_STA_RX_BW_20) -+ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_20) - return MODE_11AC_VHT20; - - return MODE_UNKNOWN; -@@ -3329,15 +3331,15 @@ static void ath10k_peer_assoc_h_phymode( - - switch (band) { - case NL80211_BAND_2GHZ: -- if (sta->vht_cap.vht_supported && -+ if (sta->deflink.vht_cap.vht_supported && - !ath10k_peer_assoc_h_vht_masked(vht_mcs_mask)) { -- if (sta->bandwidth == IEEE80211_STA_RX_BW_40) -+ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) - phymode = MODE_11AC_VHT40; - else - phymode = MODE_11AC_VHT20; -- } else if (sta->ht_cap.ht_supported && -+ } else if (sta->deflink.ht_cap.ht_supported && - !ath10k_peer_assoc_h_ht_masked(ht_mcs_mask)) { -- if (sta->bandwidth == IEEE80211_STA_RX_BW_40) -+ if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) - phymode = MODE_11NG_HT40; - else - phymode = MODE_11NG_HT20; -@@ -3354,12 +3356,12 @@ static void ath10k_peer_assoc_h_phymode( - /* - * Check VHT first. - */ -- if (sta->vht_cap.vht_supported && -+ if (sta->deflink.vht_cap.vht_supported && - !ath10k_peer_assoc_h_vht_masked(vht_mcs_mask)) { - phymode = ath10k_mac_get_phymode_vht(ar, sta); -- } else if (sta->ht_cap.ht_supported && -+ } else if (sta->deflink.ht_cap.ht_supported && - !ath10k_peer_assoc_h_ht_masked(ht_mcs_mask)) { -- if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) -+ if (sta->deflink.bandwidth >= IEEE80211_STA_RX_BW_40) - phymode = MODE_11NA_HT40; - else - phymode = MODE_11NA_HT20; -@@ -3373,8 +3375,8 @@ static void ath10k_peer_assoc_h_phymode( - } - - ath10k_dbg(ar, ATH10K_DBG_MAC, "mac peer %pM phymode %s legacy-supp-rates: 0x%x arvif-legacy-rates: 0x%x vht-supp: %d\n", -- sta->addr, ath10k_wmi_phymode_str(phymode), sta->supp_rates[band], -- arvif->bitrate_mask.control[band].legacy, sta->vht_cap.vht_supported); -+ sta->addr, ath10k_wmi_phymode_str(phymode), sta->deflink.supp_rates[band], -+ arvif->bitrate_mask.control[band].legacy, sta->deflink.vht_cap.vht_supported); - - arg->peer_phymode = phymode; - WARN_ON(phymode == MODE_UNKNOWN); -@@ -3677,8 +3679,8 @@ static void ath10k_bss_assoc(struct ieee - /* ap_sta must be accessed only within rcu section which must be left - * before calling ath10k_setup_peer_smps() which might sleep. - */ -- ht_cap = ap_sta->ht_cap; -- vht_cap = ap_sta->vht_cap; -+ ht_cap = ap_sta->deflink.ht_cap; -+ vht_cap = ap_sta->deflink.vht_cap; - - ret = ath10k_peer_assoc_prepare(ar, vif, ap_sta, &peer_arg); - if (ret) { -@@ -3713,11 +3715,11 @@ static void ath10k_bss_assoc(struct ieee - - ath10k_dbg(ar, ATH10K_DBG_MAC, - "mac vdev %d up (associated) bssid %pM aid %d bandwidth %d\n", -- arvif->vdev_id, bss_conf->bssid, bss_conf->aid, ap_sta->bandwidth); -+ arvif->vdev_id, bss_conf->bssid, vif->cfg.aid, ap_sta->deflink.bandwidth); - - WARN_ON(arvif->is_up); - -- arvif->aid = bss_conf->aid; -+ arvif->aid = vif->cfg.aid; - ether_addr_copy(arvif->bssid, bss_conf->bssid); - - ret = ath10k_wmi_pdev_set_param(ar, -@@ -4022,7 +4024,7 @@ static int ath10k_station_assoc(struct a - */ - if (!reassoc) { - ret = ath10k_setup_peer_smps(ar, arvif, sta->addr, -- &sta->ht_cap); -+ &sta->deflink.ht_cap); - if (ret) { - ath10k_warn(ar, "failed to setup peer SMPS for vdev %d: %d\n", - arvif->vdev_id, ret); -@@ -6916,7 +6918,7 @@ static void ath10k_recalculate_mgmt_rate - static void ath10k_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *info, -- u32 changed) -+ u64 changed) - { - struct ath10k *ar = hw->priv; - struct ath10k_vif *arvif = (void *)vif->drv_priv; -@@ -6930,7 +6932,7 @@ static void ath10k_bss_info_changed(stru - mutex_lock(&ar->conf_mutex); - - if (changed & BSS_CHANGED_IBSS) -- ath10k_control_ibss(arvif, info, vif->addr); -+ ath10k_control_ibss(arvif, vif); - - if (changed & BSS_CHANGED_BEACON_INT) { - arvif->beacon_interval = info->beacon_int; -@@ -6995,9 +6997,9 @@ static void ath10k_bss_info_changed(stru - - if (changed & BSS_CHANGED_SSID && - vif->type == NL80211_IFTYPE_AP) { -- arvif->u.ap.ssid_len = info->ssid_len; -- if (info->ssid_len) -- memcpy(arvif->u.ap.ssid, info->ssid, info->ssid_len); -+ arvif->u.ap.ssid_len = vif->cfg.ssid_len; -+ if (vif->cfg.ssid_len) -+ memcpy(arvif->u.ap.ssid, vif->cfg.ssid, vif->cfg.ssid_len); - arvif->u.ap.hidden_ssid = info->hidden_ssid; - } - -@@ -7074,7 +7076,7 @@ static void ath10k_bss_info_changed(stru - } - - if (changed & BSS_CHANGED_ASSOC) { -- if (info->assoc) { -+ if (vif->cfg.assoc) { - /* Workaround: Make sure monitor vdev is not running - * when associating to prevent some firmware revisions - * (e.g. 10.1 and 10.2) from crashing. -@@ -7099,7 +7101,7 @@ static void ath10k_bss_info_changed(stru - } - - if (changed & BSS_CHANGED_PS) { -- arvif->ps = vif->bss_conf.ps; -+ arvif->ps = vif->cfg.ps; - - ret = ath10k_config_ps(ar); - if (ret) -@@ -7699,7 +7701,7 @@ static void ath10k_sta_rc_update_wk(stru - - if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) { - ath10k_dbg(ar, ATH10K_DBG_STA, "mac update sta %pM supp rates, bandwidth: %d\n", -- sta->addr, sta->bandwidth); -+ sta->addr, sta->deflink.bandwidth); - - err = ath10k_station_assoc(ar, arvif->vif, sta, true); - if (err) -@@ -7751,10 +7753,10 @@ static int ath10k_sta_set_txpwr(struct i - int ret = 0; - s16 txpwr; - -- if (sta->txpwr.type == NL80211_TX_POWER_AUTOMATIC) { -+ if (sta->deflink.txpwr.type == NL80211_TX_POWER_AUTOMATIC) { - txpwr = 0; - } else { -- txpwr = sta->txpwr.power; -+ txpwr = sta->deflink.txpwr.power; - if (!txpwr) - return -EINVAL; - } -@@ -7874,26 +7876,29 @@ static int ath10k_mac_validate_rate_mask - struct ieee80211_sta *sta, - u32 rate_ctrl_flag, u8 nss) - { -- if (nss > sta->rx_nss) { -+ struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; -+ struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; -+ -+ if (nss > sta->deflink.rx_nss) { - ath10k_warn(ar, "Invalid nss field, configured %u limit %u\n", -- nss, sta->rx_nss); -+ nss, sta->deflink.rx_nss); - return -EINVAL; - } - - if (ATH10K_HW_PREAMBLE(rate_ctrl_flag) == WMI_RATE_PREAMBLE_VHT) { -- if (!sta->vht_cap.vht_supported) { -+ if (!vht_cap->vht_supported) { - ath10k_warn(ar, "Invalid VHT rate for sta %pM\n", - sta->addr); - return -EINVAL; - } - } else if (ATH10K_HW_PREAMBLE(rate_ctrl_flag) == WMI_RATE_PREAMBLE_HT) { -- if (!sta->ht_cap.ht_supported || sta->vht_cap.vht_supported) { -+ if (!ht_cap->ht_supported || vht_cap->vht_supported) { - ath10k_warn(ar, "Invalid HT rate for sta %pM\n", - sta->addr); - return -EINVAL; - } - } else { -- if (sta->ht_cap.ht_supported || sta->vht_cap.vht_supported) -+ if (ht_cap->ht_supported || vht_cap->vht_supported) - return -EINVAL; - } - -@@ -8567,7 +8572,7 @@ static int ath10k_sta_state(struct ieee8 - * New association. - */ - ath10k_dbg(ar, ATH10K_DBG_STA, "mac sta %pM associated, bandwidth: %d\n", -- sta->addr, sta->bandwidth); -+ sta->addr, sta->deflink.bandwidth); - - ret = ath10k_station_assoc(ar, vif, sta, false); - if (ret) -@@ -8580,7 +8585,7 @@ static int ath10k_sta_state(struct ieee8 - * Tdls station authorized. - */ - ath10k_dbg(ar, ATH10K_DBG_STA, "mac tdls sta %pM authorized, bandwidth: %d\n", -- sta->addr, sta->bandwidth); -+ sta->addr, sta->deflink.bandwidth); - - ret = ath10k_station_assoc(ar, vif, sta, false); - if (ret) { -@@ -8721,8 +8726,8 @@ exit: - return ret; - } - --static int ath10k_conf_tx(struct ieee80211_hw *hw, -- struct ieee80211_vif *vif, u16 ac, -+static int ath10k_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, -+ unsigned int link_id, u16 ac, - const struct ieee80211_tx_queue_params *params) - { - struct ath10k *ar = hw->priv; -@@ -9308,7 +9313,7 @@ static bool ath10k_mac_set_vht_bitrate_m - u8 rate = arvif->vht_pfr; - - /* skip non vht and multiple rate peers */ -- if (!sta->vht_cap.vht_supported || arvif->vht_num_rates != 1) -+ if (!sta->deflink.vht_cap.vht_supported || arvif->vht_num_rates != 1) - return false; - - err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, -@@ -9349,7 +9354,7 @@ static void ath10k_mac_clr_bitrate_mask_ - int err; - - /* clear vht peers only */ -- if (arsta->arvif != arvif || !sta->vht_cap.vht_supported) -+ if (arsta->arvif != arvif || !sta->deflink.vht_cap.vht_supported) - return; - - err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, -@@ -9534,13 +9539,13 @@ static void ath10k_sta_rc_update(struct - - ath10k_dbg(ar, ATH10K_DBG_STA, - "mac sta rc update for %pM changed %08x bw %d nss %d smps %d\n", -- sta->addr, changed, sta->bandwidth, sta->rx_nss, -- sta->smps_mode); -+ sta->addr, changed, sta->deflink.bandwidth, sta->deflink.rx_nss, -+ sta->deflink.smps_mode); - - if (changed & IEEE80211_RC_BW_CHANGED) { - bw = WMI_PEER_CHWIDTH_20MHZ; - -- switch (sta->bandwidth) { -+ switch (sta->deflink.bandwidth) { - case IEEE80211_STA_RX_BW_20: - bw = WMI_PEER_CHWIDTH_20MHZ; - break; -@@ -9555,7 +9560,7 @@ static void ath10k_sta_rc_update(struct - break; - default: - ath10k_warn(ar, "Invalid bandwidth %d in rc update for %pM\n", -- sta->bandwidth, sta->addr); -+ sta->deflink.bandwidth, sta->addr); - bw = WMI_PEER_CHWIDTH_20MHZ; - break; - } -@@ -9564,12 +9569,12 @@ static void ath10k_sta_rc_update(struct - } - - if (changed & IEEE80211_RC_NSS_CHANGED) -- arsta->nss = sta->rx_nss; -+ arsta->nss = sta->deflink.rx_nss; - - if (changed & IEEE80211_RC_SMPS_CHANGED) { - smps = WMI_PEER_SMPS_PS_NONE; - -- switch (sta->smps_mode) { -+ switch (sta->deflink.smps_mode) { - case IEEE80211_SMPS_AUTOMATIC: - case IEEE80211_SMPS_OFF: - smps = WMI_PEER_SMPS_PS_NONE; -@@ -9582,7 +9587,7 @@ static void ath10k_sta_rc_update(struct - break; - case IEEE80211_SMPS_NUM_MODES: - ath10k_warn(ar, "Invalid smps %d in sta rc update for %pM\n", -- sta->smps_mode, sta->addr); -+ sta->deflink.smps_mode, sta->addr); - smps = WMI_PEER_SMPS_PS_NONE; - break; - } -@@ -9896,7 +9901,7 @@ ath10k_mac_change_chanctx_cnt_iter(void - { - struct ath10k_mac_change_chanctx_arg *arg = data; - -- if (rcu_access_pointer(vif->chanctx_conf) != arg->ctx) -+ if (rcu_access_pointer(vif->bss_conf.chanctx_conf) != arg->ctx) - return; - - arg->n_vifs++; -@@ -9909,7 +9914,7 @@ ath10k_mac_change_chanctx_fill_iter(void - struct ath10k_mac_change_chanctx_arg *arg = data; - struct ieee80211_chanctx_conf *ctx; - -- ctx = rcu_access_pointer(vif->chanctx_conf); -+ ctx = rcu_access_pointer(vif->bss_conf.chanctx_conf); - if (ctx != arg->ctx) - return; - -@@ -9982,6 +9987,7 @@ unlock: - static int - ath10k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, -+ struct ieee80211_bss_conf *link_conf, - struct ieee80211_chanctx_conf *ctx) - { - struct ath10k *ar = hw->priv; -@@ -10061,6 +10067,7 @@ err: - static void - ath10k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, -+ struct ieee80211_bss_conf *link_conf, - struct ieee80211_chanctx_conf *ctx) - { - struct ath10k *ar = hw->priv; ---- a/ath10k-5.15/txrx.c -+++ b/ath10k-5.15/txrx.c -@@ -260,7 +260,7 @@ int ath10k_txrx_tx_unref(struct ath10k_h - nf = ar->debug.nf_sum[0]; - #endif - info->status.ack_signal = nf + tx_done->ack_rssi; -- info->status.is_valid_ack_signal = true; -+ info->status.flags |= IEEE80211_TX_STATUS_ACK_SIGNAL_VALID; - } - - if (tx_done->tx_rate_code || tx_done->tx_rate_flags || ar->ok_tx_rate_status) { ---- a/ath10k-5.15/wmi.c -+++ b/ath10k-5.15/wmi.c -@@ -2587,7 +2587,7 @@ wmi_process_mgmt_tx_comp(struct ath10k * - info->flags |= IEEE80211_TX_STAT_ACK; - info->status.ack_signal = ath10k_get_noisefloor(0, ar) + - param->ack_rssi; -- info->status.is_valid_ack_signal = true; -+ info->status.flags |= IEEE80211_TX_STATUS_ACK_SIGNAL_VALID; - } - - ieee80211_tx_status_irqsafe(ar->hw, msdu); -@@ -4258,13 +4258,13 @@ void ath10k_wmi_event_host_swba(struct a - * Once CSA counter is completed stop sending beacons until - * actual channel switch is done - */ -- if (arvif->vif->csa_active && -+ if (arvif->vif->bss_conf.csa_active && - ieee80211_beacon_cntdwn_is_complete(arvif->vif)) { - ieee80211_csa_finish(arvif->vif); - continue; - } - -- bcn = ieee80211_beacon_get(ar->hw, arvif->vif); -+ bcn = ieee80211_beacon_get(ar->hw, arvif->vif, 0); - if (!bcn) { - ath10k_warn(ar, "could not get mac80211 beacon, vdev_id: %i addr: %pM\n", - arvif->vdev_id, arvif->vif->addr); ---- a/ath10k-5.15/htt_rx.c -+++ b/ath10k-5.15/htt_rx.c -@@ -4017,7 +4017,7 @@ ath10k_update_per_peer_tx_stats(struct a - switch (txrate.flags) { - case WMI_RATE_PREAMBLE_OFDM: - if (arsta->arvif && arsta->arvif->vif) -- conf = rcu_dereference(arsta->arvif->vif->chanctx_conf); -+ conf = rcu_dereference(arsta->arvif->vif->bss_conf.chanctx_conf); - if (conf && conf->def.chan->band == NL80211_BAND_5GHZ) - arsta->tx_info.status.rates[0].idx = rate_idx - 4; - break; ---- a/ath10k-5.15/wmi-tlv.c -+++ b/ath10k-5.15/wmi-tlv.c -@@ -205,7 +205,7 @@ static int ath10k_wmi_tlv_event_bcn_tx_s - } - - arvif = ath10k_get_arvif(ar, vdev_id); -- if (arvif && arvif->is_up && arvif->vif->csa_active) -+ if (arvif && arvif->is_up && arvif->vif->bss_conf.csa_active) - ieee80211_queue_work(ar->hw, &arvif->ap_csa_work); - - kfree(tb); ---- a/ath10k-5.15/core.c -+++ b/ath10k-5.15/core.c -@@ -4081,7 +4081,7 @@ static int ath10k_core_probe_fw(struct a - ath10k_debug_print_board_info(ar); - } - -- device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr)); -+ device_get_mac_address(ar->dev, ar->mac_addr); - - /* Try to get mac address from device node (from nvmem cell) */ - of_get_mac_address(ar->dev->of_node, ar->mac_addr); ---- a/ath10k-5.15/pci.c -+++ b/ath10k-5.15/pci.c -@@ -3547,8 +3547,7 @@ static void ath10k_pci_free_irq(struct a - - void ath10k_pci_init_napi(struct ath10k *ar) - { -- netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_pci_napi_poll, -- ATH10K_NAPI_BUDGET); -+ netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_pci_napi_poll); - } - - static int ath10k_pci_init_irq(struct ath10k *ar) ---- a/ath10k-5.15/sdio.c -+++ b/ath10k-5.15/sdio.c -@@ -2531,8 +2531,7 @@ static int ath10k_sdio_probe(struct sdio - return -ENOMEM; - } - -- netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_sdio_napi_poll, -- ATH10K_NAPI_BUDGET); -+ netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_sdio_napi_poll); - - ath10k_dbg(ar, ATH10K_DBG_BOOT, - "sdio new func %d vendor 0x%x device 0x%x block 0x%x/0x%x\n", ---- a/ath10k-5.15/snoc.c -+++ b/ath10k-5.15/snoc.c -@@ -1242,8 +1242,7 @@ static int ath10k_snoc_napi_poll(struct - - static void ath10k_snoc_init_napi(struct ath10k *ar) - { -- netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_snoc_napi_poll, -- ATH10K_NAPI_BUDGET); -+ netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_snoc_napi_poll); - } - - static int ath10k_snoc_request_irq(struct ath10k *ar) diff --git a/package/kernel/ath10k-ct/patches/100-ath10k-ct-port-compilation-warning-for-debug-level-t.patch b/package/kernel/ath10k-ct/patches/100-ath10k-ct-port-compilation-warning-for-debug-level-t.patch new file mode 100644 index 00000000000000..f4522c87b4365b --- /dev/null +++ b/package/kernel/ath10k-ct/patches/100-ath10k-ct-port-compilation-warning-for-debug-level-t.patch @@ -0,0 +1,111 @@ +From a227621b46df8a7a5c276131b245f40eac7513fb Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Fri, 3 Nov 2023 04:03:08 +0100 +Subject: [PATCH] ath10k-ct: port compilation warning for debug level to kernel + 6.4 + +Port compilation warning for debug level previously fixed in other +kernel to kernel version 6.4. + +Signed-off-by: Christian Marangi +--- + ath10k-6.4/debug.c | 85 ++++++++++++++++++++++++++-------------------- + 1 file changed, 48 insertions(+), 37 deletions(-) + +--- a/ath10k-6.4/debug.c ++++ b/ath10k-6.4/debug.c +@@ -1345,47 +1345,58 @@ static const struct file_operations fops + .llseek = default_llseek, + }; + ++static const char debug_level_buf[] = ++ "To change debug level, set value adding up desired flags:\n" ++ "PCI: 0x1\n" ++ "WMI: 0x2\n" ++ "HTC: 0x4\n" ++ "HTT: 0x8\n" ++ "MAC: 0x10\n" ++ "BOOT: 0x20\n" ++ "PCI-DUMP: 0x40\n" ++ "HTT-DUMP: 0x80\n" ++ "MGMT: 0x100\n" ++ "DATA: 0x200\n" ++ "BMI: 0x400\n" ++ "REGULATORY: 0x800\n" ++ "TESTMODE: 0x1000\n" ++ "WMI-PRINT: 0x2000\n" ++ "PCI-PS: 0x4000\n" ++ "AHB: 0x8000\n" ++ "SDIO: 0x10000\n" ++ "SDIO_DUMP: 0x20000\n" ++ "USB: 0x40000\n" ++ "USB_BULK: 0x80000\n" ++ "SNOC: 0x100000\n" ++ "QMI: 0x200000\n" ++ "BEACONS: 0x8000000\n" ++ "NO-FW-DBGLOG:0x10000000\n" ++ "MAC2: 0x20000000\n" ++ "INFO-AS-DBG: 0x40000000\n" ++ "FW: 0x80000000\n" ++ "ALL: 0xEFFFFFFF\n"; ++ ++#define READ_DEBUG_LEVEL_SIZE sizeof(debug_level_buf) + 60 ++ + static ssize_t ath10k_read_debug_level(struct file *file, + char __user *user_buf, + size_t count, loff_t *ppos) + { +- int sz; +- const char buf[] = +- "To change debug level, set value adding up desired flags:\n" +- "PCI: 0x1\n" +- "WMI: 0x2\n" +- "HTC: 0x4\n" +- "HTT: 0x8\n" +- "MAC: 0x10\n" +- "BOOT: 0x20\n" +- "PCI-DUMP: 0x40\n" +- "HTT-DUMP: 0x80\n" +- "MGMT: 0x100\n" +- "DATA: 0x200\n" +- "BMI: 0x400\n" +- "REGULATORY: 0x800\n" +- "TESTMODE: 0x1000\n" +- "WMI-PRINT: 0x2000\n" +- "PCI-PS: 0x4000\n" +- "AHB: 0x8000\n" +- "SDIO: 0x10000\n" +- "SDIO_DUMP: 0x20000\n" +- "USB: 0x40000\n" +- "USB_BULK: 0x80000\n" +- "SNOC: 0x100000\n" +- "QMI: 0x200000\n" +- "BEACONS: 0x8000000\n" +- "NO-FW-DBGLOG:0x10000000\n" +- "MAC2: 0x20000000\n" +- "INFO-AS-DBG: 0x40000000\n" +- "FW: 0x80000000\n" +- "ALL: 0xEFFFFFFF\n"; +- char wbuf[sizeof(buf) + 60]; +- sz = snprintf(wbuf, sizeof(wbuf), "Current debug level: 0x%x\n\n%s", +- ath10k_debug_mask, buf); +- wbuf[sizeof(wbuf) - 1] = 0; ++ int sz, ret; ++ char *wbuf; ++ ++ wbuf = kcalloc(READ_DEBUG_LEVEL_SIZE, sizeof(char), GFP_KERNEL); ++ if (!wbuf) ++ return -ENOMEM; ++ ++ sz = snprintf(wbuf, READ_DEBUG_LEVEL_SIZE, ++ "Current debug level: 0x%x\n\n%s", ++ ath10k_debug_mask, debug_level_buf); ++ ++ ret = simple_read_from_buffer(user_buf, count, ppos, wbuf, sz); ++ kfree(wbuf); + +- return simple_read_from_buffer(user_buf, count, ppos, wbuf, sz); ++ return ret; + } + + /* Set logging level. diff --git a/package/kernel/ath10k-ct/patches/120-ath10k-fetch-calibration-data-via-nvmem-subsystem.patch b/package/kernel/ath10k-ct/patches/120-ath10k-fetch-calibration-data-via-nvmem-subsystem.patch deleted file mode 100644 index c935d8575eed2e..00000000000000 --- a/package/kernel/ath10k-ct/patches/120-ath10k-fetch-calibration-data-via-nvmem-subsystem.patch +++ /dev/null @@ -1,162 +0,0 @@ -From e2333703373e8b81294da5d1c73c30154f75b082 Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Fri, 15 Oct 2021 18:56:33 +0200 -Subject: [PATCH] ath10k: fetch (pre-)calibration data via nvmem subsystem - -On most embedded ath10k devices (like range extenders, -routers, accesspoints, ...) the calibration data is -stored in a easily accessible MTD partitions named -"ART", "caldata", "calibration", etc... - -Since commit 4b361cfa8624 ("mtd: core: add OTP nvmem provider support"): -MTD partitions and portions of them can be specified -as potential nvmem-cells which are accessible through -the nvmem subsystem. - -This feature - together with an nvmem cell definition either -in the platform data or via device-tree allows drivers to get -the (pre-)calibration data which is required for initializing -the WIFI. - -Tested with Netgear EX6150v2 (IPQ4018) - -Cc: Robert Marko -Cc: Thibaut Varene -Signed-off-by: Christian Lamparter ---- ---- a/ath10k-5.15/core.c -+++ b/ath10k-5.15/core.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -1005,7 +1006,8 @@ static int ath10k_core_get_board_id_from - } - - if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT || -- ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE) -+ ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE || -+ ar->cal_mode == ATH10K_PRE_CAL_MODE_NVMEM) - bmi_board_id_param = BMI_PARAM_GET_FLASH_BOARD_ID; - else - bmi_board_id_param = BMI_PARAM_GET_EEPROM_BOARD_ID; -@@ -2115,7 +2117,8 @@ static int ath10k_download_and_run_otp(s - - /* As of now pre-cal is valid for 10_4 variants */ - if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT || -- ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE) -+ ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE || -+ ar->cal_mode == ATH10K_PRE_CAL_MODE_NVMEM) - bmi_otp_exe_param = BMI_PARAM_FLASH_SECTION_ALL; - - ret = ath10k_bmi_execute(ar, address, bmi_otp_exe_param, &result); -@@ -2249,6 +2252,39 @@ struct ath10k_bss_rom_ie { - __le32 rom_len; - } __packed; - -+static int ath10k_download_cal_nvmem(struct ath10k *ar, const char *cell_name) -+{ -+ struct nvmem_cell *cell; -+ void *buf; -+ size_t len; -+ int ret; -+ -+ cell = devm_nvmem_cell_get(ar->dev, cell_name); -+ if (IS_ERR(cell)) { -+ ret = PTR_ERR(cell); -+ return ret; -+ } -+ -+ buf = nvmem_cell_read(cell, &len); -+ if (IS_ERR(buf)) -+ return PTR_ERR(buf); -+ -+ if (ar->hw_params.cal_data_len != len) { -+ kfree(buf); -+ ath10k_warn(ar, "invalid calibration data length in nvmem-cell '%s': %zu != %u\n", -+ cell_name, len, ar->hw_params.cal_data_len); -+ return -EMSGSIZE; -+ } -+ -+ ret = ath10k_download_board_data(ar, buf, len); -+ kfree(buf); -+ if (ret) -+ ath10k_warn(ar, "failed to download calibration data from nvmem-cell '%s': %d\n", -+ cell_name, ret); -+ -+ return ret; -+} -+ - int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name, - struct ath10k_fw_file *fw_file) - { -@@ -2625,6 +2661,18 @@ static int ath10k_core_pre_cal_download( - { - int ret; - -+ ret = ath10k_download_cal_nvmem(ar, "pre-calibration"); -+ if (ret == 0) { -+ ar->cal_mode = ATH10K_PRE_CAL_MODE_NVMEM; -+ goto success; -+ } else if (ret == -EPROBE_DEFER) { -+ return ret; -+ } -+ -+ ath10k_dbg(ar, ATH10K_DBG_BOOT, -+ "boot did not find a pre-calibration nvmem-cell, try file next: %d\n", -+ ret); -+ - ret = ath10k_download_cal_file(ar, ar->pre_cal_file); - if (ret == 0) { - ar->cal_mode = ATH10K_PRE_CAL_MODE_FILE; -@@ -2691,6 +2739,18 @@ static int ath10k_download_cal_data(stru - "pre cal download procedure failed, try cal file: %d\n", - ret); - -+ ret = ath10k_download_cal_nvmem(ar, "calibration"); -+ if (ret == 0) { -+ ar->cal_mode = ATH10K_CAL_MODE_NVMEM; -+ goto done; -+ } else if (ret == -EPROBE_DEFER) { -+ return ret; -+ } -+ -+ ath10k_dbg(ar, ATH10K_DBG_BOOT, -+ "boot did not find a calibration nvmem-cell, try file next: %d\n", -+ ret); -+ - ret = ath10k_download_cal_file(ar, ar->cal_file); - if (ret == 0) { - ar->cal_mode = ATH10K_CAL_MODE_FILE; ---- a/ath10k-5.15/core.h -+++ b/ath10k-5.15/core.h -@@ -1109,8 +1109,10 @@ enum ath10k_cal_mode { - ATH10K_CAL_MODE_FILE, - ATH10K_CAL_MODE_OTP, - ATH10K_CAL_MODE_DT, -+ ATH10K_CAL_MODE_NVMEM, - ATH10K_PRE_CAL_MODE_FILE, - ATH10K_PRE_CAL_MODE_DT, -+ ATH10K_PRE_CAL_MODE_NVMEM, - ATH10K_CAL_MODE_EEPROM, - }; - -@@ -1130,10 +1132,14 @@ static inline const char *ath10k_cal_mod - return "otp"; - case ATH10K_CAL_MODE_DT: - return "dt"; -+ case ATH10K_CAL_MODE_NVMEM: -+ return "nvmem"; - case ATH10K_PRE_CAL_MODE_FILE: - return "pre-cal-file"; - case ATH10K_PRE_CAL_MODE_DT: - return "pre-cal-dt"; -+ case ATH10K_PRE_CAL_MODE_NVMEM: -+ return "pre-cal-nvmem"; - case ATH10K_CAL_MODE_EEPROM: - return "eeprom"; - } diff --git a/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch b/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch index c835a33f492964..891973f38dbe2b 100644 --- a/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch +++ b/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch @@ -39,9 +39,9 @@ that the feature is properly initialized: Signed-off-by: Vincent Tremblay ---- a/ath10k-5.15/core.c -+++ b/ath10k-5.15/core.c -@@ -2798,14 +2798,14 @@ done: +--- a/ath10k-6.4/core.c ++++ b/ath10k-6.4/core.c +@@ -2869,14 +2869,14 @@ done: static void ath10k_core_fetch_btcoex_dt(struct ath10k *ar) { struct device_node *node; diff --git a/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index 2cc7c1e678babb..8eb587b877b5ca 100644 --- a/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/ath10k-ct/patches/201-ath10k-add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -66,25 +66,25 @@ v13: * cleanup includes - ath10k-5.15/Kconfig | 10 +++ - ath10k-5.15/Makefile | 1 + - ath10k-5.15/core.c | 22 +++++++ - ath10k-5.15/core.h | 9 ++- - ath10k-5.15/hw.h | 1 + - ath10k-5.15/leds.c | 103 ++++++++++++++++++++++++++++++ - ath10k-5.15/leds.h | 45 +++++++++++++ - ath10k-5.15/mac.c | 1 + - ath10k-5.15/wmi-ops.h | 32 ++++++++++ - ath10k-5.15/wmi-tlv.c | 2 + - ath10k-5.15/wmi.c | 54 ++++++++++++++++ - ath10k-5.15/wmi.h | 35 ++++++++++ + ath10k-6.4/Kconfig | 10 +++ + ath10k-6.4/Makefile | 1 + + ath10k-6.4/core.c | 22 +++++++ + ath10k-6.4/core.h | 9 ++- + ath10k-6.4/hw.h | 1 + + ath10k-6.4/leds.c | 103 ++++++++++++++++++++++++++++++ + ath10k-6.4/leds.h | 45 +++++++++++++ + ath10k-6.4/mac.c | 1 + + ath10k-6.4/wmi-ops.h | 32 ++++++++++ + ath10k-6.4/wmi-tlv.c | 2 + + ath10k-6.4/wmi.c | 54 ++++++++++++++++ + ath10k-6.4/wmi.h | 35 ++++++++++ 12 files changed, 314 insertions(+), 1 deletion(-) - create mode 100644 ath10k-5.15/leds.c - create mode 100644 ath10k-5.15/leds.h + create mode 100644 ath10k-6.4/leds.c + create mode 100644 ath10k-6.4/leds.h ---- a/ath10k-5.15/Kconfig -+++ b/ath10k-5.15/Kconfig -@@ -66,6 +66,16 @@ config ATH10K_DEBUGFS +--- a/ath10k-6.4/Kconfig ++++ b/ath10k-6.4/Kconfig +@@ -67,6 +67,16 @@ config ATH10K_DEBUGFS If unsure, say Y to make it easier to debug problems. @@ -101,8 +101,8 @@ v13: config ATH10K_SPECTRAL bool "Atheros ath10k spectral scan support" depends on ATH10K_DEBUGFS ---- a/ath10k-5.15/Makefile -+++ b/ath10k-5.15/Makefile +--- a/ath10k-6.4/Makefile ++++ b/ath10k-6.4/Makefile @@ -20,6 +20,7 @@ ath10k_core-$(CONFIG_ATH10K_SPECTRAL) += ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o @@ -111,8 +111,8 @@ v13: ath10k_core-$(CONFIG_MAC80211_DEBUGFS) += debugfs_sta.o ath10k_core-$(CONFIG_PM) += wow.o ath10k_core-$(CONFIG_ATH10K_CE) += ce.o ---- a/ath10k-5.15/core.c -+++ b/ath10k-5.15/core.c +--- a/ath10k-6.4/core.c ++++ b/ath10k-6.4/core.c @@ -28,6 +28,7 @@ #include "testmode.h" #include "wmi-ops.h" @@ -121,7 +121,7 @@ v13: /* Disable ath10k-ct DBGLOG output by default */ unsigned int ath10k_debug_mask = ATH10K_DBG_NO_DBGLOG; -@@ -70,6 +71,7 @@ static const struct ath10k_hw_params ath +@@ -78,6 +79,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA988X_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca988x hw2.0", @@ -129,7 +129,7 @@ v13: .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -143,6 +145,7 @@ static const struct ath10k_hw_params ath +@@ -159,6 +161,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9887_1_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9887 hw1.0", @@ -137,7 +137,7 @@ v13: .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -360,6 +363,7 @@ static const struct ath10k_hw_params ath +@@ -400,6 +403,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA99X0_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca99x0 hw2.0", @@ -145,7 +145,7 @@ v13: .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .otp_exe_param = 0x00000700, -@@ -402,6 +406,7 @@ static const struct ath10k_hw_params ath +@@ -446,6 +450,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9984_1_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9984/qca9994 hw1.0", @@ -153,7 +153,7 @@ v13: .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -451,6 +456,7 @@ static const struct ath10k_hw_params ath +@@ -499,6 +504,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9888_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9888 hw2.0", @@ -161,7 +161,7 @@ v13: .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -3977,6 +3983,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -4080,6 +4086,10 @@ int ath10k_core_start(struct ath10k *ar, ath10k_wmi_check_apply_board_power_ctl_table(ar); } @@ -172,7 +172,7 @@ v13: return 0; err_hif_stop: -@@ -4238,9 +4248,18 @@ static void ath10k_core_register_work(st +@@ -4341,9 +4351,18 @@ static void ath10k_core_register_work(st goto err_spectral_destroy; } @@ -191,7 +191,7 @@ v13: err_spectral_destroy: ath10k_spectral_destroy(ar); err_debug_destroy: -@@ -4300,6 +4319,8 @@ void ath10k_core_unregister(struct ath10 +@@ -4403,6 +4422,8 @@ void ath10k_core_unregister(struct ath10 if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) return; @@ -200,8 +200,8 @@ v13: ath10k_thermal_unregister(ar); /* Stop spectral before unregistering from mac80211 to remove the * relayfs debugfs file cleanly. Otherwise the parent debugfs tree ---- a/ath10k-5.15/core.h -+++ b/ath10k-5.15/core.h +--- a/ath10k-6.4/core.h ++++ b/ath10k-6.4/core.h @@ -14,6 +14,7 @@ #include #include @@ -210,7 +210,7 @@ v13: #include "htt.h" #include "htc.h" -@@ -1577,6 +1578,13 @@ struct ath10k { +@@ -1586,6 +1587,13 @@ struct ath10k { } testmode; struct { @@ -224,9 +224,9 @@ v13: /* protected by data_lock */ u32 rx_crc_err_drop; u32 fw_crash_counter; ---- a/ath10k-5.15/hw.h -+++ b/ath10k-5.15/hw.h -@@ -521,6 +521,7 @@ struct ath10k_hw_params { +--- a/ath10k-6.4/hw.h ++++ b/ath10k-6.4/hw.h +@@ -523,6 +523,7 @@ struct ath10k_hw_params { const char *name; u32 patch_load_addr; int uart_pin; @@ -235,7 +235,7 @@ v13: /* Type of hw cycle counter wraparound logic, for more info --- /dev/null -+++ b/ath10k-5.15/leds.c ++++ b/ath10k-6.4/leds.c @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2005-2011 Atheros Communications Inc. @@ -341,7 +341,7 @@ v13: +} + --- /dev/null -+++ b/ath10k-5.15/leds.h ++++ b/ath10k-6.4/leds.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2018, The Linux Foundation. All rights reserved. @@ -384,8 +384,8 @@ v13: + +#endif +#endif /* _LEDS_H_ */ ---- a/ath10k-5.15/mac.c -+++ b/ath10k-5.15/mac.c +--- a/ath10k-6.4/mac.c ++++ b/ath10k-6.4/mac.c @@ -25,6 +25,7 @@ #include "wmi-tlv.h" #include "wmi-ops.h" @@ -394,8 +394,8 @@ v13: /*********/ /* Rates */ ---- a/ath10k-5.15/wmi-ops.h -+++ b/ath10k-5.15/wmi-ops.h +--- a/ath10k-6.4/wmi-ops.h ++++ b/ath10k-6.4/wmi-ops.h @@ -228,7 +228,10 @@ struct wmi_ops { const struct wmi_bb_timing_cfg_arg *arg); struct sk_buff *(*gen_per_peer_per_tid_cfg)(struct ath10k *ar, @@ -443,9 +443,9 @@ v13: static inline int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level) { ---- a/ath10k-5.15/wmi-tlv.c -+++ b/ath10k-5.15/wmi-tlv.c -@@ -4594,6 +4594,8 @@ static const struct wmi_ops wmi_tlv_ops +--- a/ath10k-6.4/wmi-tlv.c ++++ b/ath10k-6.4/wmi-tlv.c +@@ -4601,6 +4601,8 @@ static const struct wmi_ops wmi_tlv_ops .gen_echo = ath10k_wmi_tlv_op_gen_echo, .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, .gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable, @@ -454,9 +454,9 @@ v13: }; static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { ---- a/ath10k-5.15/wmi.c -+++ b/ath10k-5.15/wmi.c -@@ -8413,6 +8413,49 @@ ath10k_wmi_op_gen_peer_set_param(struct +--- a/ath10k-6.4/wmi.c ++++ b/ath10k-6.4/wmi.c +@@ -8438,6 +8438,49 @@ ath10k_wmi_op_gen_peer_set_param(struct return skb; } @@ -506,7 +506,7 @@ v13: static struct sk_buff * ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, enum wmi_sta_ps_mode psmode) -@@ -10244,6 +10287,9 @@ static const struct wmi_ops wmi_ops = { +@@ -10269,6 +10312,9 @@ static const struct wmi_ops wmi_ops = { .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -516,7 +516,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -10314,6 +10360,8 @@ static const struct wmi_ops wmi_10_1_ops +@@ -10339,6 +10385,8 @@ static const struct wmi_ops wmi_10_1_ops .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -525,7 +525,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -10393,6 +10441,8 @@ static const struct wmi_ops wmi_10_2_ops +@@ -10418,6 +10466,8 @@ static const struct wmi_ops wmi_10_2_ops .gen_delba_send = ath10k_wmi_op_gen_delba_send, .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, @@ -534,7 +534,7 @@ v13: /* .gen_pdev_enable_adaptive_cca not implemented */ }; -@@ -10464,6 +10514,8 @@ static const struct wmi_ops wmi_10_2_4_o +@@ -10489,6 +10539,8 @@ static const struct wmi_ops wmi_10_2_4_o ath10k_wmi_op_gen_pdev_enable_adaptive_cca, .get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype, .gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing, @@ -543,7 +543,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -10546,6 +10598,8 @@ static const struct wmi_ops wmi_10_4_ops +@@ -10571,6 +10623,8 @@ static const struct wmi_ops wmi_10_4_ops .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info, .gen_echo = ath10k_wmi_op_gen_echo, .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config, @@ -552,8 +552,8 @@ v13: }; int ath10k_wmi_attach(struct ath10k *ar) ---- a/ath10k-5.15/wmi.h -+++ b/ath10k-5.15/wmi.h +--- a/ath10k-6.4/wmi.h ++++ b/ath10k-6.4/wmi.h @@ -3133,6 +3133,41 @@ enum wmi_10_4_feature_mask { }; diff --git a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch index 18c7930203c98f..4f9cf83c48875a 100644 --- a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch +++ b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch @@ -9,14 +9,14 @@ traffic. Signed-off-by: Mathias Kresin --- - ath10k-5.15/core.h | 4 ++++ - ath10k-5.15/leds.c | 4 +--- - ath10k-5.15/mac.c | 2 +- + ath10k-6.4/core.h | 4 ++++ + ath10k-6.4/leds.c | 4 +--- + ath10k-6.4/mac.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) ---- a/ath10k-5.15/core.h -+++ b/ath10k-5.15/core.h -@@ -1692,6 +1692,10 @@ struct ath10k { +--- a/ath10k-6.4/core.h ++++ b/ath10k-6.4/core.h +@@ -1701,6 +1701,10 @@ struct ath10k { u8 csi_data[4096]; u16 csi_data_len; @@ -27,8 +27,8 @@ Signed-off-by: Mathias Kresin /* must be last */ u8 drv_priv[] __aligned(sizeof(void *)); }; ---- a/ath10k-5.15/leds.c -+++ b/ath10k-5.15/leds.c +--- a/ath10k-6.4/leds.c ++++ b/ath10k-6.4/leds.c @@ -81,9 +81,7 @@ int ath10k_leds_register(struct ath10k * ar->leds.cdev.name = ar->leds.label; @@ -40,9 +40,9 @@ Signed-off-by: Mathias Kresin ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); if (ret) ---- a/ath10k-5.15/mac.c -+++ b/ath10k-5.15/mac.c -@@ -11551,7 +11551,7 @@ int ath10k_mac_register(struct ath10k *a +--- a/ath10k-6.4/mac.c ++++ b/ath10k-6.4/mac.c +@@ -11616,7 +11616,7 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; #ifdef CPTCFG_MAC80211_LEDS diff --git a/package/kernel/ath10k-ct/patches/203-ath10k-ct-fix-compilation-warning-for-debug-level.patch b/package/kernel/ath10k-ct/patches/203-ath10k-ct-fix-compilation-warning-for-debug-level.patch deleted file mode 100644 index 6c854923e77ad1..00000000000000 --- a/package/kernel/ath10k-ct/patches/203-ath10k-ct-fix-compilation-warning-for-debug-level.patch +++ /dev/null @@ -1,222 +0,0 @@ -From 3b07c3a6e4adebd0466f5e539f318224db8cfc37 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Sat, 6 May 2023 15:29:52 +0200 -Subject: [PATCH] ath10k-ct: fix compilation warning for debug level - -Rework read_debug_level function as it does exceed the stack limit for -some arch. -Fix compilation error: -/__w/openwrt/openwrt/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-malta_be/ath10k-ct-regular/ath10k-ct-2022-05-13-f808496f/ath10k-5.15/debug.c: In function 'ath10k_read_debug_level': -/__w/openwrt/openwrt/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-malta_be/ath10k-ct-regular/ath10k-ct-2022-05-13-f808496f/ath10k-5.15/debug.c:1388:1: error: the frame size of 1440 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] - 1388 | } - | ^ - -Signed-off-by: Christian Marangi ---- - ath10k-5.15/debug.c | 85 +++++++++++++++++++++++++-------------------- - ath10k-5.17/debug.c | 85 +++++++++++++++++++++++++-------------------- - 2 files changed, 96 insertions(+), 74 deletions(-) - -diff --git a/ath10k-5.15/debug.c b/ath10k-5.15/debug.c -index af84012..d0fa911 100644 ---- a/ath10k-5.15/debug.c -+++ b/ath10k-5.15/debug.c -@@ -1344,47 +1344,58 @@ static const struct file_operations fops_simulate_fw_crash = { - .llseek = default_llseek, - }; - -+static const char debug_level_buf[] = -+ "To change debug level, set value adding up desired flags:\n" -+ "PCI: 0x1\n" -+ "WMI: 0x2\n" -+ "HTC: 0x4\n" -+ "HTT: 0x8\n" -+ "MAC: 0x10\n" -+ "BOOT: 0x20\n" -+ "PCI-DUMP: 0x40\n" -+ "HTT-DUMP: 0x80\n" -+ "MGMT: 0x100\n" -+ "DATA: 0x200\n" -+ "BMI: 0x400\n" -+ "REGULATORY: 0x800\n" -+ "TESTMODE: 0x1000\n" -+ "WMI-PRINT: 0x2000\n" -+ "PCI-PS: 0x4000\n" -+ "AHB: 0x8000\n" -+ "SDIO: 0x10000\n" -+ "SDIO_DUMP: 0x20000\n" -+ "USB: 0x40000\n" -+ "USB_BULK: 0x80000\n" -+ "SNOC: 0x100000\n" -+ "QMI: 0x200000\n" -+ "BEACONS: 0x8000000\n" -+ "NO-FW-DBGLOG:0x10000000\n" -+ "MAC2: 0x20000000\n" -+ "INFO-AS-DBG: 0x40000000\n" -+ "FW: 0x80000000\n" -+ "ALL: 0xEFFFFFFF\n"; -+ -+#define READ_DEBUG_LEVEL_SIZE sizeof(debug_level_buf) + 60 -+ - static ssize_t ath10k_read_debug_level(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) - { -- int sz; -- const char buf[] = -- "To change debug level, set value adding up desired flags:\n" -- "PCI: 0x1\n" -- "WMI: 0x2\n" -- "HTC: 0x4\n" -- "HTT: 0x8\n" -- "MAC: 0x10\n" -- "BOOT: 0x20\n" -- "PCI-DUMP: 0x40\n" -- "HTT-DUMP: 0x80\n" -- "MGMT: 0x100\n" -- "DATA: 0x200\n" -- "BMI: 0x400\n" -- "REGULATORY: 0x800\n" -- "TESTMODE: 0x1000\n" -- "WMI-PRINT: 0x2000\n" -- "PCI-PS: 0x4000\n" -- "AHB: 0x8000\n" -- "SDIO: 0x10000\n" -- "SDIO_DUMP: 0x20000\n" -- "USB: 0x40000\n" -- "USB_BULK: 0x80000\n" -- "SNOC: 0x100000\n" -- "QMI: 0x200000\n" -- "BEACONS: 0x8000000\n" -- "NO-FW-DBGLOG:0x10000000\n" -- "MAC2: 0x20000000\n" -- "INFO-AS-DBG: 0x40000000\n" -- "FW: 0x80000000\n" -- "ALL: 0xEFFFFFFF\n"; -- char wbuf[sizeof(buf) + 60]; -- sz = snprintf(wbuf, sizeof(wbuf), "Current debug level: 0x%x\n\n%s", -- ath10k_debug_mask, buf); -- wbuf[sizeof(wbuf) - 1] = 0; -- -- return simple_read_from_buffer(user_buf, count, ppos, wbuf, sz); -+ int sz, ret; -+ char *wbuf; -+ -+ wbuf = kcalloc(READ_DEBUG_LEVEL_SIZE, sizeof(char), GFP_KERNEL); -+ if (!wbuf) -+ return -ENOMEM; -+ -+ sz = snprintf(wbuf, READ_DEBUG_LEVEL_SIZE, -+ "Current debug level: 0x%x\n\n%s", -+ ath10k_debug_mask, debug_level_buf); -+ -+ ret = simple_read_from_buffer(user_buf, count, ppos, wbuf, sz); -+ kfree(wbuf); -+ -+ return ret; - } - - /* Set logging level. -diff --git a/ath10k-5.17/debug.c b/ath10k-5.17/debug.c -index af84012..d0fa911 100644 ---- a/ath10k-5.17/debug.c -+++ b/ath10k-5.17/debug.c -@@ -1344,47 +1344,58 @@ static const struct file_operations fops_simulate_fw_crash = { - .llseek = default_llseek, - }; - -+static const char debug_level_buf[] = -+ "To change debug level, set value adding up desired flags:\n" -+ "PCI: 0x1\n" -+ "WMI: 0x2\n" -+ "HTC: 0x4\n" -+ "HTT: 0x8\n" -+ "MAC: 0x10\n" -+ "BOOT: 0x20\n" -+ "PCI-DUMP: 0x40\n" -+ "HTT-DUMP: 0x80\n" -+ "MGMT: 0x100\n" -+ "DATA: 0x200\n" -+ "BMI: 0x400\n" -+ "REGULATORY: 0x800\n" -+ "TESTMODE: 0x1000\n" -+ "WMI-PRINT: 0x2000\n" -+ "PCI-PS: 0x4000\n" -+ "AHB: 0x8000\n" -+ "SDIO: 0x10000\n" -+ "SDIO_DUMP: 0x20000\n" -+ "USB: 0x40000\n" -+ "USB_BULK: 0x80000\n" -+ "SNOC: 0x100000\n" -+ "QMI: 0x200000\n" -+ "BEACONS: 0x8000000\n" -+ "NO-FW-DBGLOG:0x10000000\n" -+ "MAC2: 0x20000000\n" -+ "INFO-AS-DBG: 0x40000000\n" -+ "FW: 0x80000000\n" -+ "ALL: 0xEFFFFFFF\n"; -+ -+#define READ_DEBUG_LEVEL_SIZE sizeof(debug_level_buf) + 60 -+ - static ssize_t ath10k_read_debug_level(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) - { -- int sz; -- const char buf[] = -- "To change debug level, set value adding up desired flags:\n" -- "PCI: 0x1\n" -- "WMI: 0x2\n" -- "HTC: 0x4\n" -- "HTT: 0x8\n" -- "MAC: 0x10\n" -- "BOOT: 0x20\n" -- "PCI-DUMP: 0x40\n" -- "HTT-DUMP: 0x80\n" -- "MGMT: 0x100\n" -- "DATA: 0x200\n" -- "BMI: 0x400\n" -- "REGULATORY: 0x800\n" -- "TESTMODE: 0x1000\n" -- "WMI-PRINT: 0x2000\n" -- "PCI-PS: 0x4000\n" -- "AHB: 0x8000\n" -- "SDIO: 0x10000\n" -- "SDIO_DUMP: 0x20000\n" -- "USB: 0x40000\n" -- "USB_BULK: 0x80000\n" -- "SNOC: 0x100000\n" -- "QMI: 0x200000\n" -- "BEACONS: 0x8000000\n" -- "NO-FW-DBGLOG:0x10000000\n" -- "MAC2: 0x20000000\n" -- "INFO-AS-DBG: 0x40000000\n" -- "FW: 0x80000000\n" -- "ALL: 0xEFFFFFFF\n"; -- char wbuf[sizeof(buf) + 60]; -- sz = snprintf(wbuf, sizeof(wbuf), "Current debug level: 0x%x\n\n%s", -- ath10k_debug_mask, buf); -- wbuf[sizeof(wbuf) - 1] = 0; -- -- return simple_read_from_buffer(user_buf, count, ppos, wbuf, sz); -+ int sz, ret; -+ char *wbuf; -+ -+ wbuf = kcalloc(READ_DEBUG_LEVEL_SIZE, sizeof(char), GFP_KERNEL); -+ if (!wbuf) -+ return -ENOMEM; -+ -+ sz = snprintf(wbuf, READ_DEBUG_LEVEL_SIZE, -+ "Current debug level: 0x%x\n\n%s", -+ ath10k_debug_mask, debug_level_buf); -+ -+ ret = simple_read_from_buffer(user_buf, count, ppos, wbuf, sz); -+ kfree(wbuf); -+ -+ return ret; - } - - /* Set logging level. --- -2.39.2 - diff --git a/package/kernel/ath10k-ct/patches/300-ath10k-ct-Fix-spectral-scan-NULL-pointer.patch b/package/kernel/ath10k-ct/patches/300-ath10k-ct-Fix-spectral-scan-NULL-pointer.patch deleted file mode 100644 index a3822a7e49f2bd..00000000000000 --- a/package/kernel/ath10k-ct/patches/300-ath10k-ct-Fix-spectral-scan-NULL-pointer.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0d2e335d780bda1432a9ba719c8200f796d27854 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Mon, 29 Nov 2021 12:27:12 +0100 -Subject: [PATCH] ath10k-ct: Fix spectral scan NULL pointer - -If spectral scan support is enabled then ath10k-ct will cause a NULL -pointer due to relay_open() being called with a const callback struct -which is only supported in kernel 5.11 and later. - -So, simply check the kernel version and if 5.11 and newer use the const -callback struct, otherwise use the regular struct. - -Fixes: 553a3ac ("ath10k-ct: use 5.15 version") -Signed-off-by: Robert Marko ---- - ath10k-5.15/spectral.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/ath10k-5.15/spectral.c -+++ b/ath10k-5.15/spectral.c -@@ -497,7 +497,11 @@ static int remove_buf_file_handler(struc - return 0; - } - -+#if LINUX_VERSION_IS_GEQ(5,11,0) - static const struct rchan_callbacks rfs_spec_scan_cb = { -+#else -+static struct rchan_callbacks rfs_spec_scan_cb = { -+#endif - .create_buf_file = create_buf_file_handler, - .remove_buf_file = remove_buf_file_handler, - }; diff --git a/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch b/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch index d50611b9706068..b0e6ef76fa49d8 100644 --- a/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch +++ b/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch @@ -1,5 +1,5 @@ ---- a/ath10k-5.15/htt.h -+++ b/ath10k-5.15/htt.h +--- a/ath10k-6.4/htt.h ++++ b/ath10k-6.4/htt.h @@ -237,7 +237,11 @@ enum htt_rx_ring_flags { }; diff --git a/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch b/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch index b8c6c35326685a..82109995d994e5 100644 --- a/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch +++ b/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch @@ -1,5 +1,5 @@ ---- a/ath10k-5.15/pci.c -+++ b/ath10k-5.15/pci.c +--- a/ath10k-6.4/pci.c ++++ b/ath10k-6.4/pci.c @@ -131,7 +131,11 @@ static const struct ce_attr pci_host_ce_ .flags = CE_ATTR_FLAGS, .src_nentries = 0, diff --git a/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch b/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch index ec6270c34c3315..8aef577debc3fa 100644 --- a/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch +++ b/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch @@ -13,12 +13,12 @@ own loss detection mechanism. Signed-off-by: David Bauer --- - ath10k-5.15/mac.c | 1 - + ath10k-6.4/mac.c | 1 - 1 file changed, 1 deletion(-) ---- a/ath10k-5.15/mac.c -+++ b/ath10k-5.15/mac.c -@@ -11246,7 +11246,6 @@ int ath10k_mac_register(struct ath10k *a +--- a/ath10k-6.4/mac.c ++++ b/ath10k-6.4/mac.c +@@ -11305,7 +11305,6 @@ int ath10k_mac_register(struct ath10k *a ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); ieee80211_hw_set(ar->hw, QUEUE_CONTROL); ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); diff --git a/package/kernel/bcm27xx-gpu-fw/Makefile b/package/kernel/bcm27xx-gpu-fw/Makefile index b3323c8b28fee6..048dd0d3a9d942 100644 --- a/package/kernel/bcm27xx-gpu-fw/Makefile +++ b/package/kernel/bcm27xx-gpu-fw/Makefile @@ -2,8 +2,8 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=bcm27xx-gpu-fw -PKG_VERSION:=2022-05-16 -PKG_RELEASE:=3673be308132de102fdff491d1333d9d0f823557 +PKG_VERSION:=2024-01-11 +PKG_RELEASE:=0968de28716a9b1f106b8492646d0ed0a2800152 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)/rpi-firmware-$(PKG_RELEASE) @@ -26,7 +26,7 @@ define Download/bootcode_bin FILE:=$(RPI_FIRMWARE_FILE)-bootcode.bin URL:=$(RPI_FIRMWARE_URL) URL_FILE:=bootcode.bin - HASH:=69309823da13dc96b89e3d82b44f820e4f84efa79d207adad2c8784559794f03 + HASH:=af603ebd97e7b692c30195563f7b25656eb05d57838cf1a715ebb470d1614ce4 endef $(eval $(call Download,bootcode_bin)) @@ -34,7 +34,7 @@ define Download/fixup_dat FILE:=$(RPI_FIRMWARE_FILE)-fixup.dat URL:=$(RPI_FIRMWARE_URL) URL_FILE:=fixup.dat - HASH:=921f56c62ad1995addb984b156c869202dc5d46bbe9ebcbd02c20f0def9058e3 + HASH:=c28ea955e672e374016dca61d63afa026490f0473a98115908586ab48e324aeb endef $(eval $(call Download,fixup_dat)) @@ -42,7 +42,7 @@ define Download/fixup_cd_dat FILE:=$(RPI_FIRMWARE_FILE)-fixup_cd.dat URL:=$(RPI_FIRMWARE_URL) URL_FILE:=fixup_cd.dat - HASH:=83a985aa0d73844786f3b3bf674826c520212f6f72fc6a890f2ebb5f87de5d8c + HASH:=3cf1aef5f596ca106203ed5dac9ad45e85929ec55ce44c813588645e174442ec endef $(eval $(call Download,fixup_cd_dat)) @@ -50,7 +50,7 @@ define Download/fixup_x_dat FILE:=$(RPI_FIRMWARE_FILE)-fixup_x.dat URL:=$(RPI_FIRMWARE_URL) URL_FILE:=fixup_x.dat - HASH:=8b00b00678adafe01e087240d156dbc87822e745b269be4f282596b69265cd1e + HASH:=56525c8feabde1ab86f36bb09bc55171659b2993f94132cf81ffc4293d62269d endef $(eval $(call Download,fixup_x_dat)) @@ -58,7 +58,7 @@ define Download/fixup4_dat FILE:=$(RPI_FIRMWARE_FILE)-fixup4.dat URL:=$(RPI_FIRMWARE_URL) URL_FILE:=fixup4.dat - HASH:=ef2b5d2a0a95ca48e00a1ce78b7650ee9e947cc1c588704c8ae30c1623122e2f + HASH:=615f8595801bf52373039f73ad5ad9513f83400d355eb1b2c075c7ae907e927c endef $(eval $(call Download,fixup4_dat)) @@ -66,7 +66,7 @@ define Download/fixup4cd_dat FILE:=$(RPI_FIRMWARE_FILE)-fixup4cd.dat URL:=$(RPI_FIRMWARE_URL) URL_FILE:=fixup4cd.dat - HASH:=83a985aa0d73844786f3b3bf674826c520212f6f72fc6a890f2ebb5f87de5d8c + HASH:=3cf1aef5f596ca106203ed5dac9ad45e85929ec55ce44c813588645e174442ec endef $(eval $(call Download,fixup4cd_dat)) @@ -74,7 +74,7 @@ define Download/fixup4x_dat FILE:=$(RPI_FIRMWARE_FILE)-fixup4x.dat URL:=$(RPI_FIRMWARE_URL) URL_FILE:=fixup4x.dat - HASH:=a6c4e30ada5a00fe7de83c460638ca824647651bb4a3644b8c65d7ba1d9f2d2b + HASH:=6d27a4b8ecb78cef9e1f03751b4aaec5ce8749d36988f381145a8a41dbf164ae endef $(eval $(call Download,fixup4x_dat)) @@ -82,7 +82,7 @@ define Download/start_elf FILE:=$(RPI_FIRMWARE_FILE)-start.elf URL:=$(RPI_FIRMWARE_URL) URL_FILE:=start.elf - HASH:=5455c148f4b8b04c553809bd22b995ee49ba5279ca3848df8bde6f80a388f7e0 + HASH:=e8348e88522e7a1d0e2b0944ab66d7d8f4f30da98f326e2b3c123522e45f71b2 endef $(eval $(call Download,start_elf)) @@ -90,7 +90,7 @@ define Download/start_cd_elf FILE:=$(RPI_FIRMWARE_FILE)-start_cd.elf URL:=$(RPI_FIRMWARE_URL) URL_FILE:=start_cd.elf - HASH:=168c0a9178d5a3b4bd89ef770826a85b4ea3132560ba3600c212c0cec4c575c6 + HASH:=c9b4de3f12bec7808868b898c49f656b5378ddc315f12ccab83d6519bad51680 endef $(eval $(call Download,start_cd_elf)) @@ -98,7 +98,7 @@ define Download/start_x_elf FILE:=$(RPI_FIRMWARE_FILE)-start_x.elf URL:=$(RPI_FIRMWARE_URL) URL_FILE:=start_x.elf - HASH:=30c6a7f32a25185053ca3ca9e4bcfe932246ed42a1b7c37f8803209f93d86404 + HASH:=0b5c06c109984361eeed0ab14d146f686d8aa8da2025689b887e9cb098636db9 endef $(eval $(call Download,start_x_elf)) @@ -106,7 +106,7 @@ define Download/start4_elf FILE:=$(RPI_FIRMWARE_FILE)-start4.elf URL:=$(RPI_FIRMWARE_URL) URL_FILE:=start4.elf - HASH:=be8bbff41dba2749b7b0e812f0a9d87a9122d18508f7b5ff3cd20f303d15bc07 + HASH:=fedc4ecd72c9d21018e210240dcd2e41a8bb5f936fb5674c3351f2a447a22203 endef $(eval $(call Download,start4_elf)) @@ -114,7 +114,7 @@ define Download/start4cd_elf FILE:=$(RPI_FIRMWARE_FILE)-start4cd.elf URL:=$(RPI_FIRMWARE_URL) URL_FILE:=start4cd.elf - HASH:=000372e9cf6815ade595948dbd6328665f2a535eeee44e74b0ec8e56b6fbbf90 + HASH:=ea22282a77666801378137a651e7e0b17cc186f63cdbdc8b9bb98749cd12b256 endef $(eval $(call Download,start4cd_elf)) @@ -122,7 +122,7 @@ define Download/start4x_elf FILE:=$(RPI_FIRMWARE_FILE)-start4x.elf URL:=$(RPI_FIRMWARE_URL) URL_FILE:=start4x.elf - HASH:=48895858f7936570dfab44c67bdcb0357ac8fcd630162c36ac9ed8f2de85c038 + HASH:=c509e73a9cba7af3223dea885f58294bd04845e822aa3d6278500fa4dcdb112f endef $(eval $(call Download,start4x_elf)) diff --git a/package/kernel/bpf-headers/Makefile b/package/kernel/bpf-headers/Makefile index 733f3586727082..5efd2e1cf0fb74 100644 --- a/package/kernel/bpf-headers/Makefile +++ b/package/kernel/bpf-headers/Makefile @@ -19,7 +19,7 @@ include $(INCLUDE_DIR)/kernel-$(PKG_PATCHVER) PKG_VERSION:=$(PKG_PATCHVER)$(strip $(LINUX_VERSION-$(PKG_PATCHVER))) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=$(LINUX_SITE) +PKG_SOURCE_URL:=@KERNEL/linux/kernel/v$(word 1,$(subst ., ,$(PKG_PATCHVER))).x PKG_HASH:=$(LINUX_KERNEL_HASH-$(strip $(PKG_VERSION))) PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/bpf-headers/$(PKG_NAME)-$(PKG_VERSION) diff --git a/package/kernel/lantiq/ltq-ifxos/Makefile b/package/kernel/lantiq/ltq-ifxos/Makefile index d941a9d56ff200..97f7ca78cebffa 100644 --- a/package/kernel/lantiq/ltq-ifxos/Makefile +++ b/package/kernel/lantiq/ltq-ifxos/Makefile @@ -23,6 +23,7 @@ PKG_LICENSE_FILES:=LICENSE PKG_EXTMOD_SUBDIRS:=src PKG_FIXUP:=autoreconf +PKG_BUILD_FLAGS:=no-mold include $(INCLUDE_DIR)/package.mk diff --git a/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch b/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch index 45059890e1188c..a3f210487ea529 100644 --- a/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch +++ b/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch @@ -90,3 +90,17 @@ return ret; } +--- a/src/linux/ifxos_linux_thread_drv.c ++++ b/src/linux/ifxos_linux_thread_drv.c +@@ -154,7 +154,11 @@ IFXOS_STATIC int IFXOS_KernelThreadStart + retVal = pThrCntrl->pThrFct(&pThrCntrl->thrParams); + pThrCntrl->thrParams.bRunning = IFX_FALSE; + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)) ++ kthread_complete_and_exit(&pThrCntrl->thrCompletion, (long)retVal); ++#else + complete_and_exit(&pThrCntrl->thrCompletion, (long)retVal); ++#endif + + IFXOS_PRN_USR_DBG_NL( IFXOS, IFXOS_PRN_LEVEL_NORMAL, + ("EXIT - Kernel Thread Startup <%s>" IFXOS_CRLF, diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c index 1007e74cec405f..dfb57787b9685b 100644 --- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c +++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c @@ -146,6 +146,8 @@ unsigned int ifx_ptm_dbg_enable = DBG_ENABLE_MASK_ERR; static void ptm_setup(struct net_device *dev, int ndev) { + u8 addr[ETH_ALEN]; + netif_carrier_off(dev); dev->netdev_ops = &g_ptm_netdev_ops; @@ -154,12 +156,13 @@ static void ptm_setup(struct net_device *dev, int ndev) netif_napi_add(dev, &g_ptm_priv_data.itf[ndev].napi, ptm_napi_poll, 16); dev->watchdog_timeo = ETH_WATCHDOG_TIMEOUT; - dev->dev_addr[0] = 0x00; - dev->dev_addr[1] = 0x20; - dev->dev_addr[2] = 0xda; - dev->dev_addr[3] = 0x86; - dev->dev_addr[4] = 0x23; - dev->dev_addr[5] = 0x75 + ndev; + addr[0] = 0x00; + addr[1] = 0x20; + addr[2] = 0xda; + addr[3] = 0x86; + addr[4] = 0x23; + addr[5] = 0x75 + ndev; + eth_hw_addr_set(dev, addr); } static struct net_device_stats *ptm_get_stats(struct net_device *dev) diff --git a/package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile b/package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile index f2dcf8db84d573..7b8a948179b640 100644 --- a/package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile +++ b/package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile @@ -25,6 +25,7 @@ PKG_EXTMOD_SUBDIRS:=src PKG_FIXUP:=autoreconf PKG_FLAGS:=nonshared +PKG_BUILD_FLAGS:=no-mold include $(INCLUDE_DIR)/package.mk diff --git a/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/100-compat.patch b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/100-compat.patch index a2e42ccb03fa22..74e88894d8fa3c 100644 --- a/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/100-compat.patch +++ b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/100-compat.patch @@ -8,3 +8,16 @@ MODULE_LICENSE ("GPL"); #endif /* #ifdef MODULE*/ +--- a/src/drv_mei_cpe_linux.h ++++ b/src/drv_mei_cpe_linux.h +@@ -110,6 +110,10 @@ typedef irqreturn_t (*usedIsrHandler_t)( + # endif + #endif + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)) ++#define PDE_DATA pde_data ++#endif ++ + /** + Function typedef for the Linux request_threaded_irq() + */ diff --git a/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/122-cp_linux-fix-compilation-warning.patch b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/122-cp_linux-fix-compilation-warning.patch index 63a530b6c516cc..6f180a284ecaa2 100644 --- a/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/122-cp_linux-fix-compilation-warning.patch +++ b/package/kernel/lantiq/ltq-vdsl-vr11-mei/patches/122-cp_linux-fix-compilation-warning.patch @@ -1,6 +1,6 @@ ---- a/src/drv_mei_cpe_linux.c +--- a/src/drv_mei_cpe_linux.c +++ b/src/drv_mei_cpe_linux.c -@@ -1267,7 +1267,9 @@ static long MEI_Ioctl( struct file *filp, +@@ -1267,7 +1267,9 @@ static long MEI_Ioctl( struct file *filp MEI_IOCTL_RETURN: local_args.drv_ioctl.retCode = ret; diff --git a/package/kernel/lantiq/ltq-vdsl-vr11/Makefile b/package/kernel/lantiq/ltq-vdsl-vr11/Makefile index 8284cba9a7f082..11f96d744a4daf 100644 --- a/package/kernel/lantiq/ltq-vdsl-vr11/Makefile +++ b/package/kernel/lantiq/ltq-vdsl-vr11/Makefile @@ -23,6 +23,7 @@ PKG_LICENSE:=GPL-2.0 BSD-2-Clause PKG_LICENSE_FILES:=LICENSE PKG_FIXUP:=autoreconf +PKG_BUILD_FLAGS:=no-mold include $(INCLUDE_DIR)/package.mk diff --git a/package/kernel/lantiq/vrx518_ep/patches/100-compat.patch b/package/kernel/lantiq/vrx518_ep/patches/100-compat.patch index f5b917e7078238..a139c7a862461b 100644 --- a/package/kernel/lantiq/vrx518_ep/patches/100-compat.patch +++ b/package/kernel/lantiq/vrx518_ep/patches/100-compat.patch @@ -42,6 +42,25 @@ dev_err(&pdev->dev, "%s: Failed to enable MSI interrupts error code: %d\n", __func__, err); +@@ -589,15 +589,15 @@ static int dc_ep_probe(struct pci_dev *p + /* Target structures have a limit of 32 bit DMA pointers. + * DMA pointers can be wider than 32 bits by default on some systems. + */ +- ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); ++ ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) { + dev_err(&pdev->dev, "32-bit DMA not available: %d\n", ret); + goto err_region; + } + +- ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); ++ ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) { +- dev_err(&pdev->dev, "cannot enable 32-bit consistent DMA\n"); ++ dev_err(&pdev->dev, "cannot enable 32-bit coherent DMA\n"); + goto err_region; + } + @@ -654,7 +654,7 @@ static int dc_ep_probe(struct pci_dev *p goto err_iomap; diff --git a/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch b/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch index 2c92912adef1d4..d04c1ed5df0dc2 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch @@ -243,7 +243,33 @@ #include "inc/tc_main.h" #include "inc/reg_addr.h" -@@ -182,8 +182,8 @@ static int ptm_get_qid(struct net_device +@@ -62,6 +62,9 @@ + #include "inc/fw/vrx518_addr_def.h" + #include "inc/fw/vrx518_ppe_fw.h" + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)) ++#define PDE_DATA pde_data ++#endif + + static struct ptm_priv *g_ptm_priv; + static struct ptm_ep_priv g_ep_priv[BOND_MAX]; +@@ -84,6 +87,7 @@ static int ptm_erb_addr_get(const unsign + unsigned int *data_addr, unsigned int *desc_addr); + + ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,16,0)) + static inline void tc_ether_addr_copy(u8 *dst, const u8 *src) + { + #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) +@@ -98,6 +102,7 @@ static inline void tc_ether_addr_copy(u8 + a[2] = b[2]; + #endif + } ++#endif + + static inline int is_ptm_sl(struct ptm_ep_priv *priv) + { +@@ -182,8 +187,8 @@ static int ptm_get_qid(struct net_device return qid; } @@ -254,7 +280,7 @@ { struct ptm_priv *ptm_tc = netdev_priv(dev); -@@ -191,8 +191,6 @@ static struct rtnl_link_stats64 *ptm_get +@@ -191,8 +196,6 @@ static struct rtnl_link_stats64 *ptm_get memcpy(storage, &ptm_tc->stats64, sizeof(ptm_tc->stats64)); else storage->tx_errors += ptm_tc->stats64.tx_errors; @@ -263,7 +289,16 @@ } static int ptm_set_mac_address(struct net_device *dev, void *p) -@@ -209,7 +207,7 @@ static int ptm_set_mac_address(struct ne +@@ -204,12 +207,16 @@ static int ptm_set_mac_address(struct ne + return -EBUSY; + + tc_info(ptm_tc->tc_priv, MSG_EVENT, "ptm mac address update!\n"); ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0)) ++ eth_hw_addr_set(dev, addr->sa_data); ++#else + tc_ether_addr_copy(dev->dev_addr, addr->sa_data); ++#endif + return 0; } @@ -272,7 +307,7 @@ { struct ptm_priv *ptm_tc = netdev_priv(dev); -@@ -503,7 +501,7 @@ static int ptm_xmit(struct sk_buff *skb, +@@ -503,7 +510,7 @@ static int ptm_xmit(struct sk_buff *skb, if (!showtime_stat(ptm_tc->tc_priv)) goto PTM_XMIT_DROP; @@ -281,7 +316,7 @@ goto PTM_XMIT_DROP; dump_skb_info(ptm_tc->tc_priv, skb, (MSG_TX | MSG_TXDATA)); -@@ -632,11 +630,8 @@ static int ptm_dev_init(struct tc_priv * +@@ -632,11 +639,8 @@ static int ptm_dev_init(struct tc_priv * struct ptm_priv *ptm_tc; const char macaddr[ETH_ALEN] = {0xAC, 0x9A, 0x96, 0x11, 0x22, 0x33}; @@ -295,7 +330,19 @@ if (!dev) { tc_dbg(tc_priv, MSG_INIT, "Cannot alloc net device\n"); return -ENOMEM; -@@ -2103,7 +2098,6 @@ static int ptm_showtime_exit(const unsig +@@ -644,7 +648,11 @@ static int ptm_dev_init(struct tc_priv * + ptm_tc = netdev_priv(dev); + ptm_tc->dev = dev; + ptm_tc->tc_priv = tc_priv; ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0)) ++ eth_hw_addr_set(dev, macaddr); ++#else + tc_ether_addr_copy(dev->dev_addr, macaddr); ++#endif + spin_lock_init(&ptm_tc->ptm_lock); + memcpy(ptm_tc->outq_map, def_outq_map, sizeof(def_outq_map)); + SET_NETDEV_DEV(ptm_tc->dev, tc_priv->ep_dev[id].dev); +@@ -2103,7 +2111,6 @@ static int ptm_showtime_exit(const unsig struct ptm_ep_priv *priv = tc_ep_priv(idx); u32 stop = ACA_TXIN_EN; struct dc_ep_dev *ep; @@ -398,7 +445,18 @@ #include #include #include "inc/tc_main.h" -@@ -353,7 +355,7 @@ static ssize_t mem_proc_write(struct fil +@@ -35,6 +37,10 @@ + #include "inc/platform.h" + #include "inc/dsl_tc.h" + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)) ++#define PDE_DATA pde_data ++#endif ++ + #define ATM_HEADER_SIZE (ATM_CELL_SIZE - ATM_CELL_PAYLOAD) + static char *dbg_flag_str[] = { + "rx", +@@ -353,7 +359,7 @@ static ssize_t mem_proc_write(struct fil } addr = set_val = repeat_cnt = 0; @@ -407,7 +465,7 @@ return -EFAULT; len = count < sizeof(str) ? count : sizeof(str) - 1; -@@ -450,13 +452,12 @@ static int proc_read_mem_seq_open(struct +@@ -450,13 +456,12 @@ static int proc_read_mem_seq_open(struct return single_open(file, proc_read_mem, NULL); } @@ -427,7 +485,7 @@ }; static ssize_t pp32_proc_write(struct file *file, const char __user *buf, -@@ -748,13 +749,12 @@ static int proc_read_pp32_seq_open(struc +@@ -748,13 +753,12 @@ static int proc_read_pp32_seq_open(struc return single_open(file, proc_read_pp32, PDE_DATA(inode)); } @@ -447,7 +505,7 @@ }; static int proc_read_tc_cfg(struct seq_file *seq, void *v) -@@ -865,13 +865,12 @@ static int proc_read_tc_cfg_seq_open(str +@@ -865,13 +869,12 @@ static int proc_read_tc_cfg_seq_open(str return single_open(file, proc_read_tc_cfg, PDE_DATA(inode)); } @@ -467,7 +525,7 @@ }; static ssize_t proc_write_dbg(struct file *file, const char __user *buf, -@@ -951,13 +950,12 @@ static int proc_read_dbg_seq_open(struct +@@ -951,13 +954,12 @@ static int proc_read_dbg_seq_open(struct return single_open(file, proc_read_dbg, PDE_DATA(inode)); } @@ -487,7 +545,7 @@ }; static ssize_t proc_write_tc_switch(struct file *file, const char __user *buf, -@@ -1018,11 +1016,11 @@ proc_tc_switch_help: +@@ -1018,11 +1020,11 @@ proc_tc_switch_help: return count; } @@ -503,7 +561,7 @@ static ssize_t proc_write_show_time(struct file *file, const char __user *buf, size_t count, loff_t *data) { -@@ -1077,10 +1075,9 @@ proc_show_time_help: +@@ -1077,10 +1079,9 @@ proc_show_time_help: return count; } @@ -517,7 +575,7 @@ }; static int proc_read_ver(struct seq_file *seq, void *v) -@@ -1128,12 +1125,11 @@ static int proc_read_ver_seq_open(struct +@@ -1128,12 +1129,11 @@ static int proc_read_ver_seq_open(struct return single_open(file, proc_read_ver, PDE_DATA(inode)); } @@ -535,7 +593,7 @@ }; static int proc_read_soc(struct seq_file *seq, void *v) -@@ -1142,20 +1138,18 @@ static int proc_read_soc(struct seq_file +@@ -1142,20 +1142,18 @@ static int proc_read_soc(struct seq_file tcpriv = (struct tc_priv *)seq->private; @@ -564,7 +622,7 @@ return 0; } -@@ -1165,15 +1159,13 @@ static int proc_read_soc_seq_open(struct +@@ -1165,15 +1163,13 @@ static int proc_read_soc_seq_open(struct return single_open(file, proc_read_soc, PDE_DATA(inode)); } @@ -585,7 +643,7 @@ static struct tc_proc_list tc_procs[] = { {TC_PROC_DIR, 0, NULL, 1}, {"cfg", 0644, &tc_cfg_proc_fops, 0}, -@@ -1241,13 +1233,12 @@ static int proc_read_ptm_wanmib_seq_open +@@ -1241,13 +1237,12 @@ static int proc_read_ptm_wanmib_seq_open return single_open(file, proc_read_ptm_wanmib, PDE_DATA(inode)); } @@ -605,7 +663,7 @@ }; static int proc_ptm_read_cfg(struct seq_file *seq, void *v) -@@ -1300,7 +1291,7 @@ static ssize_t ptm_cfg_proc_write(struct +@@ -1300,7 +1295,7 @@ static ssize_t ptm_cfg_proc_write(struct return -EINVAL; } @@ -614,7 +672,7 @@ return -EFAULT; len = count < sizeof(str) ? count : sizeof(str) - 1; -@@ -1343,13 +1334,12 @@ proc_ptm_cfg_help: +@@ -1343,13 +1338,12 @@ proc_ptm_cfg_help: } @@ -634,7 +692,7 @@ }; static ssize_t proc_ptm_write_prio(struct file *file, const char __user *buf, -@@ -1455,13 +1445,12 @@ static int proc_ptm_read_prio_seq_open(s +@@ -1455,13 +1449,12 @@ static int proc_ptm_read_prio_seq_open(s return single_open(file, proc_ptm_read_prio, PDE_DATA(inode)); } @@ -654,7 +712,7 @@ }; static int proc_ptm_read_bond_seq_open(struct inode *inode, struct file *file) -@@ -1469,12 +1458,11 @@ static int proc_ptm_read_bond_seq_open(s +@@ -1469,12 +1462,11 @@ static int proc_ptm_read_bond_seq_open(s return single_open(file, proc_ptm_read_bond, PDE_DATA(inode)); } @@ -672,7 +730,7 @@ }; static int proc_ptm_read_bondmib_seq_open(struct inode *inode, -@@ -1483,13 +1471,12 @@ static int proc_ptm_read_bondmib_seq_ope +@@ -1483,13 +1475,12 @@ static int proc_ptm_read_bondmib_seq_ope return single_open(file, proc_ptm_read_bondmib, PDE_DATA(inode)); } @@ -692,7 +750,7 @@ }; struct fwdbg_t { -@@ -1910,14 +1897,14 @@ static int proc_read_fwdbg_seq_open(stru +@@ -1910,14 +1901,14 @@ static int proc_read_fwdbg_seq_open(stru { return single_open(file, proc_read_fwdbg, NULL); } @@ -714,7 +772,7 @@ static struct tc_proc_list ptm_sl_procs[] = { {TC_PROC_PTM_DIR, 0, NULL, 1}, {"mem", 0644, &mem_proc_fops, 0}, -@@ -2077,7 +2064,7 @@ static ssize_t atm_cfg_proc_write(struct +@@ -2077,7 +2068,7 @@ static ssize_t atm_cfg_proc_write(struct priv = (struct atm_priv *)PDE_DATA(file_inode(file)); @@ -723,7 +781,7 @@ return -EFAULT; len = count < sizeof(str) ? count : sizeof(str) - 1; -@@ -2119,13 +2106,12 @@ proc_atm_cfg_help: +@@ -2119,13 +2110,12 @@ proc_atm_cfg_help: return count; } @@ -743,7 +801,7 @@ }; static ssize_t proc_write_atm_wanmib(struct file *file, const char __user *buf, -@@ -2173,13 +2159,12 @@ static int proc_read_atm_wanmib_seq_open +@@ -2173,13 +2163,12 @@ static int proc_read_atm_wanmib_seq_open @@ -763,7 +821,7 @@ }; static int proc_read_htu_seq_open(struct inode *inode, struct file *file) -@@ -2187,12 +2172,11 @@ static int proc_read_htu_seq_open(struct +@@ -2187,12 +2176,11 @@ static int proc_read_htu_seq_open(struct return single_open(file, proc_read_htu, PDE_DATA(inode)); } @@ -781,7 +839,7 @@ }; static int proc_read_queue_seq_open(struct inode *inode, struct file *file) -@@ -2200,12 +2184,11 @@ static int proc_read_queue_seq_open(stru +@@ -2200,12 +2188,11 @@ static int proc_read_queue_seq_open(stru return single_open(file, proc_read_queue, PDE_DATA(inode)); } @@ -799,7 +857,7 @@ }; static void set_q_prio(struct atm_priv *priv, -@@ -2428,13 +2411,12 @@ static const struct seq_operations pvc_m +@@ -2428,13 +2415,12 @@ static const struct seq_operations pvc_m .show = pvc_mib_seq_show, }; @@ -819,7 +877,7 @@ }; static int proc_read_pvc_mib_seq_open(struct inode *inode, struct file *file) -@@ -2447,12 +2429,11 @@ static int proc_read_pvc_mib_seq_open(st +@@ -2447,12 +2433,11 @@ static int proc_read_pvc_mib_seq_open(st return ret; } @@ -837,7 +895,7 @@ }; static ssize_t proc_write_cell(struct file *file, -@@ -2592,13 +2573,12 @@ static int proc_read_cell_seq_open(struc +@@ -2592,13 +2577,12 @@ static int proc_read_cell_seq_open(struc return single_open(file, proc_read_cell, NULL); } diff --git a/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch b/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch index 793adefdd65b35..edc97998b739de 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch @@ -79,7 +79,7 @@ This replaces it by a basic working implementation. tc_dbg(priv->tc_priv, MSG_TX, "ATM: TX fail\n"); --- a/dcdp/ptm_tc.c +++ b/dcdp/ptm_tc.c -@@ -497,6 +497,7 @@ static int ptm_xmit(struct sk_buff *skb, +@@ -506,6 +506,7 @@ static int ptm_xmit(struct sk_buff *skb, struct ptm_priv *ptm_tc = netdev_priv(dev); int qid; enum tc_pkt_type type; @@ -87,7 +87,7 @@ This replaces it by a basic working implementation. if (!showtime_stat(ptm_tc->tc_priv)) goto PTM_XMIT_DROP; -@@ -510,11 +511,13 @@ static int ptm_xmit(struct sk_buff *skb, +@@ -519,11 +520,13 @@ static int ptm_xmit(struct sk_buff *skb, type = ptm_tc->tc_priv->tc_mode == TC_PTM_BND_MODE ? PTM_BOND_PKT : PTM_SL_PKT; @@ -102,7 +102,7 @@ This replaces it by a basic working implementation. } return 0; -@@ -631,7 +634,7 @@ static int ptm_dev_init(struct tc_priv * +@@ -640,7 +643,7 @@ static int ptm_dev_init(struct tc_priv * const char macaddr[ETH_ALEN] = {0xAC, 0x9A, 0x96, 0x11, 0x22, 0x33}; @@ -111,7 +111,7 @@ This replaces it by a basic working implementation. if (!dev) { tc_dbg(tc_priv, MSG_INIT, "Cannot alloc net device\n"); return -ENOMEM; -@@ -2324,7 +2327,11 @@ static void ptm_aca_init(struct ptm_ep_p +@@ -2337,7 +2340,11 @@ static void ptm_aca_init(struct ptm_ep_p cfg = &priv->tc_priv->cfg; txin = ¶m.aca_txin; @@ -123,7 +123,7 @@ This replaces it by a basic working implementation. txin->hd_size_in_dw = cfg->txin.soc_desc_dwsz; txin->pd_desc_base = SB_XBAR_ADDR(__ACA_TX_IN_PD_LIST_BASE); txin->pd_desc_num = __ACA_TX_IN_PD_LIST_NUM; -@@ -2347,7 +2354,11 @@ static void ptm_aca_init(struct ptm_ep_p +@@ -2360,7 +2367,11 @@ static void ptm_aca_init(struct ptm_ep_p txin->soc_cmlt_cnt_addr); txout = ¶m.aca_txout; @@ -135,7 +135,7 @@ This replaces it by a basic working implementation. txout->hd_size_in_dw = cfg->txout.soc_desc_dwsz; if (priv->tc_priv->param.cdma_desc_loc == LOC_IN_FPI) txout->pd_desc_base = sb_r32(__TX_OUT_SHADOW_PTR) - phybase; -@@ -2373,7 +2384,11 @@ static void ptm_aca_init(struct ptm_ep_p +@@ -2386,7 +2397,11 @@ static void ptm_aca_init(struct ptm_ep_p txout->soc_cmlt_cnt_addr); rxout = ¶m.aca_rxout; @@ -147,7 +147,7 @@ This replaces it by a basic working implementation. rxout->hd_size_in_dw = cfg->rxout.soc_desc_dwsz; if (priv->tc_priv->param.cdma_desc_loc == LOC_IN_FPI) rxout->pd_desc_base = sb_r32(__RX_OUT_SHADOW_PTR) - phybase; -@@ -2399,7 +2414,11 @@ static void ptm_aca_init(struct ptm_ep_p +@@ -2412,7 +2427,11 @@ static void ptm_aca_init(struct ptm_ep_p rxout->soc_cmlt_cnt_addr); rxin = ¶m.aca_rxin; diff --git a/package/kernel/lantiq/vrx518_tc/patches/201-desc-length.patch b/package/kernel/lantiq/vrx518_tc/patches/201-desc-length.patch index 8b30914df9647c..134f119f3c05fd 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/201-desc-length.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/201-desc-length.patch @@ -54,7 +54,7 @@ significantly lower latencies when the line is saturated. struct cdma { --- a/dcdp/ptm_tc.c +++ b/dcdp/ptm_tc.c -@@ -75,7 +75,11 @@ static const u32 tx_kvec[] = { +@@ -78,7 +78,11 @@ static const u32 tx_kvec[] = { 0x30B1B233, 0xB43536B7, 0xB8393ABB, 0x3CBDBE3F, 0xC04142C3, 0x44C5C647, 0x48C9CA4B, 0xCC4D4ECF }; @@ -66,7 +66,7 @@ significantly lower latencies when the line is saturated. static const char ptm_drv_name[] = "PTM SL"; static const char ptm_bond_name[][IFNAMSIZ] = {"PTM US BOND", "PTM DS BOND"}; -@@ -1005,6 +1009,10 @@ static void us_fp_desq_cfg_ctxt_init(str +@@ -1018,6 +1022,10 @@ static void us_fp_desq_cfg_ctxt_init(str int i; u32 desc_addr; rx_descriptor_t desc; @@ -77,7 +77,7 @@ significantly lower latencies when the line is saturated. memset(&desq_cfg, 0, sizeof(desq_cfg)); /* Initialize US Fast-Path Descriptor Queue Config/Context */ -@@ -1012,7 +1020,11 @@ static void us_fp_desq_cfg_ctxt_init(str +@@ -1025,7 +1033,11 @@ static void us_fp_desq_cfg_ctxt_init(str desq_cfg.fast_path = 1; desq_cfg.mbox_int_en = 0; desq_cfg.des_sync_needed = 0; @@ -89,7 +89,7 @@ significantly lower latencies when the line is saturated. desq_cfg.des_base_addr = __US_FAST_PATH_DES_LIST_BASE; tc_mem_write(priv, fpi_addr(__US_FP_INQ_DES_CFG_CTXT), -@@ -1036,12 +1048,20 @@ static void us_qos_desq_cfg_ctxt_init(st +@@ -1049,12 +1061,20 @@ static void us_qos_desq_cfg_ctxt_init(st int offset, i; rx_descriptor_t desc; u32 phy_addr; @@ -110,7 +110,7 @@ significantly lower latencies when the line is saturated. offset = 0; for (i = 0; i < QOSQ_NUM; i++) { -@@ -1080,6 +1100,10 @@ static void us_outq_desq_cfg_ctxt_init(s +@@ -1093,6 +1113,10 @@ static void us_outq_desq_cfg_ctxt_init(s u32 phy_addr; int i; u32 offset; @@ -121,7 +121,7 @@ significantly lower latencies when the line is saturated. /* Setup OUTQ_QoS_CFG_CTXT */ /* NOTE: By default, Shaping & WFQ both are DISABLED!! */ -@@ -1108,7 +1132,11 @@ static void us_outq_desq_cfg_ctxt_init(s +@@ -1121,7 +1145,11 @@ static void us_outq_desq_cfg_ctxt_init(s desq_cfg.des_in_own_val = US_OUTQ_DES_OWN; desq_cfg.mbox_int_en = 0; desq_cfg.des_sync_needed = 0; @@ -134,7 +134,7 @@ significantly lower latencies when the line is saturated. /** * Only BC0 is used in VRX518 */ -@@ -1174,7 +1202,11 @@ static void us_qos_cfg_init(struct ptm_e +@@ -1187,7 +1215,11 @@ static void us_qos_cfg_init(struct ptm_e /* Set QoS NO DROP */ sb_w32(1, __QOSQ_NO_DROP); /* Enable Preemption function/Disable QoS by default */ @@ -146,7 +146,7 @@ significantly lower latencies when the line is saturated. /* By default, all qid mappint to non-preemption queue */ sb_w32(0x0, _QID2PREEMP_MAP); -@@ -1376,6 +1408,11 @@ static void ptm_local_desq_cfg_ctxt_init +@@ -1389,6 +1421,11 @@ static void ptm_local_desq_cfg_ctxt_init u32 dcnt, addr, pdbram_base; unsigned int us_des_alloc[] = { __US_TC_LOCAL_Q0_DES_LIST_NUM, __US_TC_LOCAL_Q1_DES_LIST_NUM}; @@ -158,7 +158,7 @@ significantly lower latencies when the line is saturated. /* Setup the Local DESQ Configuration/Context for UpStream Queues */ memset(&desq_cfg, 0, sizeof(desq_cfg)); -@@ -2321,6 +2358,10 @@ static void ptm_aca_init(struct ptm_ep_p +@@ -2334,6 +2371,10 @@ static void ptm_aca_init(struct ptm_ep_p u32 phybase = priv->ep->phy_membase; u32 start; u32 type; @@ -169,7 +169,7 @@ significantly lower latencies when the line is saturated. priv->tc_priv->tc_ops.soc_cfg_get(&priv->tc_priv->cfg, ptm_id(priv)); memset(¶m, 0, sizeof(param)); -@@ -2334,7 +2375,11 @@ static void ptm_aca_init(struct ptm_ep_p +@@ -2347,7 +2388,11 @@ static void ptm_aca_init(struct ptm_ep_p #endif txin->hd_size_in_dw = cfg->txin.soc_desc_dwsz; txin->pd_desc_base = SB_XBAR_ADDR(__ACA_TX_IN_PD_LIST_BASE); @@ -198,7 +198,7 @@ significantly lower latencies when the line is saturated. --- a/dcdp/tc_proc.c +++ b/dcdp/tc_proc.c -@@ -1114,6 +1114,9 @@ static int proc_read_ver(struct seq_file +@@ -1118,6 +1118,9 @@ static int proc_read_ver(struct seq_file (date >> 16) & 0xff, (date & 0xffff)); @@ -208,7 +208,7 @@ significantly lower latencies when the line is saturated. #ifdef FEATURE_POWER_DOWN seq_puts(seq, " + Support Power Down enhancement feature\n"); #endif -@@ -1166,6 +1169,113 @@ static const struct proc_ops tc_soc_proc +@@ -1170,6 +1173,113 @@ static const struct proc_ops tc_soc_proc .proc_release = single_release, }; @@ -322,7 +322,7 @@ significantly lower latencies when the line is saturated. static struct tc_proc_list tc_procs[] = { {TC_PROC_DIR, 0, NULL, 1}, {"cfg", 0644, &tc_cfg_proc_fops, 0}, -@@ -1174,6 +1284,9 @@ static struct tc_proc_list tc_procs[] = +@@ -1178,6 +1288,9 @@ static struct tc_proc_list tc_procs[] = {"showtime", 0200, &tc_show_time_proc_fops, 0}, {"ver", 0644, &tc_ver_proc_fops, 0}, {"soc", 0644, &tc_soc_proc_fops, 0}, @@ -332,7 +332,7 @@ significantly lower latencies when the line is saturated. }; int tc_proc_init(struct tc_priv *priv) -@@ -1333,7 +1446,6 @@ proc_ptm_cfg_help: +@@ -1337,7 +1450,6 @@ proc_ptm_cfg_help: return count; } diff --git a/package/kernel/lantiq/vrx518_tc/patches/202-napi.patch b/package/kernel/lantiq/vrx518_tc/patches/202-napi.patch index 55f0cc10667811..266beba1a7e41c 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/202-napi.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/202-napi.patch @@ -334,7 +334,7 @@ int (*umt_init)(u32 umt_id, u32 umt_period, u32 umt_dst); --- a/dcdp/ptm_tc.c +++ b/dcdp/ptm_tc.c -@@ -141,7 +141,11 @@ static int ptm_open(struct net_device *d +@@ -146,7 +146,11 @@ static int ptm_open(struct net_device *d struct ptm_priv *ptm_tc = netdev_priv(dev); tc_info(ptm_tc->tc_priv, MSG_EVENT, "ptm open\n"); @@ -346,7 +346,7 @@ #ifdef CONFIG_SOC_TYPE_XWAY xet_phy_wan_port(7, NULL, 1, 1); if (ppa_hook_ppa_phys_port_add_fn) -@@ -158,7 +162,11 @@ static int ptm_stop(struct net_device *d +@@ -163,7 +167,11 @@ static int ptm_stop(struct net_device *d struct ptm_priv *ptm_tc = netdev_priv(dev); tc_info(ptm_tc->tc_priv, MSG_EVENT, "ptm stop\n"); @@ -358,7 +358,7 @@ #ifdef CONFIG_SOC_TYPE_XWAY if (ppa_drv_datapath_mac_entry_setting) ppa_drv_datapath_mac_entry_setting(dev->dev_addr, 0, 6, 10, 1, 2); -@@ -555,7 +563,7 @@ static void ptm_rx(struct net_device *de +@@ -564,7 +572,7 @@ static void ptm_rx(struct net_device *de ptm_tc->stats64.rx_packets++; ptm_tc->stats64.rx_bytes += skb->len; @@ -367,17 +367,22 @@ ptm_tc->stats64.rx_dropped++; return; -@@ -651,6 +659,9 @@ static int ptm_dev_init(struct tc_priv * +@@ -664,6 +672,14 @@ static int ptm_dev_init(struct tc_priv * memcpy(ptm_tc->outq_map, def_outq_map, sizeof(def_outq_map)); SET_NETDEV_DEV(ptm_tc->dev, tc_priv->ep_dev[id].dev); ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)) ++ netif_napi_add(ptm_tc->dev, &ptm_tc->napi_rx, tc_priv->tc_ops.napi_rx); ++ netif_napi_add_tx(ptm_tc->dev, &ptm_tc->napi_tx, tc_priv->tc_ops.napi_tx); ++#else + netif_napi_add(ptm_tc->dev, &ptm_tc->napi_rx, tc_priv->tc_ops.napi_rx, NAPI_POLL_WEIGHT); + netif_tx_napi_add(ptm_tc->dev, &ptm_tc->napi_tx, tc_priv->tc_ops.napi_tx, NAPI_POLL_WEIGHT); + ++#endif err = register_netdev(ptm_tc->dev); if (err) goto err1; -@@ -2605,7 +2616,9 @@ static int ptm_ring_init(struct ptm_ep_p +@@ -2618,7 +2634,9 @@ static int ptm_ring_init(struct ptm_ep_p { ptm_aca_ring_config_init(priv, id, bonding); return priv->tc_priv->tc_ops.dev_reg(priv->ptm_tc->dev, @@ -388,7 +393,7 @@ } /** -@@ -2960,7 +2973,9 @@ void ptm_tc_unload(enum dsl_tc_mode tc_m +@@ -2973,7 +2991,9 @@ void ptm_tc_unload(enum dsl_tc_mode tc_m /* unregister device */ if (ptm_tc->tc_priv->tc_ops.dev_unreg != NULL) ptm_tc->tc_priv->tc_ops.dev_unreg(ptm_tc->dev, @@ -399,7 +404,7 @@ /* remove PTM callback function */ ptm_cb_setup(ptm_tc, 0); -@@ -2978,6 +2993,10 @@ void ptm_exit(void) +@@ -2991,6 +3011,10 @@ void ptm_exit(void) if (!priv) return; diff --git a/package/kernel/lantiq/vrx518_tc/patches/205-dcdp-ptm_tc-dynamically-alloc-mib.patch b/package/kernel/lantiq/vrx518_tc/patches/205-dcdp-ptm_tc-dynamically-alloc-mib.patch index ca4c041b210bbf..e239ba33466c39 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/205-dcdp-ptm_tc-dynamically-alloc-mib.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/205-dcdp-ptm_tc-dynamically-alloc-mib.patch @@ -1,6 +1,6 @@ --- a/dcdp/ptm_tc.c +++ b/dcdp/ptm_tc.c -@@ -298,15 +298,19 @@ static int ptm_tc_get_stats(struct ptm_e +@@ -307,15 +307,19 @@ static int ptm_tc_get_stats(struct ptm_e ) { struct rtnl_link_stats64 *stat; @@ -21,7 +21,7 @@ if (bonding) stats->tc_info = TC_PTM_BND_MODE; else -@@ -340,11 +344,11 @@ static int ptm_tc_get_stats(struct ptm_e +@@ -349,11 +353,11 @@ static int ptm_tc_get_stats(struct ptm_e ? cur_cnt - last_cnt : cur_cnt + ((unsigned int)(-1) - last_cnt); @@ -36,7 +36,7 @@ cur_cnt = tc_r32(GIF0_RX_CRC_ERR_CNT); last_cnt = priv->ptm_mib.rx_crc_err_pdu[0]; -@@ -358,7 +362,7 @@ static int ptm_tc_get_stats(struct ptm_e +@@ -367,7 +371,7 @@ static int ptm_tc_get_stats(struct ptm_e ? cur_cnt - last_cnt : cur_cnt + ((unsigned int)(-1) - last_cnt); @@ -45,7 +45,7 @@ cur_cnt = sb_r32(__US_TC_LOCAL_Q_CFG_CTXT_BASE + offsetof(desq_cfg_ctxt_t, deq_pkt_cnt) / 4); last_cnt = priv->ptm_mib.tx_total_pdu[0]; -@@ -376,90 +380,108 @@ static int ptm_tc_get_stats(struct ptm_e +@@ -385,90 +389,108 @@ static int ptm_tc_get_stats(struct ptm_e /* For bonding information */ if (bonding) { int i; diff --git a/package/kernel/leds-ws2812b/src/leds-ws2812b.c b/package/kernel/leds-ws2812b/src/leds-ws2812b.c index b0d13f52427fbe..0dba128c1f08ef 100644 --- a/package/kernel/leds-ws2812b/src/leds-ws2812b.c +++ b/package/kernel/leds-ws2812b/src/leds-ws2812b.c @@ -17,6 +17,7 @@ #include #include #include +#include #define WS2812B_BYTES_PER_COLOR 3 #define WS2812B_NUM_COLORS 3 @@ -191,7 +192,11 @@ static int ws2812b_probe(struct spi_device *spi) return ret; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,18,0) +static void ws2812b_remove(struct spi_device *spi) +#else static int ws2812b_remove(struct spi_device *spi) +#endif { struct ws2812b_priv *priv = spi_get_drvdata(spi); int cur_led; @@ -201,7 +206,9 @@ static int ws2812b_remove(struct spi_device *spi) kfree(priv->data_buf); mutex_destroy(&priv->mutex); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) return 0; +#endif } static const struct spi_device_id ws2812b_spi_ids[] = { diff --git a/package/kernel/linux/Makefile b/package/kernel/linux/Makefile index 2caa48f198a942..6592b01678f073 100644 --- a/package/kernel/linux/Makefile +++ b/package/kernel/linux/Makefile @@ -37,6 +37,9 @@ endef define Build/Configure endef +define Build/Quilt +endef + define Build/Compile endef diff --git a/package/kernel/linux/modules/block.mk b/package/kernel/linux/modules/block.mk index 4ee3f78f3809a2..5e6eefa76a9491 100644 --- a/package/kernel/linux/modules/block.mk +++ b/package/kernel/linux/modules/block.mk @@ -496,12 +496,12 @@ $(eval $(call KernelPackage,nbd)) define KernelPackage/nvme SUBMENU:=$(BLOCK_MENU) TITLE:=NVM Express block device - DEPENDS:=@PCI_SUPPORT + DEPENDS:=@PCI_SUPPORT +kmod-hwmon-core KCONFIG:= \ CONFIG_NVME_CORE \ CONFIG_BLK_DEV_NVME \ CONFIG_NVME_MULTIPATH=n \ - CONFIG_NVME_HWMON=n + CONFIG_NVME_HWMON=y FILES:= \ $(LINUX_DIR)/drivers/nvme/host/nvme-core.ko \ $(LINUX_DIR)/drivers/nvme/host/nvme.ko diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk index 248b4d68f9e14a..dd17d868fa1522 100644 --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -399,6 +399,19 @@ endef $(eval $(call KernelPackage,crypto-hw-hifn-795x)) +define KernelPackage/crypto-hw-ixp4xx + TITLE:=Intel IXP4xx crypto accelerator + DEPENDS:=@TARGET_ixp4xx +kmod-random-core +kmod-crypto-manager +kmod-crypto-authenc +kmod-crypto-des + KCONFIG:= \ + CONFIG_CRYPTO_HW=y \ + CONFIG_CRYPTO_DEV_IXP4XX + FILES:=$(LINUX_DIR)/drivers/crypto/ixp4xx_crypto.ko + AUTOLOAD:=$(call AutoProbe,ixp4xx_crypto) + $(call AddDepends/crypto) +endef + +$(eval $(call KernelPackage,crypto-hw-ixp4xx)) + define KernelPackage/crypto-hw-padlock TITLE:=VIA PadLock ACE with AES/SHA hw crypto module @@ -463,6 +476,35 @@ endef $(eval $(call KernelPackage,crypto-hw-talitos)) +define KernelPackage/crypto-hw-eip93 + TITLE:=MTK EIP93 crypto module + DEPENDS:=@TARGET_ramips_mt7621 \ + +kmod-crypto-authenc \ + +kmod-crypto-des \ + +kmod-crypto-md5 \ + +kmod-crypto-sha1 \ + +kmod-crypto-sha256 + KCONFIG:= \ + CONFIG_CRYPTO_HW=y \ + CONFIG_CRYPTO_DEV_EIP93 \ + CONFIG_CRYPTO_DEV_EIP93_AES=y \ + CONFIG_CRYPTO_DEV_EIP93_DES=y \ + CONFIG_CRYPTO_DEV_EIP93_AEAD=y \ + CONFIG_CRYPTO_DEV_EIP93_GENERIC_SW_MAX_LEN=256 \ + CONFIG_CRYPTO_DEV_EIP93_AES_128_SW_MAX_LEN=512 + FILES:=$(LINUX_DIR)/drivers/crypto/mtk-eip93/crypto-hw-eip93.ko + AUTOLOAD:=$(call AutoLoad,09,crypto-hw-eip93) + $(call AddDepends/crypto) +endef + +define KernelPackage/crypto-hw-eip93/description +Kernel module to enable EIP-93 Crypto engine as found +in the Mediatek MT7621 SoC. +It enables DES/3DES/AES ECB/CBC/CTR and +IPSEC offload with authenc(hmac(sha1/sha256), aes/cbc/rfc3686) +endef + +$(eval $(call KernelPackage,crypto-hw-eip93)) define KernelPackage/crypto-kpp TITLE:=Key-agreement Protocol Primitives @@ -494,6 +536,8 @@ define KernelPackage/crypto-lib-chacha20/arm FILES:=$(LINUX_DIR)/arch/arm/crypto/chacha-neon.ko endef +KernelPackage/crypto-lib-chacha20/armeb=$(KernelPackage/crypto-lib-chacha20/arm) + define KernelPackage/crypto-lib-chacha20/aarch64 KCONFIG+=CONFIG_CRYPTO_CHACHA20_NEON FILES+=$(LINUX_DIR)/arch/arm64/crypto/chacha-neon.ko @@ -587,6 +631,8 @@ define KernelPackage/crypto-lib-poly1305/arm FILES:=$(LINUX_DIR)/arch/arm/crypto/poly1305-arm.ko endef +KernelPackage/crypto-lib-poly1305/armeb=$(KernelPackage/crypto-lib-poly1305/arm) + define KernelPackage/crypto-lib-poly1305/aarch64 KCONFIG+=CONFIG_CRYPTO_POLY1305_NEON FILES:=$(LINUX_DIR)/arch/arm64/crypto/poly1305-neon.ko diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk index 1dddebfed73698..58af180c280147 100644 --- a/package/kernel/linux/modules/fs.mk +++ b/package/kernel/linux/modules/fs.mk @@ -10,7 +10,7 @@ FS_MENU:=Filesystems define KernelPackage/fs-9p SUBMENU:=$(FS_MENU) TITLE:=Plan 9 Resource Sharing Support - DEPENDS:=+kmod-9pnet + DEPENDS:=+kmod-9pnet +LINUX_6_1:kmod-fs-netfs KCONFIG:=\ CONFIG_9P_FS \ CONFIG_9P_FS_POSIX_ACL=n \ @@ -87,10 +87,14 @@ define KernelPackage/fs-smbfs-common SUBMENU:=$(FS_MENU) TITLE:=SMBFS common dependencies support HIDDEN:=1 - KCONFIG:=CONFIG_SMBFS_COMMON + KCONFIG:=\ + CONFIG_SMBFS_COMMON@lt6.1 \ + CONFIG_SMBFS@ge6.1 FILES:= \ - $(LINUX_DIR)/fs/smbfs_common/cifs_arc4.ko \ - $(LINUX_DIR)/fs/smbfs_common/cifs_md4.ko + $(LINUX_DIR)/fs/smbfs_common/cifs_arc4.ko@lt6.1 \ + $(LINUX_DIR)/fs/smbfs_common/cifs_md4.ko@lt6.1 \ + $(LINUX_DIR)/fs/smb/common/cifs_arc4.ko@ge6.1 \ + $(LINUX_DIR)/fs/smb/common/cifs_md4.ko@ge6.1 endef define KernelPackage/fs-smbfs-common/description @@ -108,7 +112,8 @@ define KernelPackage/fs-cifs CONFIG_CIFS_DFS_UPCALL=n \ CONFIG_CIFS_UPCALL=n FILES:= \ - $(LINUX_DIR)/fs/cifs/cifs.ko + $(LINUX_DIR)/fs/cifs/cifs.ko@lt6.1 \ + $(LINUX_DIR)/fs/smb/client/cifs.ko@ge6.1 AUTOLOAD:=$(call AutoLoad,30,cifs) $(call AddDepends/nls) DEPENDS+= \ @@ -269,7 +274,9 @@ define KernelPackage/fs-fscache CONFIG_FSCACHE_OBJECT_LIST=n \ CONFIG_CACHEFILES \ CONFIG_CACHEFILES_DEBUG=n \ - CONFIG_CACHEFILES_HISTOGRAM=n + CONFIG_CACHEFILES_HISTOGRAM=n \ + CONFIG_CACHEFILES_ERROR_INJECTION=n@ge5.17 \ + CONFIG_CACHEFILES_ONDEMAND=n@ge5.19 FILES:= \ $(LINUX_DIR)/fs/fscache/fscache.ko \ $(LINUX_DIR)/fs/cachefiles/cachefiles.ko @@ -352,8 +359,7 @@ define KernelPackage/fs-ksmbd DEPENDS:= \ +kmod-nls-base \ +kmod-nls-utf8 \ - +kmod-crypto-md4 \ - +kmod-crypto-md5 \ + +kmod-crypto-md5 \ +kmod-crypto-hmac \ +kmod-crypto-ecb \ +kmod-crypto-des \ @@ -371,7 +377,9 @@ define KernelPackage/fs-ksmbd CONFIG_SMB_SERVER_SMBDIRECT=n \ CONFIG_SMB_SERVER_CHECK_CAP_NET_ADMIN=n \ CONFIG_SMB_SERVER_KERBEROS5=n - FILES:=$(LINUX_DIR)/fs/ksmbd/ksmbd.ko + FILES:= \ + $(LINUX_DIR)/fs/ksmbd/ksmbd.ko@lt6.1 \ + $(LINUX_DIR)/fs/smb/server/ksmbd.ko@ge6.1 AUTOLOAD:=$(call AutoLoad,41,ksmbd) endef diff --git a/package/kernel/linux/modules/hwmon.mk b/package/kernel/linux/modules/hwmon.mk index 29392548d40c16..8afe315344f1ae 100644 --- a/package/kernel/linux/modules/hwmon.mk +++ b/package/kernel/linux/modules/hwmon.mk @@ -52,7 +52,7 @@ define KernelPackage/hwmon-adt7410 $(LINUX_DIR)/drivers/hwmon/adt7x10.ko \ $(LINUX_DIR)/drivers/hwmon/adt7410.ko AUTOLOAD:=$(call AutoLoad,60,adt7x10 adt7410) - $(call AddDepends/hwmon,+kmod-i2c-core) + $(call AddDepends/hwmon,+kmod-i2c-core +LINUX_6_1:kmod-regmap-core) endef define KernelPackage/hwmon-adt7410/description @@ -77,6 +77,23 @@ endef $(eval $(call KernelPackage,hwmon-adt7475)) +define KernelPackage/hwmon-coretemp + TITLE:=Intel Core/Core2/Atom temperature sensor + KCONFIG:=CONFIG_SENSORS_CORETEMP + FILES:=$(LINUX_DIR)/drivers/hwmon/coretemp.ko + AUTOLOAD:=$(call AutoProbe,coretemp) + $(call AddDepends/hwmon,) +endef + +define KernelPackage/hwmon-coretemp/description + Kernel module for Intel Core/Core2/Atom temperature monitoring support. + Most of the family 6 CPUs are supported. + Check Documentation/hwmon/coretemp.rst for details. +endef + +$(eval $(call KernelPackage,hwmon-coretemp)) + + define KernelPackage/hwmon-dme1737 TITLE:=SMSC DME1737 and compatible monitoring support KCONFIG:=CONFIG_SENSORS_DME1737 @@ -217,6 +234,21 @@ endef $(eval $(call KernelPackage,hwmon-it87)) +define KernelPackage/hwmon-jc42 + TITLE:=Jedec JC42.4 compliant temperature sensors support + KCONFIG:=CONFIG_SENSORS_JC42 + FILES:=$(LINUX_DIR)/drivers/hwmon/jc42.ko + AUTOLOAD:=$(call AutoProbe,jc42) + $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap-i2c) +endef + +define KernelPackage/hwmon-jc42/description + Kernel module for Jedec JC42.4 compliant temperature sensors +endef + +$(eval $(call KernelPackage,hwmon-jc42)) + + define KernelPackage/hwmon-lm63 TITLE:=LM63/64 monitoring support KCONFIG:=CONFIG_SENSORS_LM63 @@ -369,6 +401,21 @@ endef $(eval $(call KernelPackage,hwmon-max6642)) +define KernelPackage/hwmon-max6697 + TITLE:=MAX6697 monitoring support + KCONFIG:=CONFIG_SENSORS_MAX6697 + FILES:=$(LINUX_DIR)/drivers/hwmon/max6697.ko + AUTOLOAD:=$(call AutoProbe,max6697) + $(call AddDepends/hwmon,+kmod-i2c-core) +endef + +define KernelPackage/hwmon-max6697/description + Kernel module for Maxim MAX6697 temperature monitor +endef + +$(eval $(call KernelPackage,hwmon-max6697)) + + define KernelPackage/hwmon-mcp3021 TITLE:=MCP3021/3221 monitoring support KCONFIG:=CONFIG_SENSORS_MCP3021 @@ -387,9 +434,11 @@ $(eval $(call KernelPackage,hwmon-mcp3021)) define KernelPackage/hwmon-nct6775 TITLE:=NCT6106D/6775F/6776F/6779D/6791D/6792D/6793D and compatibles monitoring support KCONFIG:=CONFIG_SENSORS_NCT6775 - FILES:=$(LINUX_DIR)/drivers/hwmon/nct6775.ko + FILES:= \ + $(LINUX_DIR)/drivers/hwmon/nct6775.ko \ + $(LINUX_DIR)/drivers/hwmon/nct6775-core.ko AUTOLOAD:=$(call AutoProbe,nct6775) - $(call AddDepends/hwmon,@PCI_SUPPORT @TARGET_x86 +kmod-hwmon-vid) + $(call AddDepends/hwmon,@PCI_SUPPORT @TARGET_x86 +kmod-hwmon-vid +kmod-regmap-core) endef define KernelPackage/hwmon-nct6775/description diff --git a/package/kernel/linux/modules/i2c.mk b/package/kernel/linux/modules/i2c.mk index 6b3cf98345cb0c..7cd69dbb95a43c 100644 --- a/package/kernel/linux/modules/i2c.mk +++ b/package/kernel/linux/modules/i2c.mk @@ -84,6 +84,20 @@ endef $(eval $(call KernelPackage,i2c-algo-pcf)) +I2C_CCGS_UCSI_MODULES:= \ + CONFIG_I2C_CCGX_UCSI:drivers/i2c/busses/i2c-ccgx-ucsi + +define KernelPackage/i2c-ccgs-ucsi + $(call i2c_defaults,$(I2C_CCGS_UCSI_MODULES),58) + TITLE:=Cypress CCGx Type-C controller + DEPENDS:=+kmod-i2c-core +kmod-regmap-core + HIDDEN:=y +endef + + +$(eval $(call KernelPackage,i2c-ccgs-ucsi)) + + I2C_DWCORE_MODULES:= \ CONFIG_I2C_DESIGNWARE_CORE:drivers/i2c/busses/i2c-designware-core @@ -103,7 +117,7 @@ I2C_DWPCI_MODULES:= \ define KernelPackage/i2c-designware-pci $(call i2c_defaults,$(I2C_DWPCI_MODULES),59) TITLE:=Synopsys DesignWare PCI - DEPENDS:=@PCI_SUPPORT +kmod-i2c-designware-core + DEPENDS:=@PCI_SUPPORT +kmod-i2c-designware-core +kmod-i2c-ccgs-ucsi endef define KernelPackage/i2c-designware-pci/description @@ -186,6 +200,22 @@ endef $(eval $(call KernelPackage,i2c-mux-gpio)) +I2C_MUX_REG_MODULES:= \ + CONFIG_I2C_MUX_REG:drivers/i2c/muxes/i2c-mux-reg + +define KernelPackage/i2c-mux-reg + $(call i2c_defaults,$(I2C_MUX_REG_MODULES),51) + TITLE:=Register-based I2C mux/switches + DEPENDS:=+kmod-i2c-mux +endef + +define KernelPackage/i2c-mux-reg/description + Kernel modules for register-based I2C bus mux/switching devices +endef + +$(eval $(call KernelPackage,i2c-mux-reg)) + + I2C_MUX_PCA9541_MODULES:= \ CONFIG_I2C_MUX_PCA9541:drivers/i2c/muxes/i2c-mux-pca9541 diff --git a/package/kernel/linux/modules/leds.mk b/package/kernel/linux/modules/leds.mk index fcf9c987e8ece4..60465a8ad507f4 100644 --- a/package/kernel/linux/modules/leds.mk +++ b/package/kernel/linux/modules/leds.mk @@ -147,6 +147,22 @@ endef $(eval $(call KernelPackage,leds-apu)) +define KernelPackage/leds-mlxcpld + SUBMENU:=$(LEDS_MENU) + TITLE:=LED support for the Mellanox boards + FILES:=$(LINUX_DIR)/drivers/leds/leds-mlxcpld.ko + KCONFIG:=CONFIG_LEDS_MLXCPLD + AUTOLOAD:=$(call AutoProbe,leds-mlxcpld) +endef + +define KernelPackage/leds-mlxcpld/description + This option enables support for the LEDs on the Mellanox + boards. +endef + +$(eval $(call KernelPackage,leds-mlxcpld)) + + define KernelPackage/leds-pca955x SUBMENU:=$(LEDS_MENU) TITLE:=LED driver for PCA955x I2C chips @@ -245,3 +261,37 @@ define KernelPackage/input-leds/description endef $(eval $(call KernelPackage,input-leds)) + + +define KernelPackage/leds-lp55xx-common + SUBMENU:=$(LEDS_MENU) + TITLE:=LED common driver for LP5521/LP5523/LP55231/LP5562 controllers + DEPENDS:=+kmod-i2c-core + KCONFIG:=CONFIG_LEDS_LP55XX_COMMON + FILES:=$(LINUX_DIR)/drivers/leds/leds-lp55xx-common.ko + AUTOLOAD:=$(call AutoLoad,60,leds-lp55xx-common,1) +endef + +define KernelPackage/leds-lp55xx-common/description + This option enables support for Texas Instruments + LP5521/LP5523/LP55231/LP5562 common driver. +endef + +$(eval $(call KernelPackage,leds-lp55xx-common)) + + +define KernelPackage/leds-lp5562 + SUBMENU:=$(LEDS_MENU) + TITLE:=LED driver for LP5562 controllers + DEPENDS:=+kmod-i2c-core +kmod-leds-lp55xx-common + KCONFIG:=CONFIG_LEDS_LP5562 + FILES:=$(LINUX_DIR)/drivers/leds/leds-lp5562.ko + AUTOLOAD:=$(call AutoLoad,60,leds-lp5562,1) +endef + +define KernelPackage/leds-lp5562/description + This option enables support for Texas Instruments LP5562 + LED controllers. +endef + +$(eval $(call KernelPackage,leds-lp5562)) \ No newline at end of file diff --git a/package/kernel/linux/modules/lib.mk b/package/kernel/linux/modules/lib.mk index 299c5a8c3541fb..8d67a3187a6272 100644 --- a/package/kernel/linux/modules/lib.mk +++ b/package/kernel/linux/modules/lib.mk @@ -134,6 +134,7 @@ define KernelPackage/lib-zstd FILES:= \ $(LINUX_DIR)/crypto/zstd.ko \ $(LINUX_DIR)/lib/xxhash.ko \ + $(LINUX_DIR)/lib/zstd/zstd_common.ko@ge6.1 \ $(LINUX_DIR)/lib/zstd/zstd_compress.ko \ $(LINUX_DIR)/lib/zstd/zstd_decompress.ko AUTOLOAD:=$(call AutoProbe,xxhash zstd zstd_compress zstd_decompress) @@ -317,3 +318,29 @@ define KernelPackage/oid-registry endef $(eval $(call KernelPackage,oid-registry)) + + +define KernelPackage/lib-objagg + SUBMENU:=$(LIB_MENU) + TITLE:=objagg support + FILES:=$(LINUX_DIR)/lib/objagg.ko + KCONFIG:= \ + CONFIG_OBJAGG \ + CONFIG_TEST_OBJAGG=n + AUTOLOAD:=$(call AutoProbe,objagg) +endef + +$(eval $(call KernelPackage,lib-objagg)) + + +define KernelPackage/lib-parman + SUBMENU:=$(LIB_MENU) + TITLE:=parman support + FILES:=$(LINUX_DIR)/lib/parman.ko + KCONFIG:= \ + CONFIG_PARMAN \ + CONFIG_TEST_PARMAN=n + AUTOLOAD:=$(call AutoProbe,parman) +endef + +$(eval $(call KernelPackage,lib-parman)) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index e549e4e3f1db8a..46dcdfdef727c9 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -111,6 +111,7 @@ $(eval $(call KernelPackage,libphy)) define KernelPackage/phylink SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Model for MAC to optional PHY connection + DEPENDS:=+kmod-libphy KCONFIG:=CONFIG_PHYLINK FILES:=$(LINUX_DIR)/drivers/net/phy/phylink.ko AUTOLOAD:=$(call AutoLoad,15,phylink,1) @@ -223,6 +224,22 @@ endef $(eval $(call KernelPackage,phylib-broadcom)) +define KernelPackage/phy-amd + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=AMD PHY driver + KCONFIG:=CONFIG_AMD_PHY + DEPENDS:=+kmod-libphy + FILES:=$(LINUX_DIR)/drivers/net/phy/amd.ko + AUTOLOAD:=$(call AutoProbe,amd,1) +endef + +define KernelPackage/phy-amd/description + Currently supports the AMD and Altima PHYs. +endef + +$(eval $(call KernelPackage,phy-amd)) + + define KernelPackage/phy-ax88796b SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Asix PHY driver @@ -361,9 +378,11 @@ $(eval $(call KernelPackage,phy-smsc)) define KernelPackage/phy-aquantia SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Aquantia Ethernet PHYs - DEPENDS:=+kmod-libphy +kmod-hwmon-core + DEPENDS:=+kmod-libphy +kmod-hwmon-core +kmod-lib-crc-ccitt KCONFIG:=CONFIG_AQUANTIA_PHY - FILES:=$(LINUX_DIR)/drivers/net/phy/aquantia.ko + FILES:= \ + $(LINUX_DIR)/drivers/net/phy/aquantia.ko@lt6.1 \ + $(LINUX_DIR)/drivers/net/phy/aquantia/aquantia.ko@ge6.1 AUTOLOAD:=$(call AutoLoad,18,aquantia,1) endef @@ -1326,7 +1345,7 @@ $(eval $(call KernelPackage,mlx4-core)) define KernelPackage/mlx5-core SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Mellanox ConnectX(R) mlx5 core Network Driver - DEPENDS:=@PCI_SUPPORT +kmod-ptp + DEPENDS:=@PCI_SUPPORT +kmod-ptp +kmod-mlxfw FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko KCONFIG:= CONFIG_MLX5_CORE \ CONFIG_MLX5_CORE_EN=y \ @@ -1343,7 +1362,8 @@ define KernelPackage/mlx5-core CONFIG_MLX5_MPFS=y \ CONFIG_MLX5_SW_STEERING=n \ CONFIG_MLX5_TC_CT=n \ - CONFIG_MLX5_TLS=n + CONFIG_MLX5_TLS=n \ + CONFIG_MLX5_VFIO_PCI=n AUTOLOAD:=$(call AutoProbe,mlx5_core) endef @@ -1354,6 +1374,119 @@ endef $(eval $(call KernelPackage,mlx5-core)) +define KernelPackage/mlxfw + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Mellanox Technologies firmware flash module + FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxfw/mlxfw.ko + KCONFIG:=CONFIG_MLXFW + AUTOLOAD:=$(call AutoProbe,mlxfw) +endef + +define KernelPackage/mlxfw/description + This driver supports Mellanox Technologies Firmware + flashing common logic. +endef + +$(eval $(call KernelPackage,mlxfw)) + + +define KernelPackage/mlxsw-core + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Mellanox Technologies Switch ASICs support + DEPENDS:=+kmod-mlxfw +kmod-hwmon-core + FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_core.ko + KCONFIG:= \ + CONFIG_MLXSW_CORE \ + CONFIG_MLXSW_CORE_HWMON=y \ + CONFIG_MLXSW_CORE_THERMAL=y + AUTOLOAD:=$(call AutoProbe,mlxsw_core) +endef + +define KernelPackage/mlxsw-core/description + This driver supports Mellanox Technologies Switch ASICs family. +endef + +$(eval $(call KernelPackage,mlxsw-core)) + + +define KernelPackage/mlxsw-i2c + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=I2C bus implementation for Mellanox Technologies Switch ASICs + DEPENDS:=+kmod-mlxsw-core +kmod-i2c-core + FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_i2c.ko + KCONFIG:=CONFIG_MLXSW_I2C + AUTOLOAD:=$(call AutoProbe,mlxsw_i2c) +endef + +define KernelPackage/mlxsw-i2c/description + This is I2C bus implementation for Mellanox Technologies Switch ASICs. +endef + +$(eval $(call KernelPackage,mlxsw-i2c)) + + +define KernelPackage/mlxsw-minimal + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Mellanox Technologies minimal I2C support + DEPENDS:=+kmod-mlxsw-core +kmod-mlxsw-i2c + FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_minimal.ko + KCONFIG:=CONFIG_MLXSW_MINIMAL + AUTOLOAD:=$(call AutoProbe,mlxsw_minimal) +endef + +define KernelPackage/mlxsw-minimal/description + This driver supports I2C access for Mellanox Technologies Switch + ASICs. +endef + +$(eval $(call KernelPackage,mlxsw-minimal)) + + +define KernelPackage/mlxsw-pci + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=PCI bus implementation for Mellanox Technologies Switch ASICs + DEPENDS:=@PCI_SUPPORT +kmod-mlxsw-core + FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_pci.ko + KCONFIG:=CONFIG_MLXSW_PCI + AUTOLOAD:=$(call AutoProbe,mlxsw_pci) +endef + +define KernelPackage/mlxsw-pci/description + This is PCI bus implementation for Mellanox Technologies Switch ASICs. +endef + +$(eval $(call KernelPackage,mlxsw-pci)) + + +define KernelPackage/mlxsw-spectrum + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Mellanox Technologies Spectrum family support + DEPENDS:= \ + +kmod-mlxsw-core +kmod-mlxsw-pci +kmod-lib-objagg +kmod-lib-parman \ + +kmod-ip6-tunnel +kmod-ptp +kmod-sched-act-sample +kmod-vxlan + FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlxsw/mlxsw_spectrum.ko + KCONFIG:= \ + CONFIG_MLXSW_SPECTRUM \ + CONFIG_NET_SWITCHDEV=y \ + CONFIG_MLXSW_SPECTRUM_DCB=y \ + CONFIG_DCB=y \ + CONFIG_AMD_XGBE_DCB=n \ + CONFIG_IXGBE_DCB=n \ + CONFIG_I40E_DCB=n \ + CONFIG_QLCNIC_DCB=n \ + CONFIG_FSL_DPAA2_ETH_DCB=n \ + CONFIG_FSL_DPAA2_SWITCH=n + AUTOLOAD:=$(call AutoProbe,mlxsw_spectrum) +endef + +define KernelPackage/mlxsw-spectrum/description + This driver supports Mellanox Technologies + Spectrum/Spectrum-2/Spectrum-3/Spectrum-4 Ethernet Switch ASICs. +endef + +$(eval $(call KernelPackage,mlxsw-spectrum)) + + define KernelPackage/net-selftests SUBMENU:=$(NETWORK_DEVICES_MENU) DEPENDS:=+kmod-libphy @@ -1497,13 +1630,15 @@ $(eval $(call KernelPackage,sfc-falcon)) define KernelPackage/wwan SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=WWAN Driver Core - KCONFIG:=CONFIG_WWAN + KCONFIG:= \ + CONFIG_WWAN \ + CONFIG_WWAN_DEBUGFS=y@ge5.17 FILES:=$(LINUX_DIR)/drivers/net/wwan/wwan.ko AUTOLOAD:=$(call AutoProbe,wwan) endef define KernelPackage/wwan/description - his driver provides a common framework for WWAN drivers. + This driver provides a common framework for WWAN drivers. endef $(eval $(call KernelPackage,wwan)) @@ -1571,6 +1706,7 @@ endef $(eval $(call KernelPackage,atlantic)) + define KernelPackage/lan743x SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Microchip LAN743x PCI Express Gigabit Ethernet NIC diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk index 0d2f8a9140e761..da3e69e49ac6f1 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -1185,15 +1185,15 @@ define KernelPackage/nft-offload DEPENDS:=@IPV6 +kmod-nf-flow +kmod-nft-nat KCONFIG:= \ CONFIG_NF_FLOW_TABLE_INET \ - CONFIG_NF_FLOW_TABLE_IPV4 \ - CONFIG_NF_FLOW_TABLE_IPV6 \ + CONFIG_NF_FLOW_TABLE_IPV4@lt5.17 \ + CONFIG_NF_FLOW_TABLE_IPV6@lt5.17 \ CONFIG_NFT_FLOW_OFFLOAD FILES:= \ $(LINUX_DIR)/net/netfilter/nf_flow_table_inet.ko \ - $(LINUX_DIR)/net/ipv4/netfilter/nf_flow_table_ipv4.ko \ - $(LINUX_DIR)/net/ipv6/netfilter/nf_flow_table_ipv6.ko \ + $(LINUX_DIR)/net/ipv4/netfilter/nf_flow_table_ipv4.ko@lt5.17 \ + $(LINUX_DIR)/net/ipv6/netfilter/nf_flow_table_ipv6.ko@lt5.17 \ $(LINUX_DIR)/net/netfilter/nft_flow_offload.ko - AUTOLOAD:=$(call AutoProbe,nf_flow_table_inet nf_flow_table_ipv4 nf_flow_table_ipv6 nft_flow_offload) + AUTOLOAD:=$(call AutoProbe,nf_flow_table_inet nf_flow_table_ipv4@lt5.17 nf_flow_table_ipv6@lt5.17 nft_flow_offload) endef $(eval $(call KernelPackage,nft-offload)) diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index 27268ee04398f5..fcf327b434e12e 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -993,7 +993,7 @@ endef $(eval $(call KernelPackage,bpf-test)) -SCHED_MODULES_EXTRA = sch_codel sch_dsmark sch_gred sch_multiq sch_sfq sch_teql sch_fq act_pedit act_simple act_csum em_cmp em_nbyte em_meta em_text +SCHED_MODULES_EXTRA = sch_codel sch_dsmark sch_gred sch_multiq sch_sfq sch_teql sch_fq act_pedit act_simple act_skbmod act_csum em_cmp em_nbyte em_meta em_text SCHED_FILES_EXTRA = $(foreach mod,$(SCHED_MODULES_EXTRA),$(LINUX_DIR)/net/sched/$(mod).ko) define KernelPackage/sched @@ -1010,6 +1010,7 @@ define KernelPackage/sched CONFIG_NET_SCH_FQ \ CONFIG_NET_ACT_PEDIT \ CONFIG_NET_ACT_SIMP \ + CONFIG_NET_ACT_SKBMOD \ CONFIG_NET_ACT_CSUM \ CONFIG_NET_EMATCH_CMP \ CONFIG_NET_EMATCH_NBYTE \ @@ -1286,7 +1287,8 @@ define KernelPackage/rxrpc FILES:= \ $(LINUX_DIR)/net/rxrpc/rxrpc.ko AUTOLOAD:=$(call AutoLoad,30,rxrpc.ko) - DEPENDS:= +kmod-crypto-manager +kmod-crypto-pcbc +kmod-crypto-fcrypt + DEPENDS:= +kmod-crypto-manager +kmod-crypto-pcbc +kmod-crypto-fcrypt \ + +kmod-udptunnel4 +kmod-udptunnel6 endef define KernelPackage/rxrpc/description @@ -1322,16 +1324,13 @@ $(eval $(call KernelPackage,mpls)) define KernelPackage/9pnet SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=Plan 9 Resource Sharing Support (9P2000) - DEPENDS:=@VIRTIO_SUPPORT KCONFIG:= \ CONFIG_NET_9P \ CONFIG_NET_9P_DEBUG=n \ - CONFIG_NET_9P_XEN=n \ - CONFIG_NET_9P_VIRTIO + CONFIG_NET_9P_FD=n@ge5.17 FILES:= \ - $(LINUX_DIR)/net/9p/9pnet.ko \ - $(LINUX_DIR)/net/9p/9pnet_virtio.ko - AUTOLOAD:=$(call AutoLoad,29,9pnet 9pnet_virtio) + $(LINUX_DIR)/net/9p/9pnet.ko + AUTOLOAD:=$(call AutoLoad,29,9pnet) endef define KernelPackage/9pnet/description @@ -1341,6 +1340,25 @@ endef $(eval $(call KernelPackage,9pnet)) +define KernelPackage/9pvirtio + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Plan 9 Virtio Support + DEPENDS:=+kmod-9pnet @VIRTIO_SUPPORT + KCONFIG:= \ + CONFIG_NET_9P_XEN=n \ + CONFIG_NET_9P_VIRTIO + FILES:= \ + $(LINUX_DIR)/net/9p/9pnet_virtio.ko + AUTOLOAD:=$(call AutoLoad,29,9pnet_virtio) +endef + +define KernelPackage/9pvirtio/description + Kernel support support for + Plan 9 resource sharing for virtio. +endef + +$(eval $(call KernelPackage,9pvirtio)) + define KernelPackage/nlmon SUBMENU:=$(NETWORK_SUPPORT_MENU) @@ -1536,7 +1554,7 @@ $(eval $(call KernelPackage,qrtr-tun)) define KernelPackage/qrtr-smd SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=SMD IPC Router channels - DEPENDS:=+kmod-qrtr @TARGET_ipq807x + DEPENDS:=+kmod-qrtr @TARGET_qualcommax KCONFIG:=CONFIG_QRTR_SMD FILES:= $(LINUX_DIR)/net/qrtr/qrtr-smd.ko AUTOLOAD:=$(call AutoProbe,qrtr-smd) diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index 9c10b9750192d6..face5794727736 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -57,7 +57,8 @@ define KernelPackage/bluetooth $(LINUX_DIR)/drivers/bluetooth/hci_uart.ko \ $(LINUX_DIR)/drivers/bluetooth/btusb.ko \ $(LINUX_DIR)/drivers/bluetooth/btintel.ko \ - $(LINUX_DIR)/drivers/bluetooth/btrtl.ko + $(LINUX_DIR)/drivers/bluetooth/btrtl.ko \ + $(LINUX_DIR)/drivers/bluetooth/btmtk.ko@ge5.17 AUTOLOAD:=$(call AutoProbe,bluetooth rfcomm bnep hidp hci_uart btusb) endef @@ -727,6 +728,22 @@ endef $(eval $(call KernelPackage,rtc-pcf2127)) +define KernelPackage/rtc-r7301 + SUBMENU:=$(OTHER_MENU) + TITLE:=Epson RTC7301 support + DEFAULT:=m if ALL_KMODS && RTC_SUPPORT + DEPENDS:=+kmod-regmap-mmio + KCONFIG:=CONFIG_RTC_DRV_R7301 \ + CONFIG_RTC_CLASS=y + FILES:=$(LINUX_DIR)/drivers/rtc/rtc-r7301.ko + AUTOLOAD:=$(call AutoProbe,rtc-r7301) +endef + +define KernelPackage/rtc-r7301/description + Kernel module for Epson RTC7301 RTC chip +endef + +$(eval $(call KernelPackage,rtc-r7301)) define KernelPackage/rtc-rs5c372a SUBMENU:=$(OTHER_MENU) @@ -779,6 +796,22 @@ endef $(eval $(call KernelPackage,rtc-s35390a)) +define KernelPackage/rtc-x1205 + SUBMENU:=$(OTHER_MENU) + TITLE:=Xicor Intersil X1205 + DEFAULT:=m if ALL_KMODS && RTC_SUPPORT + DEPENDS:=+kmod-i2c-core + KCONFIG:=CONFIG_RTC_DRV_X1205 \ + CONFIG_RTC_CLASS=y + FILES:=$(LINUX_DIR)/drivers/rtc/rtc-x1205.ko + AUTOLOAD:=$(call AutoProbe,rtc-x1205) +endef + +define KernelPackage/rtc-x1205/description + Kernel module for Xicor Intersil X1205 I2C RTC chip +endef + +$(eval $(call KernelPackage,rtc-x1205)) define KernelPackage/mtdtests SUBMENU:=$(OTHER_MENU) diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 119a981d111d66..6218ec994c8357 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -331,17 +331,6 @@ define KernelPackage/usb-bcma endef $(eval $(call KernelPackage,usb-bcma)) -define KernelPackage/usb-fotg210 - TITLE:=Support for FOTG210 USB host controllers - DEPENDS:=@USB_SUPPORT @TARGET_gemini - KCONFIG:=CONFIG_USB_FOTG210_HCD - FILES:= \ - $(if $(CONFIG_USB_FOTG210_HCD),$(LINUX_DIR)/drivers/usb/host/fotg210-hcd.ko) - AUTOLOAD:=$(call AutoLoad,50,fotg210-hcd,1) - $(call AddDepends/usb) -endef -$(eval $(call KernelPackage,usb-fotg210)) - define KernelPackage/usb-ssb TITLE:=Support for SSB USB controllers DEPENDS:=@USB_SUPPORT @TARGET_bcm47xx @@ -494,7 +483,7 @@ $(eval $(call KernelPackage,usb-dwc3)) define KernelPackage/usb-dwc3-qcom TITLE:=DWC3 Qualcomm USB driver - DEPENDS:=@(TARGET_ipq40xx||TARGET_ipq806x||TARGET_ipq807x) +kmod-usb-dwc3 + DEPENDS:=@(TARGET_ipq40xx||TARGET_ipq806x||TARGET_qualcommax) +kmod-usb-dwc3 KCONFIG:= CONFIG_USB_DWC3_QCOM FILES:= $(LINUX_DIR)/drivers/usb/dwc3/dwc3-qcom.ko AUTOLOAD:=$(call AutoLoad,53,dwc3-qcom,1) @@ -545,7 +534,6 @@ $(eval $(call KernelPackage,usb-wdm)) define KernelPackage/usb-audio TITLE:=Support for USB audio devices KCONFIG:= \ - CONFIG_USB_AUDIO \ CONFIG_SND_USB=y \ CONFIG_SND_USB_AUDIO $(call AddDepends/usb) @@ -1156,7 +1144,9 @@ $(eval $(call KernelPackage,usb-net-aqc111)) define KernelPackage/usb-net-asix TITLE:=Kernel module for USB-to-Ethernet Asix convertors - DEPENDS:=+kmod-libphy +kmod-net-selftests +kmod-mdio-devres +kmod-phy-ax88796b + DEPENDS:= \ + +kmod-libphy +kmod-net-selftests +kmod-mdio-devres +kmod-phy-ax88796b \ + +LINUX_6_1:kmod-phylink KCONFIG:=CONFIG_USB_NET_AX8817X FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/asix.ko AUTOLOAD:=$(call AutoProbe,asix) @@ -1284,7 +1274,7 @@ $(eval $(call KernelPackage,usb-net-smsc75xx)) define KernelPackage/usb-net-smsc95xx TITLE:=SMSC LAN95XX based USB 2.0 10/100 ethernet devices - DEPENDS:=+kmod-libphy +kmod-phy-smsc + DEPENDS:=+kmod-libphy +kmod-phy-smsc +LINUX_6_1:kmod-net-selftests KCONFIG:=CONFIG_USB_NET_SMSC95XX FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/smsc95xx.ko AUTOLOAD:=$(call AutoProbe,smsc95xx) diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk index f1e61f33a5761f..cb96ae80f8de7d 100644 --- a/package/kernel/linux/modules/video.mk +++ b/package/kernel/linux/modules/video.mk @@ -10,11 +10,30 @@ VIDEO_MENU:=Video Support V4L2_DIR=v4l2-core V4L2_USB_DIR=usb +V4L2_MEM2MEM_DIR=platform # # Video Display # +define KernelPackage/acpi-video + SUBMENU:=$(VIDEO_MENU) + TITLE:=ACPI Extensions For Display Adapters + DEPENDS:=@TARGET_x86 +kmod-backlight + HIDDEN:=1 + KCONFIG:=CONFIG_ACPI_VIDEO \ + CONFIG_ACPI_WMI + FILES:=$(LINUX_DIR)/drivers/acpi/video.ko \ + $(LINUX_DIR)/drivers/platform/x86/wmi.ko + AUTOLOAD:=$(call AutoProbe,wmi video) +endef + +define KernelPackage/acpi-video/description + Kernel support for integrated graphics devices. +endef + +$(eval $(call KernelPackage,acpi-video)) + define KernelPackage/backlight SUBMENU:=$(VIDEO_MENU) TITLE:=Backlight support @@ -240,6 +259,36 @@ endef $(eval $(call KernelPackage,drm)) +define KernelPackage/drm-buddy + SUBMENU:=$(VIDEO_MENU) + TITLE:=A page based buddy allocator + DEPENDS:=@DISPLAY_SUPPORT +kmod-drm @LINUX_6_1 + KCONFIG:=CONFIG_DRM_BUDDY + FILES:= $(LINUX_DIR)/drivers/gpu/drm/drm_buddy.ko + AUTOLOAD:=$(call AutoProbe,drm_buddy) +endef + +define KernelPackage/drm-buddy/description + A page based buddy allocator +endef + +$(eval $(call KernelPackage,drm-buddy)) + +define KernelPackage/drm-display-helper + SUBMENU:=$(VIDEO_MENU) + TITLE:=DRM helpers for display adapters drivers + DEPENDS:=@DISPLAY_SUPPORT +kmod-drm-kms-helper @LINUX_6_1 + KCONFIG:=CONFIG_DRM_DISPLAY_HELPER + FILES:=$(LINUX_DIR)/drivers/gpu/drm/display/drm_display_helper.ko + AUTOLOAD:=$(call AutoProbe,drm_display_helper) +endef + +define KernelPackage/drm-display-helper/description + DRM helpers for display adapters drivers. +endef + +$(eval $(call KernelPackage,drm-display-helper)) + define KernelPackage/drm-ttm SUBMENU:=$(VIDEO_MENU) TITLE:=GPU memory management subsystem @@ -292,7 +341,8 @@ define KernelPackage/drm-amdgpu SUBMENU:=$(VIDEO_MENU) TITLE:=AMDGPU DRM support DEPENDS:=@TARGET_x86 @DISPLAY_SUPPORT +kmod-backlight +kmod-drm-ttm \ - +kmod-drm-ttm-helper +kmod-drm-kms-helper +kmod-i2c-algo-bit +amdgpu-firmware + +kmod-drm-ttm-helper +kmod-drm-kms-helper +kmod-i2c-algo-bit +amdgpu-firmware \ + +kmod-drm-display-helper +kmod-drm-buddy +kmod-acpi-video KCONFIG:=CONFIG_DRM_AMDGPU \ CONFIG_DRM_AMDGPU_SI=y \ CONFIG_DRM_AMDGPU_CIK=y \ @@ -390,7 +440,8 @@ define KernelPackage/drm-radeon SUBMENU:=$(VIDEO_MENU) TITLE:=Radeon DRM support DEPENDS:=@TARGET_x86 @DISPLAY_SUPPORT +kmod-backlight +kmod-drm-kms-helper \ - +kmod-drm-ttm +kmod-drm-ttm-helper +kmod-i2c-algo-bit +radeon-firmware + +kmod-drm-ttm +kmod-drm-ttm-helper +kmod-i2c-algo-bit +radeon-firmware \ + +kmod-drm-display-helper +kmod-acpi-video KCONFIG:=CONFIG_DRM_RADEON FILES:=$(LINUX_DIR)/drivers/gpu/drm/radeon/radeon.ko AUTOLOAD:=$(call AutoProbe,radeon) @@ -438,6 +489,10 @@ $(AddDepends/video) CONFIG_MEDIA_CAMERA_SUPPORT=y endef +define AddDepends/framegrabber +$(AddDepends/video) + KCONFIG+=CONFIG_MEDIA_PCI_SUPPORT=y +endef define KernelPackage/video-videobuf2 TITLE:=videobuf2 lib @@ -1044,3 +1099,96 @@ define KernelPackage/video-gspca-konica/description endef $(eval $(call KernelPackage,video-gspca-konica)) + +# +# Video Processing +# + +define KernelPackage/video-mem2mem + SUBMENU:=$(VIDEO_MENU) + TITLE:=Memory 2 Memory device support + HIDDEN:=1 + DEPENDS:=+kmod-video-videobuf2 + KCONFIG:= CONFIG_V4L_MEM2MEM_DRIVERS=y + FILES:= $(LINUX_DIR)/drivers/media/$(V4L2_DIR)/v4l2-mem2mem.ko + AUTOLOAD:=$(call AutoLoad,66,v4l2-mem2mem) + $(call AddDepends/video) +endef + +define KernelPackage/video-mem2mem/description + Memory 2 memory device support +endef + +$(eval $(call KernelPackage,video-mem2mem)) + +define KernelPackage/video-dma + SUBMENU:=$(VIDEO_MENU) + TITLE:=Video DMA support + HIDDEN:=1 + DEPENDS:=+kmod-video-videobuf2 + KCONFIG:= \ + CONFIG_VIDEOBUF2_DMA_CONTIG \ + CONFIG_VIDEOBUF2_DMA_SG + FILES:= $(LINUX_DIR)/drivers/media/common/videobuf2/videobuf2-dma-*.ko + AUTOLOAD:=$(call AutoLoad,66,videobuf2-dma-contig videobuf2-dma-sg) + $(call AddDepends/video) +endef + +define KernelPackage/video-dma/description + Video DMA support +endef + +$(eval $(call KernelPackage,video-dma)) + +define KernelPackage/video-coda + TITLE:=i.MX VPU support + DEPENDS:=@(TARGET_imx&&!TARGET_imx_cortexa7) +kmod-video-mem2mem +kmod-video-dma + KCONFIG:= \ + CONFIG_VIDEO_CODA \ + CONFIG_VIDEO_IMX_VDOA + FILES:= \ + $(LINUX_DIR)/drivers/media/$(V4L2_MEM2MEM_DIR)/coda/coda-vpu.ko \ + $(LINUX_DIR)/drivers/media/$(V4L2_MEM2MEM_DIR)/coda/imx-vdoa.ko \ + $(LINUX_DIR)/drivers/media/$(V4L2_DIR)/v4l2-jpeg.ko + AUTOLOAD:=$(call AutoProbe,coda-vpu imx-vdoa v4l2-jpeg) + $(call AddDepends/video) +endef + +define KernelPackage/video-coda/description + The i.MX Video Processing Unit (VPU) kernel module +endef + +$(eval $(call KernelPackage,video-coda)) + +define KernelPackage/video-pxp + TITLE:=i.MX PXP support + DEPENDS:=@TARGET_imx +kmod-video-mem2mem +kmod-video-dma + KCONFIG:= CONFIG_VIDEO_IMX_PXP + FILES:= $(LINUX_DIR)/drivers/media/$(V4L2_MEM2MEM_DIR)/imx-pxp.ko + AUTOLOAD:=$(call AutoProbe,imx-pxp) + $(call AddDepends/video) +endef + +define KernelPackage/video-pxp/description + The i.MX Pixel Pipeline (PXP) kernel module + This enables hardware accelerated support for image + Colour Conversion, Scaling and Rotation +endef + +$(eval $(call KernelPackage,video-pxp)) + +define KernelPackage/video-tw686x + TITLE:=TW686x support + DEPENDS:=@PCIE_SUPPORT +kmod-video-dma +kmod-sound-core + KCONFIG:= CONFIG_VIDEO_TW686X + FILES:= $(LINUX_DIR)/drivers/media/pci/tw686x/tw686x.ko + AUTOLOAD:=$(call AutoProbe,tw686x) + MODPARAMS.tw686x:=dma_mode=contig + $(call AddDepends/framegrabber) +endef + +define KernelPackage/video-tw686x/description + The Intersil/Techwell TW686x kernel module +endef + +$(eval $(call KernelPackage,video-tw686x)) diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index b4ddd8cb756f0e..17e0d9451e1c4b 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -14,7 +14,7 @@ PKG_VERSION:=6.5 PKG_RELEASE:=2 # PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15.58/ PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/ -PKG_HASH:=5d39aca7e34c33cb9b3e366117b2e86841b7bdd37933679d6b1e61be6b150648 +PKG_HASH:=908c22dceba185eab83caa5a1e58ce6b3ebdc58f099c3fd3e11c7352ebfab2d7 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) @@ -164,7 +164,7 @@ define KernelPackage/mac80211-hwsim $(call KernelPackage/mac80211/Default) TITLE:=mac80211 HW simulation device DEPENDS+= +kmod-mac80211 +@DRIVER_11AX_SUPPORT +@DRIVER_11AC_SUPPORT - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/virtual/mac80211_hwsim.ko AUTOLOAD:=$(call AutoProbe,mac80211_hwsim) endef diff --git a/package/kernel/mac80211/ath.mk b/package/kernel/mac80211/ath.mk index dc08df4f6fec56..881c89db253dc6 100644 --- a/package/kernel/mac80211/ath.mk +++ b/package/kernel/mac80211/ath.mk @@ -98,7 +98,7 @@ define KernelPackage/ath/config bool "Atheros wireless debugging" help Say Y, if you want to debug atheros wireless drivers. - Only ath9k & ath10k make use of this. + Only ath9k & ath10k & ath11k make use of this. config PACKAGE_ATH_DFS bool "Enable DFS support" @@ -317,7 +317,7 @@ define KernelPackage/ath11k/config config ATH11K_THERMAL bool "Enable thermal sensors and throttling support" depends on PACKAGE_kmod-ath11k - default y if TARGET_ipq807x + default y if TARGET_qualcommax endef @@ -325,7 +325,7 @@ define KernelPackage/ath11k-ahb $(call KernelPackage/mac80211/Default) TITLE:=Qualcomm 802.11ax AHB wireless chipset support URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath11k - DEPENDS+= @TARGET_ipq807x +kmod-ath11k +kmod-qrtr-smd + DEPENDS+= @TARGET_qualcommax +kmod-ath11k +kmod-qrtr-smd FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath11k/ath11k_ahb.ko AUTOLOAD:=$(call AutoProbe,ath11k_ahb) endef diff --git a/package/kernel/mac80211/broadcom.mk b/package/kernel/mac80211/broadcom.mk index cf80ad2d32603b..d0b08890881baa 100644 --- a/package/kernel/mac80211/broadcom.mk +++ b/package/kernel/mac80211/broadcom.mk @@ -416,7 +416,10 @@ define KernelPackage/brcmfmac DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +@DRIVER_11AC_SUPPORT \ +kmod-brcmutil +BRCMFMAC_SDIO:kmod-mmc @!TARGET_uml \ +BRCMFMAC_USB:kmod-usb-core +BRCMFMAC_USB:brcmfmac-firmware-usb - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko \ + $(foreach type,bca cyw wcc, \ + $(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmfmac/$(type)/brcmfmac-$(type).ko) AUTOLOAD:=$(call AutoProbe,brcmfmac) endef @@ -431,6 +434,7 @@ define KernelPackage/brcmfmac/config bool "Enable SDIO bus interface support" default y if TARGET_bcm27xx default y if TARGET_imx_cortexa7 + default y if TARGET_rockchip default y if TARGET_sunxi default n help diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 1bf4db6e5f0554..6572999fbc8252 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -19,6 +19,10 @@ wdev_tool() { ucode /usr/share/hostap/wdev.uc "$@" } +ubus_call() { + flock /var/run/hostapd.lock ubus call "$@" +} + drv_mac80211_init_device_config() { hostapd_common_add_device_config @@ -145,7 +149,7 @@ mac80211_hostapd_setup_base() { [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \ channel_list="$channel" - [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" + [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" "$N" set_default noscan 0 @@ -327,6 +331,11 @@ mac80211_hostapd_setup_base() { [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))" + [ "$vht_oper_chwidth" -lt 2 ] && { + vht160=0 + short_gi_160=0 + } + mac80211_add_capabilities vht_capab $vht_cap \ RXLDPC:0x10::$rxldpc \ SHORT-GI-80:0x20::$short_gi_80 \ @@ -898,7 +907,7 @@ wpa_supplicant_set_config() { ubus wait_for wpa_supplicant } - local supplicant_res="$(ubus call wpa_supplicant config_set "$data")" + local supplicant_res="$(ubus_call wpa_supplicant config_set "$data")" ret="$?" [ "$ret" != 0 -o -z "$supplicant_res" ] && wireless_setup_vif_failed WPA_SUPPLICANT_FAILED @@ -908,12 +917,12 @@ wpa_supplicant_set_config() { hostapd_set_config() { [ -n "$hostapd_ctrl" ] || { - ubus call hostapd config_set '{ "phy": "'"$phy"'", "config": "", "prev_config": "'"${hostapd_conf_file}.prev"'" }' > /dev/null + ubus_call hostapd config_set '{ "phy": "'"$phy"'", "config": "", "prev_config": "'"${hostapd_conf_file}.prev"'" }' > /dev/null return 0; } ubus wait_for hostapd - local hostapd_res="$(ubus call hostapd config_set "{ \"phy\": \"$phy\", \"config\":\"${hostapd_conf_file}\", \"prev_config\": \"${hostapd_conf_file}.prev\"}")" + local hostapd_res="$(ubus_call hostapd config_set "{ \"phy\": \"$phy\", \"config\":\"${hostapd_conf_file}\", \"prev_config\": \"${hostapd_conf_file}.prev\"}")" ret="$?" [ "$ret" != 0 -o -z "$hostapd_res" ] && { wireless_setup_failed HOSTAPD_START_FAILED @@ -928,7 +937,7 @@ wpa_supplicant_start() { [ -n "$wpa_supp_init" ] || return 0 - ubus call wpa_supplicant config_set '{ "phy": "'"$phy"'" }' > /dev/null + ubus_call wpa_supplicant config_set '{ "phy": "'"$phy"'" }' > /dev/null } mac80211_setup_supplicant() { @@ -1036,8 +1045,8 @@ mac80211_reset_config() { local phy="$1" hostapd_conf_file="/var/run/hostapd-$phy.conf" - ubus call hostapd config_set '{ "phy": "'"$phy"'", "config": "", "prev_config": "'"$hostapd_conf_file"'" }' > /dev/null - ubus call wpa_supplicant config_set '{ "phy": "'"$phy"'", "config": [] }' > /dev/null + ubus_call hostapd config_set '{ "phy": "'"$phy"'", "config": "", "prev_config": "'"$hostapd_conf_file"'" }' > /dev/null + ubus_call wpa_supplicant config_set '{ "phy": "'"$phy"'", "config": [] }' > /dev/null wdev_tool "$phy" set_config '{}' } diff --git a/package/kernel/mac80211/intel.mk b/package/kernel/mac80211/intel.mk index 8d374d73e744dd..f2aceb96cd5a5e 100644 --- a/package/kernel/mac80211/intel.mk +++ b/package/kernel/mac80211/intel.mk @@ -6,7 +6,7 @@ config-$(CONFIG_PACKAGE_IWLWIFI_DEBUGFS)+= IWLWIFI_DEBUGFS define KernelPackage/iwlwifi $(call KernelPackage/mac80211/Default) - DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11AX_SUPPORT + DEPENDS:= +kmod-mac80211 +kmod-ptp @PCI_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11AX_SUPPORT TITLE:=Intel AGN Wireless support FILES:= \ $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko \ diff --git a/package/kernel/mac80211/patches/ath/100-wifi-ath-add-struct_group-for-struct-ath_cycle_count.patch b/package/kernel/mac80211/patches/ath/100-wifi-ath-add-struct_group-for-struct-ath_cycle_count.patch new file mode 100644 index 00000000000000..6c476e90581172 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/100-wifi-ath-add-struct_group-for-struct-ath_cycle_count.patch @@ -0,0 +1,117 @@ +From e8053643b6d70e23a634f14e4408f3a6d1d3a6bf Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sat, 27 May 2023 09:04:48 +0000 +Subject: [PATCH] wifi: ath: add struct_group for struct ath_cycle_counters + +Add a struct_group to around all members in struct ath_cycle_counters. +It can help the compiler detect the intended bounds of the memcpy() and +memset(). + +This patch fixes the following build warning: + +In function 'fortify_memset_chk', + inlined from 'ath9k_ps_wakeup' at /home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/backports-6.1.24/drivers/net/wireless/ath/ath9k/main.c:140:3: +./include/linux/fortify-string.h:314:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning] + 314 | __write_overflow_field(p_size_field, size); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Shiji Yang +--- + drivers/net/wireless/ath/ath.h | 10 ++++++---- + drivers/net/wireless/ath/ath5k/ani.c | 2 +- + drivers/net/wireless/ath/ath5k/base.c | 4 ++-- + drivers/net/wireless/ath/ath5k/mac80211-ops.c | 2 +- + drivers/net/wireless/ath/ath9k/link.c | 2 +- + drivers/net/wireless/ath/ath9k/main.c | 4 ++-- + drivers/net/wireless/ath/hw.c | 2 +- + 7 files changed, 14 insertions(+), 12 deletions(-) + +--- a/drivers/net/wireless/ath/ath.h ++++ b/drivers/net/wireless/ath/ath.h +@@ -43,10 +43,12 @@ struct ath_ani { + }; + + struct ath_cycle_counters { +- u32 cycles; +- u32 rx_busy; +- u32 rx_frame; +- u32 tx_frame; ++ struct_group(cnts, ++ u32 cycles; ++ u32 rx_busy; ++ u32 rx_frame; ++ u32 tx_frame; ++ ); + }; + + enum ath_device_state { +--- a/drivers/net/wireless/ath/ath5k/ani.c ++++ b/drivers/net/wireless/ath/ath5k/ani.c +@@ -379,7 +379,7 @@ ath5k_hw_ani_get_listen_time(struct ath5 + spin_lock_bh(&common->cc_lock); + + ath_hw_cycle_counters_update(common); +- memcpy(&as->last_cc, &common->cc_ani, sizeof(as->last_cc)); ++ memcpy(&as->last_cc.cnts, &common->cc_ani.cnts, sizeof(as->last_cc.cnts)); + + /* clears common->cc_ani */ + listen = ath_hw_get_listen_time(common); +--- a/drivers/net/wireless/ath/ath5k/base.c ++++ b/drivers/net/wireless/ath/ath5k/base.c +@@ -2985,8 +2985,8 @@ ath5k_reset(struct ath5k_hw *ah, struct + memset(&ah->survey, 0, sizeof(ah->survey)); + spin_lock_bh(&common->cc_lock); + ath_hw_cycle_counters_update(common); +- memset(&common->cc_survey, 0, sizeof(common->cc_survey)); +- memset(&common->cc_ani, 0, sizeof(common->cc_ani)); ++ memset(&common->cc_survey.cnts, 0, sizeof(common->cc_survey.cnts)); ++ memset(&common->cc_ani.cnts, 0, sizeof(common->cc_ani.cnts)); + spin_unlock_bh(&common->cc_lock); + + /* +--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c ++++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c +@@ -665,7 +665,7 @@ ath5k_get_survey(struct ieee80211_hw *hw + ah->survey.time_rx += cc->rx_frame / div; + ah->survey.time_tx += cc->tx_frame / div; + } +- memset(cc, 0, sizeof(*cc)); ++ memset(&cc->cnts, 0, sizeof(cc->cnts)); + spin_unlock_bh(&common->cc_lock); + + memcpy(survey, &ah->survey, sizeof(*survey)); +--- a/drivers/net/wireless/ath/ath9k/link.c ++++ b/drivers/net/wireless/ath/ath9k/link.c +@@ -536,7 +536,7 @@ int ath_update_survey_stats(struct ath_s + if (cc->cycles > 0) + ret = cc->rx_busy * 100 / cc->cycles; + +- memset(cc, 0, sizeof(*cc)); ++ memset(&cc->cnts, 0, sizeof(cc->cnts)); + + ath_update_survey_nf(sc, pos); + +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -135,8 +135,8 @@ void ath9k_ps_wakeup(struct ath_softc *s + if (power_mode != ATH9K_PM_AWAKE) { + spin_lock(&common->cc_lock); + ath_hw_cycle_counters_update(common); +- memset(&common->cc_survey, 0, sizeof(common->cc_survey)); +- memset(&common->cc_ani, 0, sizeof(common->cc_ani)); ++ memset(&common->cc_survey.cnts, 0, sizeof(common->cc_survey.cnts)); ++ memset(&common->cc_ani.cnts, 0, sizeof(common->cc_ani.cnts)); + spin_unlock(&common->cc_lock); + } + +--- a/drivers/net/wireless/ath/hw.c ++++ b/drivers/net/wireless/ath/hw.c +@@ -183,7 +183,7 @@ int32_t ath_hw_get_listen_time(struct at + listen_time = (cc->cycles - cc->rx_frame - cc->tx_frame) / + (common->clockrate * 1000); + +- memset(cc, 0, sizeof(*cc)); ++ memset(&cc->cnts, 0, sizeof(cc->cnts)); + + return listen_time; + } diff --git a/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch b/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch index eacc72776e0f4a..23b7340e25c4a8 100644 --- a/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch +++ b/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/Makefile +++ b/drivers/net/wireless/ath/Makefile -@@ -15,10 +15,10 @@ ath-objs := main.o \ +@@ -16,10 +16,10 @@ ath-objs := main.o \ regd.o \ hw.o \ key.o \ @@ -14,7 +14,7 @@ CFLAGS_trace.o := -I$(src) --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h -@@ -317,14 +317,7 @@ void _ath_dbg(struct ath_common *common, +@@ -321,14 +321,7 @@ void _ath_dbg(struct ath_common *common, #endif /* CPTCFG_ATH_DEBUG */ /** Returns string describing opmode, or NULL if unknown mode. */ diff --git a/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch index fd5493de71d526..601ebdc7583c23 100644 --- a/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch +++ b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch @@ -82,7 +82,7 @@ help --- a/local-symbols +++ b/local-symbols -@@ -102,6 +102,7 @@ ADM8211= +@@ -101,6 +101,7 @@ ADM8211= ATH_COMMON= WLAN_VENDOR_ATH= ATH_DEBUG= diff --git a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch index 8d83921a3b847a..d0f4b15772fd4d 100644 --- a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch +++ b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch @@ -1,6 +1,6 @@ --- a/net/wireless/reg.c +++ b/net/wireless/reg.c -@@ -3370,6 +3370,8 @@ void regulatory_hint_country_ie(struct w +@@ -3340,6 +3340,8 @@ void regulatory_hint_country_ie(struct w enum environment_cap env = ENVIRON_ANY; struct regulatory_request *request = NULL, *lr; @@ -9,7 +9,7 @@ /* IE len must be evenly divisible by 2 */ if (country_ie_len & 0x01) return; -@@ -3621,6 +3623,7 @@ static bool is_wiphy_all_set_reg_flag(en +@@ -3591,6 +3593,7 @@ static bool is_wiphy_all_set_reg_flag(en void regulatory_hint_disconnect(void) { diff --git a/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch b/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch index 41ad6006b5ceff..f1b5ce1f1b250f 100644 --- a/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch +++ b/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/Kconfig +++ b/drivers/net/wireless/ath/ath10k/Kconfig -@@ -86,6 +86,12 @@ config ATH10K_TRACING +@@ -87,6 +87,12 @@ config ATH10K_TRACING help Select this to ath10k use tracing infrastructure. @@ -37,7 +37,7 @@ void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature); --- a/local-symbols +++ b/local-symbols -@@ -161,6 +161,7 @@ ATH10K_SNOC= +@@ -160,6 +160,7 @@ ATH10K_SNOC= ATH10K_DEBUG= ATH10K_DEBUGFS= ATH10K_SPECTRAL= diff --git a/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch index 7a38cf3e4ed62d..adfeb3eaaea7e7 100644 --- a/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -3516,6 +3516,16 @@ int ath10k_core_register(struct ath10k * +@@ -3507,6 +3507,16 @@ int ath10k_core_register(struct ath10k * queue_work(ar->workqueue, &ar->register_work); diff --git a/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch index e8beed17e8f19f..1a043f7b15ec6f 100644 --- a/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch +++ b/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -9909,6 +9909,21 @@ static int ath10k_mac_init_rd(struct ath +@@ -9917,6 +9917,21 @@ static int ath10k_mac_init_rd(struct ath return 0; } @@ -22,7 +22,7 @@ int ath10k_mac_register(struct ath10k *ar) { static const u32 cipher_suites[] = { -@@ -10267,6 +10282,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -10275,6 +10290,12 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; diff --git a/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index 1c1630c05199d9..2465470a577d6f 100644 --- a/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -85,7 +85,7 @@ v13: create mode 100644 drivers/net/wireless/ath/ath10k/leds.h --- a/drivers/net/wireless/ath/ath10k/Kconfig +++ b/drivers/net/wireless/ath/ath10k/Kconfig -@@ -71,6 +71,16 @@ config ATH10K_DEBUGFS +@@ -72,6 +72,16 @@ config ATH10K_DEBUGFS If unsure, say Y to make it easier to debug problems. @@ -114,7 +114,7 @@ v13: ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o --- a/local-symbols +++ b/local-symbols -@@ -162,6 +162,7 @@ ATH10K_DEBUG= +@@ -161,6 +161,7 @@ ATH10K_DEBUG= ATH10K_DEBUGFS= ATH10K_SPECTRAL= ATH10K_THERMAL= @@ -172,7 +172,7 @@ v13: .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -3231,6 +3237,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -3222,6 +3228,10 @@ int ath10k_core_start(struct ath10k *ar, goto err_hif_stop; } @@ -183,7 +183,7 @@ v13: return 0; err_hif_stop: -@@ -3489,9 +3499,18 @@ static void ath10k_core_register_work(st +@@ -3480,9 +3490,18 @@ static void ath10k_core_register_work(st goto err_spectral_destroy; } @@ -202,7 +202,7 @@ v13: err_spectral_destroy: ath10k_spectral_destroy(ar); err_debug_destroy: -@@ -3537,6 +3556,8 @@ void ath10k_core_unregister(struct ath10 +@@ -3528,6 +3547,8 @@ void ath10k_core_unregister(struct ath10 if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) return; @@ -221,7 +221,7 @@ v13: #include "htt.h" #include "htc.h" -@@ -1253,6 +1254,13 @@ struct ath10k { +@@ -1256,6 +1257,13 @@ struct ath10k { } testmode; struct { @@ -456,7 +456,7 @@ v13: { --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c -@@ -4594,6 +4594,8 @@ static const struct wmi_ops wmi_tlv_ops +@@ -4601,6 +4601,8 @@ static const struct wmi_ops wmi_tlv_ops .gen_echo = ath10k_wmi_tlv_op_gen_echo, .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, .gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable, @@ -517,7 +517,7 @@ v13: static struct sk_buff * ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, enum wmi_sta_ps_mode psmode) -@@ -9160,6 +9203,9 @@ static const struct wmi_ops wmi_ops = { +@@ -9138,6 +9181,9 @@ static const struct wmi_ops wmi_ops = { .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -527,7 +527,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9230,6 +9276,8 @@ static const struct wmi_ops wmi_10_1_ops +@@ -9208,6 +9254,8 @@ static const struct wmi_ops wmi_10_1_ops .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -536,7 +536,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9302,6 +9350,8 @@ static const struct wmi_ops wmi_10_2_ops +@@ -9280,6 +9328,8 @@ static const struct wmi_ops wmi_10_2_ops .gen_delba_send = ath10k_wmi_op_gen_delba_send, .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, @@ -545,7 +545,7 @@ v13: /* .gen_pdev_enable_adaptive_cca not implemented */ }; -@@ -9373,6 +9423,8 @@ static const struct wmi_ops wmi_10_2_4_o +@@ -9351,6 +9401,8 @@ static const struct wmi_ops wmi_10_2_4_o ath10k_wmi_op_gen_pdev_enable_adaptive_cca, .get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype, .gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing, @@ -554,7 +554,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9454,6 +9506,8 @@ static const struct wmi_ops wmi_10_4_ops +@@ -9432,6 +9484,8 @@ static const struct wmi_ops wmi_10_4_ops .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info, .gen_echo = ath10k_wmi_op_gen_echo, .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config, diff --git a/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch index 4c1f9aa815cbad..95bd48f92353ef 100644 --- a/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch +++ b/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch @@ -16,7 +16,7 @@ Signed-off-by: Mathias Kresin --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h -@@ -1309,6 +1309,10 @@ struct ath10k { +@@ -1312,6 +1312,10 @@ struct ath10k { s32 tx_power_2g_limit; s32 tx_power_5g_limit; @@ -42,7 +42,7 @@ Signed-off-by: Mathias Kresin if (ret) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -10284,7 +10284,7 @@ int ath10k_mac_register(struct ath10k *a +@@ -10292,7 +10292,7 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; #ifdef CPTCFG_MAC80211_LEDS diff --git a/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch b/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch index 084e28a2d924d8..cfa0f9108afa30 100644 --- a/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch +++ b/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch @@ -26,7 +26,7 @@ Signed-off-by: Ansuel Smith #include #include #include -@@ -3407,6 +3408,8 @@ static int ath10k_core_probe_fw(struct a +@@ -3398,6 +3399,8 @@ static int ath10k_core_probe_fw(struct a device_get_mac_address(ar->dev, ar->mac_addr); diff --git a/package/kernel/mac80211/patches/ath10k/988-ath10k-always-use-mac80211-loss-detection.patch b/package/kernel/mac80211/patches/ath10k/988-ath10k-always-use-mac80211-loss-detection.patch index f025fea63b7ad6..5a62ea3fc22ee7 100644 --- a/package/kernel/mac80211/patches/ath10k/988-ath10k-always-use-mac80211-loss-detection.patch +++ b/package/kernel/mac80211/patches/ath10k/988-ath10k-always-use-mac80211-loss-detection.patch @@ -18,7 +18,7 @@ Signed-off-by: David Bauer --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -10080,7 +10080,6 @@ int ath10k_mac_register(struct ath10k *a +@@ -10088,7 +10088,6 @@ int ath10k_mac_register(struct ath10k *a ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); ieee80211_hw_set(ar->hw, QUEUE_CONTROL); ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); diff --git a/package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-fix-band-selection-for-ppdu-received-in-.patch b/package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-fix-band-selection-for-ppdu-received-in-.patch new file mode 100644 index 00000000000000..e6f9ac9e4c0aab --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-fix-band-selection-for-ppdu-received-in-.patch @@ -0,0 +1,37 @@ +From 72c8caf904aed2caed5d6e75233294b6159ddb5d Mon Sep 17 00:00:00 2001 +From: Aditya Kumar Singh +Date: Wed, 26 Jul 2023 10:16:24 +0530 +Subject: [PATCH 1/5] wifi: ath11k: fix band selection for ppdu received in + channel 177 of 5 GHz + +5 GHz band channel 177 support was added with the commit e5e94d10c856 ("wifi: +ath11k: add channel 177 into 5 GHz channel list"). However, during processing +for the received ppdu in ath11k_dp_rx_h_ppdu(), channel number is checked only +till 173. This leads to driver code checking for channel and then fetching the +band from it which is extra effort since firmware has already given the channel +number in the metadata. + +Fix this issue by checking the channel number till 177 since we support +it now. + +Found via code review. Compile tested only. + +Fixes: e5e94d10c856 ("wifi: ath11k: add channel 177 into 5 GHz channel list") +Signed-off-by: Aditya Kumar Singh +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230726044624.20507-1-quic_adisi@quicinc.com +--- + drivers/net/wireless/ath/ath11k/dp_rx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath11k/dp_rx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_rx.c +@@ -2408,7 +2408,7 @@ static void ath11k_dp_rx_h_ppdu(struct a + rx_status->freq = center_freq; + } else if (channel_num >= 1 && channel_num <= 14) { + rx_status->band = NL80211_BAND_2GHZ; +- } else if (channel_num >= 36 && channel_num <= 173) { ++ } else if (channel_num >= 36 && channel_num <= 177) { + rx_status->band = NL80211_BAND_5GHZ; + } else { + spin_lock_bh(&ar->data_lock); diff --git a/package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-stop-tx-queues-immediately-upon-firmware.patch b/package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-stop-tx-queues-immediately-upon-firmware.patch deleted file mode 100644 index d0dc04febf764d..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-stop-tx-queues-immediately-upon-firmware.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 81e60b2dfb2744ab6642c4aa62534b4f711fdc5d Mon Sep 17 00:00:00 2001 -From: Aditya Kumar Singh -Date: Tue, 27 Sep 2022 09:18:54 +0300 -Subject: [PATCH] wifi: ath11k: stop tx queues immediately upon firmware exit - -Currently, recovery flag is set immediately upon firmware -exit but tx queues are stopped once firmware arrives back -and is ready which is during ath11k_core_restart. Once -ieee80211 hw restart is completed, tx queues are resumed. -If during the time delta between firmware exit and firmware -ready, mac80211 send packets, currently ath11k will drop it -since recovery flag will be set. But warning prints will -come - - "ath11k c000000.wifi: failed to transmit frame -108" - -If more tx packets are there, this could lead to flooding -of above print. - -However, actually tx queues should be stopped immediately -when firmware leaves. This will prevent packets to get -dropped when firmware is recovering. - -Add fix to stop tx queues immediately after firmware exit. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aditya Kumar Singh -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20220923170235.18873-1-quic_adisi@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 5 +---- - drivers/net/wireless/ath/ath11k/core.h | 1 + - drivers/net/wireless/ath/ath11k/qmi.c | 3 +++ - 3 files changed, 5 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -1641,7 +1641,7 @@ static void ath11k_update_11d(struct wor - } - } - --static void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab) -+void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab) - { - struct ath11k *ar; - struct ath11k_pdev *pdev; -@@ -1730,9 +1730,6 @@ static void ath11k_core_restart(struct w - struct ath11k_base *ab = container_of(work, struct ath11k_base, restart_work); - int ret; - -- if (!ab->is_reset) -- ath11k_core_pre_reconfigure_recovery(ab); -- - ret = ath11k_core_reconfigure_on_crash(ab); - if (ret) { - ath11k_err(ab, "failed to reconfigure driver on crash recovery\n"); ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -1158,6 +1158,7 @@ int ath11k_core_check_smbios(struct ath1 - void ath11k_core_halt(struct ath11k *ar); - int ath11k_core_resume(struct ath11k_base *ab); - int ath11k_core_suspend(struct ath11k_base *ab); -+void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab); - - const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab, - const char *filename); ---- a/drivers/net/wireless/ath/ath11k/qmi.c -+++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -3164,6 +3164,9 @@ static void ath11k_qmi_driver_event_work - case ATH11K_QMI_EVENT_SERVER_EXIT: - set_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags); - set_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags); -+ -+ if (!ab->is_reset) -+ ath11k_core_pre_reconfigure_recovery(ab); - break; - case ATH11K_QMI_EVENT_REQUEST_MEM: - ret = ath11k_qmi_event_mem_request(qmi); diff --git a/package/kernel/mac80211/patches/ath11k/0002-wifi-ath11k-Don-t-exit-on-wakeup-failure.patch b/package/kernel/mac80211/patches/ath11k/0002-wifi-ath11k-Don-t-exit-on-wakeup-failure.patch deleted file mode 100644 index 47385e0458e1c2..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0002-wifi-ath11k-Don-t-exit-on-wakeup-failure.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 45d2e268369b0c768d5a644f319758bcfd370521 Mon Sep 17 00:00:00 2001 -From: Baochen Qiang -Date: Wed, 28 Sep 2022 09:51:40 +0800 -Subject: [PATCH] wifi: ath11k: Don't exit on wakeup failure - -Currently, ath11k_pcic_read() returns an error if wakeup() -fails, this makes firmware crash debug quite hard because we can -get nothing. - -Change to go ahead on wakeup failure, in that case we still may -get something valid to check. There should be no mislead due -to incorrect content because we are aware of the failure with the -log printed. - -Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 - -Signed-off-by: Baochen Qiang -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20220928015140.5431-1-quic_bqiang@quicinc.com ---- - drivers/net/wireless/ath/ath11k/pcic.c | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/pcic.c -+++ b/drivers/net/wireless/ath/ath11k/pcic.c -@@ -218,9 +218,16 @@ int ath11k_pcic_read(struct ath11k_base - if (wakeup_required && ab->pci.ops->wakeup) { - ret = ab->pci.ops->wakeup(ab); - if (ret) { -- ath11k_warn(ab, "failed to wakeup for read from 0x%x: %d\n", -- start, ret); -- return ret; -+ ath11k_warn(ab, -+ "wakeup failed, data may be invalid: %d", -+ ret); -+ /* Even though wakeup() failed, continue processing rather -+ * than returning because some parts of the data may still -+ * be valid and useful in some cases, e.g. could give us -+ * some clues on firmware crash. -+ * Mislead due to invalid data could be avoided because we -+ * are aware of the wakeup failure. -+ */ - } - } - diff --git a/package/kernel/mac80211/patches/ath11k/0002-wifi-ath11k-simplify-ath11k_mac_validate_vht_he_fixe.patch b/package/kernel/mac80211/patches/ath11k/0002-wifi-ath11k-simplify-ath11k_mac_validate_vht_he_fixe.patch new file mode 100644 index 00000000000000..ad761e6a909098 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0002-wifi-ath11k-simplify-ath11k_mac_validate_vht_he_fixe.patch @@ -0,0 +1,38 @@ +From 6f092c98dcfa1e4cf37d45f9b8e4d4a3cbeb79d4 Mon Sep 17 00:00:00 2001 +From: Dmitry Antipov +Date: Wed, 26 Jul 2023 12:21:02 +0300 +Subject: [PATCH 2/5] wifi: ath11k: simplify + ath11k_mac_validate_vht_he_fixed_rate_settings() + +In ath11k_mac_validate_vht_he_fixed_rate_settings() ar->ab->peers +list is not altered so list_for_each_entry() should be safe. + +Compile tested only. + +Signed-off-by: Dmitry Antipov +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230726092113.78794-1-dmantipov@yandex.ru +--- + drivers/net/wireless/ath/ath11k/mac.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -8258,7 +8258,7 @@ ath11k_mac_validate_vht_he_fixed_rate_se + const struct cfg80211_bitrate_mask *mask) + { + bool he_fixed_rate = false, vht_fixed_rate = false; +- struct ath11k_peer *peer, *tmp; ++ struct ath11k_peer *peer; + const u16 *vht_mcs_mask, *he_mcs_mask; + struct ieee80211_link_sta *deflink; + u8 vht_nss, he_nss; +@@ -8281,7 +8281,7 @@ ath11k_mac_validate_vht_he_fixed_rate_se + + rcu_read_lock(); + spin_lock_bh(&ar->ab->base_lock); +- list_for_each_entry_safe(peer, tmp, &ar->ab->peers, list) { ++ list_for_each_entry(peer, &ar->ab->peers, list) { + if (peer->sta) { + deflink = &peer->sta->deflink; + diff --git a/package/kernel/mac80211/patches/ath11k/0003-wifi-ath11k-Split-coldboot-calibration-hw_param.patch b/package/kernel/mac80211/patches/ath11k/0003-wifi-ath11k-Split-coldboot-calibration-hw_param.patch new file mode 100644 index 00000000000000..f8c7c937eabfa8 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0003-wifi-ath11k-Split-coldboot-calibration-hw_param.patch @@ -0,0 +1,180 @@ +From 011e5a3052a22d3758d17442bf0c04c68bf79bea Mon Sep 17 00:00:00 2001 +From: Seevalamuthu Mariappan +Date: Wed, 26 Jul 2023 19:40:30 +0530 +Subject: [PATCH 3/5] wifi: ath11k: Split coldboot calibration hw_param + +QCN9074 enables coldboot calibration only in Factory Test Mode (FTM). +Hence, split cold_boot_calib to two hw_params for mission and FTM +mode. + +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Seevalamuthu Mariappan +Signed-off-by: Raj Kumar Bhagat +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230726141032.3061-2-quic_rajkbhag@quicinc.com +--- + drivers/net/wireless/ath/ath11k/ahb.c | 3 +-- + drivers/net/wireless/ath/ath11k/core.c | 36 ++++++++++++++++++++------ + drivers/net/wireless/ath/ath11k/core.h | 1 + + drivers/net/wireless/ath/ath11k/hw.h | 3 ++- + drivers/net/wireless/ath/ath11k/qmi.c | 6 ++--- + 5 files changed, 35 insertions(+), 14 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/ahb.c ++++ b/drivers/net/wireless/ath/ath11k/ahb.c +@@ -422,8 +422,7 @@ static int ath11k_ahb_fwreset_from_cold_ + { + int timeout; + +- if (ath11k_cold_boot_cal == 0 || ab->qmi.cal_done || +- ab->hw_params.cold_boot_calib == 0 || ++ if (!ath11k_core_coldboot_cal_support(ab) || ab->qmi.cal_done || + ab->hw_params.cbcal_restart_fw == 0) + return 0; + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -86,7 +86,8 @@ static const struct ath11k_hw_params ath + .supports_shadow_regs = false, + .idle_ps = false, + .supports_sta_ps = false, +- .cold_boot_calib = true, ++ .coldboot_cal_mm = true, ++ .coldboot_cal_ftm = true, + .cbcal_restart_fw = true, + .fw_mem_mode = 0, + .num_vdevs = 16 + 1, +@@ -167,7 +168,8 @@ static const struct ath11k_hw_params ath + .supports_shadow_regs = false, + .idle_ps = false, + .supports_sta_ps = false, +- .cold_boot_calib = true, ++ .coldboot_cal_mm = true, ++ .coldboot_cal_ftm = true, + .cbcal_restart_fw = true, + .fw_mem_mode = 0, + .num_vdevs = 16 + 1, +@@ -248,7 +250,8 @@ static const struct ath11k_hw_params ath + .supports_shadow_regs = true, + .idle_ps = true, + .supports_sta_ps = true, +- .cold_boot_calib = false, ++ .coldboot_cal_mm = false, ++ .coldboot_cal_ftm = false, + .cbcal_restart_fw = false, + .fw_mem_mode = 0, + .num_vdevs = 16 + 1, +@@ -332,7 +335,8 @@ static const struct ath11k_hw_params ath + .supports_shadow_regs = false, + .idle_ps = false, + .supports_sta_ps = false, +- .cold_boot_calib = false, ++ .coldboot_cal_mm = false, ++ .coldboot_cal_ftm = false, + .cbcal_restart_fw = false, + .fw_mem_mode = 2, + .num_vdevs = 8, +@@ -413,7 +417,8 @@ static const struct ath11k_hw_params ath + .supports_shadow_regs = true, + .idle_ps = true, + .supports_sta_ps = true, +- .cold_boot_calib = false, ++ .coldboot_cal_mm = false, ++ .coldboot_cal_ftm = false, + .cbcal_restart_fw = false, + .fw_mem_mode = 0, + .num_vdevs = 16 + 1, +@@ -495,7 +500,8 @@ static const struct ath11k_hw_params ath + .supports_shadow_regs = true, + .idle_ps = true, + .supports_sta_ps = true, +- .cold_boot_calib = false, ++ .coldboot_cal_mm = false, ++ .coldboot_cal_ftm = false, + .cbcal_restart_fw = false, + .fw_mem_mode = 0, + .num_vdevs = 16 + 1, +@@ -578,7 +584,8 @@ static const struct ath11k_hw_params ath + .supports_shadow_regs = true, + .idle_ps = true, + .supports_sta_ps = true, +- .cold_boot_calib = true, ++ .coldboot_cal_mm = true, ++ .coldboot_cal_ftm = true, + .cbcal_restart_fw = false, + .fw_mem_mode = 0, + .num_vdevs = 16 + 1, +@@ -667,7 +674,8 @@ static const struct ath11k_hw_params ath + .supports_suspend = false, + .hal_params = &ath11k_hw_hal_params_ipq8074, + .single_pdev_only = false, +- .cold_boot_calib = true, ++ .coldboot_cal_mm = true, ++ .coldboot_cal_ftm = true, + .cbcal_restart_fw = true, + .fix_l1ss = true, + .supports_dynamic_smps_6ghz = false, +@@ -749,6 +757,18 @@ void ath11k_fw_stats_free(struct ath11k_ + ath11k_fw_stats_bcn_free(&stats->bcn); + } + ++bool ath11k_core_coldboot_cal_support(struct ath11k_base *ab) ++{ ++ if (!ath11k_cold_boot_cal) ++ return false; ++ ++ if (ath11k_ftm_mode) ++ return ab->hw_params.coldboot_cal_ftm; ++ ++ else ++ return ab->hw_params.coldboot_cal_mm; ++} ++ + int ath11k_core_suspend(struct ath11k_base *ab) + { + int ret; +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -1186,6 +1186,7 @@ void ath11k_core_halt(struct ath11k *ar) + int ath11k_core_resume(struct ath11k_base *ab); + int ath11k_core_suspend(struct ath11k_base *ab); + void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab); ++bool ath11k_core_coldboot_cal_support(struct ath11k_base *ab); + + const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab, + const char *filename); +--- a/drivers/net/wireless/ath/ath11k/hw.h ++++ b/drivers/net/wireless/ath/ath11k/hw.h +@@ -187,7 +187,8 @@ struct ath11k_hw_params { + bool supports_shadow_regs; + bool idle_ps; + bool supports_sta_ps; +- bool cold_boot_calib; ++ bool coldboot_cal_mm; ++ bool coldboot_cal_ftm; + bool cbcal_restart_fw; + int fw_mem_mode; + u32 num_vdevs; +--- a/drivers/net/wireless/ath/ath11k/qmi.c ++++ b/drivers/net/wireless/ath/ath11k/qmi.c +@@ -2079,7 +2079,7 @@ static int ath11k_qmi_assign_target_mem_ + return -EINVAL; + } + +- if (ath11k_cold_boot_cal && ab->hw_params.cold_boot_calib) { ++ if (ath11k_core_coldboot_cal_support(ab)) { + if (hremote_node) { + ab->qmi.target_mem[idx].paddr = + res.start + host_ddr_sz; +@@ -3209,8 +3209,8 @@ static void ath11k_qmi_driver_event_work + break; + } + +- if (ath11k_cold_boot_cal && ab->qmi.cal_done == 0 && +- ab->hw_params.cold_boot_calib) { ++ if (ab->qmi.cal_done == 0 && ++ ath11k_core_coldboot_cal_support(ab)) { + ath11k_qmi_process_coldboot_calibration(ab); + } else { + clear_bit(ATH11K_FLAG_CRASH_FLUSH, diff --git a/package/kernel/mac80211/patches/ath11k/0004-wifi-ath11k-Add-coldboot-calibration-support-for-QCN.patch b/package/kernel/mac80211/patches/ath11k/0004-wifi-ath11k-Add-coldboot-calibration-support-for-QCN.patch new file mode 100644 index 00000000000000..9d51c1c3eaaef5 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0004-wifi-ath11k-Add-coldboot-calibration-support-for-QCN.patch @@ -0,0 +1,176 @@ +From bdfc967bf5fcd762473a01d39edb81f1165ba290 Mon Sep 17 00:00:00 2001 +From: Anilkumar Kolli +Date: Wed, 26 Jul 2023 19:40:31 +0530 +Subject: [PATCH 4/5] wifi: ath11k: Add coldboot calibration support for + QCN9074 + +QCN9074 supports 6 GHz, which has increased number of channels +compared to 5 GHz/2 GHz. So, to support coldboot calibration in +QCN9074 ATH11K_COLD_BOOT_FW_RESET_DELAY extended to 60 seconds. To +avoid code redundancy, fwreset_from_cold_boot moved to QMI and made +common for both ahb and pci. Coldboot calibration is enabled only in +FTM mode for QCN9074. QCN9074 requires firmware restart after coldboot, +hence enable cbcal_restart_fw in hw_params. + +This support can be enabled/disabled using hw params for different +hardware. Currently it is not enabled for QCA6390. + +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Anilkumar Kolli +Signed-off-by: Seevalamuthu Mariappan +Signed-off-by: Raj Kumar Bhagat +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230726141032.3061-3-quic_rajkbhag@quicinc.com +--- + drivers/net/wireless/ath/ath11k/ahb.c | 28 ++------------------------ + drivers/net/wireless/ath/ath11k/core.c | 4 ++-- + drivers/net/wireless/ath/ath11k/pci.c | 2 ++ + drivers/net/wireless/ath/ath11k/qmi.c | 28 ++++++++++++++++++++++++++ + drivers/net/wireless/ath/ath11k/qmi.h | 3 ++- + 5 files changed, 36 insertions(+), 29 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/ahb.c ++++ b/drivers/net/wireless/ath/ath11k/ahb.c +@@ -14,6 +14,7 @@ + #include "ahb.h" + #include "debug.h" + #include "hif.h" ++#include "qmi.h" + #include + #include "pcic.h" + #include +@@ -418,31 +419,6 @@ static void ath11k_ahb_power_down(struct + rproc_shutdown(ab_ahb->tgt_rproc); + } + +-static int ath11k_ahb_fwreset_from_cold_boot(struct ath11k_base *ab) +-{ +- int timeout; +- +- if (!ath11k_core_coldboot_cal_support(ab) || ab->qmi.cal_done || +- ab->hw_params.cbcal_restart_fw == 0) +- return 0; +- +- ath11k_dbg(ab, ATH11K_DBG_AHB, "wait for cold boot done\n"); +- timeout = wait_event_timeout(ab->qmi.cold_boot_waitq, +- (ab->qmi.cal_done == 1), +- ATH11K_COLD_BOOT_FW_RESET_DELAY); +- if (timeout <= 0) { +- ath11k_cold_boot_cal = 0; +- ath11k_warn(ab, "Coldboot Calibration failed timed out\n"); +- } +- +- /* reset the firmware */ +- ath11k_ahb_power_down(ab); +- ath11k_ahb_power_up(ab); +- +- ath11k_dbg(ab, ATH11K_DBG_AHB, "exited from cold boot mode\n"); +- return 0; +-} +- + static void ath11k_ahb_init_qmi_ce_config(struct ath11k_base *ab) + { + struct ath11k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; +@@ -1225,7 +1201,7 @@ static int ath11k_ahb_probe(struct platf + goto err_ce_free; + } + +- ath11k_ahb_fwreset_from_cold_boot(ab); ++ ath11k_qmi_fwreset_from_cold_boot(ab); + + return 0; + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -336,8 +336,8 @@ static const struct ath11k_hw_params ath + .idle_ps = false, + .supports_sta_ps = false, + .coldboot_cal_mm = false, +- .coldboot_cal_ftm = false, +- .cbcal_restart_fw = false, ++ .coldboot_cal_ftm = true, ++ .cbcal_restart_fw = true, + .fw_mem_mode = 2, + .num_vdevs = 8, + .num_peers = 128, +--- a/drivers/net/wireless/ath/ath11k/pci.c ++++ b/drivers/net/wireless/ath/ath11k/pci.c +@@ -15,6 +15,7 @@ + #include "mhi.h" + #include "debug.h" + #include "pcic.h" ++#include "qmi.h" + + #define ATH11K_PCI_BAR_NUM 0 + #define ATH11K_PCI_DMA_MASK 32 +@@ -897,6 +898,7 @@ unsupported_wcn6855_soc: + ath11k_err(ab, "failed to init core: %d\n", ret); + goto err_irq_affinity_cleanup; + } ++ ath11k_qmi_fwreset_from_cold_boot(ab); + return 0; + + err_irq_affinity_cleanup: +--- a/drivers/net/wireless/ath/ath11k/qmi.c ++++ b/drivers/net/wireless/ath/ath11k/qmi.c +@@ -9,6 +9,7 @@ + #include "qmi.h" + #include "core.h" + #include "debug.h" ++#include "hif.h" + #include + #include + #include +@@ -2839,6 +2840,33 @@ int ath11k_qmi_firmware_start(struct ath + return 0; + } + ++int ath11k_qmi_fwreset_from_cold_boot(struct ath11k_base *ab) ++{ ++ int timeout; ++ ++ if (!ath11k_core_coldboot_cal_support(ab) || ab->qmi.cal_done || ++ ab->hw_params.cbcal_restart_fw == 0) ++ return 0; ++ ++ ath11k_dbg(ab, ATH11K_DBG_QMI, "wait for cold boot done\n"); ++ ++ timeout = wait_event_timeout(ab->qmi.cold_boot_waitq, ++ (ab->qmi.cal_done == 1), ++ ATH11K_COLD_BOOT_FW_RESET_DELAY); ++ ++ if (timeout <= 0) { ++ ath11k_warn(ab, "Coldboot Calibration timed out\n"); ++ return -ETIMEDOUT; ++ } ++ ++ /* reset the firmware */ ++ ath11k_hif_power_down(ab); ++ ath11k_hif_power_up(ab); ++ ath11k_dbg(ab, ATH11K_DBG_QMI, "exit wait for cold boot done\n"); ++ return 0; ++} ++EXPORT_SYMBOL(ath11k_qmi_fwreset_from_cold_boot); ++ + static int ath11k_qmi_process_coldboot_calibration(struct ath11k_base *ab) + { + int timeout; +--- a/drivers/net/wireless/ath/ath11k/qmi.h ++++ b/drivers/net/wireless/ath/ath11k/qmi.h +@@ -37,7 +37,7 @@ + + #define QMI_WLANFW_MAX_DATA_SIZE_V01 6144 + #define ATH11K_FIRMWARE_MODE_OFF 4 +-#define ATH11K_COLD_BOOT_FW_RESET_DELAY (40 * HZ) ++#define ATH11K_COLD_BOOT_FW_RESET_DELAY (60 * HZ) + + #define ATH11K_QMI_DEVICE_BAR_SIZE 0x200000 + +@@ -519,5 +519,6 @@ void ath11k_qmi_msg_recv_work(struct wor + void ath11k_qmi_deinit_service(struct ath11k_base *ab); + int ath11k_qmi_init_service(struct ath11k_base *ab); + void ath11k_qmi_free_resource(struct ath11k_base *ab); ++int ath11k_qmi_fwreset_from_cold_boot(struct ath11k_base *ab); + + #endif diff --git a/package/kernel/mac80211/patches/ath11k/0005-wifi-ath11k-Fix-spelling-mistake-chnange-change.patch b/package/kernel/mac80211/patches/ath11k/0005-wifi-ath11k-Fix-spelling-mistake-chnange-change.patch deleted file mode 100644 index 4b52252ef34874..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0005-wifi-ath11k-Fix-spelling-mistake-chnange-change.patch +++ /dev/null @@ -1,25 +0,0 @@ -From a797f479bf3e02c6d179c2e6aeace7f9b22b0acd Mon Sep 17 00:00:00 2001 -From: Colin Ian King -Date: Wed, 28 Sep 2022 15:38:34 +0100 -Subject: [PATCH] wifi: ath11k: Fix spelling mistake "chnange" -> "change" - -There is a spelling mistake in an ath11k_dbg debug message. Fix it. - -Signed-off-by: Colin Ian King -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20220928143834.35189-1-colin.i.king@gmail.com ---- - drivers/net/wireless/ath/ath11k/wmi.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -6829,7 +6829,7 @@ static void ath11k_wmi_event_peer_sta_ps - } - - ath11k_dbg(ab, ATH11K_DBG_WMI, -- "peer sta ps chnange ev addr %pM state %u sup_bitmap %x ps_valid %u ts %u\n", -+ "peer sta ps change ev addr %pM state %u sup_bitmap %x ps_valid %u ts %u\n", - ev->peer_macaddr.addr, ev->peer_ps_state, - ev->ps_supported_bitmap, ev->peer_ps_valid, - ev->peer_ps_timestamp); diff --git a/package/kernel/mac80211/patches/ath11k/0005-wifi-ath11k-Remove-cal_done-check-during-probe.patch b/package/kernel/mac80211/patches/ath11k/0005-wifi-ath11k-Remove-cal_done-check-during-probe.patch new file mode 100644 index 00000000000000..884fd58d75b0ff --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0005-wifi-ath11k-Remove-cal_done-check-during-probe.patch @@ -0,0 +1,33 @@ +From 13329d0cb7212b058bd8451a99d215a8f97645ea Mon Sep 17 00:00:00 2001 +From: Seevalamuthu Mariappan +Date: Wed, 26 Jul 2023 19:40:32 +0530 +Subject: [PATCH 5/5] wifi: ath11k: Remove cal_done check during probe + +In some race conditions, calibration done QMI message is received even +before host wait starts for calibration to be done. +Due to this, resetting firmware was not performed after calibration. + +Hence, remove cal_done check in ath11k_qmi_fwreset_from_cold_boot() +as this is called only from probe. + +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Seevalamuthu Mariappan +Signed-off-by: Raj Kumar Bhagat +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230726141032.3061-4-quic_rajkbhag@quicinc.com +--- + drivers/net/wireless/ath/ath11k/qmi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath11k/qmi.c ++++ b/drivers/net/wireless/ath/ath11k/qmi.c +@@ -2844,7 +2844,7 @@ int ath11k_qmi_fwreset_from_cold_boot(st + { + int timeout; + +- if (!ath11k_core_coldboot_cal_support(ab) || ab->qmi.cal_done || ++ if (!ath11k_core_coldboot_cal_support(ab) || + ab->hw_params.cbcal_restart_fw == 0) + return 0; + diff --git a/package/kernel/mac80211/patches/ath11k/0006-wifi-ath11k-Don-t-drop-tx_status-when-peer-cannot-be.patch b/package/kernel/mac80211/patches/ath11k/0006-wifi-ath11k-Don-t-drop-tx_status-when-peer-cannot-be.patch new file mode 100644 index 00000000000000..e404a7849e63f2 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0006-wifi-ath11k-Don-t-drop-tx_status-when-peer-cannot-be.patch @@ -0,0 +1,53 @@ +From 400ece6c7f346b0a30867bd00b03b5b2563d4357 Mon Sep 17 00:00:00 2001 +From: Sven Eckelmann +Date: Tue, 22 Aug 2023 16:42:24 +0300 +Subject: [PATCH] wifi: ath11k: Don't drop tx_status when peer cannot be found + +When a station idles for a long time, hostapd will try to send a QoS Null +frame to the station as "poll". NL80211_CMD_PROBE_CLIENT is used for this +purpose. And the skb will be added to ack_status_frame - waiting for a +completion via ieee80211_report_ack_skb(). + +But when the peer was already removed before the tx_complete arrives, the +peer will be missing. And when using dev_kfree_skb_any (instead of going +through mac80211), the entry will stay inside ack_status_frames. This IDR +will therefore run full after 8K request were generated for such clients. +At this point, the access point will then just stall and not allow any new +clients because idr_alloc() for ack_status_frame will fail. + +ieee80211_free_txskb() on the other hand will (when required) call +ieee80211_report_ack_skb() and make sure that (when required) remove the +entry from the ack_status_frame. + +Tested-on: IPQ6018 hw1.0 WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 + +Fixes: 6257c702264c ("wifi: ath11k: fix tx status reporting in encap offload mode") +Fixes: 94739d45c388 ("ath11k: switch to using ieee80211_tx_status_ext()") +Cc: stable@vger.kernel.org +Signed-off-by: Sven Eckelmann +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230802-ath11k-ack_status_leak-v2-1-c0af729d6229@narfation.org +--- + drivers/net/wireless/ath/ath11k/dp_tx.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/dp_tx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_tx.c +@@ -369,7 +369,7 @@ ath11k_dp_tx_htt_tx_complete_buf(struct + "dp_tx: failed to find the peer with peer_id %d\n", + ts->peer_id); + spin_unlock_bh(&ab->base_lock); +- dev_kfree_skb_any(msdu); ++ ieee80211_free_txskb(ar->hw, msdu); + return; + } + spin_unlock_bh(&ab->base_lock); +@@ -624,7 +624,7 @@ static void ath11k_dp_tx_complete_msdu(s + "dp_tx: failed to find the peer with peer_id %d\n", + ts->peer_id); + spin_unlock_bh(&ab->base_lock); +- dev_kfree_skb_any(msdu); ++ ieee80211_free_txskb(ar->hw, msdu); + return; + } + arsta = (struct ath11k_sta *)peer->sta->drv_priv; diff --git a/package/kernel/mac80211/patches/ath11k/0007-wifi-ath11k-Cleanup-mac80211-references-on-failure-d.patch b/package/kernel/mac80211/patches/ath11k/0007-wifi-ath11k-Cleanup-mac80211-references-on-failure-d.patch new file mode 100644 index 00000000000000..ae9cd05dd6220e --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0007-wifi-ath11k-Cleanup-mac80211-references-on-failure-d.patch @@ -0,0 +1,51 @@ +From 29d15589f084d71a4ea8c544039c5839db0236e2 Mon Sep 17 00:00:00 2001 +From: Sven Eckelmann +Date: Tue, 22 Aug 2023 16:42:24 +0300 +Subject: [PATCH] wifi: ath11k: Cleanup mac80211 references on failure during + tx_complete + +When a function is using functions from mac80211 to free an skb then it +should do it consistently and not switch to the generic dev_kfree_skb_any +(or similar functions). Otherwise (like in the error handlers), mac80211 +will will not be aware of the freed skb and thus not clean up related +information in its internal data structures. + +Not doing so lead in the past to filled up structure which then prevented +new clients to connect. + +Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") +Fixes: 6257c702264c ("wifi: ath11k: fix tx status reporting in encap offload mode") +Cc: stable@vger.kernel.org +Signed-off-by: Sven Eckelmann +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230802-ath11k-ack_status_leak-v2-2-c0af729d6229@narfation.org +--- + drivers/net/wireless/ath/ath11k/dp_tx.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/dp_tx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_tx.c +@@ -344,7 +344,7 @@ ath11k_dp_tx_htt_tx_complete_buf(struct + dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); + + if (!skb_cb->vif) { +- dev_kfree_skb_any(msdu); ++ ieee80211_free_txskb(ar->hw, msdu); + return; + } + +@@ -566,12 +566,12 @@ static void ath11k_dp_tx_complete_msdu(s + dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); + + if (unlikely(!rcu_access_pointer(ab->pdevs_active[ar->pdev_idx]))) { +- dev_kfree_skb_any(msdu); ++ ieee80211_free_txskb(ar->hw, msdu); + return; + } + + if (unlikely(!skb_cb->vif)) { +- dev_kfree_skb_any(msdu); ++ ieee80211_free_txskb(ar->hw, msdu); + return; + } + diff --git a/package/kernel/mac80211/patches/ath11k/0007-wifi-ath11k-suppress-add-interface-error.patch b/package/kernel/mac80211/patches/ath11k/0007-wifi-ath11k-suppress-add-interface-error.patch deleted file mode 100644 index fbef0abb8db41f..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0007-wifi-ath11k-suppress-add-interface-error.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 638b26652b0438563a76ec90014c8cba34db982b Mon Sep 17 00:00:00 2001 -From: Karthikeyan Periyasamy -Date: Thu, 6 Oct 2022 06:28:42 +0530 -Subject: [PATCH 7/9] wifi: ath11k: suppress add interface error - -In the VIF (other than monitor type) creation request, we should not -throw the error code when the monitor VIF creation fails, since the -actual VIF creation succeeds. If we throw the error code from driver -then the actual VIF creation get fail. So suppress the monitor VIF -creation error by throwing warning message instead of error code. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.6.0.1-00760-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Karthikeyan Periyasamy -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221006005842.8599-1-quic_periyasa@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 9 +++------ - 1 file changed, 3 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6421,18 +6421,16 @@ static int ath11k_mac_op_add_interface(s - - ath11k_dp_vdev_tx_attach(ar, arvif); - -+ ath11k_debugfs_add_interface(arvif); -+ - if (vif->type != NL80211_IFTYPE_MONITOR && - test_bit(ATH11K_FLAG_MONITOR_CONF_ENABLED, &ar->monitor_flags)) { - ret = ath11k_mac_monitor_vdev_create(ar); -- if (ret) { -+ if (ret) - ath11k_warn(ar->ab, "failed to create monitor vdev during add interface: %d", - ret); -- goto err_peer_del; -- } - } - -- ath11k_debugfs_add_interface(arvif); -- - mutex_unlock(&ar->conf_mutex); - - return 0; -@@ -6457,7 +6455,6 @@ err_vdev_del: - spin_unlock_bh(&ar->data_lock); - - err: -- ath11k_debugfs_remove_interface(arvif); - mutex_unlock(&ar->conf_mutex); - - return ret; diff --git a/package/kernel/mac80211/patches/ath11k/0008-wifi-ath11k-Consistently-use-ath11k_vif_to_arvif.patch b/package/kernel/mac80211/patches/ath11k/0008-wifi-ath11k-Consistently-use-ath11k_vif_to_arvif.patch new file mode 100644 index 00000000000000..218b3ac35fc13b --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0008-wifi-ath11k-Consistently-use-ath11k_vif_to_arvif.patch @@ -0,0 +1,316 @@ +From 9476cda44c136089f14f8951ae5197d63e91735c Mon Sep 17 00:00:00 2001 +From: Jeff Johnson +Date: Mon, 21 Aug 2023 07:13:36 -0700 +Subject: [PATCH] wifi: ath11k: Consistently use ath11k_vif_to_arvif() + +Helper function ath11k_vif_to_arvif() exists to retrieve a struct +ath11k_vif from a struct ieee80211_vif. However, in multiple places +this logic is open-coded with inline typecasting. Since the +typecasting prevents the compiler from type-checking the source and +destination, update the driver to consistently use the helper +function. + +No functional changes, compile tested only. + +Signed-off-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230821-ath11k_vif_to_arvif-v1-1-fa2c3b60b5cf@quicinc.com +--- + drivers/net/wireless/ath/ath11k/mac.c | 64 +++++++++++----------- + drivers/net/wireless/ath/ath11k/testmode.c | 2 +- + 2 files changed, 33 insertions(+), 33 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -566,7 +566,7 @@ static void ath11k_get_arvif_iter(void * + struct ieee80211_vif *vif) + { + struct ath11k_vif_iter *arvif_iter = data; +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + + if (arvif->vdev_id == arvif_iter->vdev_id) + arvif_iter->arvif = arvif; +@@ -1464,7 +1464,7 @@ static int ath11k_mac_setup_bcn_tmpl_ema + u32 params = 0; + u8 i = 0; + +- tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv; ++ tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif); + + beacons = ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw, + tx_arvif->vif, 0); +@@ -1520,8 +1520,8 @@ static int ath11k_mac_setup_bcn_tmpl_mbs + struct sk_buff *bcn; + int ret; + +- if (arvif->vif->mbssid_tx_vif) { +- tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv; ++ if (vif->mbssid_tx_vif) { ++ tx_arvif = ath11k_vif_to_arvif(vif->mbssid_tx_vif); + if (tx_arvif != arvif) { + ar = tx_arvif->ar; + ab = ar->ab; +@@ -1562,7 +1562,7 @@ static int ath11k_mac_setup_bcn_tmpl(str + * non-transmitting interfaces, and results in a crash if sent. + */ + if (vif->mbssid_tx_vif && +- arvif != (void *)vif->mbssid_tx_vif->drv_priv && arvif->is_up) ++ arvif != ath11k_vif_to_arvif(vif->mbssid_tx_vif) && arvif->is_up) + return 0; + + if (vif->bss_conf.ema_ap && vif->mbssid_tx_vif) +@@ -1626,7 +1626,7 @@ static void ath11k_control_beaconing(str + ether_addr_copy(arvif->bssid, info->bssid); + + if (arvif->vif->mbssid_tx_vif) +- tx_arvif = (struct ath11k_vif *)arvif->vif->mbssid_tx_vif->drv_priv; ++ tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif); + + ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, + arvif->bssid, +@@ -1649,7 +1649,7 @@ static void ath11k_mac_handle_beacon_ite + { + struct sk_buff *skb = data; + struct ieee80211_mgmt *mgmt = (void *)skb->data; +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + + if (vif->type != NL80211_IFTYPE_STATION) + return; +@@ -1672,7 +1672,7 @@ static void ath11k_mac_handle_beacon_mis + struct ieee80211_vif *vif) + { + u32 *vdev_id = data; +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + struct ath11k *ar = arvif->ar; + struct ieee80211_hw *hw = ar->hw; + +@@ -1718,7 +1718,7 @@ static void ath11k_peer_assoc_h_basic(st + struct ieee80211_sta *sta, + struct peer_assoc_params *arg) + { +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + u32 aid; + + lockdep_assert_held(&ar->conf_mutex); +@@ -1746,7 +1746,7 @@ static void ath11k_peer_assoc_h_crypto(s + struct ieee80211_bss_conf *info = &vif->bss_conf; + struct cfg80211_chan_def def; + struct cfg80211_bss *bss; +- struct ath11k_vif *arvif = (struct ath11k_vif *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + const u8 *rsnie = NULL; + const u8 *wpaie = NULL; + +@@ -1804,7 +1804,7 @@ static void ath11k_peer_assoc_h_rates(st + struct ieee80211_sta *sta, + struct peer_assoc_params *arg) + { +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + struct wmi_rate_set_arg *rateset = &arg->peer_legacy_rates; + struct cfg80211_chan_def def; + const struct ieee80211_supported_band *sband; +@@ -1867,7 +1867,7 @@ static void ath11k_peer_assoc_h_ht(struc + struct peer_assoc_params *arg) + { + const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + struct cfg80211_chan_def def; + enum nl80211_band band; + const u8 *ht_mcs_mask; +@@ -2064,7 +2064,7 @@ static void ath11k_peer_assoc_h_vht(stru + struct peer_assoc_params *arg) + { + const struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + struct cfg80211_chan_def def; + enum nl80211_band band; + u16 *vht_mcs_mask; +@@ -2261,7 +2261,7 @@ static void ath11k_peer_assoc_h_he(struc + struct ieee80211_sta *sta, + struct peer_assoc_params *arg) + { +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + struct cfg80211_chan_def def; + const struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap; + enum nl80211_band band; +@@ -2584,7 +2584,7 @@ static void ath11k_peer_assoc_h_qos(stru + struct ieee80211_sta *sta, + struct peer_assoc_params *arg) + { +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + + switch (arvif->vdev_type) { + case WMI_VDEV_TYPE_AP: +@@ -2747,7 +2747,7 @@ static void ath11k_peer_assoc_h_phymode( + struct ieee80211_sta *sta, + struct peer_assoc_params *arg) + { +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + struct cfg80211_chan_def def; + enum nl80211_band band; + const u8 *ht_mcs_mask; +@@ -2933,7 +2933,7 @@ static bool ath11k_mac_vif_recalc_sta_he + struct ieee80211_vif *vif, + struct ieee80211_sta_he_cap *he_cap) + { +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + struct ieee80211_he_cap_elem he_cap_elem = {0}; + struct ieee80211_sta_he_cap *cap_band = NULL; + struct cfg80211_chan_def def; +@@ -2995,7 +2995,7 @@ static void ath11k_bss_assoc(struct ieee + struct ieee80211_bss_conf *bss_conf) + { + struct ath11k *ar = hw->priv; +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + struct peer_assoc_params peer_arg; + struct ieee80211_sta *ap_sta; + struct ath11k_peer *peer; +@@ -3111,7 +3111,7 @@ static void ath11k_bss_disassoc(struct i + struct ieee80211_vif *vif) + { + struct ath11k *ar = hw->priv; +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + int ret; + + lockdep_assert_held(&ar->conf_mutex); +@@ -3160,7 +3160,7 @@ static void ath11k_recalculate_mgmt_rate + struct ieee80211_vif *vif, + struct cfg80211_chan_def *def) + { +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + const struct ieee80211_supported_band *sband; + u8 basic_rate_idx; + int hw_rate_code; +@@ -4632,7 +4632,7 @@ static int ath11k_station_disassoc(struc + struct ieee80211_vif *vif, + struct ieee80211_sta *sta) + { +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + int ret = 0; + + lockdep_assert_held(&ar->conf_mutex); +@@ -5160,7 +5160,7 @@ static int ath11k_mac_op_sta_set_txpwr(s + struct ieee80211_sta *sta) + { + struct ath11k *ar = hw->priv; +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + int ret = 0; + s16 txpwr; + +@@ -5210,7 +5210,7 @@ static void ath11k_mac_op_sta_rc_update( + { + struct ath11k *ar = hw->priv; + struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + struct ath11k_peer *peer; + u32 bw, smps; + +@@ -5337,7 +5337,7 @@ static int ath11k_mac_op_conf_tx(struct + const struct ieee80211_tx_queue_params *params) + { + struct ath11k *ar = hw->priv; +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + struct wmi_wmm_params_arg *p = NULL; + int ret; + +@@ -6458,7 +6458,7 @@ static int ath11k_mac_setup_vdev_params_ + return 0; + } + +- tx_arvif = (void *)tx_vif->drv_priv; ++ tx_arvif = ath11k_vif_to_arvif(tx_vif); + + if (arvif->vif->bss_conf.nontransmitted) { + if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy) +@@ -7411,7 +7411,7 @@ ath11k_mac_update_vif_chan(struct ath11k + /* TODO: Update ar->rx_channel */ + + for (i = 0; i < n_vifs; i++) { +- arvif = (void *)vifs[i].vif->drv_priv; ++ arvif = ath11k_vif_to_arvif(vifs[i].vif); + + if (WARN_ON(!arvif->is_started)) + continue; +@@ -7453,7 +7453,7 @@ ath11k_mac_update_vif_chan(struct ath11k + + mbssid_tx_vif = arvif->vif->mbssid_tx_vif; + if (mbssid_tx_vif) +- tx_arvif = (struct ath11k_vif *)mbssid_tx_vif->drv_priv; ++ tx_arvif = ath11k_vif_to_arvif(mbssid_tx_vif); + + ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, + arvif->bssid, +@@ -7549,7 +7549,7 @@ static int ath11k_start_vdev_delay(struc + { + struct ath11k *ar = hw->priv; + struct ath11k_base *ab = ar->ab; +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + int ret; + + if (WARN_ON(arvif->is_started)) +@@ -7599,7 +7599,7 @@ ath11k_mac_op_assign_vif_chanctx(struct + { + struct ath11k *ar = hw->priv; + struct ath11k_base *ab = ar->ab; +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + int ret; + struct peer_create_params param; + +@@ -7689,7 +7689,7 @@ ath11k_mac_op_unassign_vif_chanctx(struc + { + struct ath11k *ar = hw->priv; + struct ath11k_base *ab = ar->ab; +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + struct ath11k_peer *peer; + int ret; + +@@ -8310,7 +8310,7 @@ ath11k_mac_op_set_bitrate_mask(struct ie + struct ieee80211_vif *vif, + const struct cfg80211_bitrate_mask *mask) + { +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + struct cfg80211_chan_def def; + struct ath11k_pdev_cap *cap; + struct ath11k *ar = arvif->ar; +@@ -8907,7 +8907,7 @@ static int ath11k_mac_op_remain_on_chann + enum ieee80211_roc_type type) + { + struct ath11k *ar = hw->priv; +- struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + struct scan_req_params arg; + int ret; + u32 scan_time_msec; +--- a/drivers/net/wireless/ath/ath11k/testmode.c ++++ b/drivers/net/wireless/ath/ath11k/testmode.c +@@ -350,7 +350,7 @@ static int ath11k_tm_cmd_wmi(struct ath1 + if (ar->ab->fw_mode != ATH11K_FIRMWARE_MODE_FTM && + (tag == WMI_TAG_VDEV_SET_PARAM_CMD || tag == WMI_TAG_UNIT_TEST_CMD)) { + if (vif) { +- arvif = (struct ath11k_vif *)vif->drv_priv; ++ arvif = ath11k_vif_to_arvif(vif); + *ptr = arvif->vdev_id; + } else { + ret = -EINVAL; diff --git a/package/kernel/mac80211/patches/ath11k/0008-wifi-ath11k-add-support-to-configure-channel-dwell-t.patch b/package/kernel/mac80211/patches/ath11k/0008-wifi-ath11k-add-support-to-configure-channel-dwell-t.patch deleted file mode 100644 index d0b19fe59f58f9..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0008-wifi-ath11k-add-support-to-configure-channel-dwell-t.patch +++ /dev/null @@ -1,102 +0,0 @@ -From c362daa213cdeb0a9e7c2ed84849544c24505720 Mon Sep 17 00:00:00 2001 -From: Manikanta Pubbisetty -Date: Fri, 7 Oct 2022 10:41:30 +0530 -Subject: [PATCH 8/9] wifi: ath11k: add support to configure channel dwell time - -Add support to configure channel dwell time during scan. -Dwell time help to stay on the channel for a specified duration -during scan and aid userspace in finding WiFi networks. Very -useful in passive scans where longer dwell times are needed -to find the WiFi networks. - -Configure channel dwell time from duration of the scan request -received from mac80211 when the duration is non-zero. When the -scan request does not have duration value, use the default ones, -the current implementation. - -Advertise corresponding feature flag NL80211_EXT_FEATURE_SET_SCAN_DWELL -to enable the feature. - -Change is applicable for all ath11k hardware. - -Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 - -Signed-off-by: Manikanta Pubbisetty -Reviewed-by: Jeff Johnson -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221007051130.6067-1-quic_mpubbise@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 33 +++++++++++++++++++++++---- - 1 file changed, 29 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -241,7 +241,10 @@ const struct htt_rx_ring_tlv_filter ath1 - #define ath11k_a_rates (ath11k_legacy_rates + 4) - #define ath11k_a_rates_size (ARRAY_SIZE(ath11k_legacy_rates) - 4) - --#define ATH11K_MAC_SCAN_TIMEOUT_MSECS 200 /* in msecs */ -+#define ATH11K_MAC_SCAN_CMD_EVT_OVERHEAD 200 /* in msecs */ -+ -+/* Overhead due to the processing of channel switch events from FW */ -+#define ATH11K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD 10 /* in msecs */ - - static const u32 ath11k_smps_map[] = { - [WLAN_HT_CAP_SM_PS_STATIC] = WMI_PEER_SMPS_STATIC, -@@ -3612,6 +3615,7 @@ static int ath11k_mac_op_hw_scan(struct - struct scan_req_params arg; - int ret = 0; - int i; -+ u32 scan_timeout; - - mutex_lock(&ar->conf_mutex); - -@@ -3681,6 +3685,26 @@ static int ath11k_mac_op_hw_scan(struct - ether_addr_copy(arg.mac_mask.addr, req->mac_addr_mask); - } - -+ /* if duration is set, default dwell times will be overwritten */ -+ if (req->duration) { -+ arg.dwell_time_active = req->duration; -+ arg.dwell_time_active_2g = req->duration; -+ arg.dwell_time_active_6g = req->duration; -+ arg.dwell_time_passive = req->duration; -+ arg.dwell_time_passive_6g = req->duration; -+ arg.burst_duration = req->duration; -+ -+ scan_timeout = min_t(u32, arg.max_rest_time * -+ (arg.num_chan - 1) + (req->duration + -+ ATH11K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD) * -+ arg.num_chan, arg.max_scan_time); -+ } else { -+ scan_timeout = arg.max_scan_time; -+ } -+ -+ /* Add a margin to account for event/command processing */ -+ scan_timeout += ATH11K_MAC_SCAN_CMD_EVT_OVERHEAD; -+ - ret = ath11k_start_scan(ar, &arg); - if (ret) { - ath11k_warn(ar->ab, "failed to start hw scan: %d\n", ret); -@@ -3689,10 +3713,8 @@ static int ath11k_mac_op_hw_scan(struct - spin_unlock_bh(&ar->data_lock); - } - -- /* Add a 200ms margin to account for event/command processing */ - ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, -- msecs_to_jiffies(arg.max_scan_time + -- ATH11K_MAC_SCAN_TIMEOUT_MSECS)); -+ msecs_to_jiffies(scan_timeout)); - - exit: - kfree(arg.chan_list); -@@ -9060,6 +9082,9 @@ static int __ath11k_mac_register(struct - NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP); - } - -+ wiphy_ext_feature_set(ar->hw->wiphy, -+ NL80211_EXT_FEATURE_SET_SCAN_DWELL); -+ - ath11k_reg_init(ar); - - if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) { diff --git a/package/kernel/mac80211/patches/ath11k/0009-wifi-ath11k-Fix-a-few-spelling-errors.patch b/package/kernel/mac80211/patches/ath11k/0009-wifi-ath11k-Fix-a-few-spelling-errors.patch new file mode 100644 index 00000000000000..b093f3e34211ba --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0009-wifi-ath11k-Fix-a-few-spelling-errors.patch @@ -0,0 +1,50 @@ +From d68a283bfc39aeed2a51c67804e014bf4b35c7e1 Mon Sep 17 00:00:00 2001 +From: Jeff Johnson +Date: Tue, 22 Aug 2023 07:50:49 -0700 +Subject: [PATCH] wifi: ath11k: Fix a few spelling errors + +Fix a few issues flagged by 'codespell'. + +Signed-off-by: Jeff Johnson +Acked-by: Randy Dunlap +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230822-ath_spelling-v1-2-8e2698759564@quicinc.com +--- + drivers/net/wireless/ath/ath11k/dp.h | 2 +- + drivers/net/wireless/ath/ath11k/dp_rx.c | 2 +- + drivers/net/wireless/ath/ath11k/dp_tx.c | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/dp.h ++++ b/drivers/net/wireless/ath/ath11k/dp.h +@@ -635,7 +635,7 @@ enum htt_ppdu_stats_tag_type { + * b'24 - status_swap: 1 is to swap status TLV + * b'25 - pkt_swap: 1 is to swap packet TLV + * b'26:31 - rsvd1: reserved for future use +- * dword1 - b'0:16 - ring_buffer_size: size of bufferes referenced by rx ring, ++ * dword1 - b'0:16 - ring_buffer_size: size of buffers referenced by rx ring, + * in byte units. + * Valid only for HW_TO_SW_RING and SW_TO_HW_RING + * - b'16:31 - rsvd2: Reserved for future use +--- a/drivers/net/wireless/ath/ath11k/dp_rx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_rx.c +@@ -3423,7 +3423,7 @@ static int ath11k_dp_rx_h_defrag_reo_rei + ath11k_hal_rx_buf_addr_info_set(msdu0, paddr, cookie, + ab->hw_params.hal_params->rx_buf_rbm); + +- /* Fill mpdu details into reo entrace ring */ ++ /* Fill mpdu details into reo entrance ring */ + srng = &ab->hal.srng_list[ab->dp.reo_reinject_ring.ring_id]; + + spin_lock_bh(&srng->lock); +--- a/drivers/net/wireless/ath/ath11k/dp_tx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_tx.c +@@ -238,7 +238,7 @@ tcl_ring_sel: + spin_unlock_bh(&tcl_ring->lock); + ret = -ENOMEM; + +- /* Checking for available tcl descritors in another ring in ++ /* Checking for available tcl descriptors in another ring in + * case of failure due to full tcl ring now, is better than + * checking this ring earlier for each pkt tx. + * Restart ring selection if some rings are not checked yet. diff --git a/package/kernel/mac80211/patches/ath11k/0010-wifi-ath11k-Fix-firmware-crash-on-vdev-delete-race-c.patch b/package/kernel/mac80211/patches/ath11k/0010-wifi-ath11k-Fix-firmware-crash-on-vdev-delete-race-c.patch deleted file mode 100644 index 7275af06ea28cc..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0010-wifi-ath11k-Fix-firmware-crash-on-vdev-delete-race-c.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 3811fa1f231f1a3e29759efef4992116604aab8b Mon Sep 17 00:00:00 2001 -From: Sowmiya Sree Elavalagan -Date: Tue, 11 Oct 2022 15:23:46 +0530 -Subject: [PATCH] wifi: ath11k: Fix firmware crash on vdev delete race - condition - -Current code does not wait for vdev delete completion on vdev create -failures and tries to send another vdev create followed by vdev set -param to firmware with same vdev id. This causes firmware crash. -Fix this crash by waiting for vdev delete completion on vdev -create failures. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.6.0.1-00905-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sowmiya Sree Elavalagan -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221011095346.3901-1-quic_ssreeela@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 60 +++++++++++++++++---------- - 1 file changed, 37 insertions(+), 23 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6233,6 +6233,40 @@ void ath11k_mac_11d_scan_stop_all(struct - } - } - -+static int ath11k_mac_vdev_delete(struct ath11k *ar, struct ath11k_vif *arvif) -+{ -+ unsigned long time_left; -+ struct ieee80211_vif *vif = arvif->vif; -+ int ret = 0; -+ -+ lockdep_assert_held(&ar->conf_mutex); -+ -+ reinit_completion(&ar->vdev_delete_done); -+ -+ ret = ath11k_wmi_vdev_delete(ar, arvif->vdev_id); -+ if (ret) { -+ ath11k_warn(ar->ab, "failed to delete WMI vdev %d: %d\n", -+ arvif->vdev_id, ret); -+ return ret; -+ } -+ -+ time_left = wait_for_completion_timeout(&ar->vdev_delete_done, -+ ATH11K_VDEV_DELETE_TIMEOUT_HZ); -+ if (time_left == 0) { -+ ath11k_warn(ar->ab, "Timeout in receiving vdev delete response\n"); -+ return -ETIMEDOUT; -+ } -+ -+ ar->ab->free_vdev_map |= 1LL << (arvif->vdev_id); -+ ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id); -+ ar->num_created_vdevs--; -+ -+ ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %pM deleted, vdev_id %d\n", -+ vif->addr, arvif->vdev_id); -+ -+ return ret; -+} -+ - static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) - { -@@ -6468,10 +6502,7 @@ err_peer_del: - } - - err_vdev_del: -- ath11k_wmi_vdev_delete(ar, arvif->vdev_id); -- ar->num_created_vdevs--; -- ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id); -- ab->free_vdev_map |= 1LL << arvif->vdev_id; -+ ath11k_mac_vdev_delete(ar, arvif); - spin_lock_bh(&ar->data_lock); - list_del(&arvif->list); - spin_unlock_bh(&ar->data_lock); -@@ -6499,7 +6530,6 @@ static void ath11k_mac_op_remove_interfa - struct ath11k *ar = hw->priv; - struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct ath11k_base *ab = ar->ab; -- unsigned long time_left; - int ret; - int i; - -@@ -6520,29 +6550,13 @@ static void ath11k_mac_op_remove_interfa - arvif->vdev_id, ret); - } - -- reinit_completion(&ar->vdev_delete_done); -- -- ret = ath11k_wmi_vdev_delete(ar, arvif->vdev_id); -+ ret = ath11k_mac_vdev_delete(ar, arvif); - if (ret) { -- ath11k_warn(ab, "failed to delete WMI vdev %d: %d\n", -+ ath11k_warn(ab, "failed to delete vdev %d: %d\n", - arvif->vdev_id, ret); - goto err_vdev_del; - } - -- time_left = wait_for_completion_timeout(&ar->vdev_delete_done, -- ATH11K_VDEV_DELETE_TIMEOUT_HZ); -- if (time_left == 0) { -- ath11k_warn(ab, "Timeout in receiving vdev delete response\n"); -- goto err_vdev_del; -- } -- -- ab->free_vdev_map |= 1LL << (arvif->vdev_id); -- ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id); -- ar->num_created_vdevs--; -- -- ath11k_dbg(ab, ATH11K_DBG_MAC, "vdev %pM deleted, vdev_id %d\n", -- vif->addr, arvif->vdev_id); -- - if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { - clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); - ar->monitor_vdev_id = -1; diff --git a/package/kernel/mac80211/patches/ath11k/0010-wifi-ath11k-simplify-the-code-with-module_platform_d.patch b/package/kernel/mac80211/patches/ath11k/0010-wifi-ath11k-simplify-the-code-with-module_platform_d.patch new file mode 100644 index 00000000000000..19873339b23741 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0010-wifi-ath11k-simplify-the-code-with-module_platform_d.patch @@ -0,0 +1,36 @@ +From 749a660b39030bfbacc366cd8670df2ee0e878b2 Mon Sep 17 00:00:00 2001 +From: Yang Yingliang +Date: Fri, 4 Aug 2023 17:12:55 +0800 +Subject: [PATCH] wifi: ath11k: simplify the code with module_platform_driver + +The init/exit() of driver only calls platform_driver_register/unregister, +it can be simpilfied with module_platform_driver. + +Signed-off-by: Yang Yingliang +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230804091255.1347178-1-yangyingliang@huawei.com +--- + drivers/net/wireless/ath/ath11k/ahb.c | 12 +----------- + 1 file changed, 1 insertion(+), 11 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/ahb.c ++++ b/drivers/net/wireless/ath/ath11k/ahb.c +@@ -1306,17 +1306,7 @@ static struct platform_driver ath11k_ahb + .shutdown = ath11k_ahb_shutdown, + }; + +-static int ath11k_ahb_init(void) +-{ +- return platform_driver_register(&ath11k_ahb_driver); +-} +-module_init(ath11k_ahb_init); +- +-static void ath11k_ahb_exit(void) +-{ +- platform_driver_unregister(&ath11k_ahb_driver); +-} +-module_exit(ath11k_ahb_exit); ++module_platform_driver(ath11k_ahb_driver); + + MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11ax WLAN AHB devices"); + MODULE_LICENSE("Dual BSD/GPL"); diff --git a/package/kernel/mac80211/patches/ath11k/0011-wifi-ath11k-fix-Wvoid-pointer-to-enum-cast-warning.patch b/package/kernel/mac80211/patches/ath11k/0011-wifi-ath11k-fix-Wvoid-pointer-to-enum-cast-warning.patch new file mode 100644 index 00000000000000..f42b021375b654 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0011-wifi-ath11k-fix-Wvoid-pointer-to-enum-cast-warning.patch @@ -0,0 +1,29 @@ +From 6763ef191d672ff3c2db0622652d49b0c0a60c4a Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Thu, 10 Aug 2023 11:12:23 +0200 +Subject: [PATCH] wifi: ath11k: fix Wvoid-pointer-to-enum-cast warning + +'hw_rev' is an enum, thus cast of pointer on 64-bit compile test with W=1 +causes: + + h11k/ahb.c:1124:11: error: cast to smaller integer type 'enum ath11k_hw_rev' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] + +Signed-off-by: Krzysztof Kozlowski +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230810091224.70088-1-krzysztof.kozlowski@linaro.org +--- + drivers/net/wireless/ath/ath11k/ahb.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath11k/ahb.c ++++ b/drivers/net/wireless/ath/ath11k/ahb.c +@@ -1096,7 +1096,7 @@ static int ath11k_ahb_probe(struct platf + return -EINVAL; + } + +- hw_rev = (enum ath11k_hw_rev)of_id->data; ++ hw_rev = (uintptr_t)of_id->data; + + switch (hw_rev) { + case ATH11K_HW_IPQ8074: diff --git a/package/kernel/mac80211/patches/ath11k/0011-wifi-ath11k-fix-monitor-vdev-creation-with-firmware-.patch b/package/kernel/mac80211/patches/ath11k/0011-wifi-ath11k-fix-monitor-vdev-creation-with-firmware-.patch deleted file mode 100644 index 2f066d0a565dce..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0011-wifi-ath11k-fix-monitor-vdev-creation-with-firmware-.patch +++ /dev/null @@ -1,40 +0,0 @@ -From f3ca72b0327101a074a871539e61775d43908ca4 Mon Sep 17 00:00:00 2001 -From: Nagarajan Maran -Date: Fri, 14 Oct 2022 21:20:54 +0530 -Subject: [PATCH] wifi: ath11k: fix monitor vdev creation with firmware - recovery - -During firmware recovery, the monitor interface is not -getting created in the driver and firmware since -the respective flags are not updated properly. - -So after firmware recovery is successful, when monitor -interface is brought down manually, firmware assertion -is observed, since we are trying to bring down the -interface which is not yet created in the firmware. - -Fix this by updating the monitor flags properly per -phy#, during firmware recovery. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Nagarajan Maran -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221014155054.11471-1-quic_nmaran@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -1677,6 +1677,10 @@ void ath11k_core_pre_reconfigure_recover - ath11k_mac_tx_mgmt_pending_free, ar); - idr_destroy(&ar->txmgmt_idr); - wake_up(&ar->txmgmt_empty_waitq); -+ -+ ar->monitor_vdev_id = -1; -+ clear_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags); -+ clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); - } - - wake_up(&ab->wmi_ab.tx_credits_wq); diff --git a/package/kernel/mac80211/patches/ath11k/0012-wifi-ath11k-Fix-qmi_msg_handler-data-structure-initi.patch b/package/kernel/mac80211/patches/ath11k/0012-wifi-ath11k-Fix-qmi_msg_handler-data-structure-initi.patch deleted file mode 100644 index fccfa4385a7476..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0012-wifi-ath11k-Fix-qmi_msg_handler-data-structure-initi.patch +++ /dev/null @@ -1,33 +0,0 @@ -From ed3725e15a154ebebf44e0c34806c57525483f92 Mon Sep 17 00:00:00 2001 -From: Rahul Bhattacharjee -Date: Fri, 21 Oct 2022 14:31:26 +0530 -Subject: [PATCH] wifi: ath11k: Fix qmi_msg_handler data structure - initialization - -qmi_msg_handler is required to be null terminated by QMI module. -There might be a case where a handler for a msg id is not present in the -handlers array which can lead to infinite loop while searching the handler -and therefore out of bound access in qmi_invoke_handler(). -Hence update the initialization in qmi_msg_handler data structure. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Rahul Bhattacharjee -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221021090126.28626-1-quic_rbhattac@quicinc.com ---- - drivers/net/wireless/ath/ath11k/qmi.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/qmi.c -+++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -1702,6 +1702,9 @@ static struct qmi_elem_info qmi_wlfw_fw_ - .data_type = QMI_EOTI, - .array_type = NO_ARRAY, - }, -+ -+ /* end of list */ -+ {}, - }; - - static int ath11k_qmi_host_cap_send(struct ath11k_base *ab) diff --git a/package/kernel/mac80211/patches/ath11k/0012-wifi-ath11k-Remove-unused-declarations.patch b/package/kernel/mac80211/patches/ath11k/0012-wifi-ath11k-Remove-unused-declarations.patch new file mode 100644 index 00000000000000..c318bbc3213e02 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0012-wifi-ath11k-Remove-unused-declarations.patch @@ -0,0 +1,44 @@ +From adb0b206709f4f2f1256a1ea20619ab98e99f2e7 Mon Sep 17 00:00:00 2001 +From: Yue Haibing +Date: Fri, 11 Aug 2023 18:44:13 +0800 +Subject: [PATCH] wifi: ath11k: Remove unused declarations + +Commit 2c3960c2253d ("ath11k: setup ce tasklet for control path") +declared but never implemented ath11k_ce_map_service_to_pipe(). +Commit e3396b8bddd2 ("ath11k: ce: support different CE configurations") +declared but never implemented ath11k_ce_attr_attach(). +Commit d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") +declared but never implemented ath11k_qmi_event_work()/ath11k_qmi_msg_recv_work(). + +Signed-off-by: Yue Haibing +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230811104413.33668-1-yuehaibing@huawei.com +--- + drivers/net/wireless/ath/ath11k/ce.h | 3 --- + drivers/net/wireless/ath/ath11k/qmi.h | 2 -- + 2 files changed, 5 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/ce.h ++++ b/drivers/net/wireless/ath/ath11k/ce.h +@@ -203,9 +203,6 @@ int ath11k_ce_alloc_pipes(struct ath11k_ + void ath11k_ce_free_pipes(struct ath11k_base *ab); + int ath11k_ce_get_attr_flags(struct ath11k_base *ab, int ce_id); + void ath11k_ce_poll_send_completed(struct ath11k_base *ab, u8 pipe_id); +-int ath11k_ce_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, +- u8 *ul_pipe, u8 *dl_pipe); +-int ath11k_ce_attr_attach(struct ath11k_base *ab); + void ath11k_ce_get_shadow_config(struct ath11k_base *ab, + u32 **shadow_cfg, u32 *shadow_cfg_len); + void ath11k_ce_stop_shadow_timers(struct ath11k_base *ab); +--- a/drivers/net/wireless/ath/ath11k/qmi.h ++++ b/drivers/net/wireless/ath/ath11k/qmi.h +@@ -514,8 +514,6 @@ struct qmi_wlanfw_wlan_ini_resp_msg_v01 + int ath11k_qmi_firmware_start(struct ath11k_base *ab, + u32 mode); + void ath11k_qmi_firmware_stop(struct ath11k_base *ab); +-void ath11k_qmi_event_work(struct work_struct *work); +-void ath11k_qmi_msg_recv_work(struct work_struct *work); + void ath11k_qmi_deinit_service(struct ath11k_base *ab); + int ath11k_qmi_init_service(struct ath11k_base *ab); + void ath11k_qmi_free_resource(struct ath11k_base *ab); diff --git a/package/kernel/mac80211/patches/ath11k/0013-wifi-ath11k-mhi-add-a-warning-message-for-MHI_CB_EE_.patch b/package/kernel/mac80211/patches/ath11k/0013-wifi-ath11k-mhi-add-a-warning-message-for-MHI_CB_EE_.patch new file mode 100644 index 00000000000000..e1286c9537ce7f --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0013-wifi-ath11k-mhi-add-a-warning-message-for-MHI_CB_EE_.patch @@ -0,0 +1,34 @@ +From 4a93b554cf9fa64faa7cf164c0d32fc3ce67108b Mon Sep 17 00:00:00 2001 +From: Arowa Suliman +Date: Sat, 26 Aug 2023 08:42:42 +0300 +Subject: [PATCH] wifi: ath11k: mhi: add a warning message for MHI_CB_EE_RDDM + crash + +Currently, the ath11k driver does not print a crash signature when a +MHI_CB_EE_RDDM crash happens. Checked by triggering a simulated crash using the +command and checking dmesg for logs: + +echo assert > /sys/kernel/debug/ath11k/../simulate_fw_crash + +Add a warning when firmware crash MHI_CB_EE_RDDM happens. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 + +Signed-off-by: Arowa Suliman +Reviewed-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230714001126.463127-1-arowa@chromium.org +--- + drivers/net/wireless/ath/ath11k/mhi.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/ath/ath11k/mhi.c ++++ b/drivers/net/wireless/ath/ath11k/mhi.c +@@ -333,6 +333,7 @@ static void ath11k_mhi_op_status_cb(stru + ath11k_warn(ab, "firmware crashed: MHI_CB_SYS_ERROR\n"); + break; + case MHI_CB_EE_RDDM: ++ ath11k_warn(ab, "firmware crashed: MHI_CB_EE_RDDM\n"); + if (!(test_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags))) + queue_work(ab->workqueue_aux, &ab->reset_work); + break; diff --git a/package/kernel/mac80211/patches/ath11k/0013-wifi-ath11k-synchronize-ath11k_mac_he_gi_to_nl80211_.patch b/package/kernel/mac80211/patches/ath11k/0013-wifi-ath11k-synchronize-ath11k_mac_he_gi_to_nl80211_.patch deleted file mode 100644 index 1e89b4d4f21185..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0013-wifi-ath11k-synchronize-ath11k_mac_he_gi_to_nl80211_.patch +++ /dev/null @@ -1,42 +0,0 @@ -From dd1c2322694522f674c874f5fa02ac5ae39135dd Mon Sep 17 00:00:00 2001 -From: "Jiri Slaby (SUSE)" -Date: Mon, 31 Oct 2022 12:43:41 +0100 -Subject: [PATCH] wifi: ath11k: synchronize - ath11k_mac_he_gi_to_nl80211_he_gi()'s return type - -ath11k_mac_he_gi_to_nl80211_he_gi() generates a valid warning with gcc-13: - drivers/net/wireless/ath/ath11k/mac.c:321:20: error: conflicting types for 'ath11k_mac_he_gi_to_nl80211_he_gi' due to enum/integer mismatch; have 'enum nl80211_he_gi(u8)' - drivers/net/wireless/ath/ath11k/mac.h:166:5: note: previous declaration of 'ath11k_mac_he_gi_to_nl80211_he_gi' with type 'u32(u8)' - -I.e. the type of the return value ath11k_mac_he_gi_to_nl80211_he_gi() in -the declaration is u32, while the definition spells enum nl80211_he_gi. -Synchronize them to the latter. - -Cc: Martin Liska -Cc: Kalle Valo -Cc: "David S. Miller" -Cc: Eric Dumazet -Cc: Jakub Kicinski -Cc: Paolo Abeni -Cc: ath11k@lists.infradead.org -Cc: linux-wireless@vger.kernel.org -Cc: netdev@vger.kernel.org -Signed-off-by: Jiri Slaby (SUSE) -Reviewed-by: Jeff Johnson -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221031114341.10377-1-jirislaby@kernel.org ---- - drivers/net/wireless/ath/ath11k/mac.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.h -+++ b/drivers/net/wireless/ath/ath11k/mac.h -@@ -163,7 +163,7 @@ void ath11k_mac_drain_tx(struct ath11k * - void ath11k_mac_peer_cleanup_all(struct ath11k *ar); - int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx); - u8 ath11k_mac_bw_to_mac80211_bw(u8 bw); --u32 ath11k_mac_he_gi_to_nl80211_he_gi(u8 sgi); -+enum nl80211_he_gi ath11k_mac_he_gi_to_nl80211_he_gi(u8 sgi); - enum nl80211_he_ru_alloc ath11k_mac_phy_he_ru_to_nl80211_he_ru_alloc(u16 ru_phy); - enum nl80211_he_ru_alloc ath11k_mac_he_ru_tones_to_nl80211_he_ru_alloc(u16 ru_tones); - enum ath11k_supported_bw ath11k_mac_mac80211_bw_to_ath11k_bw(enum rate_info_bw bw); diff --git a/package/kernel/mac80211/patches/ath11k/0014-wifi-ath11k-move-references-from-rsvd2-to-info-field.patch b/package/kernel/mac80211/patches/ath11k/0014-wifi-ath11k-move-references-from-rsvd2-to-info-field.patch new file mode 100644 index 00000000000000..731a763e17ce75 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0014-wifi-ath11k-move-references-from-rsvd2-to-info-field.patch @@ -0,0 +1,75 @@ +From 5bd2ced044bb95029d5c44cf7d23ced73e0fc05b Mon Sep 17 00:00:00 2001 +From: Muna Sinada +Date: Sat, 26 Aug 2023 08:42:46 +0300 +Subject: [PATCH] wifi: ath11k: move references from rsvd2 to info fields + +Remove references to reserved fields and add new info fields for +struct hal_rx_ppdu_end_user_stats. Reserved fields should not be +accessed, therefore existing references to it are to be changed to +referencing specific info fields. + +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00356-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Muna Sinada +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/1692827868-15667-1-git-send-email-quic_msinada@quicinc.com +--- + drivers/net/wireless/ath/ath11k/hal_rx.c | 10 +++++----- + drivers/net/wireless/ath/ath11k/hal_rx.h | 11 ++++++++--- + 2 files changed, 13 insertions(+), 8 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/hal_rx.c ++++ b/drivers/net/wireless/ath/ath11k/hal_rx.c +@@ -814,7 +814,7 @@ ath11k_hal_rx_handle_ofdma_info(void *rx + + rx_user_status->ul_ofdma_user_v0_word0 = __le32_to_cpu(ppdu_end_user->info6); + +- rx_user_status->ul_ofdma_user_v0_word1 = __le32_to_cpu(ppdu_end_user->rsvd2[10]); ++ rx_user_status->ul_ofdma_user_v0_word1 = __le32_to_cpu(ppdu_end_user->info9); + } + + static inline void +@@ -825,11 +825,11 @@ ath11k_hal_rx_populate_byte_count(void * + (struct hal_rx_ppdu_end_user_stats *)rx_tlv; + + rx_user_status->mpdu_ok_byte_count = +- FIELD_GET(HAL_RX_PPDU_END_USER_STATS_RSVD2_6_MPDU_OK_BYTE_COUNT, +- __le32_to_cpu(ppdu_end_user->rsvd2[6])); ++ FIELD_GET(HAL_RX_PPDU_END_USER_STATS_INFO8_MPDU_OK_BYTE_COUNT, ++ __le32_to_cpu(ppdu_end_user->info7)); + rx_user_status->mpdu_err_byte_count = +- FIELD_GET(HAL_RX_PPDU_END_USER_STATS_RSVD2_8_MPDU_ERR_BYTE_COUNT, +- __le32_to_cpu(ppdu_end_user->rsvd2[8])); ++ FIELD_GET(HAL_RX_PPDU_END_USER_STATS_INFO9_MPDU_ERR_BYTE_COUNT, ++ __le32_to_cpu(ppdu_end_user->info8)); + } + + static inline void +--- a/drivers/net/wireless/ath/ath11k/hal_rx.h ++++ b/drivers/net/wireless/ath/ath11k/hal_rx.h +@@ -222,8 +222,8 @@ struct hal_rx_ppdu_start { + #define HAL_RX_PPDU_END_USER_STATS_INFO6_TID_BITMAP GENMASK(15, 0) + #define HAL_RX_PPDU_END_USER_STATS_INFO6_TID_EOSP_BITMAP GENMASK(31, 16) + +-#define HAL_RX_PPDU_END_USER_STATS_RSVD2_6_MPDU_OK_BYTE_COUNT GENMASK(24, 0) +-#define HAL_RX_PPDU_END_USER_STATS_RSVD2_8_MPDU_ERR_BYTE_COUNT GENMASK(24, 0) ++#define HAL_RX_PPDU_END_USER_STATS_INFO7_MPDU_OK_BYTE_COUNT GENMASK(24, 0) ++#define HAL_RX_PPDU_END_USER_STATS_INFO8_MPDU_ERR_BYTE_COUNT GENMASK(24, 0) + + struct hal_rx_ppdu_end_user_stats { + __le32 rsvd0[2]; +@@ -236,7 +236,12 @@ struct hal_rx_ppdu_end_user_stats { + __le32 info4; + __le32 info5; + __le32 info6; +- __le32 rsvd2[11]; ++ __le32 rsvd2[5]; ++ __le32 info7; ++ __le32 rsvd3; ++ __le32 info8; ++ __le32 rsvd3[2]; ++ __le32 info9; + } __packed; + + struct hal_rx_ppdu_end_user_stats_ext { diff --git a/package/kernel/mac80211/patches/ath11k/0015-wifi-ath11k-fix-tid-bitmap-is-0-in-peer-rx-mu-stats.patch b/package/kernel/mac80211/patches/ath11k/0015-wifi-ath11k-fix-tid-bitmap-is-0-in-peer-rx-mu-stats.patch new file mode 100644 index 00000000000000..3edc3fc956cfc9 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0015-wifi-ath11k-fix-tid-bitmap-is-0-in-peer-rx-mu-stats.patch @@ -0,0 +1,100 @@ +From 7791487cd16cafd018cba0bf73789111a9f16843 Mon Sep 17 00:00:00 2001 +From: Muna Sinada +Date: Sat, 26 Aug 2023 08:42:46 +0300 +Subject: [PATCH] wifi: ath11k: fix tid bitmap is 0 in peer rx mu stats + +Correct parsing of reading offset for rx tid 16 bit bitmap. Incorrect +offset caused peer rx mu stats tid bitmap to always be zero. This +correction is in the software context and does not affect the +firmware interface. + +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00356-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Muna Sinada +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/1692827868-15667-2-git-send-email-quic_msinada@quicinc.com +--- + drivers/net/wireless/ath/ath11k/hal_rx.c | 10 +++++----- + drivers/net/wireless/ath/ath11k/hal_rx.h | 17 +++++++++-------- + 2 files changed, 14 insertions(+), 13 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/hal_rx.c ++++ b/drivers/net/wireless/ath/ath11k/hal_rx.c +@@ -814,7 +814,7 @@ ath11k_hal_rx_handle_ofdma_info(void *rx + + rx_user_status->ul_ofdma_user_v0_word0 = __le32_to_cpu(ppdu_end_user->info6); + +- rx_user_status->ul_ofdma_user_v0_word1 = __le32_to_cpu(ppdu_end_user->info9); ++ rx_user_status->ul_ofdma_user_v0_word1 = __le32_to_cpu(ppdu_end_user->info10); + } + + static inline void +@@ -826,10 +826,10 @@ ath11k_hal_rx_populate_byte_count(void * + + rx_user_status->mpdu_ok_byte_count = + FIELD_GET(HAL_RX_PPDU_END_USER_STATS_INFO8_MPDU_OK_BYTE_COUNT, +- __le32_to_cpu(ppdu_end_user->info7)); ++ __le32_to_cpu(ppdu_end_user->info8)); + rx_user_status->mpdu_err_byte_count = + FIELD_GET(HAL_RX_PPDU_END_USER_STATS_INFO9_MPDU_ERR_BYTE_COUNT, +- __le32_to_cpu(ppdu_end_user->info8)); ++ __le32_to_cpu(ppdu_end_user->info9)); + } + + static inline void +@@ -903,8 +903,8 @@ ath11k_hal_rx_parse_mon_status_tlv(struc + FIELD_GET(HAL_RX_PPDU_END_USER_STATS_INFO2_AST_INDEX, + __le32_to_cpu(eu_stats->info2)); + ppdu_info->tid = +- ffs(FIELD_GET(HAL_RX_PPDU_END_USER_STATS_INFO6_TID_BITMAP, +- __le32_to_cpu(eu_stats->info6))) - 1; ++ ffs(FIELD_GET(HAL_RX_PPDU_END_USER_STATS_INFO7_TID_BITMAP, ++ __le32_to_cpu(eu_stats->info7))) - 1; + ppdu_info->tcp_msdu_count = + FIELD_GET(HAL_RX_PPDU_END_USER_STATS_INFO4_TCP_MSDU_CNT, + __le32_to_cpu(eu_stats->info4)); +--- a/drivers/net/wireless/ath/ath11k/hal_rx.h ++++ b/drivers/net/wireless/ath/ath11k/hal_rx.h +@@ -149,7 +149,7 @@ struct hal_rx_mon_ppdu_info { + u8 beamformed; + u8 rssi_comb; + u8 rssi_chain_pri20[HAL_RX_MAX_NSS]; +- u8 tid; ++ u16 tid; + u16 ht_flags; + u16 vht_flags; + u16 he_flags; +@@ -219,11 +219,11 @@ struct hal_rx_ppdu_start { + #define HAL_RX_PPDU_END_USER_STATS_INFO5_OTHER_MSDU_CNT GENMASK(15, 0) + #define HAL_RX_PPDU_END_USER_STATS_INFO5_TCP_ACK_MSDU_CNT GENMASK(31, 16) + +-#define HAL_RX_PPDU_END_USER_STATS_INFO6_TID_BITMAP GENMASK(15, 0) +-#define HAL_RX_PPDU_END_USER_STATS_INFO6_TID_EOSP_BITMAP GENMASK(31, 16) ++#define HAL_RX_PPDU_END_USER_STATS_INFO7_TID_BITMAP GENMASK(15, 0) ++#define HAL_RX_PPDU_END_USER_STATS_INFO7_TID_EOSP_BITMAP GENMASK(31, 16) + +-#define HAL_RX_PPDU_END_USER_STATS_INFO7_MPDU_OK_BYTE_COUNT GENMASK(24, 0) +-#define HAL_RX_PPDU_END_USER_STATS_INFO8_MPDU_ERR_BYTE_COUNT GENMASK(24, 0) ++#define HAL_RX_PPDU_END_USER_STATS_INFO8_MPDU_OK_BYTE_COUNT GENMASK(24, 0) ++#define HAL_RX_PPDU_END_USER_STATS_INFO9_MPDU_ERR_BYTE_COUNT GENMASK(24, 0) + + struct hal_rx_ppdu_end_user_stats { + __le32 rsvd0[2]; +@@ -236,12 +236,13 @@ struct hal_rx_ppdu_end_user_stats { + __le32 info4; + __le32 info5; + __le32 info6; +- __le32 rsvd2[5]; + __le32 info7; +- __le32 rsvd3; ++ __le32 rsvd2[4]; + __le32 info8; +- __le32 rsvd3[2]; ++ __le32 rsvd3; + __le32 info9; ++ __le32 rsvd4[2]; ++ __le32 info10; + } __packed; + + struct hal_rx_ppdu_end_user_stats_ext { diff --git a/package/kernel/mac80211/patches/ath11k/0016-wifi-ath11k-Make-QMI-message-rules-const.patch b/package/kernel/mac80211/patches/ath11k/0016-wifi-ath11k-Make-QMI-message-rules-const.patch deleted file mode 100644 index 1f48df73f75a98..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0016-wifi-ath11k-Make-QMI-message-rules-const.patch +++ /dev/null @@ -1,341 +0,0 @@ -From 93c1592889fca46d09d833455628bab05516cdbf Mon Sep 17 00:00:00 2001 -From: Jeff Johnson -Date: Wed, 14 Sep 2022 17:23:03 -0700 -Subject: [PATCH] wifi: ath11k: Make QMI message rules const - -Commit ff6d365898d4 ("soc: qcom: qmi: use const for struct -qmi_elem_info") allows QMI message encoding/decoding rules to be -const, so do that for ath11k. - -Compile tested only. - -Signed-off-by: Jeff Johnson -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20220915002303.12206-1-quic_jjohnson@quicinc.com ---- - drivers/net/wireless/ath/ath11k/qmi.c | 72 +++++++++++++-------------- - 1 file changed, 36 insertions(+), 36 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/qmi.c -+++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -29,7 +29,7 @@ module_param_named(cold_boot_cal, ath11k - MODULE_PARM_DESC(cold_boot_cal, - "Decrease the channel switch time but increase the driver load time (Default: true)"); - --static struct qmi_elem_info qmi_wlanfw_host_cap_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_host_cap_req_msg_v01_ei[] = { - { - .data_type = QMI_OPT_FLAG, - .elem_len = 1, -@@ -280,7 +280,7 @@ static struct qmi_elem_info qmi_wlanfw_h - }, - }; - --static struct qmi_elem_info qmi_wlanfw_host_cap_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_host_cap_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -297,7 +297,7 @@ static struct qmi_elem_info qmi_wlanfw_h - }, - }; - --static struct qmi_elem_info qmi_wlanfw_ind_register_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_ind_register_req_msg_v01_ei[] = { - { - .data_type = QMI_OPT_FLAG, - .elem_len = 1, -@@ -522,7 +522,7 @@ static struct qmi_elem_info qmi_wlanfw_i - }, - }; - --static struct qmi_elem_info qmi_wlanfw_ind_register_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_ind_register_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -558,7 +558,7 @@ static struct qmi_elem_info qmi_wlanfw_i - }, - }; - --static struct qmi_elem_info qmi_wlanfw_mem_cfg_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_mem_cfg_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_8_BYTE, - .elem_len = 1, -@@ -590,7 +590,7 @@ static struct qmi_elem_info qmi_wlanfw_m - }, - }; - --static struct qmi_elem_info qmi_wlanfw_mem_seg_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_mem_seg_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -632,7 +632,7 @@ static struct qmi_elem_info qmi_wlanfw_m - }, - }; - --static struct qmi_elem_info qmi_wlanfw_request_mem_ind_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_request_mem_ind_msg_v01_ei[] = { - { - .data_type = QMI_DATA_LEN, - .elem_len = 1, -@@ -659,7 +659,7 @@ static struct qmi_elem_info qmi_wlanfw_r - }, - }; - --static struct qmi_elem_info qmi_wlanfw_mem_seg_resp_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_mem_seg_resp_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_8_BYTE, - .elem_len = 1, -@@ -699,7 +699,7 @@ static struct qmi_elem_info qmi_wlanfw_m - }, - }; - --static struct qmi_elem_info qmi_wlanfw_respond_mem_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_respond_mem_req_msg_v01_ei[] = { - { - .data_type = QMI_DATA_LEN, - .elem_len = 1, -@@ -726,7 +726,7 @@ static struct qmi_elem_info qmi_wlanfw_r - }, - }; - --static struct qmi_elem_info qmi_wlanfw_respond_mem_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_respond_mem_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -744,7 +744,7 @@ static struct qmi_elem_info qmi_wlanfw_r - }, - }; - --static struct qmi_elem_info qmi_wlanfw_cap_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_cap_req_msg_v01_ei[] = { - { - .data_type = QMI_EOTI, - .array_type = NO_ARRAY, -@@ -752,7 +752,7 @@ static struct qmi_elem_info qmi_wlanfw_c - }, - }; - --static struct qmi_elem_info qmi_wlanfw_device_info_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_device_info_req_msg_v01_ei[] = { - { - .data_type = QMI_EOTI, - .array_type = NO_ARRAY, -@@ -760,7 +760,7 @@ static struct qmi_elem_info qmi_wlanfw_d - }, - }; - --static struct qmi_elem_info qmi_wlfw_device_info_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlfw_device_info_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -814,7 +814,7 @@ static struct qmi_elem_info qmi_wlfw_dev - }, - }; - --static struct qmi_elem_info qmi_wlanfw_rf_chip_info_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_rf_chip_info_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -840,7 +840,7 @@ static struct qmi_elem_info qmi_wlanfw_r - }, - }; - --static struct qmi_elem_info qmi_wlanfw_rf_board_info_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_rf_board_info_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -857,7 +857,7 @@ static struct qmi_elem_info qmi_wlanfw_r - }, - }; - --static struct qmi_elem_info qmi_wlanfw_soc_info_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_soc_info_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -873,7 +873,7 @@ static struct qmi_elem_info qmi_wlanfw_s - }, - }; - --static struct qmi_elem_info qmi_wlanfw_fw_version_info_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_fw_version_info_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -899,7 +899,7 @@ static struct qmi_elem_info qmi_wlanfw_f - }, - }; - --static struct qmi_elem_info qmi_wlanfw_cap_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_cap_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -1100,7 +1100,7 @@ static struct qmi_elem_info qmi_wlanfw_c - }, - }; - --static struct qmi_elem_info qmi_wlanfw_bdf_download_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_bdf_download_req_msg_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_1_BYTE, - .elem_len = 1, -@@ -1235,7 +1235,7 @@ static struct qmi_elem_info qmi_wlanfw_b - }, - }; - --static struct qmi_elem_info qmi_wlanfw_bdf_download_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_bdf_download_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -1253,7 +1253,7 @@ static struct qmi_elem_info qmi_wlanfw_b - }, - }; - --static struct qmi_elem_info qmi_wlanfw_m3_info_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_m3_info_req_msg_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_8_BYTE, - .elem_len = 1, -@@ -1277,7 +1277,7 @@ static struct qmi_elem_info qmi_wlanfw_m - }, - }; - --static struct qmi_elem_info qmi_wlanfw_m3_info_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_m3_info_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -1294,7 +1294,7 @@ static struct qmi_elem_info qmi_wlanfw_m - }, - }; - --static struct qmi_elem_info qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -1347,7 +1347,7 @@ static struct qmi_elem_info qmi_wlanfw_c - }, - }; - --static struct qmi_elem_info qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -1382,7 +1382,7 @@ static struct qmi_elem_info qmi_wlanfw_c - }, - }; - --static struct qmi_elem_info qmi_wlanfw_shadow_reg_cfg_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_shadow_reg_cfg_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_2_BYTE, - .elem_len = 1, -@@ -1406,7 +1406,7 @@ static struct qmi_elem_info qmi_wlanfw_s - }, - }; - --static struct qmi_elem_info qmi_wlanfw_shadow_reg_v2_cfg_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_shadow_reg_v2_cfg_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -1423,7 +1423,7 @@ static struct qmi_elem_info qmi_wlanfw_s - }, - }; - --static struct qmi_elem_info qmi_wlanfw_wlan_mode_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_wlan_mode_req_msg_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -1458,7 +1458,7 @@ static struct qmi_elem_info qmi_wlanfw_w - }, - }; - --static struct qmi_elem_info qmi_wlanfw_wlan_mode_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_wlan_mode_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -1476,7 +1476,7 @@ static struct qmi_elem_info qmi_wlanfw_w - }, - }; - --static struct qmi_elem_info qmi_wlanfw_wlan_cfg_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_wlan_cfg_req_msg_v01_ei[] = { - { - .data_type = QMI_OPT_FLAG, - .elem_len = 1, -@@ -1615,7 +1615,7 @@ static struct qmi_elem_info qmi_wlanfw_w - }, - }; - --static struct qmi_elem_info qmi_wlanfw_wlan_cfg_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_wlan_cfg_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -1632,28 +1632,28 @@ static struct qmi_elem_info qmi_wlanfw_w - }, - }; - --static struct qmi_elem_info qmi_wlanfw_mem_ready_ind_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_mem_ready_ind_msg_v01_ei[] = { - { - .data_type = QMI_EOTI, - .array_type = NO_ARRAY, - }, - }; - --static struct qmi_elem_info qmi_wlanfw_fw_ready_ind_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_fw_ready_ind_msg_v01_ei[] = { - { - .data_type = QMI_EOTI, - .array_type = NO_ARRAY, - }, - }; - --static struct qmi_elem_info qmi_wlanfw_cold_boot_cal_done_ind_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_cold_boot_cal_done_ind_msg_v01_ei[] = { - { - .data_type = QMI_EOTI, - .array_type = NO_ARRAY, - }, - }; - --static struct qmi_elem_info qmi_wlanfw_wlan_ini_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_wlan_ini_req_msg_v01_ei[] = { - { - .data_type = QMI_OPT_FLAG, - .elem_len = 1, -@@ -1679,7 +1679,7 @@ static struct qmi_elem_info qmi_wlanfw_w - }, - }; - --static struct qmi_elem_info qmi_wlanfw_wlan_ini_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_wlan_ini_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -1697,7 +1697,7 @@ static struct qmi_elem_info qmi_wlanfw_w - }, - }; - --static struct qmi_elem_info qmi_wlfw_fw_init_done_ind_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlfw_fw_init_done_ind_msg_v01_ei[] = { - { - .data_type = QMI_EOTI, - .array_type = NO_ARRAY, diff --git a/package/kernel/mac80211/patches/ath11k/0016-wifi-ath11k-add-chip-id-board-name-while-searching-b.patch b/package/kernel/mac80211/patches/ath11k/0016-wifi-ath11k-add-chip-id-board-name-while-searching-b.patch new file mode 100644 index 00000000000000..662e28f4ef8d18 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0016-wifi-ath11k-add-chip-id-board-name-while-searching-b.patch @@ -0,0 +1,214 @@ +From 1133af5aea588a58043244a4ecb5ce511b310356 Mon Sep 17 00:00:00 2001 +From: Wen Gong +Date: Wed, 30 Aug 2023 02:02:26 -0400 +Subject: [PATCH] wifi: ath11k: add chip id board name while searching + board-2.bin for WCN6855 + +Sometimes board-2.bin does not have the board data which matched the +parameters such as bus type, vendor, device, subsystem-vendor, +subsystem-device, qmi-chip-id and qmi-board-id, then wlan will load fail. + +Hence add another type which only matches the bus type and qmi-chip-id, +then the ratio of missing board data reduced. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 + +Signed-off-by: Wen Gong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230830060226.18664-1-quic_wgong@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.c | 108 ++++++++++++++++++++----- + 1 file changed, 87 insertions(+), 21 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -985,9 +985,15 @@ int ath11k_core_check_dt(struct ath11k_b + return 0; + } + ++enum ath11k_bdf_name_type { ++ ATH11K_BDF_NAME_FULL, ++ ATH11K_BDF_NAME_BUS_NAME, ++ ATH11K_BDF_NAME_CHIP_ID, ++}; ++ + static int __ath11k_core_create_board_name(struct ath11k_base *ab, char *name, + size_t name_len, bool with_variant, +- bool bus_type_mode) ++ enum ath11k_bdf_name_type name_type) + { + /* strlen(',variant=') + strlen(ab->qmi.target.bdf_ext) */ + char variant[9 + ATH11K_QMI_BDF_EXT_STR_LENGTH] = { 0 }; +@@ -998,11 +1004,8 @@ static int __ath11k_core_create_board_na + + switch (ab->id.bdf_search) { + case ATH11K_BDF_SEARCH_BUS_AND_BOARD: +- if (bus_type_mode) +- scnprintf(name, name_len, +- "bus=%s", +- ath11k_bus_str(ab->hif.bus)); +- else ++ switch (name_type) { ++ case ATH11K_BDF_NAME_FULL: + scnprintf(name, name_len, + "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x,qmi-chip-id=%d,qmi-board-id=%d%s", + ath11k_bus_str(ab->hif.bus), +@@ -1012,6 +1015,19 @@ static int __ath11k_core_create_board_na + ab->qmi.target.chip_id, + ab->qmi.target.board_id, + variant); ++ break; ++ case ATH11K_BDF_NAME_BUS_NAME: ++ scnprintf(name, name_len, ++ "bus=%s", ++ ath11k_bus_str(ab->hif.bus)); ++ break; ++ case ATH11K_BDF_NAME_CHIP_ID: ++ scnprintf(name, name_len, ++ "bus=%s,qmi-chip-id=%d", ++ ath11k_bus_str(ab->hif.bus), ++ ab->qmi.target.chip_id); ++ break; ++ } + break; + default: + scnprintf(name, name_len, +@@ -1030,19 +1046,29 @@ static int __ath11k_core_create_board_na + static int ath11k_core_create_board_name(struct ath11k_base *ab, char *name, + size_t name_len) + { +- return __ath11k_core_create_board_name(ab, name, name_len, true, false); ++ return __ath11k_core_create_board_name(ab, name, name_len, true, ++ ATH11K_BDF_NAME_FULL); + } + + static int ath11k_core_create_fallback_board_name(struct ath11k_base *ab, char *name, + size_t name_len) + { +- return __ath11k_core_create_board_name(ab, name, name_len, false, false); ++ return __ath11k_core_create_board_name(ab, name, name_len, false, ++ ATH11K_BDF_NAME_FULL); + } + + static int ath11k_core_create_bus_type_board_name(struct ath11k_base *ab, char *name, + size_t name_len) + { +- return __ath11k_core_create_board_name(ab, name, name_len, false, true); ++ return __ath11k_core_create_board_name(ab, name, name_len, false, ++ ATH11K_BDF_NAME_BUS_NAME); ++} ++ ++static int ath11k_core_create_chip_id_board_name(struct ath11k_base *ab, char *name, ++ size_t name_len) ++{ ++ return __ath11k_core_create_board_name(ab, name, name_len, false, ++ ATH11K_BDF_NAME_CHIP_ID); + } + + const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab, +@@ -1289,16 +1315,21 @@ int ath11k_core_fetch_board_data_api_1(s + #define BOARD_NAME_SIZE 200 + int ath11k_core_fetch_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd) + { +- char boardname[BOARD_NAME_SIZE], fallback_boardname[BOARD_NAME_SIZE]; ++ char *boardname = NULL, *fallback_boardname = NULL, *chip_id_boardname = NULL; + char *filename, filepath[100]; +- int ret; ++ int ret = 0; + + filename = ATH11K_BOARD_API2_FILE; ++ boardname = kzalloc(BOARD_NAME_SIZE, GFP_KERNEL); ++ if (!boardname) { ++ ret = -ENOMEM; ++ goto exit; ++ } + +- ret = ath11k_core_create_board_name(ab, boardname, sizeof(boardname)); ++ ret = ath11k_core_create_board_name(ab, boardname, BOARD_NAME_SIZE); + if (ret) { + ath11k_err(ab, "failed to create board name: %d", ret); +- return ret; ++ goto exit; + } + + ab->bd_api = 2; +@@ -1307,13 +1338,19 @@ int ath11k_core_fetch_bdf(struct ath11k_ + ATH11K_BD_IE_BOARD_NAME, + ATH11K_BD_IE_BOARD_DATA); + if (!ret) +- goto success; ++ goto exit; ++ ++ fallback_boardname = kzalloc(BOARD_NAME_SIZE, GFP_KERNEL); ++ if (!fallback_boardname) { ++ ret = -ENOMEM; ++ goto exit; ++ } + + ret = ath11k_core_create_fallback_board_name(ab, fallback_boardname, +- sizeof(fallback_boardname)); ++ BOARD_NAME_SIZE); + if (ret) { + ath11k_err(ab, "failed to create fallback board name: %d", ret); +- return ret; ++ goto exit; + } + + ret = ath11k_core_fetch_board_data_api_n(ab, bd, fallback_boardname, +@@ -1321,7 +1358,28 @@ int ath11k_core_fetch_bdf(struct ath11k_ + ATH11K_BD_IE_BOARD_NAME, + ATH11K_BD_IE_BOARD_DATA); + if (!ret) +- goto success; ++ goto exit; ++ ++ chip_id_boardname = kzalloc(BOARD_NAME_SIZE, GFP_KERNEL); ++ if (!chip_id_boardname) { ++ ret = -ENOMEM; ++ goto exit; ++ } ++ ++ ret = ath11k_core_create_chip_id_board_name(ab, chip_id_boardname, ++ BOARD_NAME_SIZE); ++ if (ret) { ++ ath11k_err(ab, "failed to create chip id board name: %d", ret); ++ goto exit; ++ } ++ ++ ret = ath11k_core_fetch_board_data_api_n(ab, bd, chip_id_boardname, ++ ATH11K_BD_IE_BOARD, ++ ATH11K_BD_IE_BOARD_NAME, ++ ATH11K_BD_IE_BOARD_DATA); ++ ++ if (!ret) ++ goto exit; + + ab->bd_api = 1; + ret = ath11k_core_fetch_board_data_api_1(ab, bd, ATH11K_DEFAULT_BOARD_FILE); +@@ -1334,14 +1392,22 @@ int ath11k_core_fetch_bdf(struct ath11k_ + ath11k_err(ab, "failed to fetch board data for %s from %s\n", + fallback_boardname, filepath); + ++ ath11k_err(ab, "failed to fetch board data for %s from %s\n", ++ chip_id_boardname, filepath); ++ + ath11k_err(ab, "failed to fetch board.bin from %s\n", + ab->hw_params.fw.dir); +- return ret; + } + +-success: +- ath11k_dbg(ab, ATH11K_DBG_BOOT, "using board api %d\n", ab->bd_api); +- return 0; ++exit: ++ kfree(boardname); ++ kfree(fallback_boardname); ++ kfree(chip_id_boardname); ++ ++ if (!ret) ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, "using board api %d\n", ab->bd_api); ++ ++ return ret; + } + + int ath11k_core_fetch_regdb(struct ath11k_base *ab, struct ath11k_board_data *bd) diff --git a/package/kernel/mac80211/patches/ath11k/0017-wifi-ath11k-Trigger-sta-disconnect-on-hardware-resta.patch b/package/kernel/mac80211/patches/ath11k/0017-wifi-ath11k-Trigger-sta-disconnect-on-hardware-resta.patch deleted file mode 100644 index f95e5027b259eb..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0017-wifi-ath11k-Trigger-sta-disconnect-on-hardware-resta.patch +++ /dev/null @@ -1,119 +0,0 @@ -From a018750a2cceaf4427c4ee3d9ce3e83a171d5bd6 Mon Sep 17 00:00:00 2001 -From: Youghandhar Chintala -Date: Fri, 4 Nov 2022 14:24:03 +0530 -Subject: [PATCH] wifi: ath11k: Trigger sta disconnect on hardware restart - -Currently after the hardware restart triggered from the driver, the -station interface connection remains intact, since a disconnect trigger -is not sent to userspace. This can lead to a problem in targets where -the wifi mac sequence is added by the firmware. - -After the target restart, its wifi mac sequence number gets reset to -zero. Hence AP to which our device is connected will receive frames with -a wifi mac sequence number jump to the past, thereby resulting in the -AP dropping all these frames, until the frame arrives with a wifi mac -sequence number which AP was expecting. - -To avoid such frame drops, its better to trigger a station disconnect -upon target hardware restart which can be done with API -ieee80211_reconfig_disconnect exposed to mac80211. - -The other targets are not affected by this change, since the hardware -params flag is not set. - -Reported-by: kernel test robot - -Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 - -Signed-off-by: Youghandhar Chintala -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221104085403.11025-1-quic_youghand@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 6 ++++++ - drivers/net/wireless/ath/ath11k/hw.h | 1 + - drivers/net/wireless/ath/ath11k/mac.c | 7 +++++++ - 3 files changed, 14 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -195,6 +195,7 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = true, - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, -+ .support_fw_mac_sequence = false, - }, - { - .name = "qca6390 hw2.0", -@@ -277,6 +278,7 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = true, - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, -+ .support_fw_mac_sequence = true, - }, - { - .name = "qcn9074 hw1.0", -@@ -356,6 +358,7 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = true, - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, -+ .support_fw_mac_sequence = false, - }, - { - .name = "wcn6855 hw2.0", -@@ -438,6 +441,7 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = true, - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, -+ .support_fw_mac_sequence = true, - }, - { - .name = "wcn6855 hw2.1", -@@ -519,6 +523,7 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = true, - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, -+ .support_fw_mac_sequence = true, - }, - { - .name = "wcn6750 hw1.0", -@@ -597,6 +602,7 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = false, - .tx_ring_size = DP_TCL_DATA_RING_SIZE_WCN6750, - .smp2p_wow_exit = true, -+ .support_fw_mac_sequence = true, - }, - }; - ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -219,6 +219,7 @@ struct ath11k_hw_params { - bool tcl_ring_retry; - u32 tx_ring_size; - bool smp2p_wow_exit; -+ bool support_fw_mac_sequence; - }; - - struct ath11k_hw_ops { ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -8010,6 +8010,7 @@ ath11k_mac_op_reconfig_complete(struct i - struct ath11k *ar = hw->priv; - struct ath11k_base *ab = ar->ab; - int recovery_count; -+ struct ath11k_vif *arvif; - - if (reconfig_type != IEEE80211_RECONFIG_TYPE_RESTART) - return; -@@ -8045,6 +8046,12 @@ ath11k_mac_op_reconfig_complete(struct i - ath11k_dbg(ab, ATH11K_DBG_BOOT, "reset success\n"); - } - } -+ if (ar->ab->hw_params.support_fw_mac_sequence) { -+ list_for_each_entry(arvif, &ar->arvifs, list) { -+ if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_STA) -+ ieee80211_hw_restart_disconnect(arvif->vif); -+ } -+ } - } - - mutex_unlock(&ar->conf_mutex); diff --git a/package/kernel/mac80211/patches/ath11k/0017-wifi-ath11k-fix-boot-failure-with-one-MSI-vector.patch b/package/kernel/mac80211/patches/ath11k/0017-wifi-ath11k-fix-boot-failure-with-one-MSI-vector.patch new file mode 100644 index 00000000000000..9101a1ea1ce557 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0017-wifi-ath11k-fix-boot-failure-with-one-MSI-vector.patch @@ -0,0 +1,103 @@ +From 39564b475ac5a589e6c22c43a08cbd283c295d2c Mon Sep 17 00:00:00 2001 +From: Baochen Qiang +Date: Thu, 7 Sep 2023 09:56:06 +0800 +Subject: [PATCH] wifi: ath11k: fix boot failure with one MSI vector + +Commit 5b32b6dd96633 ("ath11k: Remove core PCI references from +PCI common code") breaks with one MSI vector because it moves +affinity setting after IRQ request, see below log: + +[ 1417.278835] ath11k_pci 0000:02:00.0: failed to receive control response completion, polling.. +[ 1418.302829] ath11k_pci 0000:02:00.0: Service connect timeout +[ 1418.302833] ath11k_pci 0000:02:00.0: failed to connect to HTT: -110 +[ 1418.303669] ath11k_pci 0000:02:00.0: failed to start core: -110 + +The detail is, if do affinity request after IRQ activated, +which is done in request_irq(), kernel caches that request and +returns success directly. Later when a subsequent MHI interrupt is +fired, kernel will do the real affinity setting work, as a result, +changs the MSI vector. However at that time host has configured +old vector to hardware, so host never receives CE or DP interrupts. + +Fix it by setting affinity before registering MHI controller +where host is, for the first time, doing IRQ request. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 +Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 +Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-01160-QCAMSLSWPLZ-1 + +Fixes: 5b32b6dd9663 ("ath11k: Remove core PCI references from PCI common code") +Signed-off-by: Baochen Qiang +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230907015606.16297-1-quic_bqiang@quicinc.com +--- + drivers/net/wireless/ath/ath11k/pci.c | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/pci.c ++++ b/drivers/net/wireless/ath/ath11k/pci.c +@@ -852,10 +852,16 @@ unsupported_wcn6855_soc: + if (ret) + goto err_pci_disable_msi; + ++ ret = ath11k_pci_set_irq_affinity_hint(ab_pci, cpumask_of(0)); ++ if (ret) { ++ ath11k_err(ab, "failed to set irq affinity %d\n", ret); ++ goto err_pci_disable_msi; ++ } ++ + ret = ath11k_mhi_register(ab_pci); + if (ret) { + ath11k_err(ab, "failed to register mhi: %d\n", ret); +- goto err_pci_disable_msi; ++ goto err_irq_affinity_cleanup; + } + + ret = ath11k_hal_srng_init(ab); +@@ -876,12 +882,6 @@ unsupported_wcn6855_soc: + goto err_ce_free; + } + +- ret = ath11k_pci_set_irq_affinity_hint(ab_pci, cpumask_of(0)); +- if (ret) { +- ath11k_err(ab, "failed to set irq affinity %d\n", ret); +- goto err_free_irq; +- } +- + /* kernel may allocate a dummy vector before request_irq and + * then allocate a real vector when request_irq is called. + * So get msi_data here again to avoid spurious interrupt +@@ -890,20 +890,17 @@ unsupported_wcn6855_soc: + ret = ath11k_pci_config_msi_data(ab_pci); + if (ret) { + ath11k_err(ab, "failed to config msi_data: %d\n", ret); +- goto err_irq_affinity_cleanup; ++ goto err_free_irq; + } + + ret = ath11k_core_init(ab); + if (ret) { + ath11k_err(ab, "failed to init core: %d\n", ret); +- goto err_irq_affinity_cleanup; ++ goto err_free_irq; + } + ath11k_qmi_fwreset_from_cold_boot(ab); + return 0; + +-err_irq_affinity_cleanup: +- ath11k_pci_set_irq_affinity_hint(ab_pci, NULL); +- + err_free_irq: + ath11k_pcic_free_irq(ab); + +@@ -916,6 +913,9 @@ err_hal_srng_deinit: + err_mhi_unregister: + ath11k_mhi_unregister(ab_pci); + ++err_irq_affinity_cleanup: ++ ath11k_pci_set_irq_affinity_hint(ab_pci, NULL); ++ + err_pci_disable_msi: + ath11k_pci_free_msi(ab_pci); + diff --git a/package/kernel/mac80211/patches/ath11k/0018-wifi-ath11k-Fix-race-condition-with-struct-htt_ppdu_.patch b/package/kernel/mac80211/patches/ath11k/0018-wifi-ath11k-Fix-race-condition-with-struct-htt_ppdu_.patch deleted file mode 100644 index cef61ee34481d9..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0018-wifi-ath11k-Fix-race-condition-with-struct-htt_ppdu_.patch +++ /dev/null @@ -1,103 +0,0 @@ -From e44de90453bb2b46a523df78c39eb896bab35dcd Mon Sep 17 00:00:00 2001 -From: Govindaraj Saminathan -Date: Tue, 29 Nov 2022 13:04:02 +0200 -Subject: [PATCH] wifi: ath11k: Fix race condition with struct - htt_ppdu_stats_info - -A crash happens when running the traffic with multiple clients: - -Crash Signature : Unable to handle kernel paging request at -virtual address ffffffd700970918 During the crash, PC points to -"ieee80211_tx_rate_update+0x30/0x68 [mac80211]" -LR points to "ath11k_dp_htt_htc_t2h_msg_handler+0x5a8/0x8a0 [ath11k]". - -Struct ppdu_stats_info is allocated and accessed from event callback via copy -engine tasklet, this has a problem when freeing it from ath11k_mac_op_stop(). - -Use data_lock during entire ath11k_dp_htt_get_ppdu_desc() call to protect -struct htt_ppdu_stats_info access and to avoid race condition when accessing it -from ath11k_mac_op_stop(). - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Govindaraj Saminathan -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221124071104.22506-1-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp_rx.c | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -1535,13 +1535,12 @@ struct htt_ppdu_stats_info *ath11k_dp_ht - { - struct htt_ppdu_stats_info *ppdu_info; - -- spin_lock_bh(&ar->data_lock); -+ lockdep_assert_held(&ar->data_lock); -+ - if (!list_empty(&ar->ppdu_stats_info)) { - list_for_each_entry(ppdu_info, &ar->ppdu_stats_info, list) { -- if (ppdu_info->ppdu_id == ppdu_id) { -- spin_unlock_bh(&ar->data_lock); -+ if (ppdu_info->ppdu_id == ppdu_id) - return ppdu_info; -- } - } - - if (ar->ppdu_stat_list_depth > HTT_PPDU_DESC_MAX_DEPTH) { -@@ -1553,16 +1552,13 @@ struct htt_ppdu_stats_info *ath11k_dp_ht - kfree(ppdu_info); - } - } -- spin_unlock_bh(&ar->data_lock); - - ppdu_info = kzalloc(sizeof(*ppdu_info), GFP_ATOMIC); - if (!ppdu_info) - return NULL; - -- spin_lock_bh(&ar->data_lock); - list_add_tail(&ppdu_info->list, &ar->ppdu_stats_info); - ar->ppdu_stat_list_depth++; -- spin_unlock_bh(&ar->data_lock); - - return ppdu_info; - } -@@ -1586,16 +1582,17 @@ static int ath11k_htt_pull_ppdu_stats(st - ar = ath11k_mac_get_ar_by_pdev_id(ab, pdev_id); - if (!ar) { - ret = -EINVAL; -- goto exit; -+ goto out; - } - - if (ath11k_debugfs_is_pktlog_lite_mode_enabled(ar)) - trace_ath11k_htt_ppdu_stats(ar, skb->data, len); - -+ spin_lock_bh(&ar->data_lock); - ppdu_info = ath11k_dp_htt_get_ppdu_desc(ar, ppdu_id); - if (!ppdu_info) { - ret = -EINVAL; -- goto exit; -+ goto out_unlock_data; - } - - ppdu_info->ppdu_id = ppdu_id; -@@ -1604,10 +1601,13 @@ static int ath11k_htt_pull_ppdu_stats(st - (void *)ppdu_info); - if (ret) { - ath11k_warn(ab, "Failed to parse tlv %d\n", ret); -- goto exit; -+ goto out_unlock_data; - } - --exit: -+out_unlock_data: -+ spin_unlock_bh(&ar->data_lock); -+ -+out: - rcu_read_unlock(); - - return ret; diff --git a/package/kernel/mac80211/patches/ath11k/0018-wifi-ath11k-drop-NULL-pointer-check-in-ath11k_update.patch b/package/kernel/mac80211/patches/ath11k/0018-wifi-ath11k-drop-NULL-pointer-check-in-ath11k_update.patch new file mode 100644 index 00000000000000..ccf7461a75865d --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0018-wifi-ath11k-drop-NULL-pointer-check-in-ath11k_update.patch @@ -0,0 +1,32 @@ +From ac13a7842ab46a87aa315514d6d7e19b03cb2adc Mon Sep 17 00:00:00 2001 +From: Dmitry Antipov +Date: Wed, 6 Sep 2023 12:36:55 +0300 +Subject: [PATCH] wifi: ath11k: drop NULL pointer check in + ath11k_update_per_peer_tx_stats() + +Since 'user_stats' is a fixed-size array of 'struct htt_ppdu_user_stats' +in 'struct htt_ppdu_stats', any of its member can't be NULL and so +relevant check may be dropped. + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +Signed-off-by: Dmitry Antipov +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230906093704.14001-1-dmantipov@yandex.ru +--- + drivers/net/wireless/ath/ath11k/dp_rx.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/dp_rx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_rx.c +@@ -1388,9 +1388,6 @@ ath11k_update_per_peer_tx_stats(struct a + u8 tid = HTT_PPDU_STATS_NON_QOS_TID; + bool is_ampdu = false; + +- if (!usr_stats) +- return; +- + if (!(usr_stats->tlv_flags & BIT(HTT_PPDU_STATS_TAG_USR_RATE))) + return; + diff --git a/package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-drop-redundant-check-in-ath11k_dp_rx_mon.patch b/package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-drop-redundant-check-in-ath11k_dp_rx_mon.patch new file mode 100644 index 00000000000000..ace199315b2ff6 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-drop-redundant-check-in-ath11k_dp_rx_mon.patch @@ -0,0 +1,38 @@ +From 82ae3f4635382ff23e2ece55b5d5e713223951ec Mon Sep 17 00:00:00 2001 +From: Dmitry Antipov +Date: Thu, 24 Aug 2023 10:50:44 +0300 +Subject: [PATCH] wifi: ath11k: drop redundant check in + ath11k_dp_rx_mon_dest_process() + +In 'ath11k_dp_rx_mon_dest_process()', 'mon_dst_srng' points to +a member of 'srng_list', which is a fixed-size array inside +'struct ath11k_hal'. This way, if 'ring_id' is valid (i. e. +between 0 and HAL_SRNG_RING_ID_MAX - 1 inclusive), 'mon_dst_srng' +can't be NULL and so relevant check may be dropped. + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +Signed-off-by: Dmitry Antipov +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230824075121.121144-1-dmantipov@yandex.ru +--- + drivers/net/wireless/ath/ath11k/dp_rx.c | 7 ------- + 1 file changed, 7 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/dp_rx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_rx.c +@@ -5094,13 +5094,6 @@ static void ath11k_dp_rx_mon_dest_proces + + mon_dst_srng = &ar->ab->hal.srng_list[ring_id]; + +- if (!mon_dst_srng) { +- ath11k_warn(ar->ab, +- "HAL Monitor Destination Ring Init Failed -- %p", +- mon_dst_srng); +- return; +- } +- + spin_lock_bh(&pmon->mon_lock); + + ath11k_hal_srng_access_begin(ar->ab, mon_dst_srng); diff --git a/package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-update-hw-params-for-IPQ5018.patch b/package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-update-hw-params-for-IPQ5018.patch deleted file mode 100644 index 25d39ddb0d3530..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-update-hw-params-for-IPQ5018.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 8dfe875aa24aec68baf6702018633c84c2c1feca Mon Sep 17 00:00:00 2001 -From: Sriram R -Date: Fri, 2 Dec 2022 23:37:13 +0200 -Subject: [PATCH] wifi: ath11k: update hw params for IPQ5018 - -Add new compatible string for IPQ5018 and add -required hw params for IPQ5018. The hw descriptors size and -datapath ops are similar to QCN9074, hence reuse the same. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sriram R -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221122132152.17771-3-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 71 ++++++++++++++++++++++++++ - drivers/net/wireless/ath/ath11k/core.h | 8 +++ - 2 files changed, 79 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -604,6 +604,77 @@ static const struct ath11k_hw_params ath - .smp2p_wow_exit = true, - .support_fw_mac_sequence = true, - }, -+ { -+ .hw_rev = ATH11K_HW_IPQ5018_HW10, -+ .name = "ipq5018 hw1.0", -+ .fw = { -+ .dir = "IPQ5018/hw1.0", -+ .board_size = 256 * 1024, -+ .cal_offset = 128 * 1024, -+ }, -+ .max_radios = MAX_RADIOS_5018, -+ .bdf_addr = 0x4BA00000, -+ /* hal_desc_sz and hw ops are similar to qcn9074 */ -+ .hal_desc_sz = sizeof(struct hal_rx_desc_qcn9074), -+ .qmi_service_ins_id = ATH11K_QMI_WLFW_SERVICE_INS_ID_V01_IPQ8074, -+ .ring_mask = &ath11k_hw_ring_mask_ipq8074, -+ .credit_flow = false, -+ .max_tx_ring = 1, -+ .spectral = { -+ .fft_sz = 2, -+ .fft_pad_sz = 0, -+ .summary_pad_sz = 16, -+ .fft_hdr_len = 24, -+ .max_fft_bins = 1024, -+ }, -+ .internal_sleep_clock = false, -+ .host_ce_config = ath11k_host_ce_config_qcn9074, -+ .ce_count = CE_CNT_5018, -+ .rxdma1_enable = true, -+ .num_rxmda_per_pdev = RXDMA_PER_PDEV_5018, -+ .rx_mac_buf_ring = false, -+ .vdev_start_delay = false, -+ .htt_peer_map_v2 = true, -+ .interface_modes = BIT(NL80211_IFTYPE_STATION) | -+ BIT(NL80211_IFTYPE_AP) | -+ BIT(NL80211_IFTYPE_MESH_POINT), -+ .supports_monitor = false, -+ .supports_sta_ps = false, -+ .supports_shadow_regs = false, -+ .fw_mem_mode = 0, -+ .num_vdevs = 16 + 1, -+ .num_peers = 512, -+ .supports_regdb = false, -+ .idle_ps = false, -+ .supports_suspend = false, -+ .hal_params = &ath11k_hw_hal_params_ipq8074, -+ .single_pdev_only = false, -+ .cold_boot_calib = true, -+ .fix_l1ss = true, -+ .supports_dynamic_smps_6ghz = false, -+ .alloc_cacheable_memory = true, -+ .supports_rssi_stats = false, -+ .fw_wmi_diag_event = false, -+ .current_cc_support = false, -+ .dbr_debug_support = true, -+ .global_reset = false, -+ .bios_sar_capa = NULL, -+ .m3_fw_support = false, -+ .fixed_bdf_addr = true, -+ .fixed_mem_region = true, -+ .static_window_map = false, -+ .hybrid_bus_type = false, -+ .fixed_fw_mem = false, -+ .support_off_channel_tx = false, -+ .supports_multi_bssid = false, -+ -+ .sram_dump = {}, -+ -+ .tcl_ring_retry = true, -+ .tx_ring_size = DP_TCL_DATA_RING_SIZE, -+ .smp2p_wow_exit = false, -+ .support_fw_mac_sequence = false, -+ }, - }; - - static inline struct ath11k_pdev *ath11k_core_get_single_pdev(struct ath11k_base *ab) ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -142,6 +142,7 @@ enum ath11k_hw_rev { - ATH11K_HW_WCN6855_HW20, - ATH11K_HW_WCN6855_HW21, - ATH11K_HW_WCN6750_HW10, -+ ATH11K_HW_IPQ5018_HW10, - }; - - enum ath11k_firmware_mode { -@@ -230,6 +231,13 @@ struct ath11k_he { - - #define MAX_RADIOS 3 - -+/* ipq5018 hw param macros */ -+#define MAX_RADIOS_5018 1 -+#define CE_CNT_5018 6 -+#define TARGET_CE_CNT_5018 9 -+#define SVC_CE_MAP_LEN_5018 17 -+#define RXDMA_PER_PDEV_5018 1 -+ - enum { - WMI_HOST_TP_SCALE_MAX = 0, - WMI_HOST_TP_SCALE_50 = 1, diff --git a/package/kernel/mac80211/patches/ath11k/0020-wifi-ath11k-remove-unused-members-of-struct-ath11k_b.patch b/package/kernel/mac80211/patches/ath11k/0020-wifi-ath11k-remove-unused-members-of-struct-ath11k_b.patch new file mode 100644 index 00000000000000..ffb210cc106a40 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0020-wifi-ath11k-remove-unused-members-of-struct-ath11k_b.patch @@ -0,0 +1,46 @@ +From 9066794113c4813b6ce4a66ed6ce14ecdf35625d Mon Sep 17 00:00:00 2001 +From: Dmitry Antipov +Date: Thu, 24 Aug 2023 10:50:45 +0300 +Subject: [PATCH] wifi: ath11k: remove unused members of 'struct ath11k_base' + +Remove set but otherwise unused 'wlan_init_status' and +'wmi_ready' members of 'struct ath11k_base', adjust +'ath11k_wmi_tlv_rdy_parse()' accordingly. + +Signed-off-by: Dmitry Antipov +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230824075121.121144-2-dmantipov@yandex.ru +--- + drivers/net/wireless/ath/ath11k/core.h | 2 -- + drivers/net/wireless/ath/ath11k/wmi.c | 2 -- + 2 files changed, 4 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -901,8 +901,6 @@ struct ath11k_base { + struct list_head peers; + wait_queue_head_t peer_mapping_wq; + u8 mac_addr[ETH_ALEN]; +- bool wmi_ready; +- u32 wlan_init_status; + int irq_num[ATH11K_IRQ_NUM_MAX]; + struct ath11k_ext_irq_grp ext_irq_grp[ATH11K_EXT_IRQ_GRP_NUM_MAX]; + struct ath11k_targ_cap target_caps; +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -7222,14 +7222,12 @@ static int ath11k_wmi_tlv_rdy_parse(stru + memset(&fixed_param, 0, sizeof(fixed_param)); + memcpy(&fixed_param, (struct wmi_ready_event *)ptr, + min_t(u16, sizeof(fixed_param), len)); +- ab->wlan_init_status = fixed_param.ready_event_min.status; + rdy_parse->num_extra_mac_addr = + fixed_param.ready_event_min.num_extra_mac_addr; + + ether_addr_copy(ab->mac_addr, + fixed_param.ready_event_min.mac_addr.addr); + ab->pktlog_defs_checksum = fixed_param.pktlog_defs_checksum; +- ab->wmi_ready = true; + break; + case WMI_TAG_ARRAY_FIXED_STRUCT: + addr_list = (struct wmi_mac_addr *)ptr; diff --git a/package/kernel/mac80211/patches/ath11k/0020-wifi-ath11k-update-ce-configurations-for-IPQ5018.patch b/package/kernel/mac80211/patches/ath11k/0020-wifi-ath11k-update-ce-configurations-for-IPQ5018.patch deleted file mode 100644 index 95643a95fec592..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0020-wifi-ath11k-update-ce-configurations-for-IPQ5018.patch +++ /dev/null @@ -1,246 +0,0 @@ -From 26af7aabd2d8225c6b2056234626ba5099610871 Mon Sep 17 00:00:00 2001 -From: Sriram R -Date: Fri, 2 Dec 2022 23:37:14 +0200 -Subject: [PATCH] wifi: ath11k: update ce configurations for IPQ5018 - -IPQ5018 is a single pdev device. Update host -and target CE configurations accordingly. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sriram R -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221122132152.17771-4-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 4 + - drivers/net/wireless/ath/ath11k/core.h | 3 + - drivers/net/wireless/ath/ath11k/hw.c | 191 +++++++++++++++++++++++++ - 3 files changed, 198 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -630,6 +630,10 @@ static const struct ath11k_hw_params ath - .internal_sleep_clock = false, - .host_ce_config = ath11k_host_ce_config_qcn9074, - .ce_count = CE_CNT_5018, -+ .target_ce_config = ath11k_target_ce_config_wlan_ipq5018, -+ .target_ce_count = TARGET_CE_CNT_5018, -+ .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_ipq5018, -+ .svc_to_ce_map_len = SVC_CE_MAP_LEN_5018, - .rxdma1_enable = true, - .num_rxmda_per_pdev = RXDMA_PER_PDEV_5018, - .rx_mac_buf_ring = false, ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -1145,6 +1145,9 @@ extern const struct service_to_pipe ath1 - extern const struct ce_pipe_config ath11k_target_ce_config_wlan_qca6390[]; - extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qca6390[]; - -+extern const struct ce_pipe_config ath11k_target_ce_config_wlan_ipq5018[]; -+extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq5018[]; -+ - extern const struct ce_pipe_config ath11k_target_ce_config_wlan_qcn9074[]; - extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qcn9074[]; - int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab); ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -1972,6 +1972,197 @@ const struct ath11k_hw_ring_mask ath11k_ - }, - }; - -+/* Target firmware's Copy Engine configuration for IPQ5018 */ -+const struct ce_pipe_config ath11k_target_ce_config_wlan_ipq5018[] = { -+ /* CE0: host->target HTC control and raw streams */ -+ { -+ .pipenum = __cpu_to_le32(0), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(2048), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE1: target->host HTT + HTC control */ -+ { -+ .pipenum = __cpu_to_le32(1), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(2048), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE2: target->host WMI */ -+ { -+ .pipenum = __cpu_to_le32(2), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(2048), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE3: host->target WMI */ -+ { -+ .pipenum = __cpu_to_le32(3), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(2048), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE4: host->target HTT */ -+ { -+ .pipenum = __cpu_to_le32(4), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), -+ .nentries = __cpu_to_le32(256), -+ .nbytes_max = __cpu_to_le32(256), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE5: target->host Pktlog */ -+ { -+ .pipenum = __cpu_to_le32(5), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(2048), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE6: Reserved for target autonomous hif_memcpy */ -+ { -+ .pipenum = __cpu_to_le32(6), -+ .pipedir = __cpu_to_le32(PIPEDIR_INOUT), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(16384), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE7 used only by Host */ -+ { -+ .pipenum = __cpu_to_le32(7), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(2048), -+ .flags = __cpu_to_le32(0x2000), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE8 target->host used only by IPA */ -+ { -+ .pipenum = __cpu_to_le32(8), -+ .pipedir = __cpu_to_le32(PIPEDIR_INOUT), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(16384), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS), -+ .reserved = __cpu_to_le32(0), -+ }, -+}; -+ -+/* Map from service/endpoint to Copy Engine for IPQ5018. -+ * This table is derived from the CE TABLE, above. -+ * It is passed to the Target at startup for use by firmware. -+ */ -+const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq5018[] = { -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(3), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(2), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(3), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(2), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(3), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(2), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(3), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(2), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(3), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(2), -+ }, -+ -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(0), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(1), -+ }, -+ -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(0), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(1), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(4), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(1), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_PKT_LOG), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(5), -+ }, -+ -+ /* (Additions here) */ -+ -+ { /* terminator entry */ } -+}; -+ - const struct ath11k_hw_regs ipq8074_regs = { - /* SW2TCL(x) R0 ring configuration address */ - .hal_tcl1_ring_base_lsb = 0x00000510, diff --git a/package/kernel/mac80211/patches/ath11k/0021-wifi-ath11k-remap-ce-register-space-for-IPQ5018.patch b/package/kernel/mac80211/patches/ath11k/0021-wifi-ath11k-remap-ce-register-space-for-IPQ5018.patch deleted file mode 100644 index d07a258ac2acb7..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0021-wifi-ath11k-remap-ce-register-space-for-IPQ5018.patch +++ /dev/null @@ -1,351 +0,0 @@ -From b42b3678c91f3ca6e0888bf5a15c1e8678fd5f2d Mon Sep 17 00:00:00 2001 -From: Sriram R -Date: Fri, 2 Dec 2022 23:37:14 +0200 -Subject: [PATCH] wifi: ath11k: remap ce register space for IPQ5018 - -In IPQ5018 ce register space is moved out of wcss unlike -ipq8074 or ipq6018 and the space is not contiguous, -hence remap the CE registers to a new space to access them. - -Register read/write is modified to check if the register to be written -falls in the CE register space and corresponding register is written. -Also adjust the interrupt register address to ce irq enable/disable. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sriram R -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221122132152.17771-5-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 44 ++++++++++++++++++++++---- - drivers/net/wireless/ath/ath11k/ce.h | 16 ++++++++++ - drivers/net/wireless/ath/ath11k/core.c | 8 +++++ - drivers/net/wireless/ath/ath11k/core.h | 1 + - drivers/net/wireless/ath/ath11k/hal.c | 17 ++++++---- - drivers/net/wireless/ath/ath11k/hal.h | 5 +++ - drivers/net/wireless/ath/ath11k/hw.c | 17 ++++++++++ - drivers/net/wireless/ath/ath11k/hw.h | 9 ++++++ - drivers/net/wireless/ath/ath11k/pci.c | 2 ++ - 9 files changed, 107 insertions(+), 12 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -267,30 +267,42 @@ static void ath11k_ahb_clearbit32(struct - static void ath11k_ahb_ce_irq_enable(struct ath11k_base *ab, u16 ce_id) - { - const struct ce_attr *ce_attr; -+ const struct ce_ie_addr *ce_ie_addr = ab->hw_params.ce_ie_addr; -+ u32 ie1_reg_addr, ie2_reg_addr, ie3_reg_addr; -+ -+ ie1_reg_addr = ce_ie_addr->ie1_reg_addr + ATH11K_CE_OFFSET(ab); -+ ie2_reg_addr = ce_ie_addr->ie2_reg_addr + ATH11K_CE_OFFSET(ab); -+ ie3_reg_addr = ce_ie_addr->ie3_reg_addr + ATH11K_CE_OFFSET(ab); - - ce_attr = &ab->hw_params.host_ce_config[ce_id]; - if (ce_attr->src_nentries) -- ath11k_ahb_setbit32(ab, ce_id, CE_HOST_IE_ADDRESS); -+ ath11k_ahb_setbit32(ab, ce_id, ie1_reg_addr); - - if (ce_attr->dest_nentries) { -- ath11k_ahb_setbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS); -+ ath11k_ahb_setbit32(ab, ce_id, ie2_reg_addr); - ath11k_ahb_setbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, -- CE_HOST_IE_3_ADDRESS); -+ ie3_reg_addr); - } - } - - static void ath11k_ahb_ce_irq_disable(struct ath11k_base *ab, u16 ce_id) - { - const struct ce_attr *ce_attr; -+ const struct ce_ie_addr *ce_ie_addr = ab->hw_params.ce_ie_addr; -+ u32 ie1_reg_addr, ie2_reg_addr, ie3_reg_addr; -+ -+ ie1_reg_addr = ce_ie_addr->ie1_reg_addr + ATH11K_CE_OFFSET(ab); -+ ie2_reg_addr = ce_ie_addr->ie2_reg_addr + ATH11K_CE_OFFSET(ab); -+ ie3_reg_addr = ce_ie_addr->ie3_reg_addr + ATH11K_CE_OFFSET(ab); - - ce_attr = &ab->hw_params.host_ce_config[ce_id]; - if (ce_attr->src_nentries) -- ath11k_ahb_clearbit32(ab, ce_id, CE_HOST_IE_ADDRESS); -+ ath11k_ahb_clearbit32(ab, ce_id, ie1_reg_addr); - - if (ce_attr->dest_nentries) { -- ath11k_ahb_clearbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS); -+ ath11k_ahb_clearbit32(ab, ce_id, ie2_reg_addr); - ath11k_ahb_clearbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, -- CE_HOST_IE_3_ADDRESS); -+ ie3_reg_addr); - } - } - -@@ -1142,10 +1154,26 @@ static int ath11k_ahb_probe(struct platf - goto err_core_free; - } - -+ ab->mem_ce = ab->mem; -+ - ret = ath11k_core_pre_init(ab); - if (ret) - goto err_core_free; - -+ if (ab->hw_params.ce_remap) { -+ const struct ce_remap *ce_remap = ab->hw_params.ce_remap; -+ /* ce register space is moved out of wcss unlike ipq8074 or ipq6018 -+ * and the space is not contiguous, hence remapping the CE registers -+ * to a new space for accessing them. -+ */ -+ ab->mem_ce = ioremap(ce_remap->base, ce_remap->size); -+ if (IS_ERR(ab->mem_ce)) { -+ dev_err(&pdev->dev, "ce ioremap error\n"); -+ ret = -ENOMEM; -+ goto err_core_free; -+ } -+ } -+ - ret = ath11k_ahb_setup_resources(ab); - if (ret) - goto err_core_free; -@@ -1236,6 +1264,10 @@ static void ath11k_ahb_free_resources(st - ath11k_ahb_release_smp2p_handle(ab); - ath11k_ahb_fw_resource_deinit(ab); - ath11k_ce_free_pipes(ab); -+ -+ if (ab->hw_params.ce_remap) -+ iounmap(ab->mem_ce); -+ - ath11k_core_free(ab); - platform_set_drvdata(pdev, NULL); - } ---- a/drivers/net/wireless/ath/ath11k/ce.h -+++ b/drivers/net/wireless/ath/ath11k/ce.h -@@ -49,6 +49,11 @@ void ath11k_ce_byte_swap(void *mem, u32 - #define CE_HOST_IE_2_ADDRESS 0x00A18040 - #define CE_HOST_IE_3_ADDRESS CE_HOST_IE_ADDRESS - -+/* CE IE registers are different for IPQ5018 */ -+#define CE_HOST_IPQ5018_IE_ADDRESS 0x0841804C -+#define CE_HOST_IPQ5018_IE_2_ADDRESS 0x08418050 -+#define CE_HOST_IPQ5018_IE_3_ADDRESS CE_HOST_IPQ5018_IE_ADDRESS -+ - #define CE_HOST_IE_3_SHIFT 0xC - - #define CE_RING_IDX_INCR(nentries_mask, idx) (((idx) + 1) & (nentries_mask)) -@@ -84,6 +89,17 @@ struct ce_pipe_config { - __le32 reserved; - }; - -+struct ce_ie_addr { -+ u32 ie1_reg_addr; -+ u32 ie2_reg_addr; -+ u32 ie3_reg_addr; -+}; -+ -+struct ce_remap { -+ u32 base; -+ u32 size; -+}; -+ - struct ce_attr { - /* CE_ATTR_* values */ - unsigned int flags; ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -54,6 +54,7 @@ static const struct ath11k_hw_params ath - .target_ce_count = 11, - .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_ipq8074, - .svc_to_ce_map_len = 21, -+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074, - .single_pdev_only = false, - .rxdma1_enable = true, - .num_rxmda_per_pdev = 1, -@@ -137,6 +138,7 @@ static const struct ath11k_hw_params ath - .target_ce_count = 11, - .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_ipq6018, - .svc_to_ce_map_len = 19, -+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074, - .single_pdev_only = false, - .rxdma1_enable = true, - .num_rxmda_per_pdev = 1, -@@ -218,6 +220,7 @@ static const struct ath11k_hw_params ath - .target_ce_count = 9, - .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qca6390, - .svc_to_ce_map_len = 14, -+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074, - .single_pdev_only = true, - .rxdma1_enable = false, - .num_rxmda_per_pdev = 2, -@@ -301,6 +304,7 @@ static const struct ath11k_hw_params ath - .target_ce_count = 9, - .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qcn9074, - .svc_to_ce_map_len = 18, -+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074, - .rxdma1_enable = true, - .num_rxmda_per_pdev = 1, - .rx_mac_buf_ring = false, -@@ -381,6 +385,7 @@ static const struct ath11k_hw_params ath - .target_ce_count = 9, - .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qca6390, - .svc_to_ce_map_len = 14, -+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074, - .single_pdev_only = true, - .rxdma1_enable = false, - .num_rxmda_per_pdev = 2, -@@ -546,6 +551,7 @@ static const struct ath11k_hw_params ath - .target_ce_count = 9, - .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qca6390, - .svc_to_ce_map_len = 14, -+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074, - .single_pdev_only = true, - .rxdma1_enable = false, - .num_rxmda_per_pdev = 1, -@@ -634,6 +640,8 @@ static const struct ath11k_hw_params ath - .target_ce_count = TARGET_CE_CNT_5018, - .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_ipq5018, - .svc_to_ce_map_len = SVC_CE_MAP_LEN_5018, -+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq5018, -+ .ce_remap = &ath11k_ce_remap_ipq5018, - .rxdma1_enable = true, - .num_rxmda_per_pdev = RXDMA_PER_PDEV_5018, - .rx_mac_buf_ring = false, ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -851,6 +851,7 @@ struct ath11k_base { - struct ath11k_dp dp; - - void __iomem *mem; -+ void __iomem *mem_ce; - unsigned long mem_len; - - struct { ---- a/drivers/net/wireless/ath/ath11k/hal.c -+++ b/drivers/net/wireless/ath/ath11k/hal.c -@@ -1220,16 +1220,20 @@ static int ath11k_hal_srng_create_config - s->reg_start[1] = HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL_STATUS_RING_HP; - - s = &hal->srng_config[HAL_CE_SRC]; -- s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_BASE_LSB; -- s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_HP; -+ s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_BASE_LSB + -+ ATH11K_CE_OFFSET(ab); -+ s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_HP + -+ ATH11K_CE_OFFSET(ab); - s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) - - HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab); - s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) - - HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab); - - s = &hal->srng_config[HAL_CE_DST]; -- s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_BASE_LSB; -- s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_HP; -+ s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_BASE_LSB + -+ ATH11K_CE_OFFSET(ab); -+ s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_HP + -+ ATH11K_CE_OFFSET(ab); - s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - - HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); - s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - -@@ -1237,8 +1241,9 @@ static int ath11k_hal_srng_create_config - - s = &hal->srng_config[HAL_CE_DST_STATUS]; - s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + -- HAL_CE_DST_STATUS_RING_BASE_LSB; -- s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_STATUS_RING_HP; -+ HAL_CE_DST_STATUS_RING_BASE_LSB + ATH11K_CE_OFFSET(ab); -+ s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_STATUS_RING_HP + -+ ATH11K_CE_OFFSET(ab); - s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - - HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); - s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - ---- a/drivers/net/wireless/ath/ath11k/hal.h -+++ b/drivers/net/wireless/ath/ath11k/hal.h -@@ -321,6 +321,10 @@ struct ath11k_base; - #define HAL_WBM2SW_RELEASE_RING_BASE_MSB_RING_SIZE 0x000fffff - #define HAL_RXDMA_RING_MAX_SIZE 0x0000ffff - -+/* IPQ5018 ce registers */ -+#define HAL_IPQ5018_CE_WFSS_REG_BASE 0x08400000 -+#define HAL_IPQ5018_CE_SIZE 0x200000 -+ - /* Add any other errors here and return them in - * ath11k_hal_rx_desc_get_err(). - */ -@@ -519,6 +523,7 @@ enum hal_srng_dir { - #define HAL_SRNG_FLAGS_MSI_INTR 0x00020000 - #define HAL_SRNG_FLAGS_CACHED 0x20000000 - #define HAL_SRNG_FLAGS_LMAC_RING 0x80000000 -+#define HAL_SRNG_FLAGS_REMAP_CE_RING 0x10000000 - - #define HAL_SRNG_TLV_HDR_TAG GENMASK(9, 1) - #define HAL_SRNG_TLV_HDR_LEN GENMASK(25, 10) ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -2163,6 +2163,23 @@ const struct service_to_pipe ath11k_targ - { /* terminator entry */ } - }; - -+const struct ce_ie_addr ath11k_ce_ie_addr_ipq8074 = { -+ .ie1_reg_addr = CE_HOST_IE_ADDRESS, -+ .ie2_reg_addr = CE_HOST_IE_2_ADDRESS, -+ .ie3_reg_addr = CE_HOST_IE_3_ADDRESS, -+}; -+ -+const struct ce_ie_addr ath11k_ce_ie_addr_ipq5018 = { -+ .ie1_reg_addr = CE_HOST_IPQ5018_IE_ADDRESS - HAL_IPQ5018_CE_WFSS_REG_BASE, -+ .ie2_reg_addr = CE_HOST_IPQ5018_IE_2_ADDRESS - HAL_IPQ5018_CE_WFSS_REG_BASE, -+ .ie3_reg_addr = CE_HOST_IPQ5018_IE_3_ADDRESS - HAL_IPQ5018_CE_WFSS_REG_BASE, -+}; -+ -+const struct ce_remap ath11k_ce_remap_ipq5018 = { -+ .base = HAL_IPQ5018_CE_WFSS_REG_BASE, -+ .size = HAL_IPQ5018_CE_SIZE, -+}; -+ - const struct ath11k_hw_regs ipq8074_regs = { - /* SW2TCL(x) R0 ring configuration address */ - .hal_tcl1_ring_base_lsb = 0x00000510, ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -80,6 +80,8 @@ - #define ATH11K_M3_FILE "m3.bin" - #define ATH11K_REGDB_FILE_NAME "regdb.bin" - -+#define ATH11K_CE_OFFSET(ab) (ab->mem_ce - ab->mem) -+ - enum ath11k_hw_rate_cck { - ATH11K_HW_RATE_CCK_LP_11M = 0, - ATH11K_HW_RATE_CCK_LP_5_5M, -@@ -158,6 +160,8 @@ struct ath11k_hw_params { - u32 target_ce_count; - const struct service_to_pipe *svc_to_ce_map; - u32 svc_to_ce_map_len; -+ const struct ce_ie_addr *ce_ie_addr; -+ const struct ce_remap *ce_remap; - - bool single_pdev_only; - -@@ -277,6 +281,11 @@ extern const struct ath11k_hw_ring_mask - extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qcn9074; - extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_wcn6750; - -+extern const struct ce_ie_addr ath11k_ce_ie_addr_ipq8074; -+extern const struct ce_ie_addr ath11k_ce_ie_addr_ipq5018; -+ -+extern const struct ce_remap ath11k_ce_remap_ipq5018; -+ - extern const struct ath11k_hw_hal_params ath11k_hw_hal_params_ipq8074; - extern const struct ath11k_hw_hal_params ath11k_hw_hal_params_qca6390; - extern const struct ath11k_hw_hal_params ath11k_hw_hal_params_wcn6750; ---- a/drivers/net/wireless/ath/ath11k/pci.c -+++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -543,6 +543,8 @@ static int ath11k_pci_claim(struct ath11 - goto clear_master; - } - -+ ab->mem_ce = ab->mem; -+ - ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot pci_mem 0x%pK\n", ab->mem); - return 0; - diff --git a/package/kernel/mac80211/patches/ath11k/0021-wifi-ath11k-use-kstrtoul_from_user-where-appropriate.patch b/package/kernel/mac80211/patches/ath11k/0021-wifi-ath11k-use-kstrtoul_from_user-where-appropriate.patch new file mode 100644 index 00000000000000..7a6b11b6d3f50e --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0021-wifi-ath11k-use-kstrtoul_from_user-where-appropriate.patch @@ -0,0 +1,60 @@ +From 458f66c30df2b8495790cf6fca76ebad44046921 Mon Sep 17 00:00:00 2001 +From: Dmitry Antipov +Date: Thu, 21 Sep 2023 11:16:57 +0300 +Subject: [PATCH] wifi: ath11k: use kstrtoul_from_user() where appropriate + +Use 'kstrtoul_from_user()' in 'ath11k_write_file_spectral_count()' +and 'ath11k_write_file_spectral_bins()' + +Signed-off-by: Dmitry Antipov +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230824075121.121144-4-dmantipov@yandex.ru +--- + drivers/net/wireless/ath/ath11k/spectral.c | 26 +++++++--------------- + 1 file changed, 8 insertions(+), 18 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/spectral.c ++++ b/drivers/net/wireless/ath/ath11k/spectral.c +@@ -386,16 +386,11 @@ static ssize_t ath11k_write_file_spectra + { + struct ath11k *ar = file->private_data; + unsigned long val; +- char buf[32]; +- ssize_t len; +- +- len = min(count, sizeof(buf) - 1); +- if (copy_from_user(buf, user_buf, len)) +- return -EFAULT; ++ ssize_t ret; + +- buf[len] = '\0'; +- if (kstrtoul(buf, 0, &val)) +- return -EINVAL; ++ ret = kstrtoul_from_user(user_buf, count, 0, &val); ++ if (ret) ++ return ret; + + if (val > ATH11K_SPECTRAL_SCAN_COUNT_MAX) + return -EINVAL; +@@ -441,16 +436,11 @@ static ssize_t ath11k_write_file_spectra + { + struct ath11k *ar = file->private_data; + unsigned long val; +- char buf[32]; +- ssize_t len; +- +- len = min(count, sizeof(buf) - 1); +- if (copy_from_user(buf, user_buf, len)) +- return -EFAULT; ++ ssize_t ret; + +- buf[len] = '\0'; +- if (kstrtoul(buf, 0, &val)) +- return -EINVAL; ++ ret = kstrtoul_from_user(user_buf, count, 0, &val); ++ if (ret) ++ return ret; + + if (val < ATH11K_SPECTRAL_MIN_BINS || + val > ar->ab->hw_params.spectral.max_fft_bins) diff --git a/package/kernel/mac80211/patches/ath11k/0022-wifi-ath11k-remove-unnecessary-void-conversions.patch b/package/kernel/mac80211/patches/ath11k/0022-wifi-ath11k-remove-unnecessary-void-conversions.patch new file mode 100644 index 00000000000000..cbd664dad58d3c --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0022-wifi-ath11k-remove-unnecessary-void-conversions.patch @@ -0,0 +1,248 @@ +From 87fd0602610d6965c45afc61780ac98842e8f902 Mon Sep 17 00:00:00 2001 +From: Wu Yunchuan +Date: Thu, 21 Sep 2023 11:50:05 +0300 +Subject: [PATCH] wifi: ath11k: remove unnecessary (void*) conversions + +No need cast (void *) to (struct ath11k_base *), +struct hal_rx_msdu_link *), (struct ath11k_buffer_addr *) or +other types. + +Signed-off-by: Wu Yunchuan +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230919045150.524304-1-yunchuan@nfschina.com +--- + drivers/net/wireless/ath/ath11k/dp.c | 2 +- + drivers/net/wireless/ath/ath11k/dp_rx.c | 13 +++++-------- + drivers/net/wireless/ath/ath11k/hal.c | 8 +++----- + drivers/net/wireless/ath/ath11k/hal_rx.c | 17 +++++++---------- + drivers/net/wireless/ath/ath11k/hal_tx.c | 2 +- + drivers/net/wireless/ath/ath11k/mac.c | 4 ++-- + drivers/net/wireless/ath/ath11k/spectral.c | 2 +- + drivers/net/wireless/ath/ath11k/wmi.c | 6 +++--- + 8 files changed, 23 insertions(+), 31 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/dp.c ++++ b/drivers/net/wireless/ath/ath11k/dp.c +@@ -1009,7 +1009,7 @@ void ath11k_dp_vdev_tx_attach(struct ath + + static int ath11k_dp_tx_pending_cleanup(int buf_id, void *skb, void *ctx) + { +- struct ath11k_base *ab = (struct ath11k_base *)ctx; ++ struct ath11k_base *ab = ctx; + struct sk_buff *msdu = skb; + + dma_unmap_single(ab->dev, ATH11K_SKB_CB(msdu)->paddr, msdu->len, +--- a/drivers/net/wireless/ath/ath11k/dp_rx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_rx.c +@@ -1256,7 +1256,7 @@ static int ath11k_htt_tlv_ppdu_stats_par + int cur_user; + u16 peer_id; + +- ppdu_info = (struct htt_ppdu_stats_info *)data; ++ ppdu_info = data; + + switch (tag) { + case HTT_PPDU_STATS_TAG_COMMON: +@@ -4486,8 +4486,7 @@ int ath11k_dp_rx_monitor_link_desc_retur + src_srng_desc = ath11k_hal_srng_src_get_next_entry(ar->ab, hal_srng); + + if (src_srng_desc) { +- struct ath11k_buffer_addr *src_desc = +- (struct ath11k_buffer_addr *)src_srng_desc; ++ struct ath11k_buffer_addr *src_desc = src_srng_desc; + + *src_desc = *((struct ath11k_buffer_addr *)p_last_buf_addr_info); + } else { +@@ -4506,8 +4505,7 @@ void ath11k_dp_rx_mon_next_link_desc_get + u8 *rbm, + void **pp_buf_addr_info) + { +- struct hal_rx_msdu_link *msdu_link = +- (struct hal_rx_msdu_link *)rx_msdu_link_desc; ++ struct hal_rx_msdu_link *msdu_link = rx_msdu_link_desc; + struct ath11k_buffer_addr *buf_addr_info; + + buf_addr_info = (struct ath11k_buffer_addr *)&msdu_link->buf_addr_info; +@@ -4548,7 +4546,7 @@ static void ath11k_hal_rx_msdu_list_get( + u32 first = FIELD_PREP(RX_MSDU_DESC_INFO0_FIRST_MSDU_IN_MPDU, 1); + u8 tmp = 0; + +- msdu_link = (struct hal_rx_msdu_link *)msdu_link_desc; ++ msdu_link = msdu_link_desc; + msdu_details = &msdu_link->msdu_link[0]; + + for (i = 0; i < HAL_RX_NUM_MSDU_DESC; i++) { +@@ -4645,8 +4643,7 @@ ath11k_dp_rx_mon_mpdu_pop(struct ath11k + bool is_frag, is_first_msdu; + bool drop_mpdu = false; + struct ath11k_skb_rxcb *rxcb; +- struct hal_reo_entrance_ring *ent_desc = +- (struct hal_reo_entrance_ring *)ring_entry; ++ struct hal_reo_entrance_ring *ent_desc = ring_entry; + int buf_id; + u32 rx_link_buf_info[2]; + u8 rbm; +--- a/drivers/net/wireless/ath/ath11k/hal.c ++++ b/drivers/net/wireless/ath/ath11k/hal.c +@@ -571,7 +571,7 @@ u32 ath11k_hal_ce_get_desc_size(enum hal + void ath11k_hal_ce_src_set_desc(void *buf, dma_addr_t paddr, u32 len, u32 id, + u8 byte_swap_data) + { +- struct hal_ce_srng_src_desc *desc = (struct hal_ce_srng_src_desc *)buf; ++ struct hal_ce_srng_src_desc *desc = buf; + + desc->buffer_addr_low = paddr & HAL_ADDR_LSB_REG_MASK; + desc->buffer_addr_info = +@@ -586,8 +586,7 @@ void ath11k_hal_ce_src_set_desc(void *bu + + void ath11k_hal_ce_dst_set_desc(void *buf, dma_addr_t paddr) + { +- struct hal_ce_srng_dest_desc *desc = +- (struct hal_ce_srng_dest_desc *)buf; ++ struct hal_ce_srng_dest_desc *desc = buf; + + desc->buffer_addr_low = paddr & HAL_ADDR_LSB_REG_MASK; + desc->buffer_addr_info = +@@ -597,8 +596,7 @@ void ath11k_hal_ce_dst_set_desc(void *bu + + u32 ath11k_hal_ce_dst_status_get_length(void *buf) + { +- struct hal_ce_srng_dst_status_desc *desc = +- (struct hal_ce_srng_dst_status_desc *)buf; ++ struct hal_ce_srng_dst_status_desc *desc = buf; + u32 len; + + len = FIELD_GET(HAL_CE_DST_STATUS_DESC_FLAGS_LEN, desc->flags); +--- a/drivers/net/wireless/ath/ath11k/hal_rx.c ++++ b/drivers/net/wireless/ath/ath11k/hal_rx.c +@@ -265,7 +265,7 @@ out: + void ath11k_hal_rx_buf_addr_info_set(void *desc, dma_addr_t paddr, + u32 cookie, u8 manager) + { +- struct ath11k_buffer_addr *binfo = (struct ath11k_buffer_addr *)desc; ++ struct ath11k_buffer_addr *binfo = desc; + u32 paddr_lo, paddr_hi; + + paddr_lo = lower_32_bits(paddr); +@@ -279,7 +279,7 @@ void ath11k_hal_rx_buf_addr_info_set(voi + void ath11k_hal_rx_buf_addr_info_get(void *desc, dma_addr_t *paddr, + u32 *cookie, u8 *rbm) + { +- struct ath11k_buffer_addr *binfo = (struct ath11k_buffer_addr *)desc; ++ struct ath11k_buffer_addr *binfo = desc; + + *paddr = + (((u64)FIELD_GET(BUFFER_ADDR_INFO1_ADDR, binfo->info1)) << 32) | +@@ -292,7 +292,7 @@ void ath11k_hal_rx_msdu_link_info_get(vo + u32 *msdu_cookies, + enum hal_rx_buf_return_buf_manager *rbm) + { +- struct hal_rx_msdu_link *link = (struct hal_rx_msdu_link *)link_desc; ++ struct hal_rx_msdu_link *link = link_desc; + struct hal_rx_msdu_details *msdu; + int i; + +@@ -699,7 +699,7 @@ u32 ath11k_hal_reo_qdesc_size(u32 ba_win + void ath11k_hal_reo_qdesc_setup(void *vaddr, int tid, u32 ba_window_size, + u32 start_seq, enum hal_pn_type type) + { +- struct hal_rx_reo_queue *qdesc = (struct hal_rx_reo_queue *)vaddr; ++ struct hal_rx_reo_queue *qdesc = vaddr; + struct hal_rx_reo_queue_ext *ext_desc; + + memset(qdesc, 0, sizeof(*qdesc)); +@@ -809,8 +809,7 @@ static inline void + ath11k_hal_rx_handle_ofdma_info(void *rx_tlv, + struct hal_rx_user_status *rx_user_status) + { +- struct hal_rx_ppdu_end_user_stats *ppdu_end_user = +- (struct hal_rx_ppdu_end_user_stats *)rx_tlv; ++ struct hal_rx_ppdu_end_user_stats *ppdu_end_user = rx_tlv; + + rx_user_status->ul_ofdma_user_v0_word0 = __le32_to_cpu(ppdu_end_user->info6); + +@@ -821,8 +820,7 @@ static inline void + ath11k_hal_rx_populate_byte_count(void *rx_tlv, void *ppduinfo, + struct hal_rx_user_status *rx_user_status) + { +- struct hal_rx_ppdu_end_user_stats *ppdu_end_user = +- (struct hal_rx_ppdu_end_user_stats *)rx_tlv; ++ struct hal_rx_ppdu_end_user_stats *ppdu_end_user = rx_tlv; + + rx_user_status->mpdu_ok_byte_count = + FIELD_GET(HAL_RX_PPDU_END_USER_STATS_INFO8_MPDU_OK_BYTE_COUNT, +@@ -1540,8 +1538,7 @@ void ath11k_hal_rx_reo_ent_buf_paddr_get + u32 *sw_cookie, void **pp_buf_addr, + u8 *rbm, u32 *msdu_cnt) + { +- struct hal_reo_entrance_ring *reo_ent_ring = +- (struct hal_reo_entrance_ring *)rx_desc; ++ struct hal_reo_entrance_ring *reo_ent_ring = rx_desc; + struct ath11k_buffer_addr *buf_addr_info; + struct rx_mpdu_desc *rx_mpdu_desc_info_details; + +--- a/drivers/net/wireless/ath/ath11k/hal_tx.c ++++ b/drivers/net/wireless/ath/ath11k/hal_tx.c +@@ -37,7 +37,7 @@ static const u8 dscp_tid_map[DSCP_TID_MA + void ath11k_hal_tx_cmd_desc_setup(struct ath11k_base *ab, void *cmd, + struct hal_tx_info *ti) + { +- struct hal_tcl_data_cmd *tcl_cmd = (struct hal_tcl_data_cmd *)cmd; ++ struct hal_tcl_data_cmd *tcl_cmd = cmd; + + tcl_cmd->buf_addr_info.info0 = + FIELD_PREP(BUFFER_ADDR_INFO0_ADDR, ti->paddr); +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -6970,8 +6970,8 @@ err: + + static int ath11k_mac_vif_unref(int buf_id, void *skb, void *ctx) + { +- struct ieee80211_vif *vif = (struct ieee80211_vif *)ctx; +- struct ath11k_skb_cb *skb_cb = ATH11K_SKB_CB((struct sk_buff *)skb); ++ struct ieee80211_vif *vif = ctx; ++ struct ath11k_skb_cb *skb_cb = ATH11K_SKB_CB(skb); + + if (skb_cb->vif == vif) + skb_cb->vif = NULL; +--- a/drivers/net/wireless/ath/ath11k/spectral.c ++++ b/drivers/net/wireless/ath/ath11k/spectral.c +@@ -592,7 +592,7 @@ int ath11k_spectral_process_fft(struct a + return -EINVAL; + } + +- tlv = (struct spectral_tlv *)data; ++ tlv = data; + tlv_len = FIELD_GET(SPECTRAL_TLV_HDR_LEN, __le32_to_cpu(tlv->header)); + /* convert Dword into bytes */ + tlv_len *= ATH11K_SPECTRAL_DWORD_SIZE; +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -2281,7 +2281,7 @@ int ath11k_wmi_send_scan_start_cmd(struc + tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_UINT32) | + FIELD_PREP(WMI_TLV_LEN, len); + ptr += TLV_HDR_SIZE; +- tmp_ptr = (u32 *)ptr; ++ tmp_ptr = ptr; + + for (i = 0; i < params->num_chan; ++i) + tmp_ptr[i] = params->chan_list[i]; +@@ -4148,7 +4148,7 @@ static int ath11k_init_cmd_send(struct a + ptr += TLV_HDR_SIZE + len; + + if (param->hw_mode_id != WMI_HOST_HW_MODE_MAX) { +- hw_mode = (struct wmi_pdev_set_hw_mode_cmd_param *)ptr; ++ hw_mode = ptr; + hw_mode->tlv_header = FIELD_PREP(WMI_TLV_TAG, + WMI_TAG_PDEV_SET_HW_MODE_CMD) | + FIELD_PREP(WMI_TLV_LEN, +@@ -4168,7 +4168,7 @@ static int ath11k_init_cmd_send(struct a + len = sizeof(*band_to_mac); + + for (idx = 0; idx < param->num_band_to_mac; idx++) { +- band_to_mac = (void *)ptr; ++ band_to_mac = ptr; + + band_to_mac->tlv_header = FIELD_PREP(WMI_TLV_TAG, + WMI_TAG_PDEV_BAND_TO_MAC) | diff --git a/package/kernel/mac80211/patches/ath11k/0022-wifi-ath11k-update-hal-srng-regs-for-IPQ5018.patch b/package/kernel/mac80211/patches/ath11k/0022-wifi-ath11k-update-hal-srng-regs-for-IPQ5018.patch deleted file mode 100644 index 35ea20a3c4fa74..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0022-wifi-ath11k-update-hal-srng-regs-for-IPQ5018.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 711b80acbdfb9667a9cf8374e13320a6e624ce73 Mon Sep 17 00:00:00 2001 -From: Sriram R -Date: Fri, 2 Dec 2022 23:37:14 +0200 -Subject: [PATCH] wifi: ath11k: update hal srng regs for IPQ5018 - -IPQ5018 hal srng register address & offsets are not -similar to IPQ8074/IPQ6018/QCN9074, hence define a -new set of srng register group data for IPQ5018. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sriram R -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221122132152.17771-6-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 1 + - drivers/net/wireless/ath/ath11k/hw.c | 79 ++++++++++++++++++++++++++ - drivers/net/wireless/ath/ath11k/hw.h | 1 + - 3 files changed, 81 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -634,6 +634,7 @@ static const struct ath11k_hw_params ath - .max_fft_bins = 1024, - }, - .internal_sleep_clock = false, -+ .regs = &ipq5018_regs, - .host_ce_config = ath11k_host_ce_config_qcn9074, - .ce_count = CE_CNT_5018, - .target_ce_config = ath11k_target_ce_config_wlan_ipq5018, ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -2645,6 +2645,85 @@ static const struct ath11k_hw_tcl2wbm_rb - }, - }; - -+const struct ath11k_hw_regs ipq5018_regs = { -+ /* SW2TCL(x) R0 ring configuration address */ -+ .hal_tcl1_ring_base_lsb = 0x00000694, -+ .hal_tcl1_ring_base_msb = 0x00000698, -+ .hal_tcl1_ring_id = 0x0000069c, -+ .hal_tcl1_ring_misc = 0x000006a4, -+ .hal_tcl1_ring_tp_addr_lsb = 0x000006b0, -+ .hal_tcl1_ring_tp_addr_msb = 0x000006b4, -+ .hal_tcl1_ring_consumer_int_setup_ix0 = 0x000006c4, -+ .hal_tcl1_ring_consumer_int_setup_ix1 = 0x000006c8, -+ .hal_tcl1_ring_msi1_base_lsb = 0x000006dc, -+ .hal_tcl1_ring_msi1_base_msb = 0x000006e0, -+ .hal_tcl1_ring_msi1_data = 0x000006e4, -+ .hal_tcl2_ring_base_lsb = 0x000006ec, -+ .hal_tcl_ring_base_lsb = 0x0000079c, -+ -+ /* TCL STATUS ring address */ -+ .hal_tcl_status_ring_base_lsb = 0x000008a4, -+ -+ /* REO2SW(x) R0 ring configuration address */ -+ .hal_reo1_ring_base_lsb = 0x000001ec, -+ .hal_reo1_ring_base_msb = 0x000001f0, -+ .hal_reo1_ring_id = 0x000001f4, -+ .hal_reo1_ring_misc = 0x000001fc, -+ .hal_reo1_ring_hp_addr_lsb = 0x00000200, -+ .hal_reo1_ring_hp_addr_msb = 0x00000204, -+ .hal_reo1_ring_producer_int_setup = 0x00000210, -+ .hal_reo1_ring_msi1_base_lsb = 0x00000234, -+ .hal_reo1_ring_msi1_base_msb = 0x00000238, -+ .hal_reo1_ring_msi1_data = 0x0000023c, -+ .hal_reo2_ring_base_lsb = 0x00000244, -+ .hal_reo1_aging_thresh_ix_0 = 0x00000564, -+ .hal_reo1_aging_thresh_ix_1 = 0x00000568, -+ .hal_reo1_aging_thresh_ix_2 = 0x0000056c, -+ .hal_reo1_aging_thresh_ix_3 = 0x00000570, -+ -+ /* REO2SW(x) R2 ring pointers (head/tail) address */ -+ .hal_reo1_ring_hp = 0x00003028, -+ .hal_reo1_ring_tp = 0x0000302c, -+ .hal_reo2_ring_hp = 0x00003030, -+ -+ /* REO2TCL R0 ring configuration address */ -+ .hal_reo_tcl_ring_base_lsb = 0x000003fc, -+ .hal_reo_tcl_ring_hp = 0x00003058, -+ -+ /* SW2REO ring address */ -+ .hal_sw2reo_ring_base_lsb = 0x0000013c, -+ .hal_sw2reo_ring_hp = 0x00003018, -+ -+ /* REO CMD ring address */ -+ .hal_reo_cmd_ring_base_lsb = 0x000000e4, -+ .hal_reo_cmd_ring_hp = 0x00003010, -+ -+ /* REO status address */ -+ .hal_reo_status_ring_base_lsb = 0x00000504, -+ .hal_reo_status_hp = 0x00003070, -+ -+ /* WCSS relative address */ -+ .hal_seq_wcss_umac_ce0_src_reg = 0x08400000 -+ - HAL_IPQ5018_CE_WFSS_REG_BASE, -+ .hal_seq_wcss_umac_ce0_dst_reg = 0x08401000 -+ - HAL_IPQ5018_CE_WFSS_REG_BASE, -+ .hal_seq_wcss_umac_ce1_src_reg = 0x08402000 -+ - HAL_IPQ5018_CE_WFSS_REG_BASE, -+ .hal_seq_wcss_umac_ce1_dst_reg = 0x08403000 -+ - HAL_IPQ5018_CE_WFSS_REG_BASE, -+ -+ /* WBM Idle address */ -+ .hal_wbm_idle_link_ring_base_lsb = 0x00000874, -+ .hal_wbm_idle_link_ring_misc = 0x00000884, -+ -+ /* SW2WBM release address */ -+ .hal_wbm_release_ring_base_lsb = 0x000001ec, -+ -+ /* WBM2SW release address */ -+ .hal_wbm0_release_ring_base_lsb = 0x00000924, -+ .hal_wbm1_release_ring_base_lsb = 0x0000097c, -+}; -+ - const struct ath11k_hw_hal_params ath11k_hw_hal_params_ipq8074 = { - .rx_buf_rbm = HAL_RX_BUF_RBM_SW3_BM, - .tcl2wbm_rbm_map = ath11k_hw_tcl2wbm_rbm_map_ipq8074, ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -415,6 +415,7 @@ extern const struct ath11k_hw_regs qca63 - extern const struct ath11k_hw_regs qcn9074_regs; - extern const struct ath11k_hw_regs wcn6855_regs; - extern const struct ath11k_hw_regs wcn6750_regs; -+extern const struct ath11k_hw_regs ipq5018_regs; - - static inline const char *ath11k_bd_ie_type_str(enum ath11k_bd_ie_type type) - { diff --git a/package/kernel/mac80211/patches/ath11k/0023-wifi-ath11k-fix-ath11k_mac_op_remain_on_channel-stac.patch b/package/kernel/mac80211/patches/ath11k/0023-wifi-ath11k-fix-ath11k_mac_op_remain_on_channel-stac.patch new file mode 100644 index 00000000000000..2c7f196f8eed64 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0023-wifi-ath11k-fix-ath11k_mac_op_remain_on_channel-stac.patch @@ -0,0 +1,96 @@ +From 4fd15bb705d3faa7e6adab2daba2e3af80d9b6bd Mon Sep 17 00:00:00 2001 +From: Dmitry Antipov +Date: Tue, 26 Sep 2023 07:29:04 +0300 +Subject: [PATCH] wifi: ath11k: fix ath11k_mac_op_remain_on_channel() stack + usage + +When compiling with clang 16.0.6, I've noticed the following: + +drivers/net/wireless/ath/ath11k/mac.c:8903:12: warning: stack frame +size (1032) exceeds limit (1024) in 'ath11k_mac_op_remain_on_channel' +[-Wframe-larger-than] +static int ath11k_mac_op_remain_on_channel(struct ieee80211_hw *hw, + ^ +68/1032 (6.59%) spills, 964/1032 (93.41%) variables + +So switch to kzalloc()'ed instance of 'struct scan_req_params' like +it's done in 'ath11k_mac_op_hw_scan()'. Compile tested only. + +Signed-off-by: Dmitry Antipov +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230926042906.13725-1-dmantipov@yandex.ru +--- + drivers/net/wireless/ath/ath11k/mac.c | 44 +++++++++++++++------------ + 1 file changed, 25 insertions(+), 19 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -8908,7 +8908,7 @@ static int ath11k_mac_op_remain_on_chann + { + struct ath11k *ar = hw->priv; + struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); +- struct scan_req_params arg; ++ struct scan_req_params *arg; + int ret; + u32 scan_time_msec; + +@@ -8940,27 +8940,31 @@ static int ath11k_mac_op_remain_on_chann + + scan_time_msec = ar->hw->wiphy->max_remain_on_channel_duration * 2; + +- memset(&arg, 0, sizeof(arg)); +- ath11k_wmi_start_scan_init(ar, &arg); +- arg.num_chan = 1; +- arg.chan_list = kcalloc(arg.num_chan, sizeof(*arg.chan_list), +- GFP_KERNEL); +- if (!arg.chan_list) { ++ arg = kzalloc(sizeof(*arg), GFP_KERNEL); ++ if (!arg) { + ret = -ENOMEM; + goto exit; + } ++ ath11k_wmi_start_scan_init(ar, arg); ++ arg->num_chan = 1; ++ arg->chan_list = kcalloc(arg->num_chan, sizeof(*arg->chan_list), ++ GFP_KERNEL); ++ if (!arg->chan_list) { ++ ret = -ENOMEM; ++ goto free_arg; ++ } + +- arg.vdev_id = arvif->vdev_id; +- arg.scan_id = ATH11K_SCAN_ID; +- arg.chan_list[0] = chan->center_freq; +- arg.dwell_time_active = scan_time_msec; +- arg.dwell_time_passive = scan_time_msec; +- arg.max_scan_time = scan_time_msec; +- arg.scan_flags |= WMI_SCAN_FLAG_PASSIVE; +- arg.scan_flags |= WMI_SCAN_FILTER_PROBE_REQ; +- arg.burst_duration = duration; ++ arg->vdev_id = arvif->vdev_id; ++ arg->scan_id = ATH11K_SCAN_ID; ++ arg->chan_list[0] = chan->center_freq; ++ arg->dwell_time_active = scan_time_msec; ++ arg->dwell_time_passive = scan_time_msec; ++ arg->max_scan_time = scan_time_msec; ++ arg->scan_flags |= WMI_SCAN_FLAG_PASSIVE; ++ arg->scan_flags |= WMI_SCAN_FILTER_PROBE_REQ; ++ arg->burst_duration = duration; + +- ret = ath11k_start_scan(ar, &arg); ++ ret = ath11k_start_scan(ar, arg); + if (ret) { + ath11k_warn(ar->ab, "failed to start roc scan: %d\n", ret); + +@@ -8986,7 +8990,9 @@ static int ath11k_mac_op_remain_on_chann + ret = 0; + + free_chan_list: +- kfree(arg.chan_list); ++ kfree(arg->chan_list); ++free_arg: ++ kfree(arg); + exit: + mutex_unlock(&ar->conf_mutex); + return ret; diff --git a/package/kernel/mac80211/patches/ath11k/0023-wifi-ath11k-initialize-hw_ops-for-IPQ5018.patch b/package/kernel/mac80211/patches/ath11k/0023-wifi-ath11k-initialize-hw_ops-for-IPQ5018.patch deleted file mode 100644 index 5ef701a4452691..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0023-wifi-ath11k-initialize-hw_ops-for-IPQ5018.patch +++ /dev/null @@ -1,90 +0,0 @@ -From ba60f2793d3a37a00da14bb56a26558a902d2831 Mon Sep 17 00:00:00 2001 -From: Sriram R -Date: Fri, 2 Dec 2022 23:37:14 +0200 -Subject: [PATCH] wifi: ath11k: initialize hw_ops for IPQ5018 - -The ipq5018_ops is initialized for IPQ5018. This is different from -other platforms. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sriram R -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221122132152.17771-7-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 1 + - drivers/net/wireless/ath/ath11k/hw.c | 40 ++++++++++++++++++++++++++ - drivers/net/wireless/ath/ath11k/hw.h | 1 + - 3 files changed, 42 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -635,6 +635,7 @@ static const struct ath11k_hw_params ath - }, - .internal_sleep_clock = false, - .regs = &ipq5018_regs, -+ .hw_ops = &ipq5018_ops, - .host_ce_config = ath11k_host_ce_config_qcn9074, - .ce_count = CE_CNT_5018, - .target_ce_config = ath11k_target_ce_config_wlan_ipq5018, ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -1084,6 +1084,46 @@ const struct ath11k_hw_ops wcn6750_ops = - .get_ring_selector = ath11k_hw_wcn6750_get_tcl_ring_selector, - }; - -+/* IPQ5018 hw ops is similar to QCN9074 except for the dest ring remap */ -+const struct ath11k_hw_ops ipq5018_ops = { -+ .get_hw_mac_from_pdev_id = ath11k_hw_ipq6018_mac_from_pdev_id, -+ .wmi_init_config = ath11k_init_wmi_config_ipq8074, -+ .mac_id_to_pdev_id = ath11k_hw_mac_id_to_pdev_id_ipq8074, -+ .mac_id_to_srng_id = ath11k_hw_mac_id_to_srng_id_ipq8074, -+ .tx_mesh_enable = ath11k_hw_qcn9074_tx_mesh_enable, -+ .rx_desc_get_first_msdu = ath11k_hw_qcn9074_rx_desc_get_first_msdu, -+ .rx_desc_get_last_msdu = ath11k_hw_qcn9074_rx_desc_get_last_msdu, -+ .rx_desc_get_l3_pad_bytes = ath11k_hw_qcn9074_rx_desc_get_l3_pad_bytes, -+ .rx_desc_get_hdr_status = ath11k_hw_qcn9074_rx_desc_get_hdr_status, -+ .rx_desc_encrypt_valid = ath11k_hw_qcn9074_rx_desc_encrypt_valid, -+ .rx_desc_get_encrypt_type = ath11k_hw_qcn9074_rx_desc_get_encrypt_type, -+ .rx_desc_get_decap_type = ath11k_hw_qcn9074_rx_desc_get_decap_type, -+ .rx_desc_get_mesh_ctl = ath11k_hw_qcn9074_rx_desc_get_mesh_ctl, -+ .rx_desc_get_ldpc_support = ath11k_hw_qcn9074_rx_desc_get_ldpc_support, -+ .rx_desc_get_mpdu_seq_ctl_vld = ath11k_hw_qcn9074_rx_desc_get_mpdu_seq_ctl_vld, -+ .rx_desc_get_mpdu_fc_valid = ath11k_hw_qcn9074_rx_desc_get_mpdu_fc_valid, -+ .rx_desc_get_mpdu_start_seq_no = ath11k_hw_qcn9074_rx_desc_get_mpdu_start_seq_no, -+ .rx_desc_get_msdu_len = ath11k_hw_qcn9074_rx_desc_get_msdu_len, -+ .rx_desc_get_msdu_sgi = ath11k_hw_qcn9074_rx_desc_get_msdu_sgi, -+ .rx_desc_get_msdu_rate_mcs = ath11k_hw_qcn9074_rx_desc_get_msdu_rate_mcs, -+ .rx_desc_get_msdu_rx_bw = ath11k_hw_qcn9074_rx_desc_get_msdu_rx_bw, -+ .rx_desc_get_msdu_freq = ath11k_hw_qcn9074_rx_desc_get_msdu_freq, -+ .rx_desc_get_msdu_pkt_type = ath11k_hw_qcn9074_rx_desc_get_msdu_pkt_type, -+ .rx_desc_get_msdu_nss = ath11k_hw_qcn9074_rx_desc_get_msdu_nss, -+ .rx_desc_get_mpdu_tid = ath11k_hw_qcn9074_rx_desc_get_mpdu_tid, -+ .rx_desc_get_mpdu_peer_id = ath11k_hw_qcn9074_rx_desc_get_mpdu_peer_id, -+ .rx_desc_copy_attn_end_tlv = ath11k_hw_qcn9074_rx_desc_copy_attn_end, -+ .rx_desc_get_mpdu_start_tag = ath11k_hw_qcn9074_rx_desc_get_mpdu_start_tag, -+ .rx_desc_get_mpdu_ppdu_id = ath11k_hw_qcn9074_rx_desc_get_mpdu_ppdu_id, -+ .rx_desc_set_msdu_len = ath11k_hw_qcn9074_rx_desc_set_msdu_len, -+ .rx_desc_get_attention = ath11k_hw_qcn9074_rx_desc_get_attention, -+ .rx_desc_get_msdu_payload = ath11k_hw_qcn9074_rx_desc_get_msdu_payload, -+ .mpdu_info_get_peerid = ath11k_hw_ipq8074_mpdu_info_get_peerid, -+ .rx_desc_mac_addr2_valid = ath11k_hw_ipq9074_rx_desc_mac_addr2_valid, -+ .rx_desc_mpdu_start_addr2 = ath11k_hw_ipq9074_rx_desc_mpdu_start_addr2, -+ -+}; -+ - #define ATH11K_TX_RING_MASK_0 BIT(0) - #define ATH11K_TX_RING_MASK_1 BIT(1) - #define ATH11K_TX_RING_MASK_2 BIT(2) ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -275,6 +275,7 @@ extern const struct ath11k_hw_ops qca639 - extern const struct ath11k_hw_ops qcn9074_ops; - extern const struct ath11k_hw_ops wcn6855_ops; - extern const struct ath11k_hw_ops wcn6750_ops; -+extern const struct ath11k_hw_ops ipq5018_ops; - - extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_ipq8074; - extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qca6390; diff --git a/package/kernel/mac80211/patches/ath11k/0024-wifi-ath11k-add-new-hw-ops-for-IPQ5018-to-get-rx-des.patch b/package/kernel/mac80211/patches/ath11k/0024-wifi-ath11k-add-new-hw-ops-for-IPQ5018-to-get-rx-des.patch deleted file mode 100644 index 64531f13f81cec..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0024-wifi-ath11k-add-new-hw-ops-for-IPQ5018-to-get-rx-des.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 69968f88f1770d61cae0febef805fd00d66cf6a1 Mon Sep 17 00:00:00 2001 -From: Sriram R -Date: Fri, 2 Dec 2022 23:37:15 +0200 -Subject: [PATCH] wifi: ath11k: add new hw ops for IPQ5018 to get rx dest ring - hashmap - -The Destination ring control register is different -for IPQ5018 when compared to IPQ8074/IPQ6018/QCN9074. -Hence create a new hw ops to fetch the hash ring map -for different device variants. ipq5018 hw ops -is similar to qcn9074 except for this change, so reuse -all the qcn9074 ops for ipq5018. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sriram R -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221122132152.17771-8-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/hw.c | 44 ++++++++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -791,6 +791,49 @@ static void ath11k_hw_wcn6855_reo_setup( - ring_hash_map); - } - -+static void ath11k_hw_ipq5018_reo_setup(struct ath11k_base *ab) -+{ -+ u32 reo_base = HAL_SEQ_WCSS_UMAC_REO_REG; -+ u32 val; -+ -+ /* Each hash entry uses three bits to map to a particular ring. */ -+ u32 ring_hash_map = HAL_HASH_ROUTING_RING_SW1 << 0 | -+ HAL_HASH_ROUTING_RING_SW2 << 4 | -+ HAL_HASH_ROUTING_RING_SW3 << 8 | -+ HAL_HASH_ROUTING_RING_SW4 << 12 | -+ HAL_HASH_ROUTING_RING_SW1 << 16 | -+ HAL_HASH_ROUTING_RING_SW2 << 20 | -+ HAL_HASH_ROUTING_RING_SW3 << 24 | -+ HAL_HASH_ROUTING_RING_SW4 << 28; -+ -+ val = ath11k_hif_read32(ab, reo_base + HAL_REO1_GEN_ENABLE); -+ -+ val &= ~HAL_REO1_GEN_ENABLE_FRAG_DST_RING; -+ val |= FIELD_PREP(HAL_REO1_GEN_ENABLE_FRAG_DST_RING, -+ HAL_SRNG_RING_ID_REO2SW1) | -+ FIELD_PREP(HAL_REO1_GEN_ENABLE_AGING_LIST_ENABLE, 1) | -+ FIELD_PREP(HAL_REO1_GEN_ENABLE_AGING_FLUSH_ENABLE, 1); -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_GEN_ENABLE, val); -+ -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_0(ab), -+ HAL_DEFAULT_REO_TIMEOUT_USEC); -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_1(ab), -+ HAL_DEFAULT_REO_TIMEOUT_USEC); -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_2(ab), -+ HAL_DEFAULT_REO_TIMEOUT_USEC); -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_3(ab), -+ HAL_DEFAULT_REO_TIMEOUT_USEC); -+ -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_0, -+ ring_hash_map); -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_1, -+ ring_hash_map); -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_2, -+ ring_hash_map); -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_3, -+ ring_hash_map); -+} -+ - static u16 ath11k_hw_ipq8074_mpdu_info_get_peerid(u8 *tlv_data) - { - u16 peer_id = 0; -@@ -1117,6 +1160,7 @@ const struct ath11k_hw_ops ipq5018_ops = - .rx_desc_get_mpdu_ppdu_id = ath11k_hw_qcn9074_rx_desc_get_mpdu_ppdu_id, - .rx_desc_set_msdu_len = ath11k_hw_qcn9074_rx_desc_set_msdu_len, - .rx_desc_get_attention = ath11k_hw_qcn9074_rx_desc_get_attention, -+ .reo_setup = ath11k_hw_ipq5018_reo_setup, - .rx_desc_get_msdu_payload = ath11k_hw_qcn9074_rx_desc_get_msdu_payload, - .mpdu_info_get_peerid = ath11k_hw_ipq8074_mpdu_info_get_peerid, - .rx_desc_mac_addr2_valid = ath11k_hw_ipq9074_rx_desc_mac_addr2_valid, diff --git a/package/kernel/mac80211/patches/ath11k/0024-wifi-ath11k-mac-fix-struct-ieee80211_sband_iftype_da.patch b/package/kernel/mac80211/patches/ath11k/0024-wifi-ath11k-mac-fix-struct-ieee80211_sband_iftype_da.patch new file mode 100644 index 00000000000000..90da6a8c44aff2 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0024-wifi-ath11k-mac-fix-struct-ieee80211_sband_iftype_da.patch @@ -0,0 +1,67 @@ +From 9e61589ac3c2d23c528d3ffd44604d98553ea1cb Mon Sep 17 00:00:00 2001 +From: Kalle Valo +Date: Wed, 27 Sep 2023 17:27:08 +0300 +Subject: [PATCH] wifi: ath11k: mac: fix struct ieee80211_sband_iftype_data + handling + +Commit e8c1841278a7 ("wifi: cfg80211: annotate iftype_data pointer with +sparse") added sparse checks for struct ieee80211_sband_iftype_data handling +which immediately found an issue in ath11k: + +drivers/net/wireless/ath/ath11k/mac.c:7952:22: warning: incorrect type in argument 1 (different address spaces) +drivers/net/wireless/ath/ath11k/mac.c:7952:22: expected struct ieee80211_sta_he_cap const *he_cap +drivers/net/wireless/ath/ath11k/mac.c:7952:22: got struct ieee80211_sta_he_cap const [noderef] __iftype_data * + +The problem here is that we are accessing sband->iftype_data directly even +though we should use for_each_sband_iftype_data() or similar. Fortunately +there's ieee80211_get_he_iftype_cap_vif() which is just what we need here so +use it to get HE capabilities. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 + +Reported-by: Johannes Berg +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230927142708.2897504-2-kvalo@kernel.org +--- + drivers/net/wireless/ath/ath11k/mac.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -7913,12 +7913,14 @@ ath11k_mac_get_tx_mcs_map(const struct i + + static bool + ath11k_mac_bitrate_mask_get_single_nss(struct ath11k *ar, ++ struct ath11k_vif *arvif, + enum nl80211_band band, + const struct cfg80211_bitrate_mask *mask, + int *nss) + { + struct ieee80211_supported_band *sband = &ar->mac.sbands[band]; + u16 vht_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map); ++ const struct ieee80211_sta_he_cap *he_cap; + u16 he_mcs_map = 0; + u8 ht_nss_mask = 0; + u8 vht_nss_mask = 0; +@@ -7949,7 +7951,11 @@ ath11k_mac_bitrate_mask_get_single_nss(s + return false; + } + +- he_mcs_map = le16_to_cpu(ath11k_mac_get_tx_mcs_map(&sband->iftype_data->he_cap)); ++ he_cap = ieee80211_get_he_iftype_cap_vif(sband, arvif->vif); ++ if (!he_cap) ++ return false; ++ ++ he_mcs_map = le16_to_cpu(ath11k_mac_get_tx_mcs_map(he_cap)); + + for (i = 0; i < ARRAY_SIZE(mask->control[band].he_mcs); i++) { + if (mask->control[band].he_mcs[i] == 0) +@@ -8365,7 +8371,7 @@ ath11k_mac_op_set_bitrate_mask(struct ie + ieee80211_iterate_stations_atomic(ar->hw, + ath11k_mac_disable_peer_fixed_rate, + arvif); +- } else if (ath11k_mac_bitrate_mask_get_single_nss(ar, band, mask, ++ } else if (ath11k_mac_bitrate_mask_get_single_nss(ar, arvif, band, mask, + &single_nss)) { + rate = WMI_FIXED_RATE_NONE; + nss = single_nss; diff --git a/package/kernel/mac80211/patches/ath11k/0025-wifi-ath11k-add-ipq5018-device-support.patch b/package/kernel/mac80211/patches/ath11k/0025-wifi-ath11k-add-ipq5018-device-support.patch deleted file mode 100644 index 5b930e8d4fd19a..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0025-wifi-ath11k-add-ipq5018-device-support.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 25edca7bb18a2a40cc7e54c6f522e9b3c917e2c5 Mon Sep 17 00:00:00 2001 -From: Sriram R -Date: Fri, 2 Dec 2022 23:37:15 +0200 -Subject: [PATCH] wifi: ath11k: add ipq5018 device support - -ipq5018 is a ahb 2ghz device, enable the compatible support for -ipq5018 in ahb. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sriram R -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221122132152.17771-9-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -32,6 +32,9 @@ static const struct of_device_id ath11k_ - { .compatible = "qcom,wcn6750-wifi", - .data = (void *)ATH11K_HW_WCN6750_HW10, - }, -+ { .compatible = "qcom,ipq5018-wifi", -+ .data = (void *)ATH11K_HW_IPQ5018_HW10, -+ }, - { } - }; - diff --git a/package/kernel/mac80211/patches/ath11k/0025-wifi-ath11k-fix-CAC-running-state-during-virtual-int.patch b/package/kernel/mac80211/patches/ath11k/0025-wifi-ath11k-fix-CAC-running-state-during-virtual-int.patch new file mode 100644 index 00000000000000..eee0bf0fb5a93b --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0025-wifi-ath11k-fix-CAC-running-state-during-virtual-int.patch @@ -0,0 +1,80 @@ +From 69fcb525905600a151997cd16367bb92c34a2b14 Mon Sep 17 00:00:00 2001 +From: Aditya Kumar Singh +Date: Tue, 3 Oct 2023 17:26:54 +0300 +Subject: [PATCH] wifi: ath11k: fix CAC running state during virtual interface + start + +Currently channel definition's primary channel's DFS CAC time +as well as primary channel's state i.e usable are used to set +the CAC_RUNNING flag for the ath11k radio structure. However, +this is wrong since certain channel definition are possbile +where primary channel may not be a DFS channel but, secondary +channel is a DFS channel. For example - channel 36 with 160 MHz +bandwidth. +In such cases, the flag will not be set which is wrong. + +Fix this issue by using cfg80211_chandef_dfs_usable() function +from cfg80211 which return trues if at least one channel is in +usable state. + +While at it, modify the CAC running debug log message to print +the CAC time as well in milli-seconds. + +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Aditya Kumar Singh +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230912051857.2284-3-quic_adisi@quicinc.com +--- + drivers/net/wireless/ath/ath11k/mac.c | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -5,6 +5,7 @@ + */ + + #include ++#include + #include + #include + #include +@@ -7196,6 +7197,7 @@ ath11k_mac_vdev_start_restart(struct ath + struct wmi_vdev_start_req_arg arg = {}; + const struct cfg80211_chan_def *chandef = &ctx->def; + int ret = 0; ++ unsigned int dfs_cac_time; + + lockdep_assert_held(&ar->conf_mutex); + +@@ -7275,20 +7277,21 @@ ath11k_mac_vdev_start_restart(struct ath + ath11k_dbg(ab, ATH11K_DBG_MAC, "vdev %pM started, vdev_id %d\n", + arvif->vif->addr, arvif->vdev_id); + +- /* Enable CAC Flag in the driver by checking the channel DFS cac time, +- * i.e dfs_cac_ms value which will be valid only for radar channels +- * and state as NL80211_DFS_USABLE which indicates CAC needs to be ++ /* Enable CAC Flag in the driver by checking the all sub-channel's DFS ++ * state as NL80211_DFS_USABLE which indicates CAC needs to be + * done before channel usage. This flags is used to drop rx packets. + * during CAC. + */ + /* TODO Set the flag for other interface types as required */ +- if (arvif->vdev_type == WMI_VDEV_TYPE_AP && +- chandef->chan->dfs_cac_ms && +- chandef->chan->dfs_state == NL80211_DFS_USABLE) { ++ if (arvif->vdev_type == WMI_VDEV_TYPE_AP && ctx->radar_enabled && ++ cfg80211_chandef_dfs_usable(ar->hw->wiphy, chandef)) { + set_bit(ATH11K_CAC_RUNNING, &ar->dev_flags); ++ dfs_cac_time = cfg80211_chandef_dfs_cac_time(ar->hw->wiphy, ++ chandef); + ath11k_dbg(ab, ATH11K_DBG_MAC, +- "CAC Started in chan_freq %d for vdev %d\n", +- arg.channel.freq, arg.vdev_id); ++ "cac started dfs_cac_time %u center_freq %d center_freq1 %d for vdev %d\n", ++ dfs_cac_time, arg.channel.freq, chandef->center_freq1, ++ arg.vdev_id); + } + + ret = ath11k_mac_set_txbf_conf(arvif); diff --git a/package/kernel/mac80211/patches/ath11k/0026-wifi-ath11k-Fix-scan-request-param-frame-size-warnin.patch b/package/kernel/mac80211/patches/ath11k/0026-wifi-ath11k-Fix-scan-request-param-frame-size-warnin.patch deleted file mode 100644 index 50c14e7b98fb8d..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0026-wifi-ath11k-Fix-scan-request-param-frame-size-warnin.patch +++ /dev/null @@ -1,161 +0,0 @@ -From d45daa6d1a8da080f1b516c570a8428a7b9225e4 Mon Sep 17 00:00:00 2001 -From: Karthikeyan Kathirvel -Date: Tue, 6 Dec 2022 00:51:25 +0530 -Subject: [PATCH] wifi: ath11k: Fix scan request param frame size warning - -Following warning was observed - -drivers/net/wireless/ath/ath11k/mac.c:2351:1: warning: the frame -size of 1184 bytes is larger than 1024 bytes [-Wframe-larger-than=] - -A local variable is declared with a size larger than 1024 bytes -this causing a compilation warning. Change the local variable to -heap memory to fix the warning. - -Tested-on: IPQ8074 AHB WLAN.HK.2.7.0.1-01701-QCAHKSWPL_SILICONZ-1 v2 - -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221205192125.13533-1-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 83 +++++++++++++++------------ - 1 file changed, 45 insertions(+), 38 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3612,7 +3612,7 @@ static int ath11k_mac_op_hw_scan(struct - struct ath11k *ar = hw->priv; - struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct cfg80211_scan_request *req = &hw_req->req; -- struct scan_req_params arg; -+ struct scan_req_params *arg = NULL; - int ret = 0; - int i; - u32 scan_timeout; -@@ -3640,72 +3640,78 @@ static int ath11k_mac_op_hw_scan(struct - if (ret) - goto exit; - -- memset(&arg, 0, sizeof(arg)); -- ath11k_wmi_start_scan_init(ar, &arg); -- arg.vdev_id = arvif->vdev_id; -- arg.scan_id = ATH11K_SCAN_ID; -+ arg = kzalloc(sizeof(*arg), GFP_KERNEL); -+ -+ if (!arg) { -+ ret = -ENOMEM; -+ goto exit; -+ } -+ -+ ath11k_wmi_start_scan_init(ar, arg); -+ arg->vdev_id = arvif->vdev_id; -+ arg->scan_id = ATH11K_SCAN_ID; - - if (req->ie_len) { -- arg.extraie.ptr = kmemdup(req->ie, req->ie_len, GFP_KERNEL); -- if (!arg.extraie.ptr) { -+ arg->extraie.ptr = kmemdup(req->ie, req->ie_len, GFP_KERNEL); -+ if (!arg->extraie.ptr) { - ret = -ENOMEM; - goto exit; - } -- arg.extraie.len = req->ie_len; -+ arg->extraie.len = req->ie_len; - } - - if (req->n_ssids) { -- arg.num_ssids = req->n_ssids; -- for (i = 0; i < arg.num_ssids; i++) { -- arg.ssid[i].length = req->ssids[i].ssid_len; -- memcpy(&arg.ssid[i].ssid, req->ssids[i].ssid, -+ arg->num_ssids = req->n_ssids; -+ for (i = 0; i < arg->num_ssids; i++) { -+ arg->ssid[i].length = req->ssids[i].ssid_len; -+ memcpy(&arg->ssid[i].ssid, req->ssids[i].ssid, - req->ssids[i].ssid_len); - } - } else { -- arg.scan_flags |= WMI_SCAN_FLAG_PASSIVE; -+ arg->scan_flags |= WMI_SCAN_FLAG_PASSIVE; - } - - if (req->n_channels) { -- arg.num_chan = req->n_channels; -- arg.chan_list = kcalloc(arg.num_chan, sizeof(*arg.chan_list), -- GFP_KERNEL); -+ arg->num_chan = req->n_channels; -+ arg->chan_list = kcalloc(arg->num_chan, sizeof(*arg->chan_list), -+ GFP_KERNEL); - -- if (!arg.chan_list) { -+ if (!arg->chan_list) { - ret = -ENOMEM; - goto exit; - } - -- for (i = 0; i < arg.num_chan; i++) -- arg.chan_list[i] = req->channels[i]->center_freq; -+ for (i = 0; i < arg->num_chan; i++) -+ arg->chan_list[i] = req->channels[i]->center_freq; - } - - if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { -- arg.scan_f_add_spoofed_mac_in_probe = 1; -- ether_addr_copy(arg.mac_addr.addr, req->mac_addr); -- ether_addr_copy(arg.mac_mask.addr, req->mac_addr_mask); -+ arg->scan_f_add_spoofed_mac_in_probe = 1; -+ ether_addr_copy(arg->mac_addr.addr, req->mac_addr); -+ ether_addr_copy(arg->mac_mask.addr, req->mac_addr_mask); - } - - /* if duration is set, default dwell times will be overwritten */ - if (req->duration) { -- arg.dwell_time_active = req->duration; -- arg.dwell_time_active_2g = req->duration; -- arg.dwell_time_active_6g = req->duration; -- arg.dwell_time_passive = req->duration; -- arg.dwell_time_passive_6g = req->duration; -- arg.burst_duration = req->duration; -+ arg->dwell_time_active = req->duration; -+ arg->dwell_time_active_2g = req->duration; -+ arg->dwell_time_active_6g = req->duration; -+ arg->dwell_time_passive = req->duration; -+ arg->dwell_time_passive_6g = req->duration; -+ arg->burst_duration = req->duration; - -- scan_timeout = min_t(u32, arg.max_rest_time * -- (arg.num_chan - 1) + (req->duration + -+ scan_timeout = min_t(u32, arg->max_rest_time * -+ (arg->num_chan - 1) + (req->duration + - ATH11K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD) * -- arg.num_chan, arg.max_scan_time); -+ arg->num_chan, arg->max_scan_time); - } else { -- scan_timeout = arg.max_scan_time; -+ scan_timeout = arg->max_scan_time; - } - - /* Add a margin to account for event/command processing */ - scan_timeout += ATH11K_MAC_SCAN_CMD_EVT_OVERHEAD; - -- ret = ath11k_start_scan(ar, &arg); -+ ret = ath11k_start_scan(ar, arg); - if (ret) { - ath11k_warn(ar->ab, "failed to start hw scan: %d\n", ret); - spin_lock_bh(&ar->data_lock); -@@ -3717,10 +3723,11 @@ static int ath11k_mac_op_hw_scan(struct - msecs_to_jiffies(scan_timeout)); - - exit: -- kfree(arg.chan_list); -- -- if (req->ie_len) -- kfree(arg.extraie.ptr); -+ if (arg) { -+ kfree(arg->chan_list); -+ kfree(arg->extraie.ptr); -+ kfree(arg); -+ } - - mutex_unlock(&ar->conf_mutex); - diff --git a/package/kernel/mac80211/patches/ath11k/0026-wifi-ath11k-fix-Tx-power-value-during-active-CAC.patch b/package/kernel/mac80211/patches/ath11k/0026-wifi-ath11k-fix-Tx-power-value-during-active-CAC.patch new file mode 100644 index 00000000000000..79c1d735b8255f --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0026-wifi-ath11k-fix-Tx-power-value-during-active-CAC.patch @@ -0,0 +1,43 @@ +From 77f1ee6fd8b6e470f721d05a2e269039d5cafcb7 Mon Sep 17 00:00:00 2001 +From: Aditya Kumar Singh +Date: Tue, 3 Oct 2023 17:26:54 +0300 +Subject: [PATCH] wifi: ath11k: fix Tx power value during active CAC + +Tx power is fetched from firmware's pdev stats. However, during active +CAC, firmware does not fill the current Tx power and sends the max +initialised value filled during firmware init. If host sends this power +to user space, this is wrong since in certain situations, the Tx power +could be greater than the max allowed by the regulatory. Hence, host +should not be fetching the Tx power during an active CAC. + +Fix this issue by returning -EAGAIN error so that user space knows that there's +no valid value available. + +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Fixes: 9a2aa68afe3d ("wifi: ath11k: add get_txpower mac ops") +Signed-off-by: Aditya Kumar Singh +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20230912051857.2284-4-quic_adisi@quicinc.com +--- + drivers/net/wireless/ath/ath11k/mac.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -9060,6 +9060,14 @@ static int ath11k_mac_op_get_txpower(str + if (ar->state != ATH11K_STATE_ON) + goto err_fallback; + ++ /* Firmware doesn't provide Tx power during CAC hence no need to fetch ++ * the stats. ++ */ ++ if (test_bit(ATH11K_CAC_RUNNING, &ar->dev_flags)) { ++ mutex_unlock(&ar->conf_mutex); ++ return -EAGAIN; ++ } ++ + req_param.pdev_id = ar->pdev->pdev_id; + req_param.stats_id = WMI_REQUEST_PDEV_STAT; + diff --git a/package/kernel/mac80211/patches/ath11k/0027-wifi-ath11k-call-ath11k_mac_fils_discovery-without-c.patch b/package/kernel/mac80211/patches/ath11k/0027-wifi-ath11k-call-ath11k_mac_fils_discovery-without-c.patch new file mode 100644 index 00000000000000..d233492513d6d7 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0027-wifi-ath11k-call-ath11k_mac_fils_discovery-without-c.patch @@ -0,0 +1,37 @@ +From e149353e6562f3e3246f75dfc4cca6a0cc5b4efc Mon Sep 17 00:00:00 2001 +From: Aloka Dixit +Date: Mon, 9 Oct 2023 10:13:54 +0300 +Subject: [PATCH] wifi: ath11k: call ath11k_mac_fils_discovery() without + condition + +Mac80211 does not set flags BSS_CHANGED_FILS_DISCOVERY and +BSS_CHANGED_UNSOL_BCAST_PROBE_RESP if there are no updates to +FILS discovery and unsolicited broadcast probe response transmission +configurations respectively. This results in the transmissions getting +stopped during BSS change operations which do not include these +attributes. Remove the checks for the flags and always send the existing +configuration to firmware. + +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Aloka Dixit +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20231004044915.6817-1-quic_alokad@quicinc.com +--- + drivers/net/wireless/ath/ath11k/mac.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -3732,9 +3732,7 @@ static void ath11k_mac_op_bss_info_chang + arvif->vdev_id, ret); + } + +- if (changed & BSS_CHANGED_FILS_DISCOVERY || +- changed & BSS_CHANGED_UNSOL_BCAST_PROBE_RESP) +- ath11k_mac_fils_discovery(arvif, info); ++ ath11k_mac_fils_discovery(arvif, info); + + if (changed & BSS_CHANGED_ARP_FILTER) { + ipv4_cnt = min(vif->cfg.arp_addr_cnt, ATH11K_IPV4_MAX_COUNT); diff --git a/package/kernel/mac80211/patches/ath11k/0028-wifi-ath11k-ath11k_debugfs_register-fix-format-trunc.patch b/package/kernel/mac80211/patches/ath11k/0028-wifi-ath11k-ath11k_debugfs_register-fix-format-trunc.patch new file mode 100644 index 00000000000000..df8a4283fae3c6 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0028-wifi-ath11k-ath11k_debugfs_register-fix-format-trunc.patch @@ -0,0 +1,39 @@ +From a47111663491ff2829df0626493ce81b48dd880a Mon Sep 17 00:00:00 2001 +From: Kalle Valo +Date: Tue, 10 Oct 2023 09:22:50 +0300 +Subject: [PATCH] wifi: ath11k: ath11k_debugfs_register(): fix + format-truncation warning + +In v6.6-rc4 with GCC 13.2 I see a new warning: + +drivers/net/wireless/ath/ath11k/debugfs.c: In function 'ath11k_debugfs_register': +drivers/net/wireless/ath/ath11k/debugfs.c:1597:51: error: '%d' directive output may be truncated writing between 1 and 3 bytes into a region of size 2 [-Werror=format-truncation=] +drivers/net/wireless/ath/ath11k/debugfs.c:1597:48: note: directive argument in the range [0, 255] +drivers/net/wireless/ath/ath11k/debugfs.c:1597:9: note: 'snprintf' output between 5 and 7 bytes into a destination of size 5 + +Increase the size of pdev_name to 10 bytes to make sure there's enough room for +the string. Also change the format to '%u' as ar->pdev_idx is u8. + +Compile tested only. + +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20231010062250.2580951-1-kvalo@kernel.org +--- + drivers/net/wireless/ath/ath11k/debugfs.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/debugfs.c ++++ b/drivers/net/wireless/ath/ath11k/debugfs.c +@@ -1591,10 +1591,10 @@ static const struct file_operations fops + int ath11k_debugfs_register(struct ath11k *ar) + { + struct ath11k_base *ab = ar->ab; +- char pdev_name[5]; ++ char pdev_name[10]; + char buf[100] = {0}; + +- snprintf(pdev_name, sizeof(pdev_name), "%s%d", "mac", ar->pdev_idx); ++ snprintf(pdev_name, sizeof(pdev_name), "%s%u", "mac", ar->pdev_idx); + + ar->debug.debugfs_pdev = debugfs_create_dir(pdev_name, ab->debugfs_soc); + if (IS_ERR(ar->debug.debugfs_pdev)) diff --git a/package/kernel/mac80211/patches/ath11k/0029-wifi-ath11k-Add-support-to-configure-FTM-responder-r.patch b/package/kernel/mac80211/patches/ath11k/0029-wifi-ath11k-Add-support-to-configure-FTM-responder-r.patch deleted file mode 100644 index f652d689b5196e..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0029-wifi-ath11k-Add-support-to-configure-FTM-responder-r.patch +++ /dev/null @@ -1,169 +0,0 @@ -From a27c6a5853eb9d4f293b99be73a6891fe88263c7 Mon Sep 17 00:00:00 2001 -From: Sowmiya Sree Elavalagan -Date: Tue, 10 Jan 2023 15:30:57 +0200 -Subject: [PATCH] wifi: ath11k: Add support to configure FTM responder role - -Fine Timing Measurement(FTM) support is used to measure round trip -time between two nodes. - -Enable FTM responder feature using hw_params on supported device. -Since FTM functionality is offloaded to firmware, adding the -interface allows user space to enable or disable FTM responder. -Also add support for advertising the same in extended capabilities. - -QCA6390, WCN6855 and WCN6750 do not support this feature. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sowmiya Sree Elavalagan -Signed-off-by: Raj Kumar Bhagat -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221220044435.10506-1-quic_rajkbhag@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 8 ++++++++ - drivers/net/wireless/ath/ath11k/core.h | 1 + - drivers/net/wireless/ath/ath11k/hw.h | 1 + - drivers/net/wireless/ath/ath11k/mac.c | 20 +++++++++++++++++++- - drivers/net/wireless/ath/ath11k/wmi.h | 1 + - 5 files changed, 30 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -116,6 +116,7 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = true, - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, -+ .ftm_responder = true, - }, - { - .hw_rev = ATH11K_HW_IPQ6018_HW10, -@@ -198,6 +199,7 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = false, -+ .ftm_responder = true, - }, - { - .name = "qca6390 hw2.0", -@@ -282,6 +284,7 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = true, -+ .ftm_responder = false, - }, - { - .name = "qcn9074 hw1.0", -@@ -363,6 +366,7 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = false, -+ .ftm_responder = true, - }, - { - .name = "wcn6855 hw2.0", -@@ -447,6 +451,7 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = true, -+ .ftm_responder = false, - }, - { - .name = "wcn6855 hw2.1", -@@ -529,6 +534,7 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = true, -+ .ftm_responder = false, - }, - { - .name = "wcn6750 hw1.0", -@@ -609,6 +615,7 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE_WCN6750, - .smp2p_wow_exit = true, - .support_fw_mac_sequence = true, -+ .ftm_responder = false, - }, - { - .hw_rev = ATH11K_HW_IPQ5018_HW10, -@@ -688,6 +695,7 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = false, -+ .ftm_responder = true, - }, - }; - ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -346,6 +346,7 @@ struct ath11k_vif { - - bool is_started; - bool is_up; -+ bool ftm_responder; - bool spectral_enabled; - bool ps; - u32 aid; ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -224,6 +224,7 @@ struct ath11k_hw_params { - u32 tx_ring_size; - bool smp2p_wow_exit; - bool support_fw_mac_sequence; -+ bool ftm_responder; - }; - - struct ath11k_hw_ops { ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3110,7 +3110,7 @@ static void ath11k_mac_op_bss_info_chang - u16 bitrate; - int ret = 0; - u8 rateidx; -- u32 rate; -+ u32 rate, param; - u32 ipv4_cnt; - - mutex_lock(&ar->conf_mutex); -@@ -3412,6 +3412,20 @@ static void ath11k_mac_op_bss_info_chang - } - } - -+ if (changed & BSS_CHANGED_FTM_RESPONDER && -+ arvif->ftm_responder != info->ftm_responder && -+ ar->ab->hw_params.ftm_responder && -+ (vif->type == NL80211_IFTYPE_AP || -+ vif->type == NL80211_IFTYPE_MESH_POINT)) { -+ arvif->ftm_responder = info->ftm_responder; -+ param = WMI_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE; -+ ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, -+ arvif->ftm_responder); -+ if (ret) -+ ath11k_warn(ar->ab, "Failed to set ftm responder %i: %d\n", -+ arvif->vdev_id, ret); -+ } -+ - if (changed & BSS_CHANGED_FILS_DISCOVERY || - changed & BSS_CHANGED_UNSOL_BCAST_PROBE_RESP) - ath11k_mac_fils_discovery(arvif, info); -@@ -9113,6 +9127,10 @@ static int __ath11k_mac_register(struct - wiphy_ext_feature_set(ar->hw->wiphy, - NL80211_EXT_FEATURE_SET_SCAN_DWELL); - -+ if (ab->hw_params.ftm_responder) -+ wiphy_ext_feature_set(ar->hw->wiphy, -+ NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER); -+ - ath11k_reg_init(ar); - - if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) { ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -1073,6 +1073,7 @@ enum wmi_tlv_vdev_param { - WMI_VDEV_PARAM_ENABLE_BCAST_PROBE_RESPONSE, - WMI_VDEV_PARAM_FILS_MAX_CHANNEL_GUARD_TIME, - WMI_VDEV_PARAM_HE_LTF = 0x74, -+ WMI_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE = 0x7d, - WMI_VDEV_PARAM_BA_MODE = 0x7e, - WMI_VDEV_PARAM_AUTORATE_MISC_CFG = 0x80, - WMI_VDEV_PARAM_SET_HE_SOUNDING_MODE = 0x87, diff --git a/package/kernel/mac80211/patches/ath11k/0029-wifi-ath11k-add-parsing-of-phy-bitmap-for-reg-rules.patch b/package/kernel/mac80211/patches/ath11k/0029-wifi-ath11k-add-parsing-of-phy-bitmap-for-reg-rules.patch new file mode 100644 index 00000000000000..10d517a27a579a --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0029-wifi-ath11k-add-parsing-of-phy-bitmap-for-reg-rules.patch @@ -0,0 +1,84 @@ +From 534c2dd8099a9cc4bad8ea8b3c7fa1f730e10d5d Mon Sep 17 00:00:00 2001 +From: Aditya Kumar Singh +Date: Tue, 10 Oct 2023 10:27:19 +0300 +Subject: [PATCH] wifi: ath11k: add parsing of phy bitmap for reg rules + +Certain regulatory domains could put restrictions on phy mode operation. +For example, in a few countries HE Operation is not allowed. For such +countries, firmware indicates this via phy bitmap in each reg rule. + +Currently, there is no logic to parse this info and then pass it on to the +cfg80211/regulatory. + +Add parsing of this phy bitmap from the regulatory channel change event and +then accordingly map it to cfg80211/regulatory flags and pass it on to it. + +While at it, correct typo in debug print s/dsf/dfs. + +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Aditya Kumar Singh +Acked-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20231004092655.25020-1-quic_adisi@quicinc.com +--- + drivers/net/wireless/ath/ath11k/reg.c | 11 +++++++++++ + drivers/net/wireless/ath/ath11k/reg.h | 3 +++ + drivers/net/wireless/ath/ath11k/wmi.c | 5 +++-- + 3 files changed, 17 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/reg.c ++++ b/drivers/net/wireless/ath/ath11k/reg.c +@@ -352,6 +352,16 @@ static u32 ath11k_map_fw_reg_flags(u16 r + return flags; + } + ++static u32 ath11k_map_fw_phy_flags(u32 phy_flags) ++{ ++ u32 flags = 0; ++ ++ if (phy_flags & ATH11K_REG_PHY_BITMAP_NO11AX) ++ flags |= NL80211_RRF_NO_HE; ++ ++ return flags; ++} ++ + static bool + ath11k_reg_can_intersect(struct ieee80211_reg_rule *rule1, + struct ieee80211_reg_rule *rule2) +@@ -685,6 +695,7 @@ ath11k_reg_build_regd(struct ath11k_base + } + + flags |= ath11k_map_fw_reg_flags(reg_rule->flags); ++ flags |= ath11k_map_fw_phy_flags(reg_info->phybitmap); + + ath11k_reg_update_rule(tmp_regd->reg_rules + i, + reg_rule->start_freq, +--- a/drivers/net/wireless/ath/ath11k/reg.h ++++ b/drivers/net/wireless/ath/ath11k/reg.h +@@ -24,6 +24,9 @@ enum ath11k_dfs_region { + ATH11K_DFS_REG_UNDEF, + }; + ++/* Phy bitmaps */ ++#define ATH11K_REG_PHY_BITMAP_NO11AX BIT(5) ++ + /* ATH11K Regulatory API's */ + void ath11k_reg_init(struct ath11k *ar); + void ath11k_reg_free(struct ath11k_base *ab); +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -5440,10 +5440,11 @@ static int ath11k_pull_reg_chan_list_ext + } + + ath11k_dbg(ab, ATH11K_DBG_WMI, +- "cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d", ++ "cc_ext %s dfs %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d phy_bitmap 0x%x", + reg_info->alpha2, reg_info->dfs_region, + reg_info->min_bw_2ghz, reg_info->max_bw_2ghz, +- reg_info->min_bw_5ghz, reg_info->max_bw_5ghz); ++ reg_info->min_bw_5ghz, reg_info->max_bw_5ghz, ++ reg_info->phybitmap); + + ath11k_dbg(ab, ATH11K_DBG_WMI, + "num_2ghz_reg_rules %d num_5ghz_reg_rules %d", diff --git a/package/kernel/mac80211/patches/ath11k/0030-wifi-ath11k-Remove-unused-struct-ath11k_htc_frame.patch b/package/kernel/mac80211/patches/ath11k/0030-wifi-ath11k-Remove-unused-struct-ath11k_htc_frame.patch new file mode 100644 index 00000000000000..df4235388a57ae --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0030-wifi-ath11k-Remove-unused-struct-ath11k_htc_frame.patch @@ -0,0 +1,38 @@ +From 480d230bef0ecd06e72ae3a84117142e38e77503 Mon Sep 17 00:00:00 2001 +From: Jeff Johnson +Date: Mon, 9 Oct 2023 09:36:54 -0700 +Subject: [PATCH] wifi: ath11k: Remove unused struct ath11k_htc_frame + +struct ath11k_htc_frame is unused, and since it illogically contains +two consecutive flexible arrays, it could never be used, so remove it. + +No functional changes, compile tested only. + +Signed-off-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20231009-ath11k_htc_frame-v1-1-81d405b7a195@quicinc.com +--- + drivers/net/wireless/ath/ath11k/htc.h | 12 ------------ + 1 file changed, 12 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/htc.h ++++ b/drivers/net/wireless/ath/ath11k/htc.h +@@ -156,18 +156,6 @@ struct ath11k_htc_record { + }; + } __packed __aligned(4); + +-/* note: the trailer offset is dynamic depending +- * on payload length. this is only a struct layout draft +- */ +-struct ath11k_htc_frame { +- struct ath11k_htc_hdr hdr; +- union { +- struct ath11k_htc_msg msg; +- u8 payload[0]; +- }; +- struct ath11k_htc_record trailer[0]; +-} __packed __aligned(4); +- + enum ath11k_htc_svc_gid { + ATH11K_HTC_SVC_GRP_RSVD = 0, + ATH11K_HTC_SVC_GRP_WMI = 1, diff --git a/package/kernel/mac80211/patches/ath11k/0030-wifi-ath11k-add-channel-177-into-5-GHz-channel-list.patch b/package/kernel/mac80211/patches/ath11k/0030-wifi-ath11k-add-channel-177-into-5-GHz-channel-list.patch deleted file mode 100644 index d0ed9c54b8842b..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0030-wifi-ath11k-add-channel-177-into-5-GHz-channel-list.patch +++ /dev/null @@ -1,41 +0,0 @@ -From e5e94d10c85653609a2893c8d0ef24a27471b68f Mon Sep 17 00:00:00 2001 -From: Wen Gong -Date: Tue, 10 Jan 2023 15:30:58 +0200 -Subject: [PATCH] wifi: ath11k: add channel 177 into 5 GHz channel list - -Add support for the 5 GHz channel 177 with center frequency 5885 MHz and -operating class 125 per IEEE Std 802.11ax-2021, Table E-4. - -Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 - -Signed-off-by: Wen Gong -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221220101912.30816-1-quic_wgong@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.h | 4 ++-- - drivers/net/wireless/ath/ath11k/mac.c | 1 + - 2 files changed, 3 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -521,8 +521,8 @@ struct ath11k_sta { - #define ATH11K_MIN_5G_FREQ 4150 - #define ATH11K_MIN_6G_FREQ 5925 - #define ATH11K_MAX_6G_FREQ 7115 --#define ATH11K_NUM_CHANS 101 --#define ATH11K_MAX_5G_CHAN 173 -+#define ATH11K_NUM_CHANS 102 -+#define ATH11K_MAX_5G_CHAN 177 - - enum ath11k_state { - ATH11K_STATE_OFF, ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -96,6 +96,7 @@ static const struct ieee80211_channel at - CHAN5G(165, 5825, 0), - CHAN5G(169, 5845, 0), - CHAN5G(173, 5865, 0), -+ CHAN5G(177, 5885, 0), - }; - - static const struct ieee80211_channel ath11k_6ghz_channels[] = { diff --git a/package/kernel/mac80211/patches/ath11k/0031-wifi-ath11k-Introduce-and-use-ath11k_sta_to_arsta.patch b/package/kernel/mac80211/patches/ath11k/0031-wifi-ath11k-Introduce-and-use-ath11k_sta_to_arsta.patch new file mode 100644 index 00000000000000..59af3b929795b9 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0031-wifi-ath11k-Introduce-and-use-ath11k_sta_to_arsta.patch @@ -0,0 +1,384 @@ +From 10c65f97b424fcee439463f933140df2a0022f98 Mon Sep 17 00:00:00 2001 +From: Jeff Johnson +Date: Mon, 9 Oct 2023 09:39:42 -0700 +Subject: [PATCH] wifi: ath11k: Introduce and use ath11k_sta_to_arsta() + +Currently, the logic to return an ath11k_sta pointer, given a +ieee80211_sta pointer, uses typecasting throughout the driver. In +general, conversion functions are preferable to typecasting since +using a conversion function allows the compiler to validate the types +of both the input and output parameters. + +ath11k already defines a conversion function ath11k_vif_to_arvif() for +a similar conversion. So introduce ath11k_sta_to_arsta() for this use +case, and convert all of the existing typecasting to use this +function. + +No functional changes, compile tested only. + +Signed-off-by: Jeff Johnson +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20231009-ath11k_sta_to_arsta-v1-1-1563e3a307e8@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.h | 5 ++++ + drivers/net/wireless/ath/ath11k/debugfs.c | 4 +-- + drivers/net/wireless/ath/ath11k/debugfs_sta.c | 30 +++++++++---------- + drivers/net/wireless/ath/ath11k/dp_rx.c | 8 ++--- + drivers/net/wireless/ath/ath11k/dp_tx.c | 4 +-- + drivers/net/wireless/ath/ath11k/mac.c | 18 +++++------ + drivers/net/wireless/ath/ath11k/peer.c | 2 +- + drivers/net/wireless/ath/ath11k/wmi.c | 6 ++-- + 8 files changed, 41 insertions(+), 36 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -1223,6 +1223,11 @@ static inline struct ath11k_vif *ath11k_ + return (struct ath11k_vif *)vif->drv_priv; + } + ++static inline struct ath11k_sta *ath11k_sta_to_arsta(struct ieee80211_sta *sta) ++{ ++ return (struct ath11k_sta *)sta->drv_priv; ++} ++ + static inline struct ath11k *ath11k_ab_to_ar(struct ath11k_base *ab, + int mac_id) + { +--- a/drivers/net/wireless/ath/ath11k/debugfs.c ++++ b/drivers/net/wireless/ath/ath11k/debugfs.c +@@ -1459,7 +1459,7 @@ static void ath11k_reset_peer_ps_duratio + struct ieee80211_sta *sta) + { + struct ath11k *ar = data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + + spin_lock_bh(&ar->data_lock); + arsta->ps_total_duration = 0; +@@ -1510,7 +1510,7 @@ static void ath11k_peer_ps_state_disable + struct ieee80211_sta *sta) + { + struct ath11k *ar = data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + + spin_lock_bh(&ar->data_lock); + arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED; +--- a/drivers/net/wireless/ath/ath11k/debugfs_sta.c ++++ b/drivers/net/wireless/ath/ath11k/debugfs_sta.c +@@ -136,7 +136,7 @@ static ssize_t ath11k_dbg_sta_dump_tx_st + size_t count, loff_t *ppos) + { + struct ieee80211_sta *sta = file->private_data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + struct ath11k_htt_data_stats *stats; + static const char *str_name[ATH11K_STATS_TYPE_MAX] = {"succ", "fail", +@@ -243,7 +243,7 @@ static ssize_t ath11k_dbg_sta_dump_rx_st + size_t count, loff_t *ppos) + { + struct ieee80211_sta *sta = file->private_data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + struct ath11k_rx_peer_stats *rx_stats = arsta->rx_stats; + int len = 0, i, retval = 0; +@@ -340,7 +340,7 @@ static int + ath11k_dbg_sta_open_htt_peer_stats(struct inode *inode, struct file *file) + { + struct ieee80211_sta *sta = inode->i_private; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + struct debug_htt_stats_req *stats_req; + int type = ar->debug.htt_stats.type; +@@ -376,7 +376,7 @@ static int + ath11k_dbg_sta_release_htt_peer_stats(struct inode *inode, struct file *file) + { + struct ieee80211_sta *sta = inode->i_private; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + + mutex_lock(&ar->conf_mutex); +@@ -413,7 +413,7 @@ static ssize_t ath11k_dbg_sta_write_peer + size_t count, loff_t *ppos) + { + struct ieee80211_sta *sta = file->private_data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + int ret, enable; + +@@ -453,7 +453,7 @@ static ssize_t ath11k_dbg_sta_read_peer_ + size_t count, loff_t *ppos) + { + struct ieee80211_sta *sta = file->private_data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + char buf[32] = {0}; + int len; +@@ -480,7 +480,7 @@ static ssize_t ath11k_dbg_sta_write_delb + size_t count, loff_t *ppos) + { + struct ieee80211_sta *sta = file->private_data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + u32 tid, initiator, reason; + int ret; +@@ -531,7 +531,7 @@ static ssize_t ath11k_dbg_sta_write_addb + size_t count, loff_t *ppos) + { + struct ieee80211_sta *sta = file->private_data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + u32 tid, status; + int ret; +@@ -581,7 +581,7 @@ static ssize_t ath11k_dbg_sta_write_addb + size_t count, loff_t *ppos) + { + struct ieee80211_sta *sta = file->private_data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + u32 tid, buf_size; + int ret; +@@ -632,7 +632,7 @@ static ssize_t ath11k_dbg_sta_read_aggr_ + size_t count, loff_t *ppos) + { + struct ieee80211_sta *sta = file->private_data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + char buf[64]; + int len = 0; +@@ -652,7 +652,7 @@ static ssize_t ath11k_dbg_sta_write_aggr + size_t count, loff_t *ppos) + { + struct ieee80211_sta *sta = file->private_data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + u32 aggr_mode; + int ret; +@@ -697,7 +697,7 @@ ath11k_write_htt_peer_stats_reset(struct + size_t count, loff_t *ppos) + { + struct ieee80211_sta *sta = file->private_data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + struct htt_ext_stats_cfg_params cfg_params = { 0 }; + int ret; +@@ -756,7 +756,7 @@ static ssize_t ath11k_dbg_sta_read_peer_ + size_t count, loff_t *ppos) + { + struct ieee80211_sta *sta = file->private_data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + char buf[20]; + int len; +@@ -783,7 +783,7 @@ static ssize_t ath11k_dbg_sta_read_curre + loff_t *ppos) + { + struct ieee80211_sta *sta = file->private_data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + u64 time_since_station_in_power_save; + char buf[20]; +@@ -817,7 +817,7 @@ static ssize_t ath11k_dbg_sta_read_total + size_t count, loff_t *ppos) + { + struct ieee80211_sta *sta = file->private_data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + char buf[20]; + u64 power_save_duration; +--- a/drivers/net/wireless/ath/ath11k/dp_rx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_rx.c +@@ -1099,7 +1099,7 @@ int ath11k_dp_rx_ampdu_start(struct ath1 + struct ieee80211_ampdu_params *params) + { + struct ath11k_base *ab = ar->ab; +- struct ath11k_sta *arsta = (void *)params->sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(params->sta); + int vdev_id = arsta->arvif->vdev_id; + int ret; + +@@ -1117,7 +1117,7 @@ int ath11k_dp_rx_ampdu_stop(struct ath11 + { + struct ath11k_base *ab = ar->ab; + struct ath11k_peer *peer; +- struct ath11k_sta *arsta = (void *)params->sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(params->sta); + int vdev_id = arsta->arvif->vdev_id; + dma_addr_t paddr; + bool active; +@@ -1456,7 +1456,7 @@ ath11k_update_per_peer_tx_stats(struct a + } + + sta = peer->sta; +- arsta = (struct ath11k_sta *)sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(sta); + + memset(&arsta->txrate, 0, sizeof(arsta->txrate)); + +@@ -5242,7 +5242,7 @@ int ath11k_dp_rx_process_mon_status(stru + goto next_skb; + } + +- arsta = (struct ath11k_sta *)peer->sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(peer->sta); + ath11k_dp_rx_update_peer_stats(arsta, ppdu_info); + + if (ath11k_debugfs_is_pktlog_peer_valid(ar, peer->addr)) +--- a/drivers/net/wireless/ath/ath11k/dp_tx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_tx.c +@@ -467,7 +467,7 @@ void ath11k_dp_tx_update_txcompl(struct + } + + sta = peer->sta; +- arsta = (struct ath11k_sta *)sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(sta); + + memset(&arsta->txrate, 0, sizeof(arsta->txrate)); + pkt_type = FIELD_GET(HAL_TX_RATE_STATS_INFO0_PKT_TYPE, +@@ -627,7 +627,7 @@ static void ath11k_dp_tx_complete_msdu(s + ieee80211_free_txskb(ar->hw, msdu); + return; + } +- arsta = (struct ath11k_sta *)peer->sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(peer->sta); + status.sta = peer->sta; + status.skb = msdu; + status.info = info; +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -2832,7 +2832,7 @@ static void ath11k_peer_assoc_prepare(st + + lockdep_assert_held(&ar->conf_mutex); + +- arsta = (struct ath11k_sta *)sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(sta); + + memset(arg, 0, sizeof(*arg)); + +@@ -4313,7 +4313,7 @@ static int ath11k_mac_op_set_key(struct + ath11k_warn(ab, "peer %pM disappeared!\n", peer_addr); + + if (sta) { +- arsta = (struct ath11k_sta *)sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(sta); + + switch (key->cipher) { + case WLAN_CIPHER_SUITE_TKIP: +@@ -4904,7 +4904,7 @@ static int ath11k_mac_station_add(struct + { + struct ath11k_base *ab = ar->ab; + struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct peer_create_params peer_param; + int ret; + +@@ -5028,7 +5028,7 @@ static int ath11k_mac_op_sta_state(struc + { + struct ath11k *ar = hw->priv; + struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k_peer *peer; + int ret = 0; + +@@ -5194,7 +5194,7 @@ static void ath11k_mac_op_sta_set_4addr( + struct ieee80211_sta *sta, bool enabled) + { + struct ath11k *ar = hw->priv; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + + if (enabled && !arsta->use_4addr_set) { + ieee80211_queue_work(ar->hw, &arsta->set_4addr_wk); +@@ -5208,7 +5208,7 @@ static void ath11k_mac_op_sta_rc_update( + u32 changed) + { + struct ath11k *ar = hw->priv; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); + struct ath11k_peer *peer; + u32 bw, smps; +@@ -6201,7 +6201,7 @@ static void ath11k_mac_op_tx(struct ieee + } + + if (control->sta) +- arsta = (struct ath11k_sta *)control->sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(control->sta); + + ret = ath11k_dp_tx(ar, arvif, arsta, skb); + if (unlikely(ret)) { +@@ -8233,7 +8233,7 @@ static void ath11k_mac_set_bitrate_mask_ + struct ieee80211_sta *sta) + { + struct ath11k_vif *arvif = data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arvif->ar; + + spin_lock_bh(&ar->data_lock); +@@ -8637,7 +8637,7 @@ static void ath11k_mac_op_sta_statistics + struct ieee80211_sta *sta, + struct station_info *sinfo) + { +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + s8 signal; + bool db2dbm = test_bit(WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT, +--- a/drivers/net/wireless/ath/ath11k/peer.c ++++ b/drivers/net/wireless/ath/ath11k/peer.c +@@ -446,7 +446,7 @@ int ath11k_peer_create(struct ath11k *ar + peer->sec_type_grp = HAL_ENCRYPT_TYPE_OPEN; + + if (sta) { +- arsta = (struct ath11k_sta *)sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(sta); + arsta->tcl_metadata |= FIELD_PREP(HTT_TCL_META_DATA_TYPE, 0) | + FIELD_PREP(HTT_TCL_META_DATA_PEER_ID, + peer->peer_id); +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -6453,7 +6453,7 @@ static int ath11k_wmi_tlv_rssi_chain_par + goto exit; + } + +- arsta = (struct ath11k_sta *)sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(sta); + + BUILD_BUG_ON(ARRAY_SIZE(arsta->chain_signal) > + ARRAY_SIZE(stats_rssi->rssi_avg_beacon)); +@@ -6541,7 +6541,7 @@ static int ath11k_wmi_tlv_fw_stats_data_ + arvif->bssid, + NULL); + if (sta) { +- arsta = (struct ath11k_sta *)sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(sta); + arsta->rssi_beacon = src->beacon_snr; + ath11k_dbg(ab, ATH11K_DBG_WMI, + "stats vdev id %d snr %d\n", +@@ -7468,7 +7468,7 @@ static void ath11k_wmi_event_peer_sta_ps + goto exit; + } + +- arsta = (struct ath11k_sta *)sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(sta); + + spin_lock_bh(&ar->data_lock); + diff --git a/package/kernel/mac80211/patches/ath11k/0031-wifi-ath11k-fix-ce-memory-mapping-for-ahb-devices.patch b/package/kernel/mac80211/patches/ath11k/0031-wifi-ath11k-fix-ce-memory-mapping-for-ahb-devices.patch deleted file mode 100644 index 2786799972f69d..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0031-wifi-ath11k-fix-ce-memory-mapping-for-ahb-devices.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 53a998c4d7284debd77734d01e1466e59a1d03b2 Mon Sep 17 00:00:00 2001 -From: Raj Kumar Bhagat -Date: Fri, 13 Jan 2023 12:02:09 +0530 -Subject: [PATCH] wifi: ath11k: fix ce memory mapping for ahb devices - -Currently ath11k_ahb module is not loaded successfully and the wifi -interface is not created. Kernel trace is seen while loading the -ath11k_ahb module. The issue is seen in all ath11k AHB devices except -in IPQ5018. - -This happens because in ath11k_ahb_probe(), ab->mem_ce is initialized -with the value of ab->mem. However, at this instant ab->mem is not -yet set. - -Later, during write to a particular memory via ath11k_ahb_write32() -this ab->mem_ce is used with particular offset. Since ab->mem_ce is -not set properly this possibly leads to memory conflict to handle -kernel paging request and the below trace is seen. - -[ 93.035047] Unable to handle kernel paging request at virtual address ffff800100a00000 -[ 93.035083] Mem abort info: -[ 93.041869] ESR = 0x0000000096000045 -[ 93.044561] EC = 0x25: DABT (current EL), IL = 32 bits -[ 93.048377] SET = 0, FnV = 0 -[ 93.053840] EA = 0, S1PTW = 0 -[ 93.056704] FSC = 0x05: level 1 translation fault -[ 93.059745] Data abort info: -[ 93.064603] ISV = 0, ISS = 0x00000045 -[ 93.067729] CM = 0, WnR = 1 -[ 93.071287] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000042219000 -[ 93.074409] [ffff800100a00000] pgd=100000007ffff003, p4d=100000007ffff003, pud=0000000000000000 -[ 93.081195] Internal error: Oops: 0000000096000045 [#1] PREEMPT SMP -[ 93.089598] Modules linked in: ath11k_ahb ath11k_pci ath11k qmi_helpers -[ 93.095851] CPU: 2 PID: 66 Comm: kworker/u8:3 Not tainted 6.1.0-rc8-wt-ath-658126-g58e4b9df840c-dirty #2 -[ 93.102454] Hardware name: Qualcomm Technologies, Inc. IPQ8074/AP-HK14 (DT) -[ 93.112171] Workqueue: ath11k_qmi_driver_event ath11k_qmi_driver_event_work [ath11k] -[ 93.118856] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) -[ 93.126838] pc : ath11k_ahb_write32+0xc/0x18 [ath11k_ahb] -[ 93.133520] lr : ath11k_hal_srng_setup+0x860/0x8f0 [ath11k] -[ 93.139075] sp : ffff80000aaebb70 -[ 93.144452] x29: ffff80000aaebb70 x28: 0000000000000020 x27: ffff80000aaebc50 -[ 93.147934] x26: ffff000004923750 x25: ffff000004921200 x24: ffff000004928000 -[ 93.155051] x23: 0000000000000020 x22: ffff000004930000 x21: ffff000004923200 -[ 93.162170] x20: ffff000004920000 x19: 00000000eea00000 x18: ffff0000049200f0 -[ 93.169288] x17: 0000000000000000 x16: 0000000000000000 x15: 000000000000025e -[ 93.176405] x14: ffff000003c414f0 x13: 0000000000000000 x12: 0000000000000008 -[ 93.183524] x11: ffff000003c41488 x10: 0000000000000040 x9 : 0000000000000000 -[ 93.190641] x8 : ffff80000a9dd100 x7 : 0000000000000000 x6 : 000000000000003f -[ 93.197759] x5 : ffff800100a00400 x4 : ffff8000031f4018 x3 : 0000000000000004 -[ 93.204877] x2 : 0000000047b62000 x1 : ffff800100a00000 x0 : ffff800012000000 -[ 93.211996] Call trace: -[ 93.219104] ath11k_ahb_write32+0xc/0x18 [ath11k_ahb] -[ 93.221366] ath11k_ce_init_ring+0x184/0x278 [ath11k] -[ 93.226576] ath11k_ce_init_pipes+0x4c/0x1a0 [ath11k] -[ 93.231610] ath11k_core_qmi_firmware_ready+0x3c/0x568 [ath11k] -[ 93.236646] ath11k_qmi_driver_event_work+0x168/0x4f8 [ath11k] -[ 93.242376] process_one_work+0x144/0x350 -[ 93.248275] worker_thread+0x120/0x430 -[ 93.252352] kthread+0xf4/0x110 -[ 93.255997] ret_from_fork+0x10/0x20 -[ 93.259043] Code: d503201f f94e1c00 8b214001 d50332bf (b9000022) -[ 93.262863] ---[ end trace 0000000000000000 ]--- - -However, for the device IPQ5018 ath11k_hw_params .ce_remap is -defined. This parameter is used to recalculate ab->mem_ce and hence, -this issue is not seen in IPQ5018. - -Hence, fix this by initializing ab->mem_ce after ab->mem is set. -ab->mem is set inside the ath11k_ahb_setup_resources() therefore -initialize ab->mem_ce after ath11k_ahb_setup_resources(). - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Fixes: b42b3678c91f ("wifi: ath11k: remap ce register space for IPQ5018") - -Signed-off-by: Raj Kumar Bhagat -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230113063209.7256-1-quic_rajkbhag@quicinc.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -1157,12 +1157,16 @@ static int ath11k_ahb_probe(struct platf - goto err_core_free; - } - -- ab->mem_ce = ab->mem; -- - ret = ath11k_core_pre_init(ab); - if (ret) - goto err_core_free; - -+ ret = ath11k_ahb_setup_resources(ab); -+ if (ret) -+ goto err_core_free; -+ -+ ab->mem_ce = ab->mem; -+ - if (ab->hw_params.ce_remap) { - const struct ce_remap *ce_remap = ab->hw_params.ce_remap; - /* ce register space is moved out of wcss unlike ipq8074 or ipq6018 -@@ -1177,10 +1181,6 @@ static int ath11k_ahb_probe(struct platf - } - } - -- ret = ath11k_ahb_setup_resources(ab); -- if (ret) -- goto err_core_free; -- - ret = ath11k_ahb_fw_resources_init(ab); - if (ret) - goto err_core_free; diff --git a/package/kernel/mac80211/patches/ath11k/0033-wifi-ath11k-Set-ext-passive-scan-flag-to-adjust-pass.patch b/package/kernel/mac80211/patches/ath11k/0033-wifi-ath11k-Set-ext-passive-scan-flag-to-adjust-pass.patch deleted file mode 100644 index 79b79e1053e49f..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0033-wifi-ath11k-Set-ext-passive-scan-flag-to-adjust-pass.patch +++ /dev/null @@ -1,73 +0,0 @@ -From cf8f3d4deb02a8fdc806c46d4112b69868544697 Mon Sep 17 00:00:00 2001 -From: Tamizh Chelvam Raja -Date: Wed, 15 Feb 2023 20:31:36 +0200 -Subject: [PATCH] wifi: ath11k: Set ext passive scan flag to adjust passive - scan start time - -Set the WMI_SCAN_FLAG_EXT_PASSIVE_SCAN_START_TIME_ENHANCE flag -while sending the scan command. If this flag is enabled when the -incoming scan request comes with a strict start time and its duration -overlaps with next TBTT, then target adjust the start time accordingly -for passive scan. Target supporting this feature will advertise -WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01467-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Tamizh Chelvam Raja -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221222131720.11368-1-quic_tamizhr@quicinc.com ---- - drivers/net/wireless/ath/ath11k/wmi.c | 8 ++++++++ - drivers/net/wireless/ath/ath11k/wmi.h | 3 +++ - 2 files changed, 11 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -2068,6 +2068,12 @@ void ath11k_wmi_start_scan_init(struct a - WMI_SCAN_EVENT_FOREIGN_CHAN | - WMI_SCAN_EVENT_DEQUEUED; - arg->scan_flags |= WMI_SCAN_CHAN_STAT_EVENT; -+ -+ if (test_bit(WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE, -+ ar->ab->wmi_ab.svc_map)) -+ arg->scan_ctrl_flags_ext |= -+ WMI_SCAN_FLAG_EXT_PASSIVE_SCAN_START_TIME_ENHANCE; -+ - arg->num_bssid = 1; - - /* fill bssid_list[0] with 0xff, otherwise bssid and RA will be -@@ -2149,6 +2155,8 @@ ath11k_wmi_copy_scan_event_cntrl_flags(s - /* for adaptive scan mode using 3 bits (21 - 23 bits) */ - WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, - param->adaptive_dwell_time_mode); -+ -+ cmd->scan_ctrl_flags_ext = param->scan_ctrl_flags_ext; - } - - int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar, ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2093,6 +2093,7 @@ enum wmi_tlv_service { - WMI_TLV_SERVICE_EXT2_MSG = 220, - WMI_TLV_SERVICE_PEER_POWER_SAVE_DURATION_SUPPORT = 246, - WMI_TLV_SERVICE_SRG_SRP_SPATIAL_REUSE_SUPPORT = 249, -+ WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE = 263, - - /* The second 128 bits */ - WMI_MAX_EXT_SERVICE = 256, -@@ -3223,6 +3224,7 @@ struct wmi_start_scan_cmd { - - #define WMI_SCAN_DWELL_MODE_MASK 0x00E00000 - #define WMI_SCAN_DWELL_MODE_SHIFT 21 -+#define WMI_SCAN_FLAG_EXT_PASSIVE_SCAN_START_TIME_ENHANCE 0x00000800 - - enum { - WMI_SCAN_DWELL_MODE_DEFAULT = 0, -@@ -3270,6 +3272,7 @@ struct scan_req_params { - }; - u32 scan_events; - }; -+ u32 scan_ctrl_flags_ext; - u32 dwell_time_active; - u32 dwell_time_active_2g; - u32 dwell_time_passive; diff --git a/package/kernel/mac80211/patches/ath11k/0034-wifi-ath11k-fix-return-value-check-in-ath11k_ahb_pro.patch b/package/kernel/mac80211/patches/ath11k/0034-wifi-ath11k-fix-return-value-check-in-ath11k_ahb_pro.patch deleted file mode 100644 index 59132913bd0f9f..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0034-wifi-ath11k-fix-return-value-check-in-ath11k_ahb_pro.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 342fcde9d91460f01f65707e16368a1571271a3a Mon Sep 17 00:00:00 2001 -From: Yang Yingliang -Date: Fri, 17 Feb 2023 11:00:31 +0800 -Subject: [PATCH] wifi: ath11k: fix return value check in ath11k_ahb_probe() - -ioremap() returns NULL pointer not PTR_ERR() when it fails, -so replace the IS_ERR() check with NULL pointer check. - -Fixes: b42b3678c91f ("wifi: ath11k: remap ce register space for IPQ5018") -Signed-off-by: Yang Yingliang -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230217030031.4021289-1-yangyingliang@huawei.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -1174,7 +1174,7 @@ static int ath11k_ahb_probe(struct platf - * to a new space for accessing them. - */ - ab->mem_ce = ioremap(ce_remap->base, ce_remap->size); -- if (IS_ERR(ab->mem_ce)) { -+ if (!ab->mem_ce) { - dev_err(&pdev->dev, "ce ioremap error\n"); - ret = -ENOMEM; - goto err_core_free; diff --git a/package/kernel/mac80211/patches/ath11k/0035-wifi-ath11k-Use-platform_get_irq-to-get-the-interrup.patch b/package/kernel/mac80211/patches/ath11k/0035-wifi-ath11k-Use-platform_get_irq-to-get-the-interrup.patch deleted file mode 100644 index 93a9da8fc2e5da..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0035-wifi-ath11k-Use-platform_get_irq-to-get-the-interrup.patch +++ /dev/null @@ -1,50 +0,0 @@ -From f117276638b7600b981b3fe28550823cfbe1ef23 Mon Sep 17 00:00:00 2001 -From: Douglas Anderson -Date: Wed, 1 Feb 2023 08:54:42 -0800 -Subject: [PATCH] wifi: ath11k: Use platform_get_irq() to get the interrupt - -As of commit a1a2b7125e10 ("of/platform: Drop static setup of IRQ -resource from DT core"), we need to use platform_get_irq() instead of -platform_get_resource() to get our IRQs because -platform_get_resource() simply won't get them anymore. - -This was already fixed in several other Atheros WiFi drivers, -apparently in response to Zeal Robot reports. An example of another -fix is commit 9503a1fc123d ("ath9k: Use platform_get_irq() to get the -interrupt"). ath11k seems to have been missed in this effort, though. - -Without this change, WiFi wasn't coming up on my Qualcomm sc7280-based -hardware. Specifically, "platform_get_resource(pdev, IORESOURCE_IRQ, -i)" was failing even for i=0. - -Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 - -Fixes: a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource from DT core") -Fixes: 00402f49d26f ("ath11k: Add support for WCN6750 device") -Signed-off-by: Douglas Anderson -Tested-by: Jun Yu -Reviewed-by: Lad Prabhakar -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230201084131.v2.1.I69cf3d56c97098287fe3a70084ee515098390b70@changeid ---- - drivers/net/wireless/ath/ath11k/ahb.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -874,11 +874,11 @@ static int ath11k_ahb_setup_msi_resource - ab->pci.msi.ep_base_data = int_prop + 32; - - for (i = 0; i < ab->pci.msi.config->total_vectors; i++) { -- res = platform_get_resource(pdev, IORESOURCE_IRQ, i); -- if (!res) -- return -ENODEV; -+ ret = platform_get_irq(pdev, i); -+ if (ret < 0) -+ return ret; - -- ab->pci.msi.irqs[i] = res->start; -+ ab->pci.msi.irqs[i] = ret; - } - - set_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags); diff --git a/package/kernel/mac80211/patches/ath11k/0036-wifi-ath11k-fix-SAC-bug-on-peer-addition-with-sta-ba.patch b/package/kernel/mac80211/patches/ath11k/0036-wifi-ath11k-fix-SAC-bug-on-peer-addition-with-sta-ba.patch deleted file mode 100644 index b37f070ba64432..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0036-wifi-ath11k-fix-SAC-bug-on-peer-addition-with-sta-ba.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 60b7d62ba8cdbd073997bff0f1cdae8d844002c0 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Thu, 9 Feb 2023 23:26:22 +0100 -Subject: [PATCH] wifi: ath11k: fix SAC bug on peer addition with sta band - migration - -Fix sleep in atomic context warning detected by Smatch static checker -analyzer. - -Following the locking pattern for peer_rhash_add lock tbl_mtx_lock mutex -always even if sta is not transitioning to another band. -This is peer_add function and a more secure locking should not cause -performance regression. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1 - -Fixes: d673cb6fe6c0 ("wifi: ath11k: fix peer addition/deletion error on sta band migration") -Reported-by: Dan Carpenter -Signed-off-by: Christian Marangi -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230209222622.1751-1-ansuelsmth@gmail.com ---- - drivers/net/wireless/ath/ath11k/peer.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/peer.c -+++ b/drivers/net/wireless/ath/ath11k/peer.c -@@ -382,22 +382,23 @@ int ath11k_peer_create(struct ath11k *ar - return -ENOBUFS; - } - -+ mutex_lock(&ar->ab->tbl_mtx_lock); - spin_lock_bh(&ar->ab->base_lock); - peer = ath11k_peer_find_by_addr(ar->ab, param->peer_addr); - if (peer) { - if (peer->vdev_id == param->vdev_id) { - spin_unlock_bh(&ar->ab->base_lock); -+ mutex_unlock(&ar->ab->tbl_mtx_lock); - return -EINVAL; - } - - /* Assume sta is transitioning to another band. - * Remove here the peer from rhash. - */ -- mutex_lock(&ar->ab->tbl_mtx_lock); - ath11k_peer_rhash_delete(ar->ab, peer); -- mutex_unlock(&ar->ab->tbl_mtx_lock); - } - spin_unlock_bh(&ar->ab->base_lock); -+ mutex_unlock(&ar->ab->tbl_mtx_lock); - - ret = ath11k_wmi_send_peer_create_cmd(ar, param); - if (ret) { diff --git a/package/kernel/mac80211/patches/ath11k/0037-wifi-ath11k-allow-system-suspend-to-survive-ath11k.patch b/package/kernel/mac80211/patches/ath11k/0037-wifi-ath11k-allow-system-suspend-to-survive-ath11k.patch deleted file mode 100644 index fa680954e6fae3..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0037-wifi-ath11k-allow-system-suspend-to-survive-ath11k.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 7c15430822e71e90203d87e6d0cfe83fa058b0dc Mon Sep 17 00:00:00 2001 -From: Len Brown -Date: Wed, 1 Feb 2023 12:32:01 -0600 -Subject: [PATCH] wifi: ath11k: allow system suspend to survive ath11k - -When ath11k runs into internal errors upon suspend, -it returns an error code to pci_pm_suspend, which -aborts the entire system suspend. - -The driver should not abort system suspend, but should -keep its internal errors to itself, and allow the system -to suspend. Otherwise, a user can suspend a laptop -by closing the lid and sealing it into a case, assuming -that is will suspend, rather than heating up and draining -the battery when in transit. - -In practice, the ath11k device seems to have plenty of transient -errors, and subsequent suspend cycles after this failure -often succeed. - -https://bugzilla.kernel.org/show_bug.cgi?id=216968 - -Fixes: d1b0c33850d29 ("ath11k: implement suspend for QCA6390 PCI devices") - -Signed-off-by: Len Brown -Cc: stable@vger.kernel.org -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230201183201.14431-1-len.brown@intel.com ---- - drivers/net/wireless/ath/ath11k/pci.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/pci.c -+++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -998,7 +998,7 @@ static __maybe_unused int ath11k_pci_pm_ - if (ret) - ath11k_warn(ab, "failed to resume core: %d\n", ret); - -- return ret; -+ return 0; - } - - static SIMPLE_DEV_PM_OPS(ath11k_pci_pm_ops, diff --git a/package/kernel/mac80211/patches/ath11k/0038-wifi-ath11k-modify-accessor-macros-to-match-index-si.patch b/package/kernel/mac80211/patches/ath11k/0038-wifi-ath11k-modify-accessor-macros-to-match-index-si.patch deleted file mode 100644 index 42bf170a03de9d..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0038-wifi-ath11k-modify-accessor-macros-to-match-index-si.patch +++ /dev/null @@ -1,61 +0,0 @@ -From a96f10422e74cde27c100b321b127ec32ae75747 Mon Sep 17 00:00:00 2001 -From: Muna Sinada -Date: Fri, 24 Feb 2023 12:28:03 +0200 -Subject: [PATCH] wifi: ath11k: modify accessor macros to match index size - -HE PHY is only 11 bytes, therefore it should be using byte indexes -instead of dword. Change corresponding macros to reflect this. - -Signed-off-by: Muna Sinada -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/1666128501-12364-2-git-send-email-quic_msinada@quicinc.com ---- - drivers/net/wireless/ath/ath11k/wmi.h | 24 +++++++++++++----------- - 1 file changed, 13 insertions(+), 11 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2859,30 +2859,32 @@ struct rx_reorder_queue_remove_params { - #define WMI_VDEV_PARAM_TXBF_SU_TX_BFER BIT(2) - #define WMI_VDEV_PARAM_TXBF_MU_TX_BFER BIT(3) - --#define HECAP_PHYDWORD_0 0 --#define HECAP_PHYDWORD_1 1 --#define HECAP_PHYDWORD_2 2 -+#define HE_PHYCAP_BYTE_0 0 -+#define HE_PHYCAP_BYTE_1 1 -+#define HE_PHYCAP_BYTE_2 2 -+#define HE_PHYCAP_BYTE_3 3 -+#define HE_PHYCAP_BYTE_4 4 - --#define HECAP_PHY_SU_BFER BIT(31) -+#define HECAP_PHY_SU_BFER BIT(7) - #define HECAP_PHY_SU_BFEE BIT(0) - #define HECAP_PHY_MU_BFER BIT(1) --#define HECAP_PHY_UL_MUMIMO BIT(22) --#define HECAP_PHY_UL_MUOFDMA BIT(23) -+#define HECAP_PHY_UL_MUMIMO BIT(6) -+#define HECAP_PHY_UL_MUOFDMA BIT(7) - - #define HECAP_PHY_SUBFMR_GET(hecap_phy) \ -- FIELD_GET(HECAP_PHY_SU_BFER, hecap_phy[HECAP_PHYDWORD_0]) -+ FIELD_GET(HECAP_PHY_SU_BFER, hecap_phy[HE_PHYCAP_BYTE_3]) - - #define HECAP_PHY_SUBFME_GET(hecap_phy) \ -- FIELD_GET(HECAP_PHY_SU_BFEE, hecap_phy[HECAP_PHYDWORD_1]) -+ FIELD_GET(HECAP_PHY_SU_BFEE, hecap_phy[HE_PHYCAP_BYTE_4]) - - #define HECAP_PHY_MUBFMR_GET(hecap_phy) \ -- FIELD_GET(HECAP_PHY_MU_BFER, hecap_phy[HECAP_PHYDWORD_1]) -+ FIELD_GET(HECAP_PHY_MU_BFER, hecap_phy[HE_PHYCAP_BYTE_4]) - - #define HECAP_PHY_ULMUMIMO_GET(hecap_phy) \ -- FIELD_GET(HECAP_PHY_UL_MUMIMO, hecap_phy[HECAP_PHYDWORD_0]) -+ FIELD_GET(HECAP_PHY_UL_MUMIMO, hecap_phy[HE_PHYCAP_BYTE_2]) - - #define HECAP_PHY_ULOFDMA_GET(hecap_phy) \ -- FIELD_GET(HECAP_PHY_UL_MUOFDMA, hecap_phy[HECAP_PHYDWORD_0]) -+ FIELD_GET(HECAP_PHY_UL_MUOFDMA, hecap_phy[HE_PHYCAP_BYTE_2]) - - #define HE_MODE_SU_TX_BFEE BIT(0) - #define HE_MODE_SU_TX_BFER BIT(1) diff --git a/package/kernel/mac80211/patches/ath11k/0039-wifi-ath11k-push-MU-MIMO-params-from-hostapd-to-hard.patch b/package/kernel/mac80211/patches/ath11k/0039-wifi-ath11k-push-MU-MIMO-params-from-hostapd-to-hard.patch deleted file mode 100644 index 298ce1a612b6a1..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0039-wifi-ath11k-push-MU-MIMO-params-from-hostapd-to-hard.patch +++ /dev/null @@ -1,300 +0,0 @@ -From 38dfe775d0abf511341f37c1cb77b919a3ad410b Mon Sep 17 00:00:00 2001 -From: Muna Sinada -Date: Fri, 24 Feb 2023 12:28:04 +0200 -Subject: [PATCH] wifi: ath11k: push MU-MIMO params from hostapd to hardware - -In the previous behaviour only HE IE in management frames are changed -regarding MU-MIMO configurations and not in hardware. Adding push of -MU-MIMO configurations to the hardware as well. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00356-QCAHKSWPL_SILICONZ-1 - -Co-developed-by: Anilkumar Kolli -Signed-off-by: Anilkumar Kolli -Signed-off-by: Muna Sinada -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/1666128501-12364-3-git-send-email-quic_msinada@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 200 ++++++++++++++++---------- - drivers/net/wireless/ath/ath11k/wmi.h | 3 + - 2 files changed, 130 insertions(+), 73 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -2699,6 +2699,117 @@ static int ath11k_setup_peer_smps(struct - ath11k_smps_map[smps]); - } - -+static bool ath11k_mac_set_he_txbf_conf(struct ath11k_vif *arvif) -+{ -+ struct ath11k *ar = arvif->ar; -+ u32 param, value; -+ int ret; -+ -+ if (!arvif->vif->bss_conf.he_support) -+ return true; -+ -+ param = WMI_VDEV_PARAM_SET_HEMU_MODE; -+ value = 0; -+ if (arvif->vif->bss_conf.he_su_beamformer) { -+ value |= FIELD_PREP(HE_MODE_SU_TX_BFER, HE_SU_BFER_ENABLE); -+ if (arvif->vif->bss_conf.he_mu_beamformer && -+ arvif->vdev_type == WMI_VDEV_TYPE_AP) -+ value |= FIELD_PREP(HE_MODE_MU_TX_BFER, HE_MU_BFER_ENABLE); -+ } -+ -+ if (arvif->vif->type != NL80211_IFTYPE_MESH_POINT) { -+ value |= FIELD_PREP(HE_MODE_DL_OFDMA, HE_DL_MUOFDMA_ENABLE) | -+ FIELD_PREP(HE_MODE_UL_OFDMA, HE_UL_MUOFDMA_ENABLE); -+ -+ if (arvif->vif->bss_conf.he_full_ul_mumimo) -+ value |= FIELD_PREP(HE_MODE_UL_MUMIMO, HE_UL_MUMIMO_ENABLE); -+ -+ if (arvif->vif->bss_conf.he_su_beamformee) -+ value |= FIELD_PREP(HE_MODE_SU_TX_BFEE, HE_SU_BFEE_ENABLE); -+ } -+ -+ ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, value); -+ if (ret) { -+ ath11k_warn(ar->ab, "failed to set vdev %d HE MU mode: %d\n", -+ arvif->vdev_id, ret); -+ return false; -+ } -+ -+ param = WMI_VDEV_PARAM_SET_HE_SOUNDING_MODE; -+ value = FIELD_PREP(HE_VHT_SOUNDING_MODE, HE_VHT_SOUNDING_MODE_ENABLE) | -+ FIELD_PREP(HE_TRIG_NONTRIG_SOUNDING_MODE, -+ HE_TRIG_NONTRIG_SOUNDING_MODE_ENABLE); -+ ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, -+ param, value); -+ if (ret) { -+ ath11k_warn(ar->ab, "failed to set vdev %d sounding mode: %d\n", -+ arvif->vdev_id, ret); -+ return false; -+ } -+ return true; -+} -+ -+static bool ath11k_mac_vif_recalc_sta_he_txbf(struct ath11k *ar, -+ struct ieee80211_vif *vif, -+ struct ieee80211_sta_he_cap *he_cap) -+{ -+ struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ieee80211_he_cap_elem he_cap_elem = {0}; -+ struct ieee80211_sta_he_cap *cap_band = NULL; -+ struct cfg80211_chan_def def; -+ u32 param = WMI_VDEV_PARAM_SET_HEMU_MODE; -+ u32 hemode = 0; -+ int ret; -+ -+ if (!vif->bss_conf.he_support) -+ return true; -+ -+ if (vif->type != NL80211_IFTYPE_STATION) -+ return false; -+ -+ if (WARN_ON(ath11k_mac_vif_chan(vif, &def))) -+ return false; -+ -+ if (def.chan->band == NL80211_BAND_2GHZ) -+ cap_band = &ar->mac.iftype[NL80211_BAND_2GHZ][vif->type].he_cap; -+ else -+ cap_band = &ar->mac.iftype[NL80211_BAND_5GHZ][vif->type].he_cap; -+ -+ memcpy(&he_cap_elem, &cap_band->he_cap_elem, sizeof(he_cap_elem)); -+ -+ if (HECAP_PHY_SUBFME_GET(he_cap_elem.phy_cap_info)) { -+ if (HECAP_PHY_SUBFMR_GET(he_cap->he_cap_elem.phy_cap_info)) -+ hemode |= FIELD_PREP(HE_MODE_SU_TX_BFEE, HE_SU_BFEE_ENABLE); -+ if (HECAP_PHY_MUBFMR_GET(he_cap->he_cap_elem.phy_cap_info)) -+ hemode |= FIELD_PREP(HE_MODE_MU_TX_BFEE, HE_MU_BFEE_ENABLE); -+ } -+ -+ if (vif->type != NL80211_IFTYPE_MESH_POINT) { -+ hemode |= FIELD_PREP(HE_MODE_DL_OFDMA, HE_DL_MUOFDMA_ENABLE) | -+ FIELD_PREP(HE_MODE_UL_OFDMA, HE_UL_MUOFDMA_ENABLE); -+ -+ if (HECAP_PHY_ULMUMIMO_GET(he_cap_elem.phy_cap_info)) -+ if (HECAP_PHY_ULMUMIMO_GET(he_cap->he_cap_elem.phy_cap_info)) -+ hemode |= FIELD_PREP(HE_MODE_UL_MUMIMO, -+ HE_UL_MUMIMO_ENABLE); -+ -+ if (FIELD_GET(HE_MODE_MU_TX_BFEE, hemode)) -+ hemode |= FIELD_PREP(HE_MODE_SU_TX_BFEE, HE_SU_BFEE_ENABLE); -+ -+ if (FIELD_GET(HE_MODE_MU_TX_BFER, hemode)) -+ hemode |= FIELD_PREP(HE_MODE_SU_TX_BFER, HE_SU_BFER_ENABLE); -+ } -+ -+ ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, hemode); -+ if (ret) { -+ ath11k_warn(ar->ab, "failed to submit vdev param txbf 0x%x: %d\n", -+ hemode, ret); -+ return false; -+ } -+ -+ return true; -+} -+ - static void ath11k_bss_assoc(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf) -@@ -2709,6 +2820,7 @@ static void ath11k_bss_assoc(struct ieee - struct ieee80211_sta *ap_sta; - struct ath11k_peer *peer; - bool is_auth = false; -+ struct ieee80211_sta_he_cap he_cap; - int ret; - - lockdep_assert_held(&ar->conf_mutex); -@@ -2726,6 +2838,9 @@ static void ath11k_bss_assoc(struct ieee - return; - } - -+ /* he_cap here is updated at assoc success for sta mode only */ -+ he_cap = ap_sta->deflink.he_cap; -+ - ath11k_peer_assoc_prepare(ar, vif, ap_sta, &peer_arg, false); - - rcu_read_unlock(); -@@ -2753,6 +2868,12 @@ static void ath11k_bss_assoc(struct ieee - return; - } - -+ if (!ath11k_mac_vif_recalc_sta_he_txbf(ar, vif, &he_cap)) { -+ ath11k_warn(ar->ab, "failed to recalc he txbf for vdev %i on bss %pM\n", -+ arvif->vdev_id, bss_conf->bssid); -+ return; -+ } -+ - WARN_ON(arvif->is_up); - - arvif->aid = vif->cfg.aid; -@@ -3202,6 +3323,8 @@ static void ath11k_mac_op_bss_info_chang - ether_addr_copy(arvif->bssid, info->bssid); - - if (changed & BSS_CHANGED_BEACON_ENABLED) { -+ if (info->enable_beacon) -+ ath11k_mac_set_he_txbf_conf(arvif); - ath11k_control_beaconing(arvif, info); - - if (arvif->is_up && vif->bss_conf.he_support && -@@ -5392,6 +5515,10 @@ static int ath11k_mac_copy_he_cap(struct - - he_cap_elem->mac_cap_info[1] &= - IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK; -+ he_cap_elem->phy_cap_info[0] &= -+ ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G; -+ he_cap_elem->phy_cap_info[0] &= -+ ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G; - - he_cap_elem->phy_cap_info[5] &= - ~IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK; -@@ -6026,69 +6153,6 @@ ath11k_mac_setup_vdev_create_params(stru - } - } - --static u32 --ath11k_mac_prepare_he_mode(struct ath11k_pdev *pdev, u32 viftype) --{ -- struct ath11k_pdev_cap *pdev_cap = &pdev->cap; -- struct ath11k_band_cap *cap_band = NULL; -- u32 *hecap_phy_ptr = NULL; -- u32 hemode = 0; -- -- if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) -- cap_band = &pdev_cap->band[NL80211_BAND_2GHZ]; -- else -- cap_band = &pdev_cap->band[NL80211_BAND_5GHZ]; -- -- hecap_phy_ptr = &cap_band->he_cap_phy_info[0]; -- -- hemode = FIELD_PREP(HE_MODE_SU_TX_BFEE, HE_SU_BFEE_ENABLE) | -- FIELD_PREP(HE_MODE_SU_TX_BFER, HECAP_PHY_SUBFMR_GET(hecap_phy_ptr)) | -- FIELD_PREP(HE_MODE_UL_MUMIMO, HECAP_PHY_ULMUMIMO_GET(hecap_phy_ptr)); -- -- /* TODO WDS and other modes */ -- if (viftype == NL80211_IFTYPE_AP) { -- hemode |= FIELD_PREP(HE_MODE_MU_TX_BFER, -- HECAP_PHY_MUBFMR_GET(hecap_phy_ptr)) | -- FIELD_PREP(HE_MODE_DL_OFDMA, HE_DL_MUOFDMA_ENABLE) | -- FIELD_PREP(HE_MODE_UL_OFDMA, HE_UL_MUOFDMA_ENABLE); -- } else { -- hemode |= FIELD_PREP(HE_MODE_MU_TX_BFEE, HE_MU_BFEE_ENABLE); -- } -- -- return hemode; --} -- --static int ath11k_set_he_mu_sounding_mode(struct ath11k *ar, -- struct ath11k_vif *arvif) --{ -- u32 param_id, param_value; -- struct ath11k_base *ab = ar->ab; -- int ret = 0; -- -- param_id = WMI_VDEV_PARAM_SET_HEMU_MODE; -- param_value = ath11k_mac_prepare_he_mode(ar->pdev, arvif->vif->type); -- ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, -- param_id, param_value); -- if (ret) { -- ath11k_warn(ab, "failed to set vdev %d HE MU mode: %d param_value %x\n", -- arvif->vdev_id, ret, param_value); -- return ret; -- } -- param_id = WMI_VDEV_PARAM_SET_HE_SOUNDING_MODE; -- param_value = -- FIELD_PREP(HE_VHT_SOUNDING_MODE, HE_VHT_SOUNDING_MODE_ENABLE) | -- FIELD_PREP(HE_TRIG_NONTRIG_SOUNDING_MODE, -- HE_TRIG_NONTRIG_SOUNDING_MODE_ENABLE); -- ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, -- param_id, param_value); -- if (ret) { -- ath11k_warn(ab, "failed to set vdev %d HE MU mode: %d\n", -- arvif->vdev_id, ret); -- return ret; -- } -- return ret; --} -- - static void ath11k_mac_op_update_vif_offload(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) - { -@@ -6757,7 +6821,6 @@ ath11k_mac_vdev_start_restart(struct ath - struct ath11k_base *ab = ar->ab; - struct wmi_vdev_start_req_arg arg = {}; - const struct cfg80211_chan_def *chandef = &ctx->def; -- int he_support = arvif->vif->bss_conf.he_support; - int ret = 0; - - lockdep_assert_held(&ar->conf_mutex); -@@ -6798,15 +6861,6 @@ ath11k_mac_vdev_start_restart(struct ath - spin_lock_bh(&ab->base_lock); - arg.regdomain = ar->ab->dfs_region; - spin_unlock_bh(&ab->base_lock); -- -- if (he_support) { -- ret = ath11k_set_he_mu_sounding_mode(ar, arvif); -- if (ret) { -- ath11k_warn(ar->ab, "failed to set he mode vdev %i\n", -- arg.vdev_id); -- return ret; -- } -- } - } - - arg.channel.passive |= !!(chandef->chan->flags & IEEE80211_CHAN_NO_IR); ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2897,8 +2897,11 @@ struct rx_reorder_queue_remove_params { - #define HE_DL_MUOFDMA_ENABLE 1 - #define HE_UL_MUOFDMA_ENABLE 1 - #define HE_DL_MUMIMO_ENABLE 1 -+#define HE_UL_MUMIMO_ENABLE 1 - #define HE_MU_BFEE_ENABLE 1 - #define HE_SU_BFEE_ENABLE 1 -+#define HE_MU_BFER_ENABLE 1 -+#define HE_SU_BFER_ENABLE 1 - - #define HE_VHT_SOUNDING_MODE_ENABLE 1 - #define HE_SU_MU_SOUNDING_MODE_ENABLE 1 diff --git a/package/kernel/mac80211/patches/ath11k/0040-wifi-ath11k-move-HE-MCS-mapper-to-a-separate-functio.patch b/package/kernel/mac80211/patches/ath11k/0040-wifi-ath11k-move-HE-MCS-mapper-to-a-separate-functio.patch deleted file mode 100644 index 6bc9880e109fba..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0040-wifi-ath11k-move-HE-MCS-mapper-to-a-separate-functio.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 8077c1bbbc28e527fb29143c46f32c6a9d6cadf0 Mon Sep 17 00:00:00 2001 -From: Muna Sinada -Date: Fri, 24 Feb 2023 12:28:04 +0200 -Subject: [PATCH] wifi: ath11k: move HE MCS mapper to a separate function - -Move HE MCS mapper to a separate function and call new function -in ath11k_mac_copy_he_cap(). - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00356-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Muna Sinada -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/1666128501-12364-4-git-send-email-quic_msinada@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 34 +++++++++++++++++---------- - 1 file changed, 22 insertions(+), 12 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5483,6 +5483,27 @@ static __le16 ath11k_mac_setup_he_6ghz_c - return cpu_to_le16(bcap->he_6ghz_capa); - } - -+static void ath11k_mac_set_hemcsmap(struct ath11k *ar, -+ struct ath11k_pdev_cap *cap, -+ struct ieee80211_sta_he_cap *he_cap, -+ int band) -+{ -+ struct ath11k_band_cap *band_cap = &cap->band[band]; -+ -+ he_cap->he_mcs_nss_supp.rx_mcs_80 = -+ cpu_to_le16(band_cap->he_mcs & 0xffff); -+ he_cap->he_mcs_nss_supp.tx_mcs_80 = -+ cpu_to_le16(band_cap->he_mcs & 0xffff); -+ he_cap->he_mcs_nss_supp.rx_mcs_160 = -+ cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ he_cap->he_mcs_nss_supp.tx_mcs_160 = -+ cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ he_cap->he_mcs_nss_supp.rx_mcs_80p80 = -+ cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ he_cap->he_mcs_nss_supp.tx_mcs_80p80 = -+ cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+} -+ - static int ath11k_mac_copy_he_cap(struct ath11k *ar, - struct ath11k_pdev_cap *cap, - struct ieee80211_sband_iftype_data *data, -@@ -5544,18 +5565,7 @@ static int ath11k_mac_copy_he_cap(struct - break; - } - -- he_cap->he_mcs_nss_supp.rx_mcs_80 = -- cpu_to_le16(band_cap->he_mcs & 0xffff); -- he_cap->he_mcs_nss_supp.tx_mcs_80 = -- cpu_to_le16(band_cap->he_mcs & 0xffff); -- he_cap->he_mcs_nss_supp.rx_mcs_160 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -- he_cap->he_mcs_nss_supp.tx_mcs_160 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -- he_cap->he_mcs_nss_supp.rx_mcs_80p80 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -- he_cap->he_mcs_nss_supp.tx_mcs_80p80 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ ath11k_mac_set_hemcsmap(ar, cap, he_cap, band); - - memset(he_cap->ppe_thres, 0, sizeof(he_cap->ppe_thres)); - if (he_cap_elem->phy_cap_info[6] & diff --git a/package/kernel/mac80211/patches/ath11k/0041-wifi-ath11k-generate-rx-and-tx-mcs-maps-for-supporte.patch b/package/kernel/mac80211/patches/ath11k/0041-wifi-ath11k-generate-rx-and-tx-mcs-maps-for-supporte.patch deleted file mode 100644 index 5cb7801b294e38..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0041-wifi-ath11k-generate-rx-and-tx-mcs-maps-for-supporte.patch +++ /dev/null @@ -1,64 +0,0 @@ -From ebf82988f844dd98e6b007cffcc5e95986056995 Mon Sep 17 00:00:00 2001 -From: Muna Sinada -Date: Fri, 24 Feb 2023 12:28:04 +0200 -Subject: [PATCH] wifi: ath11k: generate rx and tx mcs maps for supported HE - mcs - -Generate rx and tx mcs maps in ath11k_mac_set_hemcsmap() and set them -in supported mcs/nss for HE capabilities. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00356-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Muna Sinada -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/1666128501-12364-5-git-send-email-quic_msinada@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 30 ++++++++++++++++++++------- - 1 file changed, 23 insertions(+), 7 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5488,20 +5488,36 @@ static void ath11k_mac_set_hemcsmap(stru - struct ieee80211_sta_he_cap *he_cap, - int band) - { -- struct ath11k_band_cap *band_cap = &cap->band[band]; -+ u16 txmcs_map, rxmcs_map; -+ u32 i; - -+ rxmcs_map = 0; -+ txmcs_map = 0; -+ for (i = 0; i < 8; i++) { -+ if (i < ar->num_tx_chains && -+ (ar->cfg_tx_chainmask >> cap->tx_chain_mask_shift) & BIT(i)) -+ txmcs_map |= IEEE80211_HE_MCS_SUPPORT_0_11 << (i * 2); -+ else -+ txmcs_map |= IEEE80211_HE_MCS_NOT_SUPPORTED << (i * 2); -+ -+ if (i < ar->num_rx_chains && -+ (ar->cfg_rx_chainmask >> cap->tx_chain_mask_shift) & BIT(i)) -+ rxmcs_map |= IEEE80211_HE_MCS_SUPPORT_0_11 << (i * 2); -+ else -+ rxmcs_map |= IEEE80211_HE_MCS_NOT_SUPPORTED << (i * 2); -+ } - he_cap->he_mcs_nss_supp.rx_mcs_80 = -- cpu_to_le16(band_cap->he_mcs & 0xffff); -+ cpu_to_le16(rxmcs_map & 0xffff); - he_cap->he_mcs_nss_supp.tx_mcs_80 = -- cpu_to_le16(band_cap->he_mcs & 0xffff); -+ cpu_to_le16(txmcs_map & 0xffff); - he_cap->he_mcs_nss_supp.rx_mcs_160 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ cpu_to_le16(rxmcs_map & 0xffff); - he_cap->he_mcs_nss_supp.tx_mcs_160 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ cpu_to_le16(txmcs_map & 0xffff); - he_cap->he_mcs_nss_supp.rx_mcs_80p80 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ cpu_to_le16(rxmcs_map & 0xffff); - he_cap->he_mcs_nss_supp.tx_mcs_80p80 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ cpu_to_le16(txmcs_map & 0xffff); - } - - static int ath11k_mac_copy_he_cap(struct ath11k *ar, diff --git a/package/kernel/mac80211/patches/ath11k/0042-wifi-ath11k-Add-tx-ack-signal-support-for-management.patch b/package/kernel/mac80211/patches/ath11k/0042-wifi-ath11k-Add-tx-ack-signal-support-for-management.patch deleted file mode 100644 index 8d41657311a6d7..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0042-wifi-ath11k-Add-tx-ack-signal-support-for-management.patch +++ /dev/null @@ -1,150 +0,0 @@ -From 01c6c9fccbd51c1d9eab0f5794b0271b026178df Mon Sep 17 00:00:00 2001 -From: Abinaya Kalaiselvan -Date: Mon, 19 Dec 2022 11:08:44 +0530 -Subject: [PATCH] wifi: ath11k: Add tx ack signal support for management - packets - -Add support to notify tx ack signal values for management -packets to userspace through nl80211 interface. - -Advertise NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT flag -to enable this feature and it will be used for data -packets as well. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Abinaya Kalaiselvan -Signed-off-by: Maharaja Kennadyrajan -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221219053844.4084486-1-quic_mkenna@quicinc.com ---- - drivers/net/wireless/ath/ath11k/hw.c | 1 + - drivers/net/wireless/ath/ath11k/mac.c | 5 +++++ - drivers/net/wireless/ath/ath11k/wmi.c | 27 ++++++++++++++++----------- - drivers/net/wireless/ath/ath11k/wmi.h | 3 +++ - 4 files changed, 25 insertions(+), 11 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -201,6 +201,7 @@ static void ath11k_init_wmi_config_ipq80 - config->twt_ap_pdev_count = ab->num_radios; - config->twt_ap_sta_count = 1000; - config->flag1 |= WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64; -+ config->flag1 |= WMI_RSRC_CFG_FLAG1_ACK_RSSI; - } - - static int ath11k_hw_mac_id_to_pdev_id_ipq8074(struct ath11k_hw_params *hw, ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -9174,6 +9174,11 @@ static int __ath11k_mac_register(struct - goto err_free_if_combs; - } - -+ if (test_bit(WMI_TLV_SERVICE_TX_DATA_MGMT_ACK_RSSI, -+ ar->ab->wmi_ab.svc_map)) -+ wiphy_ext_feature_set(ar->hw->wiphy, -+ NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT); -+ - ar->hw->queues = ATH11K_HW_MAX_QUEUES; - ar->hw->wiphy->tx_queue_len = ATH11K_QUEUE_LEN; - ar->hw->offchannel_tx_hw_queue = ATH11K_HW_MAX_QUEUES - 1; ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -5229,8 +5229,8 @@ static int ath11k_pull_mgmt_rx_params_tl - return 0; - } - --static int wmi_process_mgmt_tx_comp(struct ath11k *ar, u32 desc_id, -- u32 status) -+static int wmi_process_mgmt_tx_comp(struct ath11k *ar, -+ struct wmi_mgmt_tx_compl_event *tx_compl_param) - { - struct sk_buff *msdu; - struct ieee80211_tx_info *info; -@@ -5238,24 +5238,29 @@ static int wmi_process_mgmt_tx_comp(stru - int num_mgmt; - - spin_lock_bh(&ar->txmgmt_idr_lock); -- msdu = idr_find(&ar->txmgmt_idr, desc_id); -+ msdu = idr_find(&ar->txmgmt_idr, tx_compl_param->desc_id); - - if (!msdu) { - ath11k_warn(ar->ab, "received mgmt tx compl for invalid msdu_id: %d\n", -- desc_id); -+ tx_compl_param->desc_id); - spin_unlock_bh(&ar->txmgmt_idr_lock); - return -ENOENT; - } - -- idr_remove(&ar->txmgmt_idr, desc_id); -+ idr_remove(&ar->txmgmt_idr, tx_compl_param->desc_id); - spin_unlock_bh(&ar->txmgmt_idr_lock); - - skb_cb = ATH11K_SKB_CB(msdu); - dma_unmap_single(ar->ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); - - info = IEEE80211_SKB_CB(msdu); -- if ((!(info->flags & IEEE80211_TX_CTL_NO_ACK)) && !status) -+ if ((!(info->flags & IEEE80211_TX_CTL_NO_ACK)) && -+ !tx_compl_param->status) { - info->flags |= IEEE80211_TX_STAT_ACK; -+ if (test_bit(WMI_TLV_SERVICE_TX_DATA_MGMT_ACK_RSSI, -+ ar->ab->wmi_ab.svc_map)) -+ info->status.ack_signal = tx_compl_param->ack_rssi; -+ } - - ieee80211_tx_status_irqsafe(ar->hw, msdu); - -@@ -5267,7 +5272,7 @@ static int wmi_process_mgmt_tx_comp(stru - - ath11k_dbg(ar->ab, ATH11K_DBG_WMI, - "wmi mgmt tx comp pending %d desc id %d\n", -- num_mgmt, desc_id); -+ num_mgmt, tx_compl_param->desc_id); - - if (!num_mgmt) - wake_up(&ar->txmgmt_empty_waitq); -@@ -5300,6 +5305,7 @@ static int ath11k_pull_mgmt_tx_compl_par - param->pdev_id = ev->pdev_id; - param->desc_id = ev->desc_id; - param->status = ev->status; -+ param->ack_rssi = ev->ack_rssi; - - kfree(tb); - return 0; -@@ -7070,13 +7076,12 @@ static void ath11k_mgmt_tx_compl_event(s - goto exit; - } - -- wmi_process_mgmt_tx_comp(ar, tx_compl_param.desc_id, -- tx_compl_param.status); -+ wmi_process_mgmt_tx_comp(ar, &tx_compl_param); - - ath11k_dbg(ab, ATH11K_DBG_MGMT, -- "mgmt tx compl ev pdev_id %d, desc_id %d, status %d", -+ "mgmt tx compl ev pdev_id %d, desc_id %d, status %d ack_rssi %d", - tx_compl_param.pdev_id, tx_compl_param.desc_id, -- tx_compl_param.status); -+ tx_compl_param.status, tx_compl_param.ack_rssi); - - exit: - rcu_read_unlock(); ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2311,6 +2311,7 @@ struct wmi_init_cmd { - } __packed; - - #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64 BIT(5) -+#define WMI_RSRC_CFG_FLAG1_ACK_RSSI BIT(18) - - struct wmi_resource_config { - u32 tlv_header; -@@ -4550,6 +4551,8 @@ struct wmi_mgmt_tx_compl_event { - u32 desc_id; - u32 status; - u32 pdev_id; -+ u32 ppdu_id; -+ u32 ack_rssi; - } __packed; - - struct wmi_scan_event { diff --git a/package/kernel/mac80211/patches/ath11k/0043-wifi-ath11k-use-proper-regulatory-reference-for-band.patch b/package/kernel/mac80211/patches/ath11k/0043-wifi-ath11k-use-proper-regulatory-reference-for-band.patch deleted file mode 100644 index 5bc195528e4448..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0043-wifi-ath11k-use-proper-regulatory-reference-for-band.patch +++ /dev/null @@ -1,216 +0,0 @@ -From 25e289e1f52e1f4fb1d07622c6a24f8d8a8e420d Mon Sep 17 00:00:00 2001 -From: Aditya Kumar Singh -Date: Wed, 1 Mar 2023 16:20:58 +0200 -Subject: [PATCH] wifi: ath11k: use proper regulatory reference for bands - -Currently, during regulatory event, 2 GHz/5 GHz is referred -to as 2G/5G including variable names. However, there is no -such entity as 2G or 5G. - -Re-name such occurences to its proper name. No functional changes. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aditya Kumar Singh -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230110121024.14051-2-quic_adisi@quicinc.com ---- - drivers/net/wireless/ath/ath11k/reg.c | 20 ++++----- - drivers/net/wireless/ath/ath11k/wmi.c | 58 ++++++++++++++------------- - drivers/net/wireless/ath/ath11k/wmi.h | 28 ++++++------- - 3 files changed, 54 insertions(+), 52 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/reg.c -+++ b/drivers/net/wireless/ath/ath11k/reg.c -@@ -619,7 +619,7 @@ ath11k_reg_build_regd(struct ath11k_base - u32 flags; - char alpha2[3]; - -- num_rules = reg_info->num_5g_reg_rules + reg_info->num_2g_reg_rules; -+ num_rules = reg_info->num_5ghz_reg_rules + reg_info->num_2ghz_reg_rules; - - if (!num_rules) - goto ret; -@@ -644,20 +644,20 @@ ath11k_reg_build_regd(struct ath11k_base - alpha2, ath11k_reg_get_regdom_str(tmp_regd->dfs_region), - reg_info->dfs_region, num_rules); - /* Update reg_rules[] below. Firmware is expected to -- * send these rules in order(2G rules first and then 5G) -+ * send these rules in order(2 GHz rules first and then 5 GHz) - */ - for (; i < num_rules; i++) { -- if (reg_info->num_2g_reg_rules && -- (i < reg_info->num_2g_reg_rules)) { -- reg_rule = reg_info->reg_rules_2g_ptr + i; -+ if (reg_info->num_2ghz_reg_rules && -+ (i < reg_info->num_2ghz_reg_rules)) { -+ reg_rule = reg_info->reg_rules_2ghz_ptr + i; - max_bw = min_t(u16, reg_rule->max_bw, -- reg_info->max_bw_2g); -+ reg_info->max_bw_2ghz); - flags = 0; -- } else if (reg_info->num_5g_reg_rules && -- (j < reg_info->num_5g_reg_rules)) { -- reg_rule = reg_info->reg_rules_5g_ptr + j++; -+ } else if (reg_info->num_5ghz_reg_rules && -+ (j < reg_info->num_5ghz_reg_rules)) { -+ reg_rule = reg_info->reg_rules_5ghz_ptr + j++; - max_bw = min_t(u16, reg_rule->max_bw, -- reg_info->max_bw_5g); -+ reg_info->max_bw_5ghz); - - /* FW doesn't pass NL80211_RRF_AUTO_BW flag for - * BW Auto correction, we can enable this by default ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -4959,7 +4959,7 @@ static int ath11k_pull_reg_chan_list_upd - const void **tb; - const struct wmi_reg_chan_list_cc_event *chan_list_event_hdr; - struct wmi_regulatory_rule_struct *wmi_reg_rule; -- u32 num_2g_reg_rules, num_5g_reg_rules; -+ u32 num_2ghz_reg_rules, num_5ghz_reg_rules; - int ret; - - ath11k_dbg(ab, ATH11K_DBG_WMI, "processing regulatory channel list\n"); -@@ -4978,10 +4978,10 @@ static int ath11k_pull_reg_chan_list_upd - return -EPROTO; - } - -- reg_info->num_2g_reg_rules = chan_list_event_hdr->num_2g_reg_rules; -- reg_info->num_5g_reg_rules = chan_list_event_hdr->num_5g_reg_rules; -+ reg_info->num_2ghz_reg_rules = chan_list_event_hdr->num_2ghz_reg_rules; -+ reg_info->num_5ghz_reg_rules = chan_list_event_hdr->num_5ghz_reg_rules; - -- if (!(reg_info->num_2g_reg_rules + reg_info->num_5g_reg_rules)) { -+ if (!(reg_info->num_2ghz_reg_rules + reg_info->num_5ghz_reg_rules)) { - ath11k_warn(ab, "No regulatory rules available in the event info\n"); - kfree(tb); - return -EINVAL; -@@ -5008,46 +5008,48 @@ static int ath11k_pull_reg_chan_list_upd - else if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_FAIL) - reg_info->status_code = REG_SET_CC_STATUS_FAIL; - -- reg_info->min_bw_2g = chan_list_event_hdr->min_bw_2g; -- reg_info->max_bw_2g = chan_list_event_hdr->max_bw_2g; -- reg_info->min_bw_5g = chan_list_event_hdr->min_bw_5g; -- reg_info->max_bw_5g = chan_list_event_hdr->max_bw_5g; -+ reg_info->min_bw_2ghz = chan_list_event_hdr->min_bw_2ghz; -+ reg_info->max_bw_2ghz = chan_list_event_hdr->max_bw_2ghz; -+ reg_info->min_bw_5ghz = chan_list_event_hdr->min_bw_5ghz; -+ reg_info->max_bw_5ghz = chan_list_event_hdr->max_bw_5ghz; - -- num_2g_reg_rules = reg_info->num_2g_reg_rules; -- num_5g_reg_rules = reg_info->num_5g_reg_rules; -+ num_2ghz_reg_rules = reg_info->num_2ghz_reg_rules; -+ num_5ghz_reg_rules = reg_info->num_5ghz_reg_rules; - - ath11k_dbg(ab, ATH11K_DBG_WMI, -- "%s:cc %s dsf %d BW: min_2g %d max_2g %d min_5g %d max_5g %d", -+ "%s:cc %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d", - __func__, reg_info->alpha2, reg_info->dfs_region, -- reg_info->min_bw_2g, reg_info->max_bw_2g, -- reg_info->min_bw_5g, reg_info->max_bw_5g); -+ reg_info->min_bw_2ghz, reg_info->max_bw_2ghz, -+ reg_info->min_bw_5ghz, reg_info->max_bw_5ghz); - - ath11k_dbg(ab, ATH11K_DBG_WMI, -- "%s: num_2g_reg_rules %d num_5g_reg_rules %d", __func__, -- num_2g_reg_rules, num_5g_reg_rules); -+ "%s: num_2ghz_reg_rules %d num_5ghz_reg_rules %d", __func__, -+ num_2ghz_reg_rules, num_5ghz_reg_rules); - - wmi_reg_rule = - (struct wmi_regulatory_rule_struct *)((u8 *)chan_list_event_hdr - + sizeof(*chan_list_event_hdr) - + sizeof(struct wmi_tlv)); - -- if (num_2g_reg_rules) { -- reg_info->reg_rules_2g_ptr = create_reg_rules_from_wmi(num_2g_reg_rules, -- wmi_reg_rule); -- if (!reg_info->reg_rules_2g_ptr) { -+ if (num_2ghz_reg_rules) { -+ reg_info->reg_rules_2ghz_ptr = -+ create_reg_rules_from_wmi(num_2ghz_reg_rules, -+ wmi_reg_rule); -+ if (!reg_info->reg_rules_2ghz_ptr) { - kfree(tb); -- ath11k_warn(ab, "Unable to Allocate memory for 2g rules\n"); -+ ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n"); - return -ENOMEM; - } - } - -- if (num_5g_reg_rules) { -- wmi_reg_rule += num_2g_reg_rules; -- reg_info->reg_rules_5g_ptr = create_reg_rules_from_wmi(num_5g_reg_rules, -- wmi_reg_rule); -- if (!reg_info->reg_rules_5g_ptr) { -+ if (num_5ghz_reg_rules) { -+ wmi_reg_rule += num_2ghz_reg_rules; -+ reg_info->reg_rules_5ghz_ptr = -+ create_reg_rules_from_wmi(num_5ghz_reg_rules, -+ wmi_reg_rule); -+ if (!reg_info->reg_rules_5ghz_ptr) { - kfree(tb); -- ath11k_warn(ab, "Unable to Allocate memory for 5g rules\n"); -+ ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n"); - return -ENOMEM; - } - } -@@ -6619,8 +6621,8 @@ fallback: - WARN_ON(1); - mem_free: - if (reg_info) { -- kfree(reg_info->reg_rules_2g_ptr); -- kfree(reg_info->reg_rules_5g_ptr); -+ kfree(reg_info->reg_rules_2ghz_ptr); -+ kfree(reg_info->reg_rules_5ghz_ptr); - kfree(reg_info); - } - return ret; ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -4129,14 +4129,14 @@ struct cur_regulatory_info { - u8 alpha2[REG_ALPHA2_LEN + 1]; - u32 dfs_region; - u32 phybitmap; -- u32 min_bw_2g; -- u32 max_bw_2g; -- u32 min_bw_5g; -- u32 max_bw_5g; -- u32 num_2g_reg_rules; -- u32 num_5g_reg_rules; -- struct cur_reg_rule *reg_rules_2g_ptr; -- struct cur_reg_rule *reg_rules_5g_ptr; -+ u32 min_bw_2ghz; -+ u32 max_bw_2ghz; -+ u32 min_bw_5ghz; -+ u32 max_bw_5ghz; -+ u32 num_2ghz_reg_rules; -+ u32 num_5ghz_reg_rules; -+ struct cur_reg_rule *reg_rules_2ghz_ptr; -+ struct cur_reg_rule *reg_rules_5ghz_ptr; - }; - - struct wmi_reg_chan_list_cc_event { -@@ -4148,12 +4148,12 @@ struct wmi_reg_chan_list_cc_event { - u32 domain_code; - u32 dfs_region; - u32 phybitmap; -- u32 min_bw_2g; -- u32 max_bw_2g; -- u32 min_bw_5g; -- u32 max_bw_5g; -- u32 num_2g_reg_rules; -- u32 num_5g_reg_rules; -+ u32 min_bw_2ghz; -+ u32 max_bw_2ghz; -+ u32 min_bw_5ghz; -+ u32 max_bw_5ghz; -+ u32 num_2ghz_reg_rules; -+ u32 num_5ghz_reg_rules; - } __packed; - - struct wmi_regulatory_rule_struct { diff --git a/package/kernel/mac80211/patches/ath11k/0044-wifi-ath11k-add-support-to-parse-new-WMI-event-for-6.patch b/package/kernel/mac80211/patches/ath11k/0044-wifi-ath11k-add-support-to-parse-new-WMI-event-for-6.patch deleted file mode 100644 index e165c09dc47885..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0044-wifi-ath11k-add-support-to-parse-new-WMI-event-for-6.patch +++ /dev/null @@ -1,844 +0,0 @@ -From 91fa00fa69224aae5afb720c5e68b22e4c4f7333 Mon Sep 17 00:00:00 2001 -From: Aditya Kumar Singh -Date: Wed, 1 Mar 2023 16:20:59 +0200 -Subject: [PATCH] wifi: ath11k: add support to parse new WMI event for 6 GHz - -In order to support different power levels of 6 GHz AP and client, -new WMI event for regulatory - WMI_REG_CHAN_LIST_CC_EXT_EVENTID is -added in firmware. This event provides new parameters required for -6 GHz regulatory rules. - -Add support for parsing 2.4 GHz, 5 GHz and 6 GHz reg rules and other -parameters from WMI_REG_CHAN_LIST_CC_EXT_EVENTID. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Lavanya Suresh -Signed-off-by: Wen Gong -Signed-off-by: Aditya Kumar Singh -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230110121024.14051-3-quic_adisi@quicinc.com ---- - drivers/net/wireless/ath/ath11k/reg.c | 37 ++- - drivers/net/wireless/ath/ath11k/wmi.c | 418 +++++++++++++++++++++++++- - drivers/net/wireless/ath/ath11k/wmi.h | 163 +++++++++- - 3 files changed, 584 insertions(+), 34 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/reg.c -+++ b/drivers/net/wireless/ath/ath11k/reg.c -@@ -613,7 +613,7 @@ ath11k_reg_build_regd(struct ath11k_base - { - struct ieee80211_regdomain *tmp_regd, *default_regd, *new_regd = NULL; - struct cur_reg_rule *reg_rule; -- u8 i = 0, j = 0; -+ u8 i = 0, j = 0, k = 0; - u8 num_rules; - u16 max_bw; - u32 flags; -@@ -621,6 +621,12 @@ ath11k_reg_build_regd(struct ath11k_base - - num_rules = reg_info->num_5ghz_reg_rules + reg_info->num_2ghz_reg_rules; - -+ /* FIXME: Currently taking reg rules for 6 GHz only from Indoor AP mode list. -+ * This can be updated after complete 6 GHz regulatory support is added. -+ */ -+ if (reg_info->is_ext_reg_event) -+ num_rules += reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP]; -+ - if (!num_rules) - goto ret; - -@@ -666,6 +672,14 @@ ath11k_reg_build_regd(struct ath11k_base - * per other BW rule flags we pass from here - */ - flags = NL80211_RRF_AUTO_BW; -+ } else if (reg_info->is_ext_reg_event && -+ reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP] && -+ (k < reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP])) { -+ reg_rule = reg_info->reg_rules_6ghz_ap_ptr[WMI_REG_INDOOR_AP] + -+ k++; -+ max_bw = min_t(u16, reg_rule->max_bw, -+ reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP]); -+ flags = NL80211_RRF_AUTO_BW; - } else { - break; - } -@@ -693,12 +707,21 @@ ath11k_reg_build_regd(struct ath11k_base - continue; - } - -- ath11k_dbg(ab, ATH11K_DBG_REG, -- "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", -- i + 1, reg_rule->start_freq, reg_rule->end_freq, -- max_bw, reg_rule->ant_gain, reg_rule->reg_power, -- tmp_regd->reg_rules[i].dfs_cac_ms, -- flags); -+ if (reg_info->is_ext_reg_event) { -+ ath11k_dbg(ab, ATH11K_DBG_REG, -+ "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d) (%d, %d)\n", -+ i + 1, reg_rule->start_freq, reg_rule->end_freq, -+ max_bw, reg_rule->ant_gain, reg_rule->reg_power, -+ tmp_regd->reg_rules[i].dfs_cac_ms, flags, -+ reg_rule->psd_flag, reg_rule->psd_eirp); -+ } else { -+ ath11k_dbg(ab, ATH11K_DBG_REG, -+ "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", -+ i + 1, reg_rule->start_freq, reg_rule->end_freq, -+ max_bw, reg_rule->ant_gain, reg_rule->reg_power, -+ tmp_regd->reg_rules[i].dfs_cac_ms, -+ flags); -+ } - } - - tmp_regd->n_reg_rules = i; ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -105,6 +105,8 @@ static const struct wmi_tlv_policy wmi_t - = { .min_len = sizeof(struct wmi_vdev_stopped_event) }, - [WMI_TAG_REG_CHAN_LIST_CC_EVENT] - = { .min_len = sizeof(struct wmi_reg_chan_list_cc_event) }, -+ [WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT] -+ = { .min_len = sizeof(struct wmi_reg_chan_list_cc_ext_event) }, - [WMI_TAG_MGMT_RX_HDR] - = { .min_len = sizeof(struct wmi_mgmt_rx_hdr) }, - [WMI_TAG_MGMT_TX_COMPL_EVENT] -@@ -3974,6 +3976,10 @@ ath11k_wmi_copy_resource_config(struct w - wmi_cfg->sched_params = tg_cfg->sched_params; - wmi_cfg->twt_ap_pdev_count = tg_cfg->twt_ap_pdev_count; - wmi_cfg->twt_ap_sta_count = tg_cfg->twt_ap_sta_count; -+ wmi_cfg->host_service_flags &= -+ ~(1 << WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT); -+ wmi_cfg->host_service_flags |= (tg_cfg->is_reg_cc_ext_event_supported << -+ WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT); - } - - static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi, -@@ -4192,6 +4198,10 @@ int ath11k_wmi_cmd_init(struct ath11k_ba - - ab->hw_params.hw_ops->wmi_init_config(ab, &config); - -+ if (test_bit(WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT, -+ ab->wmi_ab.svc_map)) -+ config.is_reg_cc_ext_event_supported = 1; -+ - memcpy(&wmi_sc->wlan_resource_config, &config, sizeof(config)); - - init_param.res_cfg = &wmi_sc->wlan_resource_config; -@@ -4995,18 +5005,11 @@ static int ath11k_pull_reg_chan_list_upd - reg_info->phy_id = chan_list_event_hdr->phy_id; - reg_info->ctry_code = chan_list_event_hdr->country_id; - reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code; -- if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_PASS) -- reg_info->status_code = REG_SET_CC_STATUS_PASS; -- else if (chan_list_event_hdr->status_code == WMI_REG_CURRENT_ALPHA2_NOT_FOUND) -- reg_info->status_code = REG_CURRENT_ALPHA2_NOT_FOUND; -- else if (chan_list_event_hdr->status_code == WMI_REG_INIT_ALPHA2_NOT_FOUND) -- reg_info->status_code = REG_INIT_ALPHA2_NOT_FOUND; -- else if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_CHANGE_NOT_ALLOWED) -- reg_info->status_code = REG_SET_CC_CHANGE_NOT_ALLOWED; -- else if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_NO_MEMORY) -- reg_info->status_code = REG_SET_CC_STATUS_NO_MEMORY; -- else if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_FAIL) -- reg_info->status_code = REG_SET_CC_STATUS_FAIL; -+ -+ reg_info->status_code = -+ ath11k_wmi_cc_setting_code_to_reg(chan_list_event_hdr->status_code); -+ -+ reg_info->is_ext_reg_event = false; - - reg_info->min_bw_2ghz = chan_list_event_hdr->min_bw_2ghz; - reg_info->max_bw_2ghz = chan_list_event_hdr->max_bw_2ghz; -@@ -5060,6 +5063,372 @@ static int ath11k_pull_reg_chan_list_upd - return 0; - } - -+static struct cur_reg_rule -+*create_ext_reg_rules_from_wmi(u32 num_reg_rules, -+ struct wmi_regulatory_ext_rule *wmi_reg_rule) -+{ -+ struct cur_reg_rule *reg_rule_ptr; -+ u32 count; -+ -+ reg_rule_ptr = kcalloc(num_reg_rules, sizeof(*reg_rule_ptr), GFP_ATOMIC); -+ -+ if (!reg_rule_ptr) -+ return NULL; -+ -+ for (count = 0; count < num_reg_rules; count++) { -+ reg_rule_ptr[count].start_freq = -+ u32_get_bits(wmi_reg_rule[count].freq_info, -+ REG_RULE_START_FREQ); -+ reg_rule_ptr[count].end_freq = -+ u32_get_bits(wmi_reg_rule[count].freq_info, -+ REG_RULE_END_FREQ); -+ reg_rule_ptr[count].max_bw = -+ u32_get_bits(wmi_reg_rule[count].bw_pwr_info, -+ REG_RULE_MAX_BW); -+ reg_rule_ptr[count].reg_power = -+ u32_get_bits(wmi_reg_rule[count].bw_pwr_info, -+ REG_RULE_REG_PWR); -+ reg_rule_ptr[count].ant_gain = -+ u32_get_bits(wmi_reg_rule[count].bw_pwr_info, -+ REG_RULE_ANT_GAIN); -+ reg_rule_ptr[count].flags = -+ u32_get_bits(wmi_reg_rule[count].flag_info, -+ REG_RULE_FLAGS); -+ reg_rule_ptr[count].psd_flag = -+ u32_get_bits(wmi_reg_rule[count].psd_power_info, -+ REG_RULE_PSD_INFO); -+ reg_rule_ptr[count].psd_eirp = -+ u32_get_bits(wmi_reg_rule[count].psd_power_info, -+ REG_RULE_PSD_EIRP); -+ } -+ -+ return reg_rule_ptr; -+} -+ -+static u8 -+ath11k_invalid_5ghz_reg_ext_rules_from_wmi(u32 num_reg_rules, -+ const struct wmi_regulatory_ext_rule *rule) -+{ -+ u8 num_invalid_5ghz_rules = 0; -+ u32 count, start_freq; -+ -+ for (count = 0; count < num_reg_rules; count++) { -+ start_freq = u32_get_bits(rule[count].freq_info, -+ REG_RULE_START_FREQ); -+ -+ if (start_freq >= ATH11K_MIN_6G_FREQ) -+ num_invalid_5ghz_rules++; -+ } -+ -+ return num_invalid_5ghz_rules; -+} -+ -+static int ath11k_pull_reg_chan_list_ext_update_ev(struct ath11k_base *ab, -+ struct sk_buff *skb, -+ struct cur_regulatory_info *reg_info) -+{ -+ const void **tb; -+ const struct wmi_reg_chan_list_cc_ext_event *ext_chan_list_event_hdr; -+ struct wmi_regulatory_ext_rule *ext_wmi_reg_rule; -+ u32 num_2ghz_reg_rules, num_5ghz_reg_rules; -+ u32 num_6ghz_reg_rules_ap[WMI_REG_CURRENT_MAX_AP_TYPE]; -+ u32 num_6ghz_client[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE]; -+ u32 total_reg_rules = 0; -+ int ret, i, j, num_invalid_5ghz_ext_rules = 0; -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, "processing regulatory ext channel list\n"); -+ -+ tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); -+ if (IS_ERR(tb)) { -+ ret = PTR_ERR(tb); -+ ath11k_warn(ab, "failed to parse tlv: %d\n", ret); -+ return ret; -+ } -+ -+ ext_chan_list_event_hdr = tb[WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT]; -+ if (!ext_chan_list_event_hdr) { -+ ath11k_warn(ab, "failed to fetch reg chan list ext update ev\n"); -+ kfree(tb); -+ return -EPROTO; -+ } -+ -+ reg_info->num_2ghz_reg_rules = -+ ext_chan_list_event_hdr->num_2ghz_reg_rules; -+ reg_info->num_5ghz_reg_rules = -+ ext_chan_list_event_hdr->num_5ghz_reg_rules; -+ reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP] = -+ ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_lpi; -+ reg_info->num_6ghz_rules_ap[WMI_REG_STANDARD_POWER_AP] = -+ ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_sp; -+ reg_info->num_6ghz_rules_ap[WMI_REG_VERY_LOW_POWER_AP] = -+ ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_vlp; -+ -+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { -+ reg_info->num_6ghz_rules_client[WMI_REG_INDOOR_AP][i] = -+ ext_chan_list_event_hdr->num_6ghz_reg_rules_client_lpi[i]; -+ reg_info->num_6ghz_rules_client[WMI_REG_STANDARD_POWER_AP][i] = -+ ext_chan_list_event_hdr->num_6ghz_reg_rules_client_sp[i]; -+ reg_info->num_6ghz_rules_client[WMI_REG_VERY_LOW_POWER_AP][i] = -+ ext_chan_list_event_hdr->num_6ghz_reg_rules_client_vlp[i]; -+ } -+ -+ num_2ghz_reg_rules = reg_info->num_2ghz_reg_rules; -+ num_5ghz_reg_rules = reg_info->num_5ghz_reg_rules; -+ -+ total_reg_rules += num_2ghz_reg_rules; -+ total_reg_rules += num_5ghz_reg_rules; -+ -+ if ((num_2ghz_reg_rules > MAX_REG_RULES) || -+ (num_5ghz_reg_rules > MAX_REG_RULES)) { -+ ath11k_warn(ab, "Num reg rules for 2.4 GHz/5 GHz exceeds max limit (num_2ghz_reg_rules: %d num_5ghz_reg_rules: %d max_rules: %d)\n", -+ num_2ghz_reg_rules, num_5ghz_reg_rules, MAX_REG_RULES); -+ kfree(tb); -+ return -EINVAL; -+ } -+ -+ for (i = 0; i < WMI_REG_CURRENT_MAX_AP_TYPE; i++) { -+ num_6ghz_reg_rules_ap[i] = reg_info->num_6ghz_rules_ap[i]; -+ -+ if (num_6ghz_reg_rules_ap[i] > MAX_6GHZ_REG_RULES) { -+ ath11k_warn(ab, "Num 6 GHz reg rules for AP mode(%d) exceeds max limit (num_6ghz_reg_rules_ap: %d, max_rules: %d)\n", -+ i, num_6ghz_reg_rules_ap[i], MAX_6GHZ_REG_RULES); -+ kfree(tb); -+ return -EINVAL; -+ } -+ -+ total_reg_rules += num_6ghz_reg_rules_ap[i]; -+ } -+ -+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { -+ num_6ghz_client[WMI_REG_INDOOR_AP][i] = -+ reg_info->num_6ghz_rules_client[WMI_REG_INDOOR_AP][i]; -+ total_reg_rules += num_6ghz_client[WMI_REG_INDOOR_AP][i]; -+ -+ num_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] = -+ reg_info->num_6ghz_rules_client[WMI_REG_STANDARD_POWER_AP][i]; -+ total_reg_rules += num_6ghz_client[WMI_REG_STANDARD_POWER_AP][i]; -+ -+ num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] = -+ reg_info->num_6ghz_rules_client[WMI_REG_VERY_LOW_POWER_AP][i]; -+ total_reg_rules += num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i]; -+ -+ if ((num_6ghz_client[WMI_REG_INDOOR_AP][i] > MAX_6GHZ_REG_RULES) || -+ (num_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] > -+ MAX_6GHZ_REG_RULES) || -+ (num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] > -+ MAX_6GHZ_REG_RULES)) { -+ ath11k_warn(ab, -+ "Num 6 GHz client reg rules exceeds max limit, for client(type: %d)\n", -+ i); -+ kfree(tb); -+ return -EINVAL; -+ } -+ } -+ -+ if (!total_reg_rules) { -+ ath11k_warn(ab, "No reg rules available\n"); -+ kfree(tb); -+ return -EINVAL; -+ } -+ -+ memcpy(reg_info->alpha2, &ext_chan_list_event_hdr->alpha2, -+ REG_ALPHA2_LEN); -+ -+ reg_info->dfs_region = ext_chan_list_event_hdr->dfs_region; -+ reg_info->phybitmap = ext_chan_list_event_hdr->phybitmap; -+ reg_info->num_phy = ext_chan_list_event_hdr->num_phy; -+ reg_info->phy_id = ext_chan_list_event_hdr->phy_id; -+ reg_info->ctry_code = ext_chan_list_event_hdr->country_id; -+ reg_info->reg_dmn_pair = ext_chan_list_event_hdr->domain_code; -+ -+ reg_info->status_code = -+ ath11k_wmi_cc_setting_code_to_reg(ext_chan_list_event_hdr->status_code); -+ -+ reg_info->is_ext_reg_event = true; -+ -+ reg_info->min_bw_2ghz = ext_chan_list_event_hdr->min_bw_2ghz; -+ reg_info->max_bw_2ghz = ext_chan_list_event_hdr->max_bw_2ghz; -+ reg_info->min_bw_5ghz = ext_chan_list_event_hdr->min_bw_5ghz; -+ reg_info->max_bw_5ghz = ext_chan_list_event_hdr->max_bw_5ghz; -+ -+ reg_info->min_bw_6ghz_ap[WMI_REG_INDOOR_AP] = -+ ext_chan_list_event_hdr->min_bw_6ghz_ap_lpi; -+ reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP] = -+ ext_chan_list_event_hdr->max_bw_6ghz_ap_lpi; -+ reg_info->min_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] = -+ ext_chan_list_event_hdr->min_bw_6ghz_ap_sp; -+ reg_info->max_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] = -+ ext_chan_list_event_hdr->max_bw_6ghz_ap_sp; -+ reg_info->min_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] = -+ ext_chan_list_event_hdr->min_bw_6ghz_ap_vlp; -+ reg_info->max_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] = -+ ext_chan_list_event_hdr->max_bw_6ghz_ap_vlp; -+ -+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { -+ reg_info->min_bw_6ghz_client[WMI_REG_INDOOR_AP][i] = -+ ext_chan_list_event_hdr->min_bw_6ghz_client_lpi[i]; -+ reg_info->max_bw_6ghz_client[WMI_REG_INDOOR_AP][i] = -+ ext_chan_list_event_hdr->max_bw_6ghz_client_lpi[i]; -+ reg_info->min_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] = -+ ext_chan_list_event_hdr->min_bw_6ghz_client_sp[i]; -+ reg_info->max_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] = -+ ext_chan_list_event_hdr->max_bw_6ghz_client_sp[i]; -+ reg_info->min_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] = -+ ext_chan_list_event_hdr->min_bw_6ghz_client_vlp[i]; -+ reg_info->max_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] = -+ ext_chan_list_event_hdr->max_bw_6ghz_client_vlp[i]; -+ } -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "%s:cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d", -+ __func__, reg_info->alpha2, reg_info->dfs_region, -+ reg_info->min_bw_2ghz, reg_info->max_bw_2ghz, -+ reg_info->min_bw_5ghz, reg_info->max_bw_5ghz); -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "num_2ghz_reg_rules %d num_5ghz_reg_rules %d", -+ num_2ghz_reg_rules, num_5ghz_reg_rules); -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "num_6ghz_reg_rules_ap_lpi: %d num_6ghz_reg_rules_ap_sp: %d num_6ghz_reg_rules_ap_vlp: %d", -+ num_6ghz_reg_rules_ap[WMI_REG_INDOOR_AP], -+ num_6ghz_reg_rules_ap[WMI_REG_STANDARD_POWER_AP], -+ num_6ghz_reg_rules_ap[WMI_REG_VERY_LOW_POWER_AP]); -+ -+ j = WMI_REG_DEFAULT_CLIENT; -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz Regular client: num_6ghz_reg_rules_lpi: %d num_6ghz_reg_rules_sp: %d num_6ghz_reg_rules_vlp: %d", -+ num_6ghz_client[WMI_REG_INDOOR_AP][j], -+ num_6ghz_client[WMI_REG_STANDARD_POWER_AP][j], -+ num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][j]); -+ -+ j = WMI_REG_SUBORDINATE_CLIENT; -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz Subordinate client: num_6ghz_reg_rules_lpi: %d num_6ghz_reg_rules_sp: %d num_6ghz_reg_rules_vlp: %d", -+ num_6ghz_client[WMI_REG_INDOOR_AP][j], -+ num_6ghz_client[WMI_REG_STANDARD_POWER_AP][j], -+ num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][j]); -+ -+ ext_wmi_reg_rule = -+ (struct wmi_regulatory_ext_rule *)((u8 *)ext_chan_list_event_hdr -+ + sizeof(*ext_chan_list_event_hdr) -+ + sizeof(struct wmi_tlv)); -+ if (num_2ghz_reg_rules) { -+ reg_info->reg_rules_2ghz_ptr = -+ create_ext_reg_rules_from_wmi(num_2ghz_reg_rules, -+ ext_wmi_reg_rule); -+ -+ if (!reg_info->reg_rules_2ghz_ptr) { -+ kfree(tb); -+ ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n"); -+ return -ENOMEM; -+ } -+ } -+ -+ ext_wmi_reg_rule += num_2ghz_reg_rules; -+ -+ /* Firmware might include 6 GHz reg rule in 5 GHz rule list -+ * for few countries along with separate 6 GHz rule. -+ * Having same 6 GHz reg rule in 5 GHz and 6 GHz rules list -+ * causes intersect check to be true, and same rules will be -+ * shown multiple times in iw cmd. -+ * Hence, avoid parsing 6 GHz rule from 5 GHz reg rule list -+ */ -+ num_invalid_5ghz_ext_rules = -+ ath11k_invalid_5ghz_reg_ext_rules_from_wmi(num_5ghz_reg_rules, -+ ext_wmi_reg_rule); -+ -+ if (num_invalid_5ghz_ext_rules) { -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "CC: %s 5 GHz reg rules number %d from fw, %d number of invalid 5 GHz rules", -+ reg_info->alpha2, reg_info->num_5ghz_reg_rules, -+ num_invalid_5ghz_ext_rules); -+ -+ num_5ghz_reg_rules = num_5ghz_reg_rules - num_invalid_5ghz_ext_rules; -+ reg_info->num_5ghz_reg_rules = num_5ghz_reg_rules; -+ } -+ -+ if (num_5ghz_reg_rules) { -+ reg_info->reg_rules_5ghz_ptr = -+ create_ext_reg_rules_from_wmi(num_5ghz_reg_rules, -+ ext_wmi_reg_rule); -+ -+ if (!reg_info->reg_rules_5ghz_ptr) { -+ kfree(tb); -+ ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n"); -+ return -ENOMEM; -+ } -+ } -+ -+ /* We have adjusted the number of 5 GHz reg rules above. But still those -+ * many rules needs to be adjusted in ext_wmi_reg_rule. -+ * -+ * NOTE: num_invalid_5ghz_ext_rules will be 0 for rest other cases. -+ */ -+ ext_wmi_reg_rule += (num_5ghz_reg_rules + num_invalid_5ghz_ext_rules); -+ -+ for (i = 0; i < WMI_REG_CURRENT_MAX_AP_TYPE; i++) { -+ reg_info->reg_rules_6ghz_ap_ptr[i] = -+ create_ext_reg_rules_from_wmi(num_6ghz_reg_rules_ap[i], -+ ext_wmi_reg_rule); -+ -+ if (!reg_info->reg_rules_6ghz_ap_ptr[i]) { -+ kfree(tb); -+ ath11k_warn(ab, "Unable to Allocate memory for 6 GHz AP rules\n"); -+ return -ENOMEM; -+ } -+ -+ ext_wmi_reg_rule += num_6ghz_reg_rules_ap[i]; -+ } -+ -+ for (j = 0; j < WMI_REG_CURRENT_MAX_AP_TYPE; j++) { -+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { -+ reg_info->reg_rules_6ghz_client_ptr[j][i] = -+ create_ext_reg_rules_from_wmi(num_6ghz_client[j][i], -+ ext_wmi_reg_rule); -+ -+ if (!reg_info->reg_rules_6ghz_client_ptr[j][i]) { -+ kfree(tb); -+ ath11k_warn(ab, "Unable to Allocate memory for 6 GHz client rules\n"); -+ return -ENOMEM; -+ } -+ -+ ext_wmi_reg_rule += num_6ghz_client[j][i]; -+ } -+ } -+ -+ reg_info->client_type = ext_chan_list_event_hdr->client_type; -+ reg_info->rnr_tpe_usable = ext_chan_list_event_hdr->rnr_tpe_usable; -+ reg_info->unspecified_ap_usable = -+ ext_chan_list_event_hdr->unspecified_ap_usable; -+ reg_info->domain_code_6ghz_ap[WMI_REG_INDOOR_AP] = -+ ext_chan_list_event_hdr->domain_code_6ghz_ap_lpi; -+ reg_info->domain_code_6ghz_ap[WMI_REG_STANDARD_POWER_AP] = -+ ext_chan_list_event_hdr->domain_code_6ghz_ap_sp; -+ reg_info->domain_code_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] = -+ ext_chan_list_event_hdr->domain_code_6ghz_ap_vlp; -+ -+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { -+ reg_info->domain_code_6ghz_client[WMI_REG_INDOOR_AP][i] = -+ ext_chan_list_event_hdr->domain_code_6ghz_client_lpi[i]; -+ reg_info->domain_code_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] = -+ ext_chan_list_event_hdr->domain_code_6ghz_client_sp[i]; -+ reg_info->domain_code_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] = -+ ext_chan_list_event_hdr->domain_code_6ghz_client_vlp[i]; -+ } -+ -+ reg_info->domain_code_6ghz_super_id = -+ ext_chan_list_event_hdr->domain_code_6ghz_super_id; -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, "6 GHz client_type: %d domain_code_6ghz_super_id: %d", -+ reg_info->client_type, reg_info->domain_code_6ghz_super_id); -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, "processed regulatory ext channel list\n"); -+ -+ kfree(tb); -+ return 0; -+} -+ - static int ath11k_pull_peer_del_resp_ev(struct ath11k_base *ab, struct sk_buff *skb, - struct wmi_peer_delete_resp_event *peer_del_resp) - { -@@ -6507,12 +6876,14 @@ static bool ath11k_reg_is_world_alpha(ch - return false; - } - --static int ath11k_reg_chan_list_event(struct ath11k_base *ab, struct sk_buff *skb) -+static int ath11k_reg_chan_list_event(struct ath11k_base *ab, -+ struct sk_buff *skb, -+ enum wmi_reg_chan_list_cmd_type id) - { - struct cur_regulatory_info *reg_info = NULL; - struct ieee80211_regdomain *regd = NULL; - bool intersect = false; -- int ret = 0, pdev_idx; -+ int ret = 0, pdev_idx, i, j; - struct ath11k *ar; - - reg_info = kzalloc(sizeof(*reg_info), GFP_ATOMIC); -@@ -6521,7 +6892,11 @@ static int ath11k_reg_chan_list_event(st - goto fallback; - } - -- ret = ath11k_pull_reg_chan_list_update_ev(ab, skb, reg_info); -+ if (id == WMI_REG_CHAN_LIST_CC_ID) -+ ret = ath11k_pull_reg_chan_list_update_ev(ab, skb, reg_info); -+ else -+ ret = ath11k_pull_reg_chan_list_ext_update_ev(ab, skb, reg_info); -+ - if (ret) { - ath11k_warn(ab, "failed to extract regulatory info from received event\n"); - goto fallback; -@@ -6623,6 +6998,14 @@ mem_free: - if (reg_info) { - kfree(reg_info->reg_rules_2ghz_ptr); - kfree(reg_info->reg_rules_5ghz_ptr); -+ if (reg_info->is_ext_reg_event) { -+ for (i = 0; i < WMI_REG_CURRENT_MAX_AP_TYPE; i++) -+ kfree(reg_info->reg_rules_6ghz_ap_ptr[i]); -+ -+ for (j = 0; j < WMI_REG_CURRENT_MAX_AP_TYPE; j++) -+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) -+ kfree(reg_info->reg_rules_6ghz_client_ptr[j][i]); -+ } - kfree(reg_info); - } - return ret; -@@ -8054,7 +8437,10 @@ static void ath11k_wmi_tlv_op_rx(struct - ath11k_service_ready_ext2_event(ab, skb); - break; - case WMI_REG_CHAN_LIST_CC_EVENTID: -- ath11k_reg_chan_list_event(ab, skb); -+ ath11k_reg_chan_list_event(ab, skb, WMI_REG_CHAN_LIST_CC_ID); -+ break; -+ case WMI_REG_CHAN_LIST_CC_EXT_EVENTID: -+ ath11k_reg_chan_list_event(ab, skb, WMI_REG_CHAN_LIST_CC_EXT_ID); - break; - case WMI_READY_EVENTID: - ath11k_ready_event(ab, skb); ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -797,6 +797,7 @@ enum wmi_tlv_event_id { - WMI_RMC_NEW_LEADER_EVENTID = WMI_TLV_CMD(WMI_GRP_RMC), - WMI_REG_CHAN_LIST_CC_EVENTID = WMI_TLV_CMD(WMI_GRP_REGULATORY), - WMI_11D_NEW_COUNTRY_EVENTID, -+ WMI_REG_CHAN_LIST_CC_EXT_EVENTID, - WMI_NDI_CAP_RSP_EVENTID = WMI_TLV_CMD(WMI_GRP_PROTOTYPE), - WMI_NDP_INITIATOR_RSP_EVENTID, - WMI_NDP_RESPONDER_RSP_EVENTID, -@@ -1865,6 +1866,8 @@ enum wmi_tlv_tag { - WMI_TAG_PDEV_SRG_OBSS_BSSID_ENABLE_BITMAP_CMD, - WMI_TAG_PDEV_NON_SRG_OBSS_COLOR_ENABLE_BITMAP_CMD, - WMI_TAG_PDEV_NON_SRG_OBSS_BSSID_ENABLE_BITMAP_CMD, -+ WMI_TAG_REGULATORY_RULE_EXT_STRUCT = 0x3A9, -+ WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT, - WMI_TAG_PDEV_SET_BIOS_SAR_TABLE_CMD = 0x3D8, - WMI_TAG_PDEV_SET_BIOS_GEO_TABLE_CMD, - WMI_TAG_MAX -@@ -2097,6 +2100,7 @@ enum wmi_tlv_service { - - /* The second 128 bits */ - WMI_MAX_EXT_SERVICE = 256, -+ WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT = 281, - WMI_TLV_SERVICE_BIOS_SAR_SUPPORT = 326, - - /* The third 128 bits */ -@@ -2313,6 +2317,8 @@ struct wmi_init_cmd { - #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64 BIT(5) - #define WMI_RSRC_CFG_FLAG1_ACK_RSSI BIT(18) - -+#define WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT 4 -+ - struct wmi_resource_config { - u32 tlv_header; - u32 num_vdevs; -@@ -2372,6 +2378,15 @@ struct wmi_resource_config { - u32 sched_params; - u32 twt_ap_pdev_count; - u32 twt_ap_sta_count; -+ u32 max_nlo_ssids; -+ u32 num_pkt_filters; -+ u32 num_max_sta_vdevs; -+ u32 max_bssid_indicator; -+ u32 ul_resp_config; -+ u32 msdu_flow_override_config0; -+ u32 msdu_flow_override_config1; -+ u32 flags2; -+ u32 host_service_flags; - } __packed; - - struct wmi_service_ready_event { -@@ -2854,6 +2869,8 @@ struct rx_reorder_queue_remove_params { - #define REG_RULE_MAX_BW 0x0000ffff - #define REG_RULE_REG_PWR 0x00ff0000 - #define REG_RULE_ANT_GAIN 0xff000000 -+#define REG_RULE_PSD_INFO BIT(0) -+#define REG_RULE_PSD_EIRP 0xff0000 - - #define WMI_VDEV_PARAM_TXBF_SU_TX_BFEE BIT(0) - #define WMI_VDEV_PARAM_TXBF_MU_TX_BFEE BIT(1) -@@ -4049,6 +4066,7 @@ struct wmi_he_rate_set { - - #define MAX_REG_RULES 10 - #define REG_ALPHA2_LEN 2 -+#define MAX_6GHZ_REG_RULES 5 - - enum wmi_start_event_param { - WMI_VDEV_START_RESP_EVENT = 0, -@@ -4079,16 +4097,6 @@ enum wmi_vdev_start_resp_status_code { - WMI_VDEV_START_RESPONSE_INVALID_REGDOMAIN = 4, - }; - --; --enum cc_setting_code { -- REG_SET_CC_STATUS_PASS = 0, -- REG_CURRENT_ALPHA2_NOT_FOUND = 1, -- REG_INIT_ALPHA2_NOT_FOUND = 2, -- REG_SET_CC_CHANGE_NOT_ALLOWED = 3, -- REG_SET_CC_STATUS_NO_MEMORY = 4, -- REG_SET_CC_STATUS_FAIL = 5, --}; -- - /* Regaulatory Rule Flags Passed by FW */ - #define REGULATORY_CHAN_DISABLED BIT(0) - #define REGULATORY_CHAN_NO_IR BIT(1) -@@ -4102,13 +4110,72 @@ enum cc_setting_code { - #define REGULATORY_CHAN_NO_20MHZ BIT(11) - #define REGULATORY_CHAN_NO_10MHZ BIT(12) - --enum { -+enum wmi_reg_chan_list_cmd_type { -+ WMI_REG_CHAN_LIST_CC_ID = 0, -+ WMI_REG_CHAN_LIST_CC_EXT_ID = 1, -+}; -+ -+enum wmi_reg_cc_setting_code { - WMI_REG_SET_CC_STATUS_PASS = 0, - WMI_REG_CURRENT_ALPHA2_NOT_FOUND = 1, - WMI_REG_INIT_ALPHA2_NOT_FOUND = 2, - WMI_REG_SET_CC_CHANGE_NOT_ALLOWED = 3, - WMI_REG_SET_CC_STATUS_NO_MEMORY = 4, - WMI_REG_SET_CC_STATUS_FAIL = 5, -+ -+ /* add new setting code above, update in -+ * @enum cc_setting_code as well. -+ * Also handle it in ath11k_wmi_cc_setting_code_to_reg() -+ */ -+}; -+ -+enum cc_setting_code { -+ REG_SET_CC_STATUS_PASS = 0, -+ REG_CURRENT_ALPHA2_NOT_FOUND = 1, -+ REG_INIT_ALPHA2_NOT_FOUND = 2, -+ REG_SET_CC_CHANGE_NOT_ALLOWED = 3, -+ REG_SET_CC_STATUS_NO_MEMORY = 4, -+ REG_SET_CC_STATUS_FAIL = 5, -+ -+ /* add new setting code above, update in -+ * @enum wmi_reg_cc_setting_code as well. -+ */ -+}; -+ -+static inline enum cc_setting_code -+ath11k_wmi_cc_setting_code_to_reg(enum wmi_reg_cc_setting_code status_code) -+{ -+ switch (status_code) { -+ case WMI_REG_SET_CC_STATUS_PASS: -+ return REG_SET_CC_STATUS_PASS; -+ case WMI_REG_CURRENT_ALPHA2_NOT_FOUND: -+ return REG_CURRENT_ALPHA2_NOT_FOUND; -+ case WMI_REG_INIT_ALPHA2_NOT_FOUND: -+ return REG_INIT_ALPHA2_NOT_FOUND; -+ case WMI_REG_SET_CC_CHANGE_NOT_ALLOWED: -+ return REG_SET_CC_CHANGE_NOT_ALLOWED; -+ case WMI_REG_SET_CC_STATUS_NO_MEMORY: -+ return REG_SET_CC_STATUS_NO_MEMORY; -+ case WMI_REG_SET_CC_STATUS_FAIL: -+ return REG_SET_CC_STATUS_FAIL; -+ } -+ -+ return REG_SET_CC_STATUS_FAIL; -+} -+ -+enum wmi_reg_6ghz_ap_type { -+ WMI_REG_INDOOR_AP = 0, -+ WMI_REG_STANDARD_POWER_AP = 1, -+ WMI_REG_VERY_LOW_POWER_AP = 2, -+ -+ WMI_REG_CURRENT_MAX_AP_TYPE, -+ WMI_REG_MAX_AP_TYPE = 7, -+}; -+ -+enum wmi_reg_6ghz_client_type { -+ WMI_REG_DEFAULT_CLIENT = 0, -+ WMI_REG_SUBORDINATE_CLIENT = 1, -+ WMI_REG_MAX_CLIENT_TYPE = 2, - }; - - struct cur_reg_rule { -@@ -4118,6 +4185,8 @@ struct cur_reg_rule { - u8 reg_power; - u8 ant_gain; - u16 flags; -+ bool psd_flag; -+ s8 psd_eirp; - }; - - struct cur_regulatory_info { -@@ -4137,6 +4206,22 @@ struct cur_regulatory_info { - u32 num_5ghz_reg_rules; - struct cur_reg_rule *reg_rules_2ghz_ptr; - struct cur_reg_rule *reg_rules_5ghz_ptr; -+ bool is_ext_reg_event; -+ enum wmi_reg_6ghz_client_type client_type; -+ bool rnr_tpe_usable; -+ bool unspecified_ap_usable; -+ u8 domain_code_6ghz_ap[WMI_REG_CURRENT_MAX_AP_TYPE]; -+ u8 domain_code_6ghz_client[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE]; -+ u32 domain_code_6ghz_super_id; -+ u32 min_bw_6ghz_ap[WMI_REG_CURRENT_MAX_AP_TYPE]; -+ u32 max_bw_6ghz_ap[WMI_REG_CURRENT_MAX_AP_TYPE]; -+ u32 min_bw_6ghz_client[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE]; -+ u32 max_bw_6ghz_client[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE]; -+ u32 num_6ghz_rules_ap[WMI_REG_CURRENT_MAX_AP_TYPE]; -+ u32 num_6ghz_rules_client[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE]; -+ struct cur_reg_rule *reg_rules_6ghz_ap_ptr[WMI_REG_CURRENT_MAX_AP_TYPE]; -+ struct cur_reg_rule *reg_rules_6ghz_client_ptr -+ [WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE]; - }; - - struct wmi_reg_chan_list_cc_event { -@@ -4163,6 +4248,61 @@ struct wmi_regulatory_rule_struct { - u32 flag_info; - }; - -+#define WMI_REG_CLIENT_MAX 4 -+ -+struct wmi_reg_chan_list_cc_ext_event { -+ u32 status_code; -+ u32 phy_id; -+ u32 alpha2; -+ u32 num_phy; -+ u32 country_id; -+ u32 domain_code; -+ u32 dfs_region; -+ u32 phybitmap; -+ u32 min_bw_2ghz; -+ u32 max_bw_2ghz; -+ u32 min_bw_5ghz; -+ u32 max_bw_5ghz; -+ u32 num_2ghz_reg_rules; -+ u32 num_5ghz_reg_rules; -+ u32 client_type; -+ u32 rnr_tpe_usable; -+ u32 unspecified_ap_usable; -+ u32 domain_code_6ghz_ap_lpi; -+ u32 domain_code_6ghz_ap_sp; -+ u32 domain_code_6ghz_ap_vlp; -+ u32 domain_code_6ghz_client_lpi[WMI_REG_CLIENT_MAX]; -+ u32 domain_code_6ghz_client_sp[WMI_REG_CLIENT_MAX]; -+ u32 domain_code_6ghz_client_vlp[WMI_REG_CLIENT_MAX]; -+ u32 domain_code_6ghz_super_id; -+ u32 min_bw_6ghz_ap_sp; -+ u32 max_bw_6ghz_ap_sp; -+ u32 min_bw_6ghz_ap_lpi; -+ u32 max_bw_6ghz_ap_lpi; -+ u32 min_bw_6ghz_ap_vlp; -+ u32 max_bw_6ghz_ap_vlp; -+ u32 min_bw_6ghz_client_sp[WMI_REG_CLIENT_MAX]; -+ u32 max_bw_6ghz_client_sp[WMI_REG_CLIENT_MAX]; -+ u32 min_bw_6ghz_client_lpi[WMI_REG_CLIENT_MAX]; -+ u32 max_bw_6ghz_client_lpi[WMI_REG_CLIENT_MAX]; -+ u32 min_bw_6ghz_client_vlp[WMI_REG_CLIENT_MAX]; -+ u32 max_bw_6ghz_client_vlp[WMI_REG_CLIENT_MAX]; -+ u32 num_6ghz_reg_rules_ap_sp; -+ u32 num_6ghz_reg_rules_ap_lpi; -+ u32 num_6ghz_reg_rules_ap_vlp; -+ u32 num_6ghz_reg_rules_client_sp[WMI_REG_CLIENT_MAX]; -+ u32 num_6ghz_reg_rules_client_lpi[WMI_REG_CLIENT_MAX]; -+ u32 num_6ghz_reg_rules_client_vlp[WMI_REG_CLIENT_MAX]; -+} __packed; -+ -+struct wmi_regulatory_ext_rule { -+ u32 tlv_header; -+ u32 freq_info; -+ u32 bw_pwr_info; -+ u32 flag_info; -+ u32 psd_power_info; -+} __packed; -+ - struct wmi_vdev_delete_resp_event { - u32 vdev_id; - } __packed; -@@ -5358,6 +5498,7 @@ struct target_resource_config { - u32 sched_params; - u32 twt_ap_pdev_count; - u32 twt_ap_sta_count; -+ u8 is_reg_cc_ext_event_supported; - }; - - enum wmi_debug_log_param { diff --git a/package/kernel/mac80211/patches/ath11k/0045-wifi-ath11k-add-debug-prints-in-regulatory-WMI-event.patch b/package/kernel/mac80211/patches/ath11k/0045-wifi-ath11k-add-debug-prints-in-regulatory-WMI-event.patch deleted file mode 100644 index b88e51928f7abd..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0045-wifi-ath11k-add-debug-prints-in-regulatory-WMI-event.patch +++ /dev/null @@ -1,567 +0,0 @@ -From e238e62ba8868a784e485eb94451c87cd1b85cee Mon Sep 17 00:00:00 2001 -From: Aditya Kumar Singh -Date: Wed, 1 Mar 2023 16:20:59 +0200 -Subject: [PATCH] wifi: ath11k: add debug prints in regulatory WMI event - processing - -Add some more debug prints in processing regulatory WMI event in order to -increase more debuggability. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aditya Kumar Singh -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230110121024.14051-4-quic_adisi@quicinc.com ---- - drivers/net/wireless/ath/ath11k/reg.c | 2 +- - drivers/net/wireless/ath/ath11k/wmi.c | 207 ++++++++++++++++++-------- - drivers/net/wireless/ath/ath11k/wmi.h | 142 ++++++++++++++++++ - 3 files changed, 291 insertions(+), 60 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/reg.c -+++ b/drivers/net/wireless/ath/ath11k/reg.c -@@ -646,7 +646,7 @@ ath11k_reg_build_regd(struct ath11k_base - tmp_regd->dfs_region = ath11k_map_fw_dfs_region(reg_info->dfs_region); - - ath11k_dbg(ab, ATH11K_DBG_REG, -- "\r\nCountry %s, CFG Regdomain %s FW Regdomain %d, num_reg_rules %d\n", -+ "Country %s, CFG Regdomain %s FW Regdomain %d, num_reg_rules %d\n", - alpha2, ath11k_reg_get_regdom_str(tmp_regd->dfs_region), - reg_info->dfs_region, num_rules); - /* Update reg_rules[] below. Firmware is expected to ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -4925,6 +4925,26 @@ static int ath11k_pull_vdev_start_resp_t - return 0; - } - -+static void ath11k_print_reg_rule(struct ath11k_base *ab, const char *band, -+ u32 num_reg_rules, -+ struct cur_reg_rule *reg_rule_ptr) -+{ -+ struct cur_reg_rule *reg_rule = reg_rule_ptr; -+ u32 count; -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, "number of reg rules in %s band: %d\n", -+ band, num_reg_rules); -+ -+ for (count = 0; count < num_reg_rules; count++) { -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "reg rule %d: (%d - %d @ %d) (%d, %d) (FLAGS %d)\n", -+ count + 1, reg_rule->start_freq, reg_rule->end_freq, -+ reg_rule->max_bw, reg_rule->ant_gain, -+ reg_rule->reg_power, reg_rule->flags); -+ reg_rule++; -+ } -+} -+ - static struct cur_reg_rule - *create_reg_rules_from_wmi(u32 num_reg_rules, - struct wmi_regulatory_rule_struct *wmi_reg_rule) -@@ -5006,6 +5026,10 @@ static int ath11k_pull_reg_chan_list_upd - reg_info->ctry_code = chan_list_event_hdr->country_id; - reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code; - -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "status_code %s", -+ ath11k_cc_status_to_str(reg_info->status_code)); -+ - reg_info->status_code = - ath11k_wmi_cc_setting_code_to_reg(chan_list_event_hdr->status_code); - -@@ -5020,13 +5044,13 @@ static int ath11k_pull_reg_chan_list_upd - num_5ghz_reg_rules = reg_info->num_5ghz_reg_rules; - - ath11k_dbg(ab, ATH11K_DBG_WMI, -- "%s:cc %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d", -- __func__, reg_info->alpha2, reg_info->dfs_region, -+ "cc %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d", -+ reg_info->alpha2, reg_info->dfs_region, - reg_info->min_bw_2ghz, reg_info->max_bw_2ghz, - reg_info->min_bw_5ghz, reg_info->max_bw_5ghz); - - ath11k_dbg(ab, ATH11K_DBG_WMI, -- "%s: num_2ghz_reg_rules %d num_5ghz_reg_rules %d", __func__, -+ "num_2ghz_reg_rules %d num_5ghz_reg_rules %d", - num_2ghz_reg_rules, num_5ghz_reg_rules); - - wmi_reg_rule = -@@ -5043,6 +5067,10 @@ static int ath11k_pull_reg_chan_list_upd - ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n"); - return -ENOMEM; - } -+ -+ ath11k_print_reg_rule(ab, "2 GHz", -+ num_2ghz_reg_rules, -+ reg_info->reg_rules_2ghz_ptr); - } - - if (num_5ghz_reg_rules) { -@@ -5055,6 +5083,10 @@ static int ath11k_pull_reg_chan_list_upd - ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n"); - return -ENOMEM; - } -+ -+ ath11k_print_reg_rule(ab, "5 GHz", -+ num_5ghz_reg_rules, -+ reg_info->reg_rules_5ghz_ptr); - } - - ath11k_dbg(ab, ATH11K_DBG_WMI, "processed regulatory channel list\n"); -@@ -5128,7 +5160,7 @@ static int ath11k_pull_reg_chan_list_ext - struct cur_regulatory_info *reg_info) - { - const void **tb; -- const struct wmi_reg_chan_list_cc_ext_event *ext_chan_list_event_hdr; -+ const struct wmi_reg_chan_list_cc_ext_event *ev; - struct wmi_regulatory_ext_rule *ext_wmi_reg_rule; - u32 num_2ghz_reg_rules, num_5ghz_reg_rules; - u32 num_6ghz_reg_rules_ap[WMI_REG_CURRENT_MAX_AP_TYPE]; -@@ -5145,31 +5177,29 @@ static int ath11k_pull_reg_chan_list_ext - return ret; - } - -- ext_chan_list_event_hdr = tb[WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT]; -- if (!ext_chan_list_event_hdr) { -+ ev = tb[WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT]; -+ if (!ev) { - ath11k_warn(ab, "failed to fetch reg chan list ext update ev\n"); - kfree(tb); - return -EPROTO; - } - -- reg_info->num_2ghz_reg_rules = -- ext_chan_list_event_hdr->num_2ghz_reg_rules; -- reg_info->num_5ghz_reg_rules = -- ext_chan_list_event_hdr->num_5ghz_reg_rules; -+ reg_info->num_2ghz_reg_rules = ev->num_2ghz_reg_rules; -+ reg_info->num_5ghz_reg_rules = ev->num_5ghz_reg_rules; - reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP] = -- ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_lpi; -+ ev->num_6ghz_reg_rules_ap_lpi; - reg_info->num_6ghz_rules_ap[WMI_REG_STANDARD_POWER_AP] = -- ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_sp; -+ ev->num_6ghz_reg_rules_ap_sp; - reg_info->num_6ghz_rules_ap[WMI_REG_VERY_LOW_POWER_AP] = -- ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_vlp; -+ ev->num_6ghz_reg_rules_ap_vlp; - - for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { - reg_info->num_6ghz_rules_client[WMI_REG_INDOOR_AP][i] = -- ext_chan_list_event_hdr->num_6ghz_reg_rules_client_lpi[i]; -+ ev->num_6ghz_reg_rules_client_lpi[i]; - reg_info->num_6ghz_rules_client[WMI_REG_STANDARD_POWER_AP][i] = -- ext_chan_list_event_hdr->num_6ghz_reg_rules_client_sp[i]; -+ ev->num_6ghz_reg_rules_client_sp[i]; - reg_info->num_6ghz_rules_client[WMI_REG_VERY_LOW_POWER_AP][i] = -- ext_chan_list_event_hdr->num_6ghz_reg_rules_client_vlp[i]; -+ ev->num_6ghz_reg_rules_client_vlp[i]; - } - - num_2ghz_reg_rules = reg_info->num_2ghz_reg_rules; -@@ -5231,57 +5261,79 @@ static int ath11k_pull_reg_chan_list_ext - return -EINVAL; - } - -- memcpy(reg_info->alpha2, &ext_chan_list_event_hdr->alpha2, -- REG_ALPHA2_LEN); -+ memcpy(reg_info->alpha2, &ev->alpha2, REG_ALPHA2_LEN); -+ -+ reg_info->dfs_region = ev->dfs_region; -+ reg_info->phybitmap = ev->phybitmap; -+ reg_info->num_phy = ev->num_phy; -+ reg_info->phy_id = ev->phy_id; -+ reg_info->ctry_code = ev->country_id; -+ reg_info->reg_dmn_pair = ev->domain_code; - -- reg_info->dfs_region = ext_chan_list_event_hdr->dfs_region; -- reg_info->phybitmap = ext_chan_list_event_hdr->phybitmap; -- reg_info->num_phy = ext_chan_list_event_hdr->num_phy; -- reg_info->phy_id = ext_chan_list_event_hdr->phy_id; -- reg_info->ctry_code = ext_chan_list_event_hdr->country_id; -- reg_info->reg_dmn_pair = ext_chan_list_event_hdr->domain_code; -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "status_code %s", -+ ath11k_cc_status_to_str(reg_info->status_code)); - - reg_info->status_code = -- ath11k_wmi_cc_setting_code_to_reg(ext_chan_list_event_hdr->status_code); -+ ath11k_wmi_cc_setting_code_to_reg(ev->status_code); - - reg_info->is_ext_reg_event = true; - -- reg_info->min_bw_2ghz = ext_chan_list_event_hdr->min_bw_2ghz; -- reg_info->max_bw_2ghz = ext_chan_list_event_hdr->max_bw_2ghz; -- reg_info->min_bw_5ghz = ext_chan_list_event_hdr->min_bw_5ghz; -- reg_info->max_bw_5ghz = ext_chan_list_event_hdr->max_bw_5ghz; -+ reg_info->min_bw_2ghz = ev->min_bw_2ghz; -+ reg_info->max_bw_2ghz = ev->max_bw_2ghz; -+ reg_info->min_bw_5ghz = ev->min_bw_5ghz; -+ reg_info->max_bw_5ghz = ev->max_bw_5ghz; - - reg_info->min_bw_6ghz_ap[WMI_REG_INDOOR_AP] = -- ext_chan_list_event_hdr->min_bw_6ghz_ap_lpi; -+ ev->min_bw_6ghz_ap_lpi; - reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP] = -- ext_chan_list_event_hdr->max_bw_6ghz_ap_lpi; -+ ev->max_bw_6ghz_ap_lpi; - reg_info->min_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] = -- ext_chan_list_event_hdr->min_bw_6ghz_ap_sp; -+ ev->min_bw_6ghz_ap_sp; - reg_info->max_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] = -- ext_chan_list_event_hdr->max_bw_6ghz_ap_sp; -+ ev->max_bw_6ghz_ap_sp; - reg_info->min_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] = -- ext_chan_list_event_hdr->min_bw_6ghz_ap_vlp; -+ ev->min_bw_6ghz_ap_vlp; - reg_info->max_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] = -- ext_chan_list_event_hdr->max_bw_6ghz_ap_vlp; -+ ev->max_bw_6ghz_ap_vlp; -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz AP BW: LPI (%d - %d), SP (%d - %d), VLP (%d - %d)\n", -+ reg_info->min_bw_6ghz_ap[WMI_REG_INDOOR_AP], -+ reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP], -+ reg_info->min_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP], -+ reg_info->max_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP], -+ reg_info->min_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP], -+ reg_info->max_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP]); - - for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { - reg_info->min_bw_6ghz_client[WMI_REG_INDOOR_AP][i] = -- ext_chan_list_event_hdr->min_bw_6ghz_client_lpi[i]; -+ ev->min_bw_6ghz_client_lpi[i]; - reg_info->max_bw_6ghz_client[WMI_REG_INDOOR_AP][i] = -- ext_chan_list_event_hdr->max_bw_6ghz_client_lpi[i]; -+ ev->max_bw_6ghz_client_lpi[i]; - reg_info->min_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] = -- ext_chan_list_event_hdr->min_bw_6ghz_client_sp[i]; -+ ev->min_bw_6ghz_client_sp[i]; - reg_info->max_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] = -- ext_chan_list_event_hdr->max_bw_6ghz_client_sp[i]; -+ ev->max_bw_6ghz_client_sp[i]; - reg_info->min_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] = -- ext_chan_list_event_hdr->min_bw_6ghz_client_vlp[i]; -+ ev->min_bw_6ghz_client_vlp[i]; - reg_info->max_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] = -- ext_chan_list_event_hdr->max_bw_6ghz_client_vlp[i]; -+ ev->max_bw_6ghz_client_vlp[i]; -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz %s BW: LPI (%d - %d), SP (%d - %d), VLP (%d - %d)\n", -+ ath11k_6ghz_client_type_to_str(i), -+ reg_info->min_bw_6ghz_client[WMI_REG_INDOOR_AP][i], -+ reg_info->max_bw_6ghz_client[WMI_REG_INDOOR_AP][i], -+ reg_info->min_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i], -+ reg_info->max_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i], -+ reg_info->min_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i], -+ reg_info->max_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i]); - } - - ath11k_dbg(ab, ATH11K_DBG_WMI, -- "%s:cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d", -- __func__, reg_info->alpha2, reg_info->dfs_region, -+ "cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d", -+ reg_info->alpha2, reg_info->dfs_region, - reg_info->min_bw_2ghz, reg_info->max_bw_2ghz, - reg_info->min_bw_5ghz, reg_info->max_bw_5ghz); - -@@ -5310,9 +5362,8 @@ static int ath11k_pull_reg_chan_list_ext - num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][j]); - - ext_wmi_reg_rule = -- (struct wmi_regulatory_ext_rule *)((u8 *)ext_chan_list_event_hdr -- + sizeof(*ext_chan_list_event_hdr) -- + sizeof(struct wmi_tlv)); -+ (struct wmi_regulatory_ext_rule *)((u8 *)ev + sizeof(*ev) + -+ sizeof(struct wmi_tlv)); - if (num_2ghz_reg_rules) { - reg_info->reg_rules_2ghz_ptr = - create_ext_reg_rules_from_wmi(num_2ghz_reg_rules, -@@ -5323,6 +5374,10 @@ static int ath11k_pull_reg_chan_list_ext - ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n"); - return -ENOMEM; - } -+ -+ ath11k_print_reg_rule(ab, "2 GHz", -+ num_2ghz_reg_rules, -+ reg_info->reg_rules_2ghz_ptr); - } - - ext_wmi_reg_rule += num_2ghz_reg_rules; -@@ -5358,6 +5413,10 @@ static int ath11k_pull_reg_chan_list_ext - ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n"); - return -ENOMEM; - } -+ -+ ath11k_print_reg_rule(ab, "5 GHz", -+ num_5ghz_reg_rules, -+ reg_info->reg_rules_5ghz_ptr); - } - - /* We have adjusted the number of 5 GHz reg rules above. But still those -@@ -5378,10 +5437,17 @@ static int ath11k_pull_reg_chan_list_ext - return -ENOMEM; - } - -+ ath11k_print_reg_rule(ab, ath11k_6ghz_ap_type_to_str(i), -+ num_6ghz_reg_rules_ap[i], -+ reg_info->reg_rules_6ghz_ap_ptr[i]); -+ - ext_wmi_reg_rule += num_6ghz_reg_rules_ap[i]; - } - - for (j = 0; j < WMI_REG_CURRENT_MAX_AP_TYPE; j++) { -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz AP type %s", ath11k_6ghz_ap_type_to_str(j)); -+ - for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { - reg_info->reg_rules_6ghz_client_ptr[j][i] = - create_ext_reg_rules_from_wmi(num_6ghz_client[j][i], -@@ -5393,35 +5459,58 @@ static int ath11k_pull_reg_chan_list_ext - return -ENOMEM; - } - -+ ath11k_print_reg_rule(ab, -+ ath11k_6ghz_client_type_to_str(i), -+ num_6ghz_client[j][i], -+ reg_info->reg_rules_6ghz_client_ptr[j][i]); -+ - ext_wmi_reg_rule += num_6ghz_client[j][i]; - } - } - -- reg_info->client_type = ext_chan_list_event_hdr->client_type; -- reg_info->rnr_tpe_usable = ext_chan_list_event_hdr->rnr_tpe_usable; -+ reg_info->client_type = ev->client_type; -+ reg_info->rnr_tpe_usable = ev->rnr_tpe_usable; - reg_info->unspecified_ap_usable = -- ext_chan_list_event_hdr->unspecified_ap_usable; -+ ev->unspecified_ap_usable; - reg_info->domain_code_6ghz_ap[WMI_REG_INDOOR_AP] = -- ext_chan_list_event_hdr->domain_code_6ghz_ap_lpi; -+ ev->domain_code_6ghz_ap_lpi; - reg_info->domain_code_6ghz_ap[WMI_REG_STANDARD_POWER_AP] = -- ext_chan_list_event_hdr->domain_code_6ghz_ap_sp; -+ ev->domain_code_6ghz_ap_sp; - reg_info->domain_code_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] = -- ext_chan_list_event_hdr->domain_code_6ghz_ap_vlp; -+ ev->domain_code_6ghz_ap_vlp; -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz reg info client type %s rnr_tpe_usable %d unspecified_ap_usable %d AP sub domain: lpi %s, sp %s, vlp %s\n", -+ ath11k_6ghz_client_type_to_str(reg_info->client_type), -+ reg_info->rnr_tpe_usable, -+ reg_info->unspecified_ap_usable, -+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_ap_lpi), -+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_ap_sp), -+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_ap_vlp)); - - for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { - reg_info->domain_code_6ghz_client[WMI_REG_INDOOR_AP][i] = -- ext_chan_list_event_hdr->domain_code_6ghz_client_lpi[i]; -+ ev->domain_code_6ghz_client_lpi[i]; - reg_info->domain_code_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] = -- ext_chan_list_event_hdr->domain_code_6ghz_client_sp[i]; -+ ev->domain_code_6ghz_client_sp[i]; - reg_info->domain_code_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] = -- ext_chan_list_event_hdr->domain_code_6ghz_client_vlp[i]; -+ ev->domain_code_6ghz_client_vlp[i]; -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz client type %s client sub domain: lpi %s, sp %s, vlp %s\n", -+ ath11k_6ghz_client_type_to_str(i), -+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_client_lpi[i]), -+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_client_sp[i]), -+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_client_vlp[i]) -+ ); - } - -- reg_info->domain_code_6ghz_super_id = -- ext_chan_list_event_hdr->domain_code_6ghz_super_id; -+ reg_info->domain_code_6ghz_super_id = ev->domain_code_6ghz_super_id; - -- ath11k_dbg(ab, ATH11K_DBG_WMI, "6 GHz client_type: %d domain_code_6ghz_super_id: %d", -- reg_info->client_type, reg_info->domain_code_6ghz_super_id); -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz client_type %s 6 GHz super domain %s", -+ ath11k_6ghz_client_type_to_str(reg_info->client_type), -+ ath11k_super_reg_6ghz_to_str(reg_info->domain_code_6ghz_super_id)); - - ath11k_dbg(ab, ATH11K_DBG_WMI, "processed regulatory ext channel list\n"); - ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -4139,6 +4139,7 @@ enum cc_setting_code { - - /* add new setting code above, update in - * @enum wmi_reg_cc_setting_code as well. -+ * Also handle it in ath11k_cc_status_to_str() - */ - }; - -@@ -4163,21 +4164,162 @@ ath11k_wmi_cc_setting_code_to_reg(enum w - return REG_SET_CC_STATUS_FAIL; - } - -+static inline const char *ath11k_cc_status_to_str(enum cc_setting_code code) -+{ -+ switch (code) { -+ case REG_SET_CC_STATUS_PASS: -+ return "REG_SET_CC_STATUS_PASS"; -+ case REG_CURRENT_ALPHA2_NOT_FOUND: -+ return "REG_CURRENT_ALPHA2_NOT_FOUND"; -+ case REG_INIT_ALPHA2_NOT_FOUND: -+ return "REG_INIT_ALPHA2_NOT_FOUND"; -+ case REG_SET_CC_CHANGE_NOT_ALLOWED: -+ return "REG_SET_CC_CHANGE_NOT_ALLOWED"; -+ case REG_SET_CC_STATUS_NO_MEMORY: -+ return "REG_SET_CC_STATUS_NO_MEMORY"; -+ case REG_SET_CC_STATUS_FAIL: -+ return "REG_SET_CC_STATUS_FAIL"; -+ } -+ -+ return "Unknown CC status"; -+} -+ - enum wmi_reg_6ghz_ap_type { - WMI_REG_INDOOR_AP = 0, - WMI_REG_STANDARD_POWER_AP = 1, - WMI_REG_VERY_LOW_POWER_AP = 2, - -+ /* add AP type above, handle in ath11k_6ghz_ap_type_to_str() -+ */ - WMI_REG_CURRENT_MAX_AP_TYPE, - WMI_REG_MAX_AP_TYPE = 7, - }; - -+static inline const char * -+ath11k_6ghz_ap_type_to_str(enum wmi_reg_6ghz_ap_type type) -+{ -+ switch (type) { -+ case WMI_REG_INDOOR_AP: -+ return "INDOOR AP"; -+ case WMI_REG_STANDARD_POWER_AP: -+ return "STANDARD POWER AP"; -+ case WMI_REG_VERY_LOW_POWER_AP: -+ return "VERY LOW POWER AP"; -+ case WMI_REG_CURRENT_MAX_AP_TYPE: -+ return "CURRENT_MAX_AP_TYPE"; -+ case WMI_REG_MAX_AP_TYPE: -+ return "MAX_AP_TYPE"; -+ } -+ -+ return "unknown 6 GHz AP type"; -+} -+ - enum wmi_reg_6ghz_client_type { - WMI_REG_DEFAULT_CLIENT = 0, - WMI_REG_SUBORDINATE_CLIENT = 1, - WMI_REG_MAX_CLIENT_TYPE = 2, -+ -+ /* add client type above, handle it in -+ * ath11k_6ghz_client_type_to_str() -+ */ -+}; -+ -+static inline const char * -+ath11k_6ghz_client_type_to_str(enum wmi_reg_6ghz_client_type type) -+{ -+ switch (type) { -+ case WMI_REG_DEFAULT_CLIENT: -+ return "DEFAULT CLIENT"; -+ case WMI_REG_SUBORDINATE_CLIENT: -+ return "SUBORDINATE CLIENT"; -+ case WMI_REG_MAX_CLIENT_TYPE: -+ return "MAX_CLIENT_TYPE"; -+ } -+ -+ return "unknown 6 GHz client type"; -+} -+ -+enum reg_subdomains_6ghz { -+ EMPTY_6GHZ = 0x0, -+ FCC1_CLIENT_LPI_REGULAR_6GHZ = 0x01, -+ FCC1_CLIENT_SP_6GHZ = 0x02, -+ FCC1_AP_LPI_6GHZ = 0x03, -+ FCC1_CLIENT_LPI_SUBORDINATE = FCC1_AP_LPI_6GHZ, -+ FCC1_AP_SP_6GHZ = 0x04, -+ ETSI1_LPI_6GHZ = 0x10, -+ ETSI1_VLP_6GHZ = 0x11, -+ ETSI2_LPI_6GHZ = 0x12, -+ ETSI2_VLP_6GHZ = 0x13, -+ APL1_LPI_6GHZ = 0x20, -+ APL1_VLP_6GHZ = 0x21, -+ -+ /* add sub-domain above, handle it in -+ * ath11k_sub_reg_6ghz_to_str() -+ */ -+}; -+ -+static inline const char * -+ath11k_sub_reg_6ghz_to_str(enum reg_subdomains_6ghz sub_id) -+{ -+ switch (sub_id) { -+ case EMPTY_6GHZ: -+ return "N/A"; -+ case FCC1_CLIENT_LPI_REGULAR_6GHZ: -+ return "FCC1_CLIENT_LPI_REGULAR_6GHZ"; -+ case FCC1_CLIENT_SP_6GHZ: -+ return "FCC1_CLIENT_SP_6GHZ"; -+ case FCC1_AP_LPI_6GHZ: -+ return "FCC1_AP_LPI_6GHZ/FCC1_CLIENT_LPI_SUBORDINATE"; -+ case FCC1_AP_SP_6GHZ: -+ return "FCC1_AP_SP_6GHZ"; -+ case ETSI1_LPI_6GHZ: -+ return "ETSI1_LPI_6GHZ"; -+ case ETSI1_VLP_6GHZ: -+ return "ETSI1_VLP_6GHZ"; -+ case ETSI2_LPI_6GHZ: -+ return "ETSI2_LPI_6GHZ"; -+ case ETSI2_VLP_6GHZ: -+ return "ETSI2_VLP_6GHZ"; -+ case APL1_LPI_6GHZ: -+ return "APL1_LPI_6GHZ"; -+ case APL1_VLP_6GHZ: -+ return "APL1_VLP_6GHZ"; -+ } -+ -+ return "unknown sub reg id"; -+} -+ -+enum reg_super_domain_6ghz { -+ FCC1_6GHZ = 0x01, -+ ETSI1_6GHZ = 0x02, -+ ETSI2_6GHZ = 0x03, -+ APL1_6GHZ = 0x04, -+ FCC1_6GHZ_CL = 0x05, -+ -+ /* add super domain above, handle it in -+ * ath11k_super_reg_6ghz_to_str() -+ */ - }; - -+static inline const char * -+ath11k_super_reg_6ghz_to_str(enum reg_super_domain_6ghz domain_id) -+{ -+ switch (domain_id) { -+ case FCC1_6GHZ: -+ return "FCC1_6GHZ"; -+ case ETSI1_6GHZ: -+ return "ETSI1_6GHZ"; -+ case ETSI2_6GHZ: -+ return "ETSI2_6GHZ"; -+ case APL1_6GHZ: -+ return "APL1_6GHZ"; -+ case FCC1_6GHZ_CL: -+ return "FCC1_6GHZ_CL"; -+ } -+ -+ return "unknown domain id"; -+} -+ - struct cur_reg_rule { - u16 start_freq; - u16 end_freq; diff --git a/package/kernel/mac80211/patches/ath11k/0046-wifi-ath11k-Replace-fake-flex-array-with-flexible-ar.patch b/package/kernel/mac80211/patches/ath11k/0046-wifi-ath11k-Replace-fake-flex-array-with-flexible-ar.patch deleted file mode 100644 index bd1617856442bd..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0046-wifi-ath11k-Replace-fake-flex-array-with-flexible-ar.patch +++ /dev/null @@ -1,246 +0,0 @@ -From 3b1088a09ec9438523c251d8435e78988824bc0d Mon Sep 17 00:00:00 2001 -From: "Gustavo A. R. Silva" -Date: Tue, 7 Mar 2023 16:22:39 -0600 -Subject: [PATCH] wifi: ath11k: Replace fake flex-array with flexible-array - member -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Zero-length arrays as fake flexible arrays are deprecated and we are -moving towards adopting C99 flexible-array members instead. - -Address 25 of the following warnings found with GCC-13 and --fstrict-flex-arrays=3 enabled: -drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c:30:51: warning: array subscript is outside array bounds of ‘const u32[0]’ {aka ‘const unsigned int[]’} [-Warray-bounds=] - -This helps with the ongoing efforts to tighten the FORTIFY_SOURCE -routines on memcpy() and help us make progress towards globally -enabling -fstrict-flex-arrays=3 [1]. - -Link: https://github.com/KSPP/linux/issues/21 -Link: https://github.com/KSPP/linux/issues/266 -Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1] -Signed-off-by: Gustavo A. R. Silva -Reviewed-by: Simon Horman -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/ZAe5L5DtmsQxzqRH@work ---- - .../wireless/ath/ath11k/debugfs_htt_stats.h | 73 +++++++++++-------- - 1 file changed, 43 insertions(+), 30 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h -+++ b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h -@@ -143,7 +143,8 @@ enum htt_tx_pdev_underrun_enum { - /* Bytes stored in little endian order */ - /* Length should be multiple of DWORD */ - struct htt_stats_string_tlv { -- u32 data[0]; /* Can be variable length */ -+ /* Can be variable length */ -+ DECLARE_FLEX_ARRAY(u32, data); - } __packed; - - #define HTT_STATS_MAC_ID GENMASK(7, 0) -@@ -205,27 +206,32 @@ struct htt_tx_pdev_stats_cmn_tlv { - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_pdev_stats_urrn_tlv_v { -- u32 urrn_stats[0]; /* HTT_TX_PDEV_MAX_URRN_STATS */ -+ /* HTT_TX_PDEV_MAX_URRN_STATS */ -+ DECLARE_FLEX_ARRAY(u32, urrn_stats); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_pdev_stats_flush_tlv_v { -- u32 flush_errs[0]; /* HTT_TX_PDEV_MAX_FLUSH_REASON_STATS */ -+ /* HTT_TX_PDEV_MAX_FLUSH_REASON_STATS */ -+ DECLARE_FLEX_ARRAY(u32, flush_errs); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_pdev_stats_sifs_tlv_v { -- u32 sifs_status[0]; /* HTT_TX_PDEV_MAX_SIFS_BURST_STATS */ -+ /* HTT_TX_PDEV_MAX_SIFS_BURST_STATS */ -+ DECLARE_FLEX_ARRAY(u32, sifs_status); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_pdev_stats_phy_err_tlv_v { -- u32 phy_errs[0]; /* HTT_TX_PDEV_MAX_PHY_ERR_STATS */ -+ /* HTT_TX_PDEV_MAX_PHY_ERR_STATS */ -+ DECLARE_FLEX_ARRAY(u32, phy_errs); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_pdev_stats_sifs_hist_tlv_v { -- u32 sifs_hist_status[0]; /* HTT_TX_PDEV_SIFS_BURST_HIST_STATS */ -+ /* HTT_TX_PDEV_SIFS_BURST_HIST_STATS */ -+ DECLARE_FLEX_ARRAY(u32, sifs_hist_status); - }; - - struct htt_tx_pdev_stats_tx_ppdu_stats_tlv_v { -@@ -590,20 +596,20 @@ struct htt_tx_hwq_difs_latency_stats_tlv - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_hwq_cmd_result_stats_tlv_v { -- /* Histogram of sched cmd result */ -- u32 cmd_result[0]; /* HTT_TX_HWQ_MAX_CMD_RESULT_STATS */ -+ /* Histogram of sched cmd result, HTT_TX_HWQ_MAX_CMD_RESULT_STATS */ -+ DECLARE_FLEX_ARRAY(u32, cmd_result); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_hwq_cmd_stall_stats_tlv_v { -- /* Histogram of various pause conitions */ -- u32 cmd_stall_status[0]; /* HTT_TX_HWQ_MAX_CMD_STALL_STATS */ -+ /* Histogram of various pause conitions, HTT_TX_HWQ_MAX_CMD_STALL_STATS */ -+ DECLARE_FLEX_ARRAY(u32, cmd_stall_status); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_hwq_fes_result_stats_tlv_v { -- /* Histogram of number of user fes result */ -- u32 fes_result[0]; /* HTT_TX_HWQ_MAX_FES_RESULT_STATS */ -+ /* Histogram of number of user fes result, HTT_TX_HWQ_MAX_FES_RESULT_STATS */ -+ DECLARE_FLEX_ARRAY(u32, fes_result); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size -@@ -635,8 +641,8 @@ struct htt_tx_hwq_tried_mpdu_cnt_hist_tl - * #define WAL_TXOP_USED_HISTOGRAM_INTERVAL 1000 ( 1 ms ) - */ - struct htt_tx_hwq_txop_used_cnt_hist_tlv_v { -- /* Histogram of txop used cnt */ -- u32 txop_used_cnt_hist[0]; /* HTT_TX_HWQ_TXOP_USED_CNT_HIST */ -+ /* Histogram of txop used cnt, HTT_TX_HWQ_TXOP_USED_CNT_HIST */ -+ DECLARE_FLEX_ARRAY(u32, txop_used_cnt_hist); - }; - - /* == TX SELFGEN STATS == */ -@@ -804,17 +810,20 @@ struct htt_tx_pdev_mpdu_stats_tlv { - /* == TX SCHED STATS == */ - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_sched_txq_cmd_posted_tlv_v { -- u32 sched_cmd_posted[0]; /* HTT_TX_PDEV_SCHED_TX_MODE_MAX */ -+ /* HTT_TX_PDEV_SCHED_TX_MODE_MAX */ -+ DECLARE_FLEX_ARRAY(u32, sched_cmd_posted); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_sched_txq_cmd_reaped_tlv_v { -- u32 sched_cmd_reaped[0]; /* HTT_TX_PDEV_SCHED_TX_MODE_MAX */ -+ /* HTT_TX_PDEV_SCHED_TX_MODE_MAX */ -+ DECLARE_FLEX_ARRAY(u32, sched_cmd_reaped); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_sched_txq_sched_order_su_tlv_v { -- u32 sched_order_su[0]; /* HTT_TX_PDEV_NUM_SCHED_ORDER_LOG */ -+ /* HTT_TX_PDEV_NUM_SCHED_ORDER_LOG */ -+ DECLARE_FLEX_ARRAY(u32, sched_order_su); - }; - - enum htt_sched_txq_sched_ineligibility_tlv_enum { -@@ -842,7 +851,7 @@ enum htt_sched_txq_sched_ineligibility_t - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_sched_txq_sched_ineligibility_tlv_v { - /* indexed by htt_sched_txq_sched_ineligibility_tlv_enum */ -- u32 sched_ineligibility[0]; -+ DECLARE_FLEX_ARRAY(u32, sched_ineligibility); - }; - - #define HTT_TX_PDEV_STATS_SCHED_PER_TXQ_MAC_ID GENMASK(7, 0) -@@ -888,18 +897,20 @@ struct htt_stats_tx_sched_cmn_tlv { - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_tqm_gen_mpdu_stats_tlv_v { -- u32 gen_mpdu_end_reason[0]; /* HTT_TX_TQM_MAX_GEN_MPDU_END_REASON */ -+ /* HTT_TX_TQM_MAX_GEN_MPDU_END_REASON */ -+ DECLARE_FLEX_ARRAY(u32, gen_mpdu_end_reason); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_tqm_list_mpdu_stats_tlv_v { -- u32 list_mpdu_end_reason[0]; /* HTT_TX_TQM_MAX_LIST_MPDU_END_REASON */ -+ /* HTT_TX_TQM_MAX_LIST_MPDU_END_REASON */ -+ DECLARE_FLEX_ARRAY(u32, list_mpdu_end_reason); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_tqm_list_mpdu_cnt_tlv_v { -- u32 list_mpdu_cnt_hist[0]; -- /* HTT_TX_TQM_MAX_LIST_MPDU_CNT_HISTOGRAM_BINS */ -+ /* HTT_TX_TQM_MAX_LIST_MPDU_CNT_HISTOGRAM_BINS */ -+ DECLARE_FLEX_ARRAY(u32, list_mpdu_cnt_hist); - }; - - struct htt_tx_tqm_pdev_stats_tlv_v { -@@ -1098,7 +1109,7 @@ struct htt_tx_de_compl_stats_tlv { - * ENTRIES_PER_BIN_COUNT) - */ - struct htt_tx_de_fw2wbm_ring_full_hist_tlv { -- u32 fw2wbm_ring_full_hist[0]; -+ DECLARE_FLEX_ARRAY(u32, fw2wbm_ring_full_hist); - }; - - struct htt_tx_de_cmn_stats_tlv { -@@ -1151,7 +1162,7 @@ struct htt_ring_if_cmn_tlv { - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_sfm_client_user_tlv_v { - /* Number of DWORDS used per user and per client */ -- u32 dwords_used_by_user_n[0]; -+ DECLARE_FLEX_ARRAY(u32, dwords_used_by_user_n); - }; - - struct htt_sfm_client_tlv { -@@ -1436,12 +1447,14 @@ struct htt_rx_soc_fw_stats_tlv { - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_rx_soc_fw_refill_ring_empty_tlv_v { -- u32 refill_ring_empty_cnt[0]; /* HTT_RX_STATS_REFILL_MAX_RING */ -+ /* HTT_RX_STATS_REFILL_MAX_RING */ -+ DECLARE_FLEX_ARRAY(u32, refill_ring_empty_cnt); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_rx_soc_fw_refill_ring_num_refill_tlv_v { -- u32 refill_ring_num_refill[0]; /* HTT_RX_STATS_REFILL_MAX_RING */ -+ /* HTT_RX_STATS_REFILL_MAX_RING */ -+ DECLARE_FLEX_ARRAY(u32, refill_ring_num_refill); - }; - - /* RXDMA error code from WBM released packets */ -@@ -1473,7 +1486,7 @@ enum htt_rx_rxdma_error_code_enum { - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_rx_soc_fw_refill_ring_num_rxdma_err_tlv_v { -- u32 rxdma_err[0]; /* HTT_RX_RXDMA_MAX_ERR_CODE */ -+ DECLARE_FLEX_ARRAY(u32, rxdma_err); /* HTT_RX_RXDMA_MAX_ERR_CODE */ - }; - - /* REO error code from WBM released packets */ -@@ -1505,7 +1518,7 @@ enum htt_rx_reo_error_code_enum { - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_rx_soc_fw_refill_ring_num_reo_err_tlv_v { -- u32 reo_err[0]; /* HTT_RX_REO_MAX_ERR_CODE */ -+ DECLARE_FLEX_ARRAY(u32, reo_err); /* HTT_RX_REO_MAX_ERR_CODE */ - }; - - /* == RX PDEV STATS == */ -@@ -1622,13 +1635,13 @@ struct htt_rx_pdev_fw_stats_phy_err_tlv - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_rx_pdev_fw_ring_mpdu_err_tlv_v { - /* Num error MPDU for each RxDMA error type */ -- u32 fw_ring_mpdu_err[0]; /* HTT_RX_STATS_RXDMA_MAX_ERR */ -+ DECLARE_FLEX_ARRAY(u32, fw_ring_mpdu_err); /* HTT_RX_STATS_RXDMA_MAX_ERR */ - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_rx_pdev_fw_mpdu_drop_tlv_v { - /* Num MPDU dropped */ -- u32 fw_mpdu_drop[0]; /* HTT_RX_STATS_FW_DROP_REASON_MAX */ -+ DECLARE_FLEX_ARRAY(u32, fw_mpdu_drop); /* HTT_RX_STATS_FW_DROP_REASON_MAX */ - }; - - #define HTT_PDEV_CCA_STATS_TX_FRAME_INFO_PRESENT (0x1) diff --git a/package/kernel/mac80211/patches/ath11k/0047-wifi-ath11k-fix-deinitialization-of-firmware-resourc.patch b/package/kernel/mac80211/patches/ath11k/0047-wifi-ath11k-fix-deinitialization-of-firmware-resourc.patch deleted file mode 100644 index eec11f50e3cea5..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0047-wifi-ath11k-fix-deinitialization-of-firmware-resourc.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 5a78ac33e3cb8822da64dd1af196e83664b332b0 Mon Sep 17 00:00:00 2001 -From: Aditya Kumar Singh -Date: Thu, 9 Mar 2023 15:23:08 +0530 -Subject: [PATCH] wifi: ath11k: fix deinitialization of firmware resources - -Currently, in ath11k_ahb_fw_resources_init(), iommu domain -mapping is done only for the chipsets having fixed firmware -memory. Also, for such chipsets, mapping is done only if it -does not have TrustZone support. - -During deinitialization, only if TrustZone support is not there, -iommu is unmapped back. However, for non fixed firmware memory -chipsets, TrustZone support is not there and this makes the -condition check to true and it tries to unmap the memory which -was not mapped during initialization. - -This leads to the following trace - - -[ 83.198790] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008 -[ 83.259537] Modules linked in: ath11k_ahb ath11k qmi_helpers -.. snip .. -[ 83.280286] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) -[ 83.287228] pc : __iommu_unmap+0x30/0x140 -[ 83.293907] lr : iommu_unmap+0x5c/0xa4 -[ 83.298072] sp : ffff80000b3abad0 -.. snip .. -[ 83.369175] Call trace: -[ 83.376282] __iommu_unmap+0x30/0x140 -[ 83.378541] iommu_unmap+0x5c/0xa4 -[ 83.382360] ath11k_ahb_fw_resource_deinit.part.12+0x2c/0xac [ath11k_ahb] -[ 83.385666] ath11k_ahb_free_resources+0x140/0x17c [ath11k_ahb] -[ 83.392521] ath11k_ahb_shutdown+0x34/0x40 [ath11k_ahb] -[ 83.398248] platform_shutdown+0x20/0x2c -[ 83.403455] device_shutdown+0x16c/0x1c4 -[ 83.407621] kernel_restart_prepare+0x34/0x3c -[ 83.411529] kernel_restart+0x14/0x74 -[ 83.415781] __do_sys_reboot+0x1c4/0x22c -[ 83.419427] __arm64_sys_reboot+0x1c/0x24 -[ 83.423420] invoke_syscall+0x44/0xfc -[ 83.427326] el0_svc_common.constprop.3+0xac/0xe8 -[ 83.430974] do_el0_svc+0xa0/0xa8 -[ 83.435659] el0_svc+0x1c/0x44 -[ 83.438957] el0t_64_sync_handler+0x60/0x144 -[ 83.441910] el0t_64_sync+0x15c/0x160 -[ 83.446343] Code: aa0103f4 f9400001 f90027a1 d2800001 (f94006a0) -[ 83.449903] ---[ end trace 0000000000000000 ]--- - -This can be reproduced by probing an AHB chipset which is not -having a fixed memory region. During reboot (or rmmod) trace -can be seen. - -Fix this issue by adding a condition check on firmware fixed memory -hw_param as done in the counter initialization function. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Fixes: f9eec4947add ("ath11k: Add support for targets without trustzone") -Signed-off-by: Aditya Kumar Singh -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230309095308.24937-1-quic_adisi@quicinc.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 6 ++++++ - 1 file changed, 6 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -1078,6 +1078,12 @@ static int ath11k_ahb_fw_resource_deinit - struct iommu_domain *iommu; - size_t unmapped_size; - -+ /* Chipsets not requiring MSA would have not initialized -+ * MSA resources, return success in such cases. -+ */ -+ if (!ab->hw_params.fixed_fw_mem) -+ return 0; -+ - if (ab_ahb->fw.use_tz) - return 0; - diff --git a/package/kernel/mac80211/patches/ath11k/0048-wifi-ath11k-fix-BUFFER_DONE-read-on-monitor-ring-rx-.patch b/package/kernel/mac80211/patches/ath11k/0048-wifi-ath11k-fix-BUFFER_DONE-read-on-monitor-ring-rx-.patch deleted file mode 100644 index 3e22645331be9f..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0048-wifi-ath11k-fix-BUFFER_DONE-read-on-monitor-ring-rx-.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 68e93ac5a31d4975b25f819b2dfe914c72abc3bb Mon Sep 17 00:00:00 2001 -From: Harshitha Prem -Date: Wed, 15 Mar 2023 12:24:43 +0200 -Subject: [PATCH] wifi: ath11k: fix BUFFER_DONE read on monitor ring rx buffer - -Perform dma_sync_single_for_cpu() on monitor ring rx buffer before -reading BUFFER_DONE tag and do dma_unmap_single() only after device -had set BUFFER_DONE tag to the buffer. - -Also when BUFFER_DONE tag is not set, allow the buffer to get read -next time without freeing skb. - -This helps to fix AP+Monitor VAP with flood traffic scenario to see -monitor ring rx buffer overrun missing BUFFER_DONE tag to be set. - -Also remove redundant rx dma buf free performed on DP -rx_mon_status_refill_ring. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sathishkumar Muruganandam -Signed-off-by: Harshitha Prem -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230309164434.32660-1-quic_hprem@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp_rx.c | 57 ++++++++++--------------- - 1 file changed, 23 insertions(+), 34 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -435,7 +435,6 @@ fail_free_skb: - static int ath11k_dp_rxdma_buf_ring_free(struct ath11k *ar, - struct dp_rxdma_ring *rx_ring) - { -- struct ath11k_pdev_dp *dp = &ar->dp; - struct sk_buff *skb; - int buf_id; - -@@ -453,28 +452,6 @@ static int ath11k_dp_rxdma_buf_ring_free - idr_destroy(&rx_ring->bufs_idr); - spin_unlock_bh(&rx_ring->idr_lock); - -- /* if rxdma1_enable is false, mon_status_refill_ring -- * isn't setup, so don't clean. -- */ -- if (!ar->ab->hw_params.rxdma1_enable) -- return 0; -- -- rx_ring = &dp->rx_mon_status_refill_ring[0]; -- -- spin_lock_bh(&rx_ring->idr_lock); -- idr_for_each_entry(&rx_ring->bufs_idr, skb, buf_id) { -- idr_remove(&rx_ring->bufs_idr, buf_id); -- /* XXX: Understand where internal driver does this dma_unmap -- * of rxdma_buffer. -- */ -- dma_unmap_single(ar->ab->dev, ATH11K_SKB_RXCB(skb)->paddr, -- skb->len + skb_tailroom(skb), DMA_BIDIRECTIONAL); -- dev_kfree_skb_any(skb); -- } -- -- idr_destroy(&rx_ring->bufs_idr); -- spin_unlock_bh(&rx_ring->idr_lock); -- - return 0; - } - -@@ -3029,39 +3006,51 @@ static int ath11k_dp_rx_reap_mon_status_ - - spin_lock_bh(&rx_ring->idr_lock); - skb = idr_find(&rx_ring->bufs_idr, buf_id); -+ spin_unlock_bh(&rx_ring->idr_lock); -+ - if (!skb) { - ath11k_warn(ab, "rx monitor status with invalid buf_id %d\n", - buf_id); -- spin_unlock_bh(&rx_ring->idr_lock); - pmon->buf_state = DP_MON_STATUS_REPLINISH; - goto move_next; - } - -- idr_remove(&rx_ring->bufs_idr, buf_id); -- spin_unlock_bh(&rx_ring->idr_lock); -- - rxcb = ATH11K_SKB_RXCB(skb); - -- dma_unmap_single(ab->dev, rxcb->paddr, -- skb->len + skb_tailroom(skb), -- DMA_FROM_DEVICE); -+ dma_sync_single_for_cpu(ab->dev, rxcb->paddr, -+ skb->len + skb_tailroom(skb), -+ DMA_FROM_DEVICE); - - tlv = (struct hal_tlv_hdr *)skb->data; - if (FIELD_GET(HAL_TLV_HDR_TAG, tlv->tl) != - HAL_RX_STATUS_BUFFER_DONE) { -- ath11k_warn(ab, "mon status DONE not set %lx\n", -+ ath11k_warn(ab, "mon status DONE not set %lx, buf_id %d\n", - FIELD_GET(HAL_TLV_HDR_TAG, -- tlv->tl)); -- dev_kfree_skb_any(skb); -+ tlv->tl), buf_id); -+ /* If done status is missing, hold onto status -+ * ring until status is done for this status -+ * ring buffer. -+ * Keep HP in mon_status_ring unchanged, -+ * and break from here. -+ * Check status for same buffer for next time -+ */ - pmon->buf_state = DP_MON_STATUS_NO_DMA; -- goto move_next; -+ break; - } - -+ spin_lock_bh(&rx_ring->idr_lock); -+ idr_remove(&rx_ring->bufs_idr, buf_id); -+ spin_unlock_bh(&rx_ring->idr_lock); - if (ab->hw_params.full_monitor_mode) { - ath11k_dp_rx_mon_update_status_buf_state(pmon, tlv); - if (paddr == pmon->mon_status_paddr) - pmon->buf_state = DP_MON_STATUS_MATCH; - } -+ -+ dma_unmap_single(ab->dev, rxcb->paddr, -+ skb->len + skb_tailroom(skb), -+ DMA_FROM_DEVICE); -+ - __skb_queue_tail(skb_list, skb); - } else { - pmon->buf_state = DP_MON_STATUS_REPLINISH; diff --git a/package/kernel/mac80211/patches/ath11k/0049-wifi-ath11k-Optimize-6-GHz-scan-time.patch b/package/kernel/mac80211/patches/ath11k/0049-wifi-ath11k-Optimize-6-GHz-scan-time.patch deleted file mode 100644 index f468990feb7831..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0049-wifi-ath11k-Optimize-6-GHz-scan-time.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 8b4d2f080afbd4280ecca0f4b3ceea943a7a86d0 Mon Sep 17 00:00:00 2001 -From: Manikanta Pubbisetty -Date: Thu, 23 Mar 2023 11:39:13 +0530 -Subject: [PATCH] wifi: ath11k: Optimize 6 GHz scan time - -Currently, time taken to scan all supported channels on WCN6750 -is ~8 seconds and connection time is almost 10 seconds. WCN6750 -supports three Wi-Fi bands (i.e., 2.4/5/6 GHz) and the numbers of -channels for scan come around ~100 channels (default case). -Since the chip doesn't have support for DBS (Dual Band Simultaneous), -scans cannot be parallelized resulting in longer scan times. - -Among the 100 odd channels, ~60 channels are in 6 GHz band. Therefore, -optimizing the scan for 6 GHz channels will bring down the overall -scan time. - -WCN6750 firmware has support to scan a 6 GHz channel based on co-located -AP information i.e., RNR IE which is found in the legacy 2.4/5 GHz scan -results. When a scan request with all supported channel list is enqueued -to the firmware, then based on WMI_SCAN_CHAN_FLAG_SCAN_ONLY_IF_RNR_FOUND -scan channel flag, firmware will scan only those 6 GHz channels for which -RNR IEs are found in the legacy scan results. - -In the proposed design, based on NL80211_SCAN_FLAG_COLOCATED_6GHZ scan -flag, driver will set the WMI_SCAN_CHAN_FLAG_SCAN_ONLY_IF_RNR_FOUND flag -for non-PSC channels. Since there is high probability to find 6 GHz APs -on PSC channels, these channels are always scanned. Only non-PSC channels -are selectively scanned based on cached RNR information from the legacy -scan results. - -If NL80211_SCAN_FLAG_COLOCATED_6GHZ is not set in the scan flags, -then scan will happen on all supported channels (default behavior). - -With these optimizations, scan time is improved by 1.5-1.8 seconds on -WCN6750. Similar savings have been observed on WCN6855. - -Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 -Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.16 - -Signed-off-by: Manikanta Pubbisetty -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230323060913.10097-1-quic_mpubbise@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 25 +++++++++++++++++++++++-- - drivers/net/wireless/ath/ath11k/wmi.h | 4 ++++ - 2 files changed, 27 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3819,8 +3819,29 @@ static int ath11k_mac_op_hw_scan(struct - goto exit; - } - -- for (i = 0; i < arg->num_chan; i++) -- arg->chan_list[i] = req->channels[i]->center_freq; -+ for (i = 0; i < arg->num_chan; i++) { -+ if (test_bit(WMI_TLV_SERVICE_SCAN_CONFIG_PER_CHANNEL, -+ ar->ab->wmi_ab.svc_map)) { -+ arg->chan_list[i] = -+ u32_encode_bits(req->channels[i]->center_freq, -+ WMI_SCAN_CONFIG_PER_CHANNEL_MASK); -+ -+ /* If NL80211_SCAN_FLAG_COLOCATED_6GHZ is set in scan -+ * flags, then scan all PSC channels in 6 GHz band and -+ * those non-PSC channels where RNR IE is found during -+ * the legacy 2.4/5 GHz scan. -+ * If NL80211_SCAN_FLAG_COLOCATED_6GHZ is not set, -+ * then all channels in 6 GHz will be scanned. -+ */ -+ if (req->channels[i]->band == NL80211_BAND_6GHZ && -+ req->flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ && -+ !cfg80211_channel_is_psc(req->channels[i])) -+ arg->chan_list[i] |= -+ WMI_SCAN_CH_FLAG_SCAN_ONLY_IF_RNR_FOUND; -+ } else { -+ arg->chan_list[i] = req->channels[i]->center_freq; -+ } -+ } - } - - if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2100,6 +2100,7 @@ enum wmi_tlv_service { - - /* The second 128 bits */ - WMI_MAX_EXT_SERVICE = 256, -+ WMI_TLV_SERVICE_SCAN_CONFIG_PER_CHANNEL = 265, - WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT = 281, - WMI_TLV_SERVICE_BIOS_SAR_SUPPORT = 326, - -@@ -3249,6 +3250,9 @@ struct wmi_start_scan_cmd { - #define WMI_SCAN_DWELL_MODE_SHIFT 21 - #define WMI_SCAN_FLAG_EXT_PASSIVE_SCAN_START_TIME_ENHANCE 0x00000800 - -+#define WMI_SCAN_CONFIG_PER_CHANNEL_MASK GENMASK(19, 0) -+#define WMI_SCAN_CH_FLAG_SCAN_ONLY_IF_RNR_FOUND BIT(20) -+ - enum { - WMI_SCAN_DWELL_MODE_DEFAULT = 0, - WMI_SCAN_DWELL_MODE_CONSERVATIVE = 1, diff --git a/package/kernel/mac80211/patches/ath11k/0050-wifi-ath11k-Configure-the-FTM-responder-role-using-f.patch b/package/kernel/mac80211/patches/ath11k/0050-wifi-ath11k-Configure-the-FTM-responder-role-using-f.patch deleted file mode 100644 index bca08b177fd11c..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0050-wifi-ath11k-Configure-the-FTM-responder-role-using-f.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 813968c24126cc5c8320cd5db0e262069a535063 Mon Sep 17 00:00:00 2001 -From: Ganesh Babu Jothiram -Date: Fri, 24 Mar 2023 16:57:00 +0200 -Subject: [PATCH] wifi: ath11k: Configure the FTM responder role using firmware - capability flag - -Fine Time Measurement(FTM) is offloaded feature to firmware. -Hence, the configuration of FTM responder role is done using -firmware capability flag instead of hw param. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Ganesh Babu Jothiram -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230317072034.8217-1-quic_gjothira@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 8 -------- - drivers/net/wireless/ath/ath11k/hw.h | 1 - - drivers/net/wireless/ath/ath11k/mac.c | 4 ++-- - 3 files changed, 2 insertions(+), 11 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -116,7 +116,6 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = true, - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, -- .ftm_responder = true, - }, - { - .hw_rev = ATH11K_HW_IPQ6018_HW10, -@@ -199,7 +198,6 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = false, -- .ftm_responder = true, - }, - { - .name = "qca6390 hw2.0", -@@ -284,7 +282,6 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = true, -- .ftm_responder = false, - }, - { - .name = "qcn9074 hw1.0", -@@ -366,7 +363,6 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = false, -- .ftm_responder = true, - }, - { - .name = "wcn6855 hw2.0", -@@ -451,7 +447,6 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = true, -- .ftm_responder = false, - }, - { - .name = "wcn6855 hw2.1", -@@ -534,7 +529,6 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = true, -- .ftm_responder = false, - }, - { - .name = "wcn6750 hw1.0", -@@ -615,7 +609,6 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE_WCN6750, - .smp2p_wow_exit = true, - .support_fw_mac_sequence = true, -- .ftm_responder = false, - }, - { - .hw_rev = ATH11K_HW_IPQ5018_HW10, -@@ -695,7 +688,6 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = false, -- .ftm_responder = true, - }, - }; - ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -224,7 +224,6 @@ struct ath11k_hw_params { - u32 tx_ring_size; - bool smp2p_wow_exit; - bool support_fw_mac_sequence; -- bool ftm_responder; - }; - - struct ath11k_hw_ops { ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3538,7 +3538,7 @@ static void ath11k_mac_op_bss_info_chang - - if (changed & BSS_CHANGED_FTM_RESPONDER && - arvif->ftm_responder != info->ftm_responder && -- ar->ab->hw_params.ftm_responder && -+ test_bit(WMI_TLV_SERVICE_RTT, ar->ab->wmi_ab.svc_map) && - (vif->type == NL80211_IFTYPE_AP || - vif->type == NL80211_IFTYPE_MESH_POINT)) { - arvif->ftm_responder = info->ftm_responder; -@@ -9234,7 +9234,7 @@ static int __ath11k_mac_register(struct - wiphy_ext_feature_set(ar->hw->wiphy, - NL80211_EXT_FEATURE_SET_SCAN_DWELL); - -- if (ab->hw_params.ftm_responder) -+ if (test_bit(WMI_TLV_SERVICE_RTT, ar->ab->wmi_ab.svc_map)) - wiphy_ext_feature_set(ar->hw->wiphy, - NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER); - diff --git a/package/kernel/mac80211/patches/ath11k/0051-wifi-ath11k-fix-rssi-station-dump-not-updated-in-QCN.patch b/package/kernel/mac80211/patches/ath11k/0051-wifi-ath11k-fix-rssi-station-dump-not-updated-in-QCN.patch deleted file mode 100644 index 835dece1fe715d..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0051-wifi-ath11k-fix-rssi-station-dump-not-updated-in-QCN.patch +++ /dev/null @@ -1,158 +0,0 @@ -From 031ffa6c2cd305a57ccc6d610f2decd956b2e7f6 Mon Sep 17 00:00:00 2001 -From: P Praneesh -Date: Fri, 24 Mar 2023 16:57:00 +0200 -Subject: [PATCH] wifi: ath11k: fix rssi station dump not updated in QCN9074 - -In QCN9074, station dump signal values display default value which -is -95 dbm, since there is firmware header change for HAL_RX_MPDU_START -between QCN9074 and IPQ8074 which cause wrong peer_id fetch from msdu. -Fix this by updating hal_rx_mpdu_info with corresponding QCN9074 tlv -format. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01695-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: P Praneesh -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230320110312.20639-1-quic_ppranees@quicinc.com ---- - drivers/net/wireless/ath/ath11k/hal_rx.c | 10 ++++++++- - drivers/net/wireless/ath/ath11k/hal_rx.h | 18 +++++++++++++++- - drivers/net/wireless/ath/ath11k/hw.c | 27 ++++++++++++++++-------- - drivers/net/wireless/ath/ath11k/hw.h | 2 +- - 4 files changed, 45 insertions(+), 12 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/hal_rx.c -+++ b/drivers/net/wireless/ath/ath11k/hal_rx.c -@@ -865,6 +865,12 @@ ath11k_hal_rx_populate_mu_user_info(void - ath11k_hal_rx_populate_byte_count(rx_tlv, ppdu_info, rx_user_status); - } - -+static u16 ath11k_hal_rx_mpduinfo_get_peerid(struct ath11k_base *ab, -+ struct hal_rx_mpdu_info *mpdu_info) -+{ -+ return ab->hw_params.hw_ops->mpdu_info_get_peerid(mpdu_info); -+} -+ - static enum hal_rx_mon_status - ath11k_hal_rx_parse_mon_status_tlv(struct ath11k_base *ab, - struct hal_rx_mon_ppdu_info *ppdu_info, -@@ -1459,9 +1465,11 @@ ath11k_hal_rx_parse_mon_status_tlv(struc - break; - } - case HAL_RX_MPDU_START: { -+ struct hal_rx_mpdu_info *mpdu_info = -+ (struct hal_rx_mpdu_info *)tlv_data; - u16 peer_id; - -- peer_id = ab->hw_params.hw_ops->mpdu_info_get_peerid(tlv_data); -+ peer_id = ath11k_hal_rx_mpduinfo_get_peerid(ab, mpdu_info); - if (peer_id) - ppdu_info->peer_id = peer_id; - break; ---- a/drivers/net/wireless/ath/ath11k/hal_rx.h -+++ b/drivers/net/wireless/ath/ath11k/hal_rx.h -@@ -405,7 +405,7 @@ struct hal_rx_phyrx_rssi_legacy_info { - #define HAL_RX_MPDU_INFO_INFO0_PEERID_WCN6855 GENMASK(15, 0) - #define HAL_RX_MPDU_INFO_INFO1_MPDU_LEN GENMASK(13, 0) - --struct hal_rx_mpdu_info { -+struct hal_rx_mpdu_info_ipq8074 { - __le32 rsvd0; - __le32 info0; - __le32 rsvd1[11]; -@@ -413,12 +413,28 @@ struct hal_rx_mpdu_info { - __le32 rsvd2[9]; - } __packed; - -+struct hal_rx_mpdu_info_qcn9074 { -+ __le32 rsvd0[10]; -+ __le32 info0; -+ __le32 rsvd1[2]; -+ __le32 info1; -+ __le32 rsvd2[9]; -+} __packed; -+ - struct hal_rx_mpdu_info_wcn6855 { - __le32 rsvd0[8]; - __le32 info0; - __le32 rsvd1[14]; - } __packed; - -+struct hal_rx_mpdu_info { -+ union { -+ struct hal_rx_mpdu_info_ipq8074 ipq8074; -+ struct hal_rx_mpdu_info_qcn9074 qcn9074; -+ struct hal_rx_mpdu_info_wcn6855 wcn6855; -+ } u; -+} __packed; -+ - #define HAL_RX_PPDU_END_DURATION GENMASK(23, 0) - struct hal_rx_ppdu_end_duration { - __le32 rsvd0[9]; ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -835,26 +835,35 @@ static void ath11k_hw_ipq5018_reo_setup( - ring_hash_map); - } - --static u16 ath11k_hw_ipq8074_mpdu_info_get_peerid(u8 *tlv_data) -+static u16 -+ath11k_hw_ipq8074_mpdu_info_get_peerid(struct hal_rx_mpdu_info *mpdu_info) - { - u16 peer_id = 0; -- struct hal_rx_mpdu_info *mpdu_info = -- (struct hal_rx_mpdu_info *)tlv_data; - - peer_id = FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID, -- __le32_to_cpu(mpdu_info->info0)); -+ __le32_to_cpu(mpdu_info->u.ipq8074.info0)); - - return peer_id; - } - --static u16 ath11k_hw_wcn6855_mpdu_info_get_peerid(u8 *tlv_data) -+static u16 -+ath11k_hw_qcn9074_mpdu_info_get_peerid(struct hal_rx_mpdu_info *mpdu_info) -+{ -+ u16 peer_id = 0; -+ -+ peer_id = FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID, -+ __le32_to_cpu(mpdu_info->u.qcn9074.info0)); -+ -+ return peer_id; -+} -+ -+static u16 -+ath11k_hw_wcn6855_mpdu_info_get_peerid(struct hal_rx_mpdu_info *mpdu_info) - { - u16 peer_id = 0; -- struct hal_rx_mpdu_info_wcn6855 *mpdu_info = -- (struct hal_rx_mpdu_info_wcn6855 *)tlv_data; - - peer_id = FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID_WCN6855, -- __le32_to_cpu(mpdu_info->info0)); -+ __le32_to_cpu(mpdu_info->u.wcn6855.info0)); - return peer_id; - } - -@@ -1042,7 +1051,7 @@ const struct ath11k_hw_ops qcn9074_ops = - .rx_desc_get_attention = ath11k_hw_qcn9074_rx_desc_get_attention, - .rx_desc_get_msdu_payload = ath11k_hw_qcn9074_rx_desc_get_msdu_payload, - .reo_setup = ath11k_hw_ipq8074_reo_setup, -- .mpdu_info_get_peerid = ath11k_hw_ipq8074_mpdu_info_get_peerid, -+ .mpdu_info_get_peerid = ath11k_hw_qcn9074_mpdu_info_get_peerid, - .rx_desc_mac_addr2_valid = ath11k_hw_ipq9074_rx_desc_mac_addr2_valid, - .rx_desc_mpdu_start_addr2 = ath11k_hw_ipq9074_rx_desc_mpdu_start_addr2, - .get_ring_selector = ath11k_hw_ipq8074_get_tcl_ring_selector, ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -263,7 +263,7 @@ struct ath11k_hw_ops { - struct rx_attention *(*rx_desc_get_attention)(struct hal_rx_desc *desc); - u8 *(*rx_desc_get_msdu_payload)(struct hal_rx_desc *desc); - void (*reo_setup)(struct ath11k_base *ab); -- u16 (*mpdu_info_get_peerid)(u8 *tlv_data); -+ u16 (*mpdu_info_get_peerid)(struct hal_rx_mpdu_info *mpdu_info); - bool (*rx_desc_mac_addr2_valid)(struct hal_rx_desc *desc); - u8* (*rx_desc_mpdu_start_addr2)(struct hal_rx_desc *desc); - u32 (*get_ring_selector)(struct sk_buff *skb); diff --git a/package/kernel/mac80211/patches/ath11k/0052-wifi-ath11k-Fix-invalid-management-rx-frame-length-i.patch b/package/kernel/mac80211/patches/ath11k/0052-wifi-ath11k-Fix-invalid-management-rx-frame-length-i.patch deleted file mode 100644 index 0c1637fb04c2b9..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0052-wifi-ath11k-Fix-invalid-management-rx-frame-length-i.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 447b0398a9cd41ca343dfd43e555af92d6214487 Mon Sep 17 00:00:00 2001 -From: Bhagavathi Perumal S -Date: Fri, 24 Mar 2023 16:57:00 +0200 -Subject: [PATCH] wifi: ath11k: Fix invalid management rx frame length issue - -The WMI management rx event has multiple arrays of TLVs, however the common -WMI TLV parser won't handle multiple TLV tags of same type. -So the multiple array tags of WMI management rx TLV is parsed incorrectly -and the length calculated becomes wrong when the target sends multiple -array tags. - -Add separate TLV parser to handle multiple arrays for WMI management rx -TLV. This fixes invalid length issue when the target sends multiple array -tags. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Bhagavathi Perumal S -Co-developed-by: Nagarajan Maran -Signed-off-by: Nagarajan Maran -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230320133840.30162-1-quic_nmaran@quicinc.com ---- - drivers/net/wireless/ath/ath11k/wmi.c | 45 +++++++++++++++++++++------ - 1 file changed, 35 insertions(+), 10 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -82,6 +82,12 @@ struct wmi_tlv_fw_stats_parse { - bool chain_rssi_done; - }; - -+struct wmi_tlv_mgmt_rx_parse { -+ const struct wmi_mgmt_rx_hdr *fixed; -+ const u8 *frame_buf; -+ bool frame_buf_done; -+}; -+ - static const struct wmi_tlv_policy wmi_tlv_policies[] = { - [WMI_TAG_ARRAY_BYTE] - = { .min_len = 0 }, -@@ -5633,28 +5639,49 @@ static int ath11k_pull_vdev_stopped_para - return 0; - } - -+static int ath11k_wmi_tlv_mgmt_rx_parse(struct ath11k_base *ab, -+ u16 tag, u16 len, -+ const void *ptr, void *data) -+{ -+ struct wmi_tlv_mgmt_rx_parse *parse = data; -+ -+ switch (tag) { -+ case WMI_TAG_MGMT_RX_HDR: -+ parse->fixed = ptr; -+ break; -+ case WMI_TAG_ARRAY_BYTE: -+ if (!parse->frame_buf_done) { -+ parse->frame_buf = ptr; -+ parse->frame_buf_done = true; -+ } -+ break; -+ } -+ return 0; -+} -+ - static int ath11k_pull_mgmt_rx_params_tlv(struct ath11k_base *ab, - struct sk_buff *skb, - struct mgmt_rx_event_params *hdr) - { -- const void **tb; -+ struct wmi_tlv_mgmt_rx_parse parse = { }; - const struct wmi_mgmt_rx_hdr *ev; - const u8 *frame; - int ret; - -- tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); -- if (IS_ERR(tb)) { -- ret = PTR_ERR(tb); -- ath11k_warn(ab, "failed to parse tlv: %d\n", ret); -+ ret = ath11k_wmi_tlv_iter(ab, skb->data, skb->len, -+ ath11k_wmi_tlv_mgmt_rx_parse, -+ &parse); -+ if (ret) { -+ ath11k_warn(ab, "failed to parse mgmt rx tlv %d\n", -+ ret); - return ret; - } - -- ev = tb[WMI_TAG_MGMT_RX_HDR]; -- frame = tb[WMI_TAG_ARRAY_BYTE]; -+ ev = parse.fixed; -+ frame = parse.frame_buf; - - if (!ev || !frame) { - ath11k_warn(ab, "failed to fetch mgmt rx hdr"); -- kfree(tb); - return -EPROTO; - } - -@@ -5673,7 +5700,6 @@ static int ath11k_pull_mgmt_rx_params_tl - - if (skb->len < (frame - skb->data) + hdr->buf_len) { - ath11k_warn(ab, "invalid length in mgmt rx hdr ev"); -- kfree(tb); - return -EPROTO; - } - -@@ -5685,7 +5711,6 @@ static int ath11k_pull_mgmt_rx_params_tl - - ath11k_ce_byte_swap(skb->data, hdr->buf_len); - -- kfree(tb); - return 0; - } - diff --git a/package/kernel/mac80211/patches/ath11k/0053-wifi-ath11k-fix-writing-to-unintended-memory-region.patch b/package/kernel/mac80211/patches/ath11k/0053-wifi-ath11k-fix-writing-to-unintended-memory-region.patch deleted file mode 100644 index 7b8a7d454313a8..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0053-wifi-ath11k-fix-writing-to-unintended-memory-region.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 756a7f90878f0866fd2fe167ef37e90b47326b96 Mon Sep 17 00:00:00 2001 -From: P Praneesh -Date: Fri, 24 Mar 2023 16:57:01 +0200 -Subject: [PATCH] wifi: ath11k: fix writing to unintended memory region - -While initializing spectral, the magic value is getting written to the -invalid memory address leading to random boot-up crash. This occurs -due to the incorrect index increment in ath11k_dbring_fill_magic_value -function. Fix it by replacing the existing logic with memset32 to ensure -there is no invalid memory access. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01838-QCAHKSWPL_SILICONZ-1 - -Fixes: d3d358efc553 ("ath11k: add spectral/CFR buffer validation support") -Signed-off-by: P Praneesh -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230321052900.16895-1-quic_ppranees@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dbring.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dbring.c -+++ b/drivers/net/wireless/ath/ath11k/dbring.c -@@ -26,13 +26,13 @@ int ath11k_dbring_validate_buffer(struct - static void ath11k_dbring_fill_magic_value(struct ath11k *ar, - void *buffer, u32 size) - { -- u32 *temp; -- int idx; -+ /* memset32 function fills buffer payload with the ATH11K_DB_MAGIC_VALUE -+ * and the variable size is expected to be the number of u32 values -+ * to be stored, not the number of bytes. -+ */ -+ size = size / sizeof(u32); - -- size = size >> 2; -- -- for (idx = 0, temp = buffer; idx < size; idx++, temp++) -- *temp++ = ATH11K_DB_MAGIC_VALUE; -+ memset32(buffer, ATH11K_DB_MAGIC_VALUE, size); - } - - static int ath11k_dbring_bufs_replenish(struct ath11k *ar, diff --git a/package/kernel/mac80211/patches/ath11k/0054-wifi-ath11k-Send-11d-scan-start-before-WMI_START_SCA.patch b/package/kernel/mac80211/patches/ath11k/0054-wifi-ath11k-Send-11d-scan-start-before-WMI_START_SCA.patch deleted file mode 100644 index 0f8e63759217e8..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0054-wifi-ath11k-Send-11d-scan-start-before-WMI_START_SCA.patch +++ /dev/null @@ -1,61 +0,0 @@ -From e89a51aedf380bc60219dc9afa96c36507060fb3 Mon Sep 17 00:00:00 2001 -From: Manikanta Pubbisetty -Date: Wed, 15 Mar 2023 21:48:17 +0530 -Subject: [PATCH] wifi: ath11k: Send 11d scan start before WMI_START_SCAN_CMDID - -Firmwares advertising the support of triggering 11d algorithm on the -scan results of a regular scan expects driver to send -WMI_11D_SCAN_START_CMDID before sending WMI_START_SCAN_CMDID. -Triggering 11d algorithm on the scan results of a normal scan helps -in completely avoiding a separate 11d scan for determining regdomain. -This indirectly helps in speeding up connections on station -interfaces on the chipsets supporting 11D scan. - -To enable this feature, send WMI_11D_SCAN_START_CMDID just before -sending WMI_START_SCAN_CMDID if the firmware advertises -WMI_TLV_SERVICE_SUPPORT_11D_FOR_HOST_SCAN service flag. - -WCN6750 & WCN6855 supports this feature. - -Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-01160-QCAMSLSWPLZ-1 -Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 - -Signed-off-by: Manikanta Pubbisetty -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230315161817.29627-1-quic_mpubbise@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 12 ++++++++++++ - drivers/net/wireless/ath/ath11k/wmi.h | 1 + - 2 files changed, 13 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3755,6 +3755,18 @@ static int ath11k_mac_op_hw_scan(struct - int i; - u32 scan_timeout; - -+ /* Firmwares advertising the support of triggering 11D algorithm -+ * on the scan results of a regular scan expects driver to send -+ * WMI_11D_SCAN_START_CMDID before sending WMI_START_SCAN_CMDID. -+ * With this feature, separate 11D scan can be avoided since -+ * regdomain can be determined with the scan results of the -+ * regular scan. -+ */ -+ if (ar->state_11d == ATH11K_11D_PREPARING && -+ test_bit(WMI_TLV_SERVICE_SUPPORT_11D_FOR_HOST_SCAN, -+ ar->ab->wmi_ab.svc_map)) -+ ath11k_mac_11d_scan_start(ar, arvif->vdev_id); -+ - mutex_lock(&ar->conf_mutex); - - spin_lock_bh(&ar->data_lock); ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2103,6 +2103,7 @@ enum wmi_tlv_service { - WMI_TLV_SERVICE_SCAN_CONFIG_PER_CHANNEL = 265, - WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT = 281, - WMI_TLV_SERVICE_BIOS_SAR_SUPPORT = 326, -+ WMI_TLV_SERVICE_SUPPORT_11D_FOR_HOST_SCAN = 357, - - /* The third 128 bits */ - WMI_MAX_EXT2_SERVICE = 384 diff --git a/package/kernel/mac80211/patches/ath11k/0055-wifi-ath11k-Remove-redundant-pci_clear_master.patch b/package/kernel/mac80211/patches/ath11k/0055-wifi-ath11k-Remove-redundant-pci_clear_master.patch deleted file mode 100644 index 0439727e72faaa..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0055-wifi-ath11k-Remove-redundant-pci_clear_master.patch +++ /dev/null @@ -1,58 +0,0 @@ -From f812e2a9f85d6bea78957ccb5197e4491316848b Mon Sep 17 00:00:00 2001 -From: Cai Huoqing -Date: Thu, 23 Mar 2023 19:26:09 +0800 -Subject: [PATCH] wifi: ath11k: Remove redundant pci_clear_master - -Remove pci_clear_master to simplify the code, -the bus-mastering is also cleared in do_pci_disable_device, -like this: -./drivers/pci/pci.c:2197 -static void do_pci_disable_device(struct pci_dev *dev) -{ - u16 pci_command; - - pci_read_config_word(dev, PCI_COMMAND, &pci_command); - if (pci_command & PCI_COMMAND_MASTER) { - pci_command &= ~PCI_COMMAND_MASTER; - pci_write_config_word(dev, PCI_COMMAND, pci_command); - } - - pcibios_disable_device(dev); -}. -And dev->is_busmaster is set to 0 in pci_disable_device. - -Signed-off-by: Cai Huoqing -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230323112613.7550-1-cai.huoqing@linux.dev ---- - drivers/net/wireless/ath/ath11k/pci.c | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/pci.c -+++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -540,7 +540,7 @@ static int ath11k_pci_claim(struct ath11 - if (!ab->mem) { - ath11k_err(ab, "failed to map pci bar %d\n", ATH11K_PCI_BAR_NUM); - ret = -EIO; -- goto clear_master; -+ goto release_region; - } - - ab->mem_ce = ab->mem; -@@ -548,8 +548,6 @@ static int ath11k_pci_claim(struct ath11 - ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot pci_mem 0x%pK\n", ab->mem); - return 0; - --clear_master: -- pci_clear_master(pdev); - release_region: - pci_release_region(pdev, ATH11K_PCI_BAR_NUM); - disable_device: -@@ -565,7 +563,6 @@ static void ath11k_pci_free_region(struc - - pci_iounmap(pci_dev, ab->mem); - ab->mem = NULL; -- pci_clear_master(pci_dev); - pci_release_region(pci_dev, ATH11K_PCI_BAR_NUM); - if (pci_is_enabled(pci_dev)) - pci_disable_device(pci_dev); diff --git a/package/kernel/mac80211/patches/ath11k/0056-wifi-ath11k-Disable-Spectral-scan-upon-removing-inte.patch b/package/kernel/mac80211/patches/ath11k/0056-wifi-ath11k-Disable-Spectral-scan-upon-removing-inte.patch deleted file mode 100644 index 44532a4d7200cb..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0056-wifi-ath11k-Disable-Spectral-scan-upon-removing-inte.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 5c690db63b45c6c4c4932b13173af71df369dba5 Mon Sep 17 00:00:00 2001 -From: Tamizh Chelvam Raja -Date: Tue, 28 Mar 2023 12:41:50 +0530 -Subject: [PATCH] wifi: ath11k: Disable Spectral scan upon removing interface - -Host might receive spectral events during interface -down sequence and this might create below errors. - -failed to handle dma buf release event -22 -failed to handle dma buf release event -22 - -Fix this by disabling spectral config during remove interface. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Tamizh Chelvam Raja -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230328071150.29645-1-quic_tamizhr@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6685,6 +6685,11 @@ static void ath11k_mac_op_remove_interfa - ath11k_dbg(ab, ATH11K_DBG_MAC, "mac remove interface (vdev %d)\n", - arvif->vdev_id); - -+ ret = ath11k_spectral_vif_stop(arvif); -+ if (ret) -+ ath11k_warn(ab, "failed to stop spectral for vdev %i: %d\n", -+ arvif->vdev_id, ret); -+ - if (arvif->vdev_type == WMI_VDEV_TYPE_STA) - ath11k_mac_11d_scan_stop(ar); - diff --git a/package/kernel/mac80211/patches/ath11k/0057-wifi-ath11k-enable-SAR-support-on-WCN6750.patch b/package/kernel/mac80211/patches/ath11k/0057-wifi-ath11k-enable-SAR-support-on-WCN6750.patch deleted file mode 100644 index 5e64e552c1d35a..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0057-wifi-ath11k-enable-SAR-support-on-WCN6750.patch +++ /dev/null @@ -1,29 +0,0 @@ -From abf57d84973ce1abcb67504ac0df8aea1fe09a76 Mon Sep 17 00:00:00 2001 -From: Youghandhar Chintala -Date: Tue, 28 Mar 2023 17:04:55 +0530 -Subject: [PATCH] wifi: ath11k: enable SAR support on WCN6750 - -Currently, SAR is enabled only on WCN6855, enable this for WCN6750 too. This -functionality gets triggered, when the user space application calls -NL80211_CMD_SET_SAR_SPECS. - -Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 - -Signed-off-by: Youghandhar Chintala -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230328113455.11252-1-quic_youghand@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -593,7 +593,7 @@ static const struct ath11k_hw_params ath - .current_cc_support = true, - .dbr_debug_support = false, - .global_reset = false, -- .bios_sar_capa = NULL, -+ .bios_sar_capa = &ath11k_hw_sar_capa_wcn6855, - .m3_fw_support = false, - .fixed_bdf_addr = false, - .fixed_mem_region = false, diff --git a/package/kernel/mac80211/patches/ath11k/0058-wifi-ath11k-pci-Add-more-MODULE_FIRMWARE-entries.patch b/package/kernel/mac80211/patches/ath11k/0058-wifi-ath11k-pci-Add-more-MODULE_FIRMWARE-entries.patch deleted file mode 100644 index 585864eff2e3a2..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0058-wifi-ath11k-pci-Add-more-MODULE_FIRMWARE-entries.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 06c58473969239e00d76b683edd511952060ca56 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Thu, 30 Mar 2023 16:37:18 +0200 -Subject: [PATCH] wifi: ath11k: pci: Add more MODULE_FIRMWARE() entries - -As there are a few more models supported by the driver, let's add the -missing MODULE_FIRMWARE() entries for them. The lack of them resulted -in the missing device enablement on some systems, such as the -installation image of openSUSE. - -While we are at it, use the wildcard instead of listing each firmware -files individually for each. - -Signed-off-by: Takashi Iwai -Reviewed-by: Simon Horman -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230330143718.19511-1-tiwai@suse.de ---- - drivers/net/wireless/ath/ath11k/pci.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/pci.c -+++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -1036,7 +1036,8 @@ module_exit(ath11k_pci_exit); - MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11ax WLAN PCIe devices"); - MODULE_LICENSE("Dual BSD/GPL"); - --/* QCA639x 2.0 firmware files */ --MODULE_FIRMWARE(ATH11K_FW_DIR "/QCA6390/hw2.0/" ATH11K_BOARD_API2_FILE); --MODULE_FIRMWARE(ATH11K_FW_DIR "/QCA6390/hw2.0/" ATH11K_AMSS_FILE); --MODULE_FIRMWARE(ATH11K_FW_DIR "/QCA6390/hw2.0/" ATH11K_M3_FILE); -+/* firmware files */ -+MODULE_FIRMWARE(ATH11K_FW_DIR "/QCA6390/hw2.0/*"); -+MODULE_FIRMWARE(ATH11K_FW_DIR "/QCN9074/hw1.0/*"); -+MODULE_FIRMWARE(ATH11K_FW_DIR "/WCN6855/hw2.0/*"); -+MODULE_FIRMWARE(ATH11K_FW_DIR "/WCN6855/hw2.1/*"); diff --git a/package/kernel/mac80211/patches/ath11k/0059-wifi-ath11k-print-a-warning-when-crypto_alloc_shash-.patch b/package/kernel/mac80211/patches/ath11k/0059-wifi-ath11k-print-a-warning-when-crypto_alloc_shash-.patch deleted file mode 100644 index fab52a0fa7b096..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0059-wifi-ath11k-print-a-warning-when-crypto_alloc_shash-.patch +++ /dev/null @@ -1,34 +0,0 @@ -From a87a9110ac0dcbfd9458b6665c141fa1c16a669d Mon Sep 17 00:00:00 2001 -From: Kalle Valo -Date: Wed, 5 Apr 2023 12:04:25 +0300 -Subject: [PATCH] wifi: ath11k: print a warning when crypto_alloc_shash() fails - -Christoph reported that ath11k failed to initialise when michael_mic.ko -module was not installed. To make it easier to notice that case print a -warning when crypto_alloc_shash() fails. - -Compile tested only. - -Reported-by: Christoph Hellwig -Link: https://lore.kernel.org/all/20221130133016.GC3055@lst.de/ -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405090425.1351-1-kvalo@kernel.org ---- - drivers/net/wireless/ath/ath11k/dp_rx.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -3106,8 +3106,11 @@ int ath11k_peer_rx_frag_setup(struct ath - int i; - - tfm = crypto_alloc_shash("michael_mic", 0, 0); -- if (IS_ERR(tfm)) -+ if (IS_ERR(tfm)) { -+ ath11k_warn(ab, "failed to allocate michael_mic shash: %ld\n", -+ PTR_ERR(tfm)); - return PTR_ERR(tfm); -+ } - - spin_lock_bh(&ab->base_lock); - diff --git a/package/kernel/mac80211/patches/ath11k/0060-wifi-ath11k-Ignore-frags-from-uninitialized-peer-in-.patch b/package/kernel/mac80211/patches/ath11k/0060-wifi-ath11k-Ignore-frags-from-uninitialized-peer-in-.patch deleted file mode 100644 index 5bbf9e04a4db7f..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0060-wifi-ath11k-Ignore-frags-from-uninitialized-peer-in-.patch +++ /dev/null @@ -1,104 +0,0 @@ -From a06bfb3c9f69f303692cdae87bc0899d2ae8b2a6 Mon Sep 17 00:00:00 2001 -From: Harshitha Prem -Date: Tue, 4 Apr 2023 00:11:54 +0530 -Subject: [PATCH] wifi: ath11k: Ignore frags from uninitialized peer in dp. - -When max virtual ap interfaces are configured in all the bands with -ACS and hostapd restart is done every 60s, a crash is observed at -random times. -In this certain scenario, a fragmented packet is received for -self peer, for which rx_tid and rx_frags are not initialized in -datapath. While handling this fragment, crash is observed as the -rx_frag list is uninitialised and when we walk in -ath11k_dp_rx_h_sort_frags, skb null leads to exception. - -To address this, before processing received fragments we check -dp_setup_done flag is set to ensure that peer has completed its -dp peer setup for fragment queue, else ignore processing the -fragments. - -Call trace: - ath11k_dp_process_rx_err+0x550/0x1084 [ath11k] - ath11k_dp_service_srng+0x70/0x370 [ath11k] - 0xffffffc009693a04 - __napi_poll+0x30/0xa4 - net_rx_action+0x118/0x270 - __do_softirq+0x10c/0x244 - irq_exit+0x64/0xb4 - __handle_domain_irq+0x88/0xac - gic_handle_irq+0x74/0xbc - el1_irq+0xf0/0x1c0 - arch_cpu_idle+0x10/0x18 - do_idle+0x104/0x248 - cpu_startup_entry+0x20/0x64 - rest_init+0xd0/0xdc - arch_call_rest_init+0xc/0x14 - start_kernel+0x480/0x4b8 - Code: f9400281 f94066a2 91405021 b94a0023 (f9406401) - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Harshitha Prem -Signed-off-by: Nagarajan Maran -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403184155.8670-2-quic_nmaran@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp.c | 4 +++- - drivers/net/wireless/ath/ath11k/dp_rx.c | 8 ++++++++ - drivers/net/wireless/ath/ath11k/peer.h | 1 + - 3 files changed, 12 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/dp.c -+++ b/drivers/net/wireless/ath/ath11k/dp.c -@@ -36,6 +36,7 @@ void ath11k_dp_peer_cleanup(struct ath11 - } - - ath11k_peer_rx_tid_cleanup(ar, peer); -+ peer->dp_setup_done = false; - crypto_free_shash(peer->tfm_mmic); - spin_unlock_bh(&ab->base_lock); - } -@@ -72,7 +73,8 @@ int ath11k_dp_peer_setup(struct ath11k * - ret = ath11k_peer_rx_frag_setup(ar, addr, vdev_id); - if (ret) { - ath11k_warn(ab, "failed to setup rx defrag context\n"); -- return ret; -+ tid--; -+ goto peer_clean; - } - - /* TODO: Setup other peer specific resource used in data path */ ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -3130,6 +3130,7 @@ int ath11k_peer_rx_frag_setup(struct ath - } - - peer->tfm_mmic = tfm; -+ peer->dp_setup_done = true; - spin_unlock_bh(&ab->base_lock); - - return 0; -@@ -3575,6 +3576,13 @@ static int ath11k_dp_rx_frag_h_mpdu(stru - ret = -ENOENT; - goto out_unlock; - } -+ if (!peer->dp_setup_done) { -+ ath11k_warn(ab, "The peer %pM [%d] has uninitialized datapath\n", -+ peer->addr, peer_id); -+ ret = -ENOENT; -+ goto out_unlock; -+ } -+ - rx_tid = &peer->rx_tid[tid]; - - if ((!skb_queue_empty(&rx_tid->rx_frags) && seqno != rx_tid->cur_sn) || ---- a/drivers/net/wireless/ath/ath11k/peer.h -+++ b/drivers/net/wireless/ath/ath11k/peer.h -@@ -35,6 +35,7 @@ struct ath11k_peer { - u16 sec_type; - u16 sec_type_grp; - bool is_authorized; -+ bool dp_setup_done; - }; - - void ath11k_peer_unmap_event(struct ath11k_base *ab, u16 peer_id); diff --git a/package/kernel/mac80211/patches/ath11k/0061-wifi-ath11k-fix-undefined-behavior-with-__fls-in-dp.patch b/package/kernel/mac80211/patches/ath11k/0061-wifi-ath11k-fix-undefined-behavior-with-__fls-in-dp.patch deleted file mode 100644 index d68c19f16098fe..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0061-wifi-ath11k-fix-undefined-behavior-with-__fls-in-dp.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 41e02bf4ae32cf2ac47b08b4caaa9c1a032e4ce7 Mon Sep 17 00:00:00 2001 -From: Harshitha Prem -Date: Tue, 4 Apr 2023 00:11:55 +0530 -Subject: [PATCH] wifi: ath11k: fix undefined behavior with __fls in dp - -"__fls" would have an undefined behavior if the argument is passed -as "0". Hence, added changes to handle the same. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Harshitha Prem -Signed-off-by: Nagarajan Maran -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403184155.8670-3-quic_nmaran@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp_rx.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -3598,7 +3598,7 @@ static int ath11k_dp_rx_frag_h_mpdu(stru - goto out_unlock; - } - -- if (frag_no > __fls(rx_tid->rx_frag_bitmap)) -+ if (!rx_tid->rx_frag_bitmap || (frag_no > __fls(rx_tid->rx_frag_bitmap))) - __skb_queue_tail(&rx_tid->rx_frags, msdu); - else - ath11k_dp_rx_h_sort_frags(ar, &rx_tid->rx_frags, msdu); diff --git a/package/kernel/mac80211/patches/ath11k/0062-wifi-ath11k-fix-double-free-of-peer-rx_tid-during-re.patch b/package/kernel/mac80211/patches/ath11k/0062-wifi-ath11k-fix-double-free-of-peer-rx_tid-during-re.patch deleted file mode 100644 index dd37b1e4fa8c62..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0062-wifi-ath11k-fix-double-free-of-peer-rx_tid-during-re.patch +++ /dev/null @@ -1,144 +0,0 @@ -From 93a91f40c25c3d0e61f8540a7accf105090f9995 Mon Sep 17 00:00:00 2001 -From: Harshitha Prem -Date: Mon, 17 Apr 2023 13:35:00 +0300 -Subject: [PATCH] wifi: ath11k: fix double free of peer rx_tid during reo cmd - failure - -Peer rx_tid is locally copied thrice during peer_rx_tid_cleanup to -send REO_CMD_UPDATE_RX_QUEUE followed by REO_CMD_FLUSH_CACHE to flush -all aged REO descriptors from HW cache. - -When sending REO_CMD_FLUSH_CACHE fails, we do dma unmap of already -mapped rx_tid->vaddr and free it. This is not checked during -reo_cmd_list_cleanup() and dp_reo_cmd_free() before trying to free and -unmap again. - -Fix this by setting rx_tid->vaddr NULL in rx tid delete and also -wherever freeing it to check in reo_cmd_list_cleanup() and -reo_cmd_free() before trying to free again. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sathishkumar Muruganandam -Signed-off-by: Harshitha Prem -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403182420.23375-2-quic_hprem@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp_rx.c | 43 ++++++++++++++++++------- - 1 file changed, 31 insertions(+), 12 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -668,13 +668,18 @@ void ath11k_dp_reo_cmd_list_cleanup(stru - struct ath11k_dp *dp = &ab->dp; - struct dp_reo_cmd *cmd, *tmp; - struct dp_reo_cache_flush_elem *cmd_cache, *tmp_cache; -+ struct dp_rx_tid *rx_tid; - - spin_lock_bh(&dp->reo_cmd_lock); - list_for_each_entry_safe(cmd, tmp, &dp->reo_cmd_list, list) { - list_del(&cmd->list); -- dma_unmap_single(ab->dev, cmd->data.paddr, -- cmd->data.size, DMA_BIDIRECTIONAL); -- kfree(cmd->data.vaddr); -+ rx_tid = &cmd->data; -+ if (rx_tid->vaddr) { -+ dma_unmap_single(ab->dev, rx_tid->paddr, -+ rx_tid->size, DMA_BIDIRECTIONAL); -+ kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; -+ } - kfree(cmd); - } - -@@ -682,9 +687,13 @@ void ath11k_dp_reo_cmd_list_cleanup(stru - &dp->reo_cmd_cache_flush_list, list) { - list_del(&cmd_cache->list); - dp->reo_cmd_cache_flush_count--; -- dma_unmap_single(ab->dev, cmd_cache->data.paddr, -- cmd_cache->data.size, DMA_BIDIRECTIONAL); -- kfree(cmd_cache->data.vaddr); -+ rx_tid = &cmd_cache->data; -+ if (rx_tid->vaddr) { -+ dma_unmap_single(ab->dev, rx_tid->paddr, -+ rx_tid->size, DMA_BIDIRECTIONAL); -+ kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; -+ } - kfree(cmd_cache); - } - spin_unlock_bh(&dp->reo_cmd_lock); -@@ -698,10 +707,12 @@ static void ath11k_dp_reo_cmd_free(struc - if (status != HAL_REO_CMD_SUCCESS) - ath11k_warn(dp->ab, "failed to flush rx tid hw desc, tid %d status %d\n", - rx_tid->tid, status); -- -- dma_unmap_single(dp->ab->dev, rx_tid->paddr, rx_tid->size, -- DMA_BIDIRECTIONAL); -- kfree(rx_tid->vaddr); -+ if (rx_tid->vaddr) { -+ dma_unmap_single(dp->ab->dev, rx_tid->paddr, rx_tid->size, -+ DMA_BIDIRECTIONAL); -+ kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; -+ } - } - - static void ath11k_dp_reo_cache_flush(struct ath11k_base *ab, -@@ -740,6 +751,7 @@ static void ath11k_dp_reo_cache_flush(st - dma_unmap_single(ab->dev, rx_tid->paddr, rx_tid->size, - DMA_BIDIRECTIONAL); - kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; - } - } - -@@ -792,6 +804,7 @@ free_desc: - dma_unmap_single(ab->dev, rx_tid->paddr, rx_tid->size, - DMA_BIDIRECTIONAL); - kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; - } - - void ath11k_peer_rx_tid_delete(struct ath11k *ar, -@@ -804,6 +817,8 @@ void ath11k_peer_rx_tid_delete(struct at - if (!rx_tid->active) - return; - -+ rx_tid->active = false; -+ - cmd.flag = HAL_REO_CMD_FLG_NEED_STATUS; - cmd.addr_lo = lower_32_bits(rx_tid->paddr); - cmd.addr_hi = upper_32_bits(rx_tid->paddr); -@@ -818,9 +833,11 @@ void ath11k_peer_rx_tid_delete(struct at - dma_unmap_single(ar->ab->dev, rx_tid->paddr, rx_tid->size, - DMA_BIDIRECTIONAL); - kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; - } - -- rx_tid->active = false; -+ rx_tid->paddr = 0; -+ rx_tid->size = 0; - } - - static int ath11k_dp_rx_link_desc_return(struct ath11k_base *ab, -@@ -967,6 +984,7 @@ static void ath11k_dp_rx_tid_mem_free(st - dma_unmap_single(ab->dev, rx_tid->paddr, rx_tid->size, - DMA_BIDIRECTIONAL); - kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; - - rx_tid->active = false; - -@@ -1067,7 +1085,8 @@ int ath11k_peer_rx_tid_setup(struct ath1 - return ret; - - err_mem_free: -- kfree(vaddr); -+ kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; - - return ret; - } diff --git a/package/kernel/mac80211/patches/ath11k/0063-wifi-ath11k-Prevent-REO-cmd-failures.patch b/package/kernel/mac80211/patches/ath11k/0063-wifi-ath11k-Prevent-REO-cmd-failures.patch deleted file mode 100644 index 4b9af180620132..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0063-wifi-ath11k-Prevent-REO-cmd-failures.patch +++ /dev/null @@ -1,43 +0,0 @@ -From a8ae833657a45746debde85c38bb7f070d344026 Mon Sep 17 00:00:00 2001 -From: Harshitha Prem -Date: Mon, 17 Apr 2023 13:35:01 +0300 -Subject: [PATCH] wifi: ath11k: Prevent REO cmd failures - -Prevent REO cmd failures causing double free by increasing REO cmd -ring size and moving REO status ring mask to IRQ group 3 from group -0 to separate from tx completion ring on IRQ group 0 which may delay -reo status processing. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sathishkumar Muruganandam -Signed-off-by: Harshitha Prem -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403182420.23375-3-quic_hprem@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp.h | 2 +- - drivers/net/wireless/ath/ath11k/hw.c | 1 + - 2 files changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/dp.h -+++ b/drivers/net/wireless/ath/ath11k/dp.h -@@ -214,7 +214,7 @@ struct ath11k_pdev_dp { - #define DP_REO_REINJECT_RING_SIZE 32 - #define DP_RX_RELEASE_RING_SIZE 1024 - #define DP_REO_EXCEPTION_RING_SIZE 128 --#define DP_REO_CMD_RING_SIZE 128 -+#define DP_REO_CMD_RING_SIZE 256 - #define DP_REO_STATUS_RING_SIZE 2048 - #define DP_RXDMA_BUF_RING_SIZE 4096 - #define DP_RXDMA_REFILL_RING_SIZE 2048 ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -1233,6 +1233,7 @@ const struct ath11k_hw_ring_mask ath11k_ - ATH11K_RX_WBM_REL_RING_MASK_0, - }, - .reo_status = { -+ 0, 0, 0, - ATH11K_REO_STATUS_RING_MASK_0, - }, - .rxdma2host = { diff --git a/package/kernel/mac80211/patches/ath11k/0064-wifi-ath11k-add-peer-mac-information-in-failure-case.patch b/package/kernel/mac80211/patches/ath11k/0064-wifi-ath11k-add-peer-mac-information-in-failure-case.patch deleted file mode 100644 index fbcbdfff712fc6..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0064-wifi-ath11k-add-peer-mac-information-in-failure-case.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 20487cc3ff36bbfa9505f0a078ba98f09abfc717 Mon Sep 17 00:00:00 2001 -From: Harshitha Prem -Date: Mon, 17 Apr 2023 13:35:01 +0300 -Subject: [PATCH] wifi: ath11k: add peer mac information in failure cases - -During reo command failure, the peer mac detail for which the reo -command was not successful is unknown. Hence, to improve the -debuggability, add the peer mac information in the failure cases -which would be useful during multi client cases. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sathishkumar Muruganandam -Signed-off-by: Harshitha Prem -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403182420.23375-4-quic_hprem@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp_rx.c | 16 ++++++++++------ - 1 file changed, 10 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -1009,7 +1009,8 @@ int ath11k_peer_rx_tid_setup(struct ath1 - - peer = ath11k_peer_find(ab, vdev_id, peer_mac); - if (!peer) { -- ath11k_warn(ab, "failed to find the peer to set up rx tid\n"); -+ ath11k_warn(ab, "failed to find the peer %pM to set up rx tid\n", -+ peer_mac); - spin_unlock_bh(&ab->base_lock); - return -ENOENT; - } -@@ -1022,7 +1023,8 @@ int ath11k_peer_rx_tid_setup(struct ath1 - ba_win_sz, ssn, true); - spin_unlock_bh(&ab->base_lock); - if (ret) { -- ath11k_warn(ab, "failed to update reo for rx tid %d\n", tid); -+ ath11k_warn(ab, "failed to update reo for peer %pM rx tid %d\n: %d", -+ peer_mac, tid, ret); - return ret; - } - -@@ -1030,8 +1032,8 @@ int ath11k_peer_rx_tid_setup(struct ath1 - peer_mac, paddr, - tid, 1, ba_win_sz); - if (ret) -- ath11k_warn(ab, "failed to send wmi command to update rx reorder queue, tid :%d (%d)\n", -- tid, ret); -+ ath11k_warn(ab, "failed to send wmi rx reorder queue for peer %pM tid %d: %d\n", -+ peer_mac, tid, ret); - return ret; - } - -@@ -1064,6 +1066,8 @@ int ath11k_peer_rx_tid_setup(struct ath1 - ret = dma_mapping_error(ab->dev, paddr); - if (ret) { - spin_unlock_bh(&ab->base_lock); -+ ath11k_warn(ab, "failed to setup dma map for peer %pM rx tid %d: %d\n", -+ peer_mac, tid, ret); - goto err_mem_free; - } - -@@ -1077,8 +1081,8 @@ int ath11k_peer_rx_tid_setup(struct ath1 - ret = ath11k_wmi_peer_rx_reorder_queue_setup(ar, vdev_id, peer_mac, - paddr, tid, 1, ba_win_sz); - if (ret) { -- ath11k_warn(ar->ab, "failed to setup rx reorder queue, tid :%d (%d)\n", -- tid, ret); -+ ath11k_warn(ar->ab, "failed to setup rx reorder queue for peer %pM tid %d: %d\n", -+ peer_mac, tid, ret); - ath11k_dp_rx_tid_mem_free(ab, peer_mac, vdev_id, tid); - } - diff --git a/package/kernel/mac80211/patches/ath11k/0065-wifi-ath11k-fix-tx-status-reporting-in-encap-offload.patch b/package/kernel/mac80211/patches/ath11k/0065-wifi-ath11k-fix-tx-status-reporting-in-encap-offload.patch deleted file mode 100644 index e2fe419158f391..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0065-wifi-ath11k-fix-tx-status-reporting-in-encap-offload.patch +++ /dev/null @@ -1,119 +0,0 @@ -From 6257c702264c44d74c6b71f0c62a7665da2dc356 Mon Sep 17 00:00:00 2001 -From: Pradeep Kumar Chitrapu -Date: Mon, 17 Apr 2023 13:35:02 +0300 -Subject: [PATCH] wifi: ath11k: fix tx status reporting in encap offload mode - -ieee80211_tx_status() treats packets in 802.11 frame format and -tries to extract sta address from packet header. When tx encap -offload is enabled, this becomes invalid operation. Hence, switch -to using ieee80211_tx_status_ext() after filling in station -address for handling both 802.11 and 802.3 frames. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Pradeep Kumar Chitrapu -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403195738.25367-2-quic_pradeepc@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp.h | 4 +++ - drivers/net/wireless/ath/ath11k/dp_tx.c | 33 ++++++++++++++++++++++++- - drivers/net/wireless/ath/ath11k/dp_tx.h | 1 + - 3 files changed, 37 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/dp.h -+++ b/drivers/net/wireless/ath/ath11k/dp.h -@@ -303,12 +303,16 @@ struct ath11k_dp { - - #define HTT_TX_WBM_COMP_STATUS_OFFSET 8 - -+#define HTT_INVALID_PEER_ID 0xffff -+ - /* HTT tx completion is overlaid in wbm_release_ring */ - #define HTT_TX_WBM_COMP_INFO0_STATUS GENMASK(12, 9) - #define HTT_TX_WBM_COMP_INFO0_REINJECT_REASON GENMASK(16, 13) - #define HTT_TX_WBM_COMP_INFO0_REINJECT_REASON GENMASK(16, 13) - - #define HTT_TX_WBM_COMP_INFO1_ACK_RSSI GENMASK(31, 24) -+#define HTT_TX_WBM_COMP_INFO2_SW_PEER_ID GENMASK(15, 0) -+#define HTT_TX_WBM_COMP_INFO2_VALID BIT(21) - - struct htt_tx_wbm_completion { - u32 info0; ---- a/drivers/net/wireless/ath/ath11k/dp_tx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_tx.c -@@ -316,10 +316,12 @@ ath11k_dp_tx_htt_tx_complete_buf(struct - struct dp_tx_ring *tx_ring, - struct ath11k_dp_htt_wbm_tx_status *ts) - { -+ struct ieee80211_tx_status status = { 0 }; - struct sk_buff *msdu; - struct ieee80211_tx_info *info; - struct ath11k_skb_cb *skb_cb; - struct ath11k *ar; -+ struct ath11k_peer *peer; - - spin_lock(&tx_ring->tx_idr_lock); - msdu = idr_remove(&tx_ring->txbuf_idr, ts->msdu_id); -@@ -341,6 +343,11 @@ ath11k_dp_tx_htt_tx_complete_buf(struct - - dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); - -+ if (!skb_cb->vif) { -+ dev_kfree_skb_any(msdu); -+ return; -+ } -+ - memset(&info->status, 0, sizeof(info->status)); - - if (ts->acked) { -@@ -355,7 +362,23 @@ ath11k_dp_tx_htt_tx_complete_buf(struct - } - } - -- ieee80211_tx_status(ar->hw, msdu); -+ spin_lock_bh(&ab->base_lock); -+ peer = ath11k_peer_find_by_id(ab, ts->peer_id); -+ if (!peer || !peer->sta) { -+ ath11k_dbg(ab, ATH11K_DBG_DATA, -+ "dp_tx: failed to find the peer with peer_id %d\n", -+ ts->peer_id); -+ spin_unlock_bh(&ab->base_lock); -+ dev_kfree_skb_any(msdu); -+ return; -+ } -+ spin_unlock_bh(&ab->base_lock); -+ -+ status.sta = peer->sta; -+ status.info = info; -+ status.skb = msdu; -+ -+ ieee80211_tx_status_ext(ar->hw, &status); - } - - static void -@@ -379,7 +402,15 @@ ath11k_dp_tx_process_htt_tx_complete(str - ts.msdu_id = msdu_id; - ts.ack_rssi = FIELD_GET(HTT_TX_WBM_COMP_INFO1_ACK_RSSI, - status_desc->info1); -+ -+ if (FIELD_GET(HTT_TX_WBM_COMP_INFO2_VALID, status_desc->info2)) -+ ts.peer_id = FIELD_GET(HTT_TX_WBM_COMP_INFO2_SW_PEER_ID, -+ status_desc->info2); -+ else -+ ts.peer_id = HTT_INVALID_PEER_ID; -+ - ath11k_dp_tx_htt_tx_complete_buf(ab, tx_ring, &ts); -+ - break; - case HAL_WBM_REL_HTT_TX_COMP_STATUS_REINJ: - case HAL_WBM_REL_HTT_TX_COMP_STATUS_INSPECT: ---- a/drivers/net/wireless/ath/ath11k/dp_tx.h -+++ b/drivers/net/wireless/ath/ath11k/dp_tx.h -@@ -13,6 +13,7 @@ struct ath11k_dp_htt_wbm_tx_status { - u32 msdu_id; - bool acked; - int ack_rssi; -+ u16 peer_id; - }; - - void ath11k_dp_tx_update_txcompl(struct ath11k *ar, struct hal_tx_status *ts); diff --git a/package/kernel/mac80211/patches/ath11k/0066-wifi-ath11k-Fix-incorrect-update-of-radiotap-fields.patch b/package/kernel/mac80211/patches/ath11k/0066-wifi-ath11k-Fix-incorrect-update-of-radiotap-fields.patch deleted file mode 100644 index 4f94580100f399..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0066-wifi-ath11k-Fix-incorrect-update-of-radiotap-fields.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 2f0c9ac8362da09c80f1cd422ef7fd6fa9b252b9 Mon Sep 17 00:00:00 2001 -From: Pradeep Kumar Chitrapu -Date: Mon, 17 Apr 2023 13:35:02 +0300 -Subject: [PATCH] wifi: ath11k: Fix incorrect update of radiotap fields - -Fix incorrect update of ppdu stats causing incorrect radiotap -fields. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Pradeep Kumar Chitrapu -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403195738.25367-3-quic_pradeepc@quicinc.com ---- - drivers/net/wireless/ath/ath11k/hal_rx.c | 4 ++-- - drivers/net/wireless/ath/ath11k/hal_rx.h | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/hal_rx.c -+++ b/drivers/net/wireless/ath/ath11k/hal_rx.c -@@ -1029,7 +1029,7 @@ ath11k_hal_rx_parse_mon_status_tlv(struc - info1 = __le32_to_cpu(vht_sig->info1); - - ppdu_info->ldpc = FIELD_GET(HAL_RX_VHT_SIG_A_INFO_INFO1_SU_MU_CODING, -- info0); -+ info1); - ppdu_info->mcs = FIELD_GET(HAL_RX_VHT_SIG_A_INFO_INFO1_MCS, - info1); - gi_setting = FIELD_GET(HAL_RX_VHT_SIG_A_INFO_INFO1_GI_SETTING, -@@ -1452,7 +1452,7 @@ ath11k_hal_rx_parse_mon_status_tlv(struc - * PHYRX_OTHER_RECEIVE_INFO TLV. - */ - ppdu_info->rssi_comb = -- FIELD_GET(HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO1_RSSI_COMB, -+ FIELD_GET(HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RSSI_COMB, - __le32_to_cpu(rssi->info0)); - - if (db2dbm) { ---- a/drivers/net/wireless/ath/ath11k/hal_rx.h -+++ b/drivers/net/wireless/ath/ath11k/hal_rx.h -@@ -385,7 +385,7 @@ struct hal_rx_he_sig_b2_ofdma_info { - __le32 info0; - } __packed; - --#define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO1_RSSI_COMB GENMASK(15, 8) -+#define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RSSI_COMB GENMASK(15, 8) - - #define HAL_RX_PHYRX_RSSI_PREAMBLE_PRI20 GENMASK(7, 0) - diff --git a/package/kernel/mac80211/patches/ath11k/0067-wifi-ath11k-Fix-SKB-corruption-in-REO-destination-ri.patch b/package/kernel/mac80211/patches/ath11k/0067-wifi-ath11k-Fix-SKB-corruption-in-REO-destination-ri.patch deleted file mode 100644 index 8b300f3a790a35..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0067-wifi-ath11k-Fix-SKB-corruption-in-REO-destination-ri.patch +++ /dev/null @@ -1,70 +0,0 @@ -From f9fff67d2d7ca6fa8066132003a3deef654c55b1 Mon Sep 17 00:00:00 2001 -From: Nagarajan Maran -Date: Mon, 17 Apr 2023 13:35:02 +0300 -Subject: [PATCH] wifi: ath11k: Fix SKB corruption in REO destination ring - -While running traffics for a long time, randomly an RX descriptor -filled with value "0" from REO destination ring is received. -This descriptor which is invalid causes the wrong SKB (SKB stored in -the IDR lookup with buffer id "0") to be fetched which in turn -causes SKB memory corruption issue and the same leads to crash -after some time. - -Changed the start id for idr allocation to "1" and the buffer id "0" -is reserved for error validation. Introduced Sanity check to validate -the descriptor, before processing the SKB. - -Crash Signature : - -Unable to handle kernel paging request at virtual address 3f004900 -PC points to "b15_dma_inv_range+0x30/0x50" -LR points to "dma_cache_maint_page+0x8c/0x128". -The Backtrace obtained is as follows: -[<8031716c>] (b15_dma_inv_range) from [<80313a4c>] (dma_cache_maint_page+0x8c/0x128) -[<80313a4c>] (dma_cache_maint_page) from [<80313b90>] (__dma_page_dev_to_cpu+0x28/0xcc) -[<80313b90>] (__dma_page_dev_to_cpu) from [<7fb5dd68>] (ath11k_dp_process_rx+0x1e8/0x4a4 [ath11k]) -[<7fb5dd68>] (ath11k_dp_process_rx [ath11k]) from [<7fb53c20>] (ath11k_dp_service_srng+0xb0/0x2ac [ath11k]) -[<7fb53c20>] (ath11k_dp_service_srng [ath11k]) from [<7f67bba4>] (ath11k_pci_ext_grp_napi_poll+0x1c/0x78 [ath11k_pci]) -[<7f67bba4>] (ath11k_pci_ext_grp_napi_poll [ath11k_pci]) from [<807d5cf4>] (__napi_poll+0x28/0xb8) -[<807d5cf4>] (__napi_poll) from [<807d5f28>] (net_rx_action+0xf0/0x280) -[<807d5f28>] (net_rx_action) from [<80302148>] (__do_softirq+0xd0/0x280) -[<80302148>] (__do_softirq) from [<80320408>] (irq_exit+0x74/0xd4) -[<80320408>] (irq_exit) from [<803638a4>] (__handle_domain_irq+0x90/0xb4) -[<803638a4>] (__handle_domain_irq) from [<805bedec>] (gic_handle_irq+0x58/0x90) -[<805bedec>] (gic_handle_irq) from [<80301a78>] (__irq_svc+0x58/0x8c) - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Nagarajan Maran -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403191533.28114-1-quic_nmaran@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp_rx.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -389,10 +389,10 @@ int ath11k_dp_rxbufs_replenish(struct at - goto fail_free_skb; - - spin_lock_bh(&rx_ring->idr_lock); -- buf_id = idr_alloc(&rx_ring->bufs_idr, skb, 0, -- rx_ring->bufs_max * 3, GFP_ATOMIC); -+ buf_id = idr_alloc(&rx_ring->bufs_idr, skb, 1, -+ (rx_ring->bufs_max * 3) + 1, GFP_ATOMIC); - spin_unlock_bh(&rx_ring->idr_lock); -- if (buf_id < 0) -+ if (buf_id <= 0) - goto fail_dma_unmap; - - desc = ath11k_hal_srng_src_get_next_entry(ab, srng); -@@ -2665,6 +2665,9 @@ try_again: - cookie); - mac_id = FIELD_GET(DP_RXDMA_BUF_COOKIE_PDEV_ID, cookie); - -+ if (unlikely(buf_id == 0)) -+ continue; -+ - ar = ab->pdevs[mac_id].ar; - rx_ring = &ar->dp.rx_refill_buf_ring; - spin_lock_bh(&rx_ring->idr_lock); diff --git a/package/kernel/mac80211/patches/ath11k/0068-wifi-ath11k-Remove-disabling-of-80-80-and-160-MHz.patch b/package/kernel/mac80211/patches/ath11k/0068-wifi-ath11k-Remove-disabling-of-80-80-and-160-MHz.patch deleted file mode 100644 index ce5ffd273be333..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0068-wifi-ath11k-Remove-disabling-of-80-80-and-160-MHz.patch +++ /dev/null @@ -1,49 +0,0 @@ -From b100722a777f6455d913666a376f81342b2cb995 Mon Sep 17 00:00:00 2001 -From: Muna Sinada -Date: Mon, 17 Apr 2023 13:22:27 -0700 -Subject: [PATCH] wifi: ath11k: Remove disabling of 80+80 and 160 MHz - -This is a regression fix for 80+80 and 160 MHz support bits being -cleared, therefore not adverised. Remove disable of 80+80 and 160 MHz -capability flags and assign valid center frequency 2 similar to -VHT80_80. - -Fixes: 38dfe775d0ab ("wifi: ath11k: push MU-MIMO params from hostapd to hardware") -Reported-by: Robert Marko -Tested-by: Robert Marko # IPQ8074 WLAN.HK.2.9.0.1-01385-QCAHKSWPL_SILICONZ-1 -Link: https://bugzilla.kernel.org/show_bug.cgi?id=217299 -Co-developed-by: P Praneesh -Signed-off-by: P Praneesh -Signed-off-by: Muna Sinada -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/1681762947-13882-1-git-send-email-quic_msinada@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 4 ---- - drivers/net/wireless/ath/ath11k/wmi.c | 3 ++- - 2 files changed, 2 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5585,10 +5585,6 @@ static int ath11k_mac_copy_he_cap(struct - - he_cap_elem->mac_cap_info[1] &= - IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK; -- he_cap_elem->phy_cap_info[0] &= -- ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G; -- he_cap_elem->phy_cap_info[0] &= -- ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G; - - he_cap_elem->phy_cap_info[5] &= - ~IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK; ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -871,7 +871,8 @@ static void ath11k_wmi_put_wmi_channel(s - - chan->band_center_freq2 = arg->channel.band_center_freq1; - -- } else if (arg->channel.mode == MODE_11AC_VHT80_80) { -+ } else if ((arg->channel.mode == MODE_11AC_VHT80_80) || -+ (arg->channel.mode == MODE_11AX_HE80_80)) { - chan->band_center_freq2 = arg->channel.band_center_freq2; - } else { - chan->band_center_freq2 = 0; diff --git a/package/kernel/mac80211/patches/ath11k/0069-wifi-ath11k-fix-registration-of-6Ghz-only-phy-withou.patch b/package/kernel/mac80211/patches/ath11k/0069-wifi-ath11k-fix-registration-of-6Ghz-only-phy-withou.patch deleted file mode 100644 index 32468dbc4cab62..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0069-wifi-ath11k-fix-registration-of-6Ghz-only-phy-withou.patch +++ /dev/null @@ -1,61 +0,0 @@ -From e2ceb1de2f83aafd8003f0b72dfd4b7441e97d14 Mon Sep 17 00:00:00 2001 -From: Maxime Bizon -Date: Fri, 21 Apr 2023 16:54:45 +0200 -Subject: [PATCH] wifi: ath11k: fix registration of 6Ghz-only phy without the - full channel range - -Because of what seems to be a typo, a 6Ghz-only phy for which the BDF -does not allow the 7115Mhz channel will fail to register: - - WARNING: CPU: 2 PID: 106 at net/wireless/core.c:907 wiphy_register+0x914/0x954 - Modules linked in: ath11k_pci sbsa_gwdt - CPU: 2 PID: 106 Comm: kworker/u8:5 Not tainted 6.3.0-rc7-next-20230418-00549-g1e096a17625a-dirty #9 - Hardware name: Freebox V7R Board (DT) - Workqueue: ath11k_qmi_driver_event ath11k_qmi_driver_event_work - pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) - pc : wiphy_register+0x914/0x954 - lr : ieee80211_register_hw+0x67c/0xc10 - sp : ffffff800b123aa0 - x29: ffffff800b123aa0 x28: 0000000000000000 x27: 0000000000000000 - x26: 0000000000000000 x25: 0000000000000006 x24: ffffffc008d51418 - x23: ffffffc008cb0838 x22: ffffff80176c2460 x21: 0000000000000168 - x20: ffffff80176c0000 x19: ffffff80176c03e0 x18: 0000000000000014 - x17: 00000000cbef338c x16: 00000000d2a26f21 x15: 00000000ad6bb85f - x14: 0000000000000020 x13: 0000000000000020 x12: 00000000ffffffbd - x11: 0000000000000208 x10: 00000000fffffdf7 x9 : ffffffc009394718 - x8 : ffffff80176c0528 x7 : 000000007fffffff x6 : 0000000000000006 - x5 : 0000000000000005 x4 : ffffff800b304284 x3 : ffffff800b304284 - x2 : ffffff800b304d98 x1 : 0000000000000000 x0 : 0000000000000000 - Call trace: - wiphy_register+0x914/0x954 - ieee80211_register_hw+0x67c/0xc10 - ath11k_mac_register+0x7c4/0xe10 - ath11k_core_qmi_firmware_ready+0x1f4/0x570 - ath11k_qmi_driver_event_work+0x198/0x590 - process_one_work+0x1b8/0x328 - worker_thread+0x6c/0x414 - kthread+0x100/0x104 - ret_from_fork+0x10/0x20 - ---[ end trace 0000000000000000 ]--- - ath11k_pci 0002:01:00.0: ieee80211 registration failed: -22 - ath11k_pci 0002:01:00.0: failed register the radio with mac80211: -22 - ath11k_pci 0002:01:00.0: failed to create pdev core: -22 - -Signed-off-by: Maxime Bizon -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230421145445.2612280-1-mbizon@freebox.fr ---- - drivers/net/wireless/ath/ath11k/mac.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -8892,7 +8892,7 @@ static int ath11k_mac_setup_channels_rat - } - - if (supported_bands & WMI_HOST_WLAN_5G_CAP) { -- if (reg_cap->high_5ghz_chan >= ATH11K_MAX_6G_FREQ) { -+ if (reg_cap->high_5ghz_chan >= ATH11K_MIN_6G_FREQ) { - channels = kmemdup(ath11k_6ghz_channels, - sizeof(ath11k_6ghz_channels), GFP_KERNEL); - if (!channels) { diff --git a/package/kernel/mac80211/patches/ath11k/0070-wifi-ath-work-around-false-positive-stringop-overrea.patch b/package/kernel/mac80211/patches/ath11k/0070-wifi-ath-work-around-false-positive-stringop-overrea.patch deleted file mode 100644 index aa4df16a90fe6b..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0070-wifi-ath-work-around-false-positive-stringop-overrea.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 695df2f417d25202bdac9cde3c82d2acb6492b4d Mon Sep 17 00:00:00 2001 -From: Arnd Bergmann -Date: Fri, 5 May 2023 16:11:25 +0300 -Subject: [PATCH] wifi: ath: work around false-positive stringop-overread - warning - -In a rare arm64 randconfig build, I got multiple warnings for ath11k -and ath12k: - -In function 'ath11k_peer_assoc_h_ht', - inlined from 'ath11k_peer_assoc_prepare' at drivers/net/wireless/ath/ath11k/mac.c:2665:2: -drivers/net/wireless/ath/ath11k/mac.c:1709:13: error: 'ath11k_peer_assoc_h_ht_masked' reading 10 bytes from a region of size 0 [-Werror=stringop-overread] - 1709 | if (ath11k_peer_assoc_h_ht_masked(ht_mcs_mask)) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This happens whenever gcc-13 fails to inline one of the functions -that take a fixed-length array argument but gets passed a pointer. - -Change these functions to all take a regular pointer argument -instead. - -Signed-off-by: Arnd Bergmann -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230417205447.1800912-1-arnd@kernel.org ---- - drivers/net/wireless/ath/ath11k/mac.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -433,7 +433,7 @@ u8 ath11k_mac_bitrate_to_idx(const struc - } - - static u32 --ath11k_mac_max_ht_nss(const u8 ht_mcs_mask[IEEE80211_HT_MCS_MASK_LEN]) -+ath11k_mac_max_ht_nss(const u8 *ht_mcs_mask) - { - int nss; - -@@ -445,7 +445,7 @@ ath11k_mac_max_ht_nss(const u8 ht_mcs_ma - } - - static u32 --ath11k_mac_max_vht_nss(const u16 vht_mcs_mask[NL80211_VHT_NSS_MAX]) -+ath11k_mac_max_vht_nss(const u16 *vht_mcs_mask) - { - int nss; - -@@ -457,7 +457,7 @@ ath11k_mac_max_vht_nss(const u16 vht_mcs - } - - static u32 --ath11k_mac_max_he_nss(const u16 he_mcs_mask[NL80211_HE_NSS_MAX]) -+ath11k_mac_max_he_nss(const u16 *he_mcs_mask) - { - int nss; - -@@ -1658,7 +1658,7 @@ static void ath11k_peer_assoc_h_rates(st - } - - static bool --ath11k_peer_assoc_h_ht_masked(const u8 ht_mcs_mask[IEEE80211_HT_MCS_MASK_LEN]) -+ath11k_peer_assoc_h_ht_masked(const u8 *ht_mcs_mask) - { - int nss; - -@@ -1670,7 +1670,7 @@ ath11k_peer_assoc_h_ht_masked(const u8 h - } - - static bool --ath11k_peer_assoc_h_vht_masked(const u16 vht_mcs_mask[]) -+ath11k_peer_assoc_h_vht_masked(const u16 *vht_mcs_mask) - { - int nss; - -@@ -2065,7 +2065,7 @@ static u16 ath11k_peer_assoc_h_he_limit( - } - - static bool --ath11k_peer_assoc_h_he_masked(const u16 he_mcs_mask[NL80211_HE_NSS_MAX]) -+ath11k_peer_assoc_h_he_masked(const u16 *he_mcs_mask) - { - int nss; - diff --git a/package/kernel/mac80211/patches/ath11k/0071-wifi-ath11k-driver-settings-for-MBSSID-and-EMA.patch b/package/kernel/mac80211/patches/ath11k/0071-wifi-ath11k-driver-settings-for-MBSSID-and-EMA.patch deleted file mode 100644 index bede4819ca4072..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0071-wifi-ath11k-driver-settings-for-MBSSID-and-EMA.patch +++ /dev/null @@ -1,133 +0,0 @@ -From a08dbb04d7365a04d52882143cf196005bfc88c3 Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Fri, 5 May 2023 16:11:27 +0300 -Subject: [PATCH 71/77] wifi: ath11k: driver settings for MBSSID and EMA - -Advertise the driver support for multiple BSSID (MBSSID) and -enhanced multi-BSSID advertisements (EMA) by setting extended -capabilities. - -Configure mbssid_max_interfaces and ema_max_profile_periodicity -fields in structure wiphy which are used to advertise maximum number -of interfaces and profile periodicity supported by the driver. - -Add new WMI fields to configure maximum vdev count supported for -MBSSID and profile periodicity in case of EMA. -Setting WMI_RSRC_CFG_FLAG2_CALC_NEXT_DTIM_COUNT_SET flag -indicates that the firmware should track and update the DTIM counts -for each non-transmitted profile. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aloka Dixit -Co-developed-by: John Crispin -Signed-off-by: John Crispin -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405221648.17950-2-quic_alokad@quicinc.com ---- - drivers/net/wireless/ath/ath11k/hw.c | 3 +++ - drivers/net/wireless/ath/ath11k/hw.h | 1 + - drivers/net/wireless/ath/ath11k/mac.c | 7 +++++++ - drivers/net/wireless/ath/ath11k/wmi.c | 3 +++ - drivers/net/wireless/ath/ath11k/wmi.h | 6 ++++++ - 5 files changed, 20 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -202,6 +202,9 @@ static void ath11k_init_wmi_config_ipq80 - config->twt_ap_sta_count = 1000; - config->flag1 |= WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64; - config->flag1 |= WMI_RSRC_CFG_FLAG1_ACK_RSSI; -+ config->ema_max_vap_cnt = ab->num_radios; -+ config->ema_max_profile_period = TARGET_EMA_MAX_PROFILE_PERIOD; -+ config->beacon_tx_offload_max_vdev += config->ema_max_vap_cnt; - } - - static int ath11k_hw_mac_id_to_pdev_id_ipq8074(struct ath11k_hw_params *hw, ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -64,6 +64,7 @@ - #define TARGET_NUM_WDS_ENTRIES 32 - #define TARGET_DMA_BURST_SIZE 1 - #define TARGET_RX_BATCHMODE 1 -+#define TARGET_EMA_MAX_PROFILE_PERIOD 8 - - #define ATH11K_HW_MAX_QUEUES 4 - #define ATH11K_QUEUE_LEN 4096 ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -9001,19 +9001,23 @@ static int ath11k_mac_setup_iface_combin - - static const u8 ath11k_if_types_ext_capa[] = { - [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING, -+ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT, - [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF, - }; - - static const u8 ath11k_if_types_ext_capa_sta[] = { - [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING, -+ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT, - [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF, - [9] = WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT, - }; - - static const u8 ath11k_if_types_ext_capa_ap[] = { - [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING, -+ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT, - [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF, - [9] = WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT, -+ [10] = WLAN_EXT_CAPA11_EMA_SUPPORT, - }; - - static const struct wiphy_iftype_ext_capab ath11k_iftypes_ext_capa[] = { -@@ -9251,6 +9255,9 @@ static int __ath11k_mac_register(struct - wiphy_ext_feature_set(ar->hw->wiphy, - NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER); - -+ ar->hw->wiphy->mbssid_max_interfaces = TARGET_NUM_VDEVS(ab); -+ ar->hw->wiphy->ema_max_profile_periodicity = TARGET_EMA_MAX_PROFILE_PERIOD; -+ - ath11k_reg_init(ar); - - if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) { ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -3987,6 +3987,9 @@ ath11k_wmi_copy_resource_config(struct w - ~(1 << WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT); - wmi_cfg->host_service_flags |= (tg_cfg->is_reg_cc_ext_event_supported << - WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT); -+ wmi_cfg->flags2 = WMI_RSRC_CFG_FLAG2_CALC_NEXT_DTIM_COUNT_SET; -+ wmi_cfg->ema_max_vap_cnt = tg_cfg->ema_max_vap_cnt; -+ wmi_cfg->ema_max_profile_period = tg_cfg->ema_max_profile_period; - } - - static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi, ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2317,6 +2317,7 @@ struct wmi_init_cmd { - } __packed; - - #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64 BIT(5) -+#define WMI_RSRC_CFG_FLAG2_CALC_NEXT_DTIM_COUNT_SET BIT(9) - #define WMI_RSRC_CFG_FLAG1_ACK_RSSI BIT(18) - - #define WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT 4 -@@ -2389,6 +2390,9 @@ struct wmi_resource_config { - u32 msdu_flow_override_config1; - u32 flags2; - u32 host_service_flags; -+ u32 max_rnr_neighbours; -+ u32 ema_max_vap_cnt; -+ u32 ema_max_profile_period; - } __packed; - - struct wmi_service_ready_event { -@@ -5646,6 +5650,8 @@ struct target_resource_config { - u32 twt_ap_pdev_count; - u32 twt_ap_sta_count; - u8 is_reg_cc_ext_event_supported; -+ u32 ema_max_vap_cnt; -+ u32 ema_max_profile_period; - }; - - enum wmi_debug_log_param { diff --git a/package/kernel/mac80211/patches/ath11k/0072-wifi-ath11k-MBSSID-configuration-during-vdev-create-.patch b/package/kernel/mac80211/patches/ath11k/0072-wifi-ath11k-MBSSID-configuration-during-vdev-create-.patch deleted file mode 100644 index 4ba0717319cad8..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0072-wifi-ath11k-MBSSID-configuration-during-vdev-create-.patch +++ /dev/null @@ -1,215 +0,0 @@ -From 5a81610acf66c4ad6e1a1fbd09f3f555fca863b1 Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Fri, 5 May 2023 16:11:27 +0300 -Subject: [PATCH 72/77] wifi: ath11k: MBSSID configuration during vdev - create/start - -Configure multiple BSSID flags and index of the transmitting interface -in vdev create/start commands depending on the service bit -WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aloka Dixit -Co-developed-by: John Crispin -Signed-off-by: John Crispin -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405221648.17950-3-quic_alokad@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 70 +++++++++++++++++++++++++-- - drivers/net/wireless/ath/ath11k/wmi.c | 5 ++ - drivers/net/wireless/ath/ath11k/wmi.h | 19 ++++++++ - 3 files changed, 90 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6181,17 +6181,62 @@ static void ath11k_mac_op_stop(struct ie - atomic_set(&ar->num_pending_mgmt_tx, 0); - } - --static void --ath11k_mac_setup_vdev_create_params(struct ath11k_vif *arvif, -- struct vdev_create_params *params) -+static int ath11k_mac_setup_vdev_params_mbssid(struct ath11k_vif *arvif, -+ u32 *flags, u32 *tx_vdev_id) -+{ -+ struct ath11k *ar = arvif->ar; -+ struct ath11k_vif *tx_arvif; -+ struct ieee80211_vif *tx_vif; -+ -+ *tx_vdev_id = 0; -+ tx_vif = arvif->vif->mbssid_tx_vif; -+ if (!tx_vif) { -+ *flags = WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP; -+ return 0; -+ } -+ -+ tx_arvif = (void *)tx_vif->drv_priv; -+ -+ if (arvif->vif->bss_conf.nontransmitted) { -+ if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy) -+ return -EINVAL; -+ -+ *flags = WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP; -+ *tx_vdev_id = ath11k_vif_to_arvif(tx_vif)->vdev_id; -+ } else if (tx_arvif == arvif) { -+ *flags = WMI_HOST_VDEV_FLAGS_TRANSMIT_AP; -+ } else { -+ return -EINVAL; -+ } -+ -+ if (arvif->vif->bss_conf.ema_ap) -+ *flags |= WMI_HOST_VDEV_FLAGS_EMA_MODE; -+ -+ return 0; -+} -+ -+static int ath11k_mac_setup_vdev_create_params(struct ath11k_vif *arvif, -+ struct vdev_create_params *params) - { - struct ath11k *ar = arvif->ar; - struct ath11k_pdev *pdev = ar->pdev; -+ int ret; - - params->if_id = arvif->vdev_id; - params->type = arvif->vdev_type; - params->subtype = arvif->vdev_subtype; - params->pdev_id = pdev->pdev_id; -+ params->mbssid_flags = 0; -+ params->mbssid_tx_vdev_id = 0; -+ -+ if (!test_bit(WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT, -+ ar->ab->wmi_ab.svc_map)) { -+ ret = ath11k_mac_setup_vdev_params_mbssid(arvif, -+ ¶ms->mbssid_flags, -+ ¶ms->mbssid_tx_vdev_id); -+ if (ret) -+ return ret; -+ } - - if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) { - params->chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains; -@@ -6206,6 +6251,7 @@ ath11k_mac_setup_vdev_create_params(stru - params->chains[NL80211_BAND_6GHZ].tx = ar->num_tx_chains; - params->chains[NL80211_BAND_6GHZ].rx = ar->num_rx_chains; - } -+ return 0; - } - - static void ath11k_mac_op_update_vif_offload(struct ieee80211_hw *hw, -@@ -6500,7 +6546,12 @@ static int ath11k_mac_op_add_interface(s - for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++) - vif->hw_queue[i] = i % (ATH11K_HW_MAX_QUEUES - 1); - -- ath11k_mac_setup_vdev_create_params(arvif, &vdev_param); -+ ret = ath11k_mac_setup_vdev_create_params(arvif, &vdev_param); -+ if (ret) { -+ ath11k_warn(ab, "failed to create vdev parameters %d: %d\n", -+ arvif->vdev_id, ret); -+ goto err; -+ } - - ret = ath11k_wmi_vdev_create(ar, vif->addr, &vdev_param); - if (ret) { -@@ -6905,6 +6956,17 @@ ath11k_mac_vdev_start_restart(struct ath - arg.pref_tx_streams = ar->num_tx_chains; - arg.pref_rx_streams = ar->num_rx_chains; - -+ arg.mbssid_flags = 0; -+ arg.mbssid_tx_vdev_id = 0; -+ if (test_bit(WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT, -+ ar->ab->wmi_ab.svc_map)) { -+ ret = ath11k_mac_setup_vdev_params_mbssid(arvif, -+ &arg.mbssid_flags, -+ &arg.mbssid_tx_vdev_id); -+ if (ret) -+ return ret; -+ } -+ - if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { - arg.ssid = arvif->u.ap.ssid; - arg.ssid_len = arvif->u.ap.ssid_len; ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -724,6 +724,9 @@ int ath11k_wmi_vdev_create(struct ath11k - cmd->vdev_subtype = param->subtype; - cmd->num_cfg_txrx_streams = WMI_NUM_SUPPORTED_BAND_MAX; - cmd->pdev_id = param->pdev_id; -+ cmd->mbssid_flags = param->mbssid_flags; -+ cmd->mbssid_tx_vdev_id = param->mbssid_tx_vdev_id; -+ - ether_addr_copy(cmd->vdev_macaddr.addr, macaddr); - - ptr = skb->data + sizeof(*cmd); -@@ -941,6 +944,8 @@ int ath11k_wmi_vdev_start(struct ath11k - cmd->cac_duration_ms = arg->cac_duration_ms; - cmd->regdomain = arg->regdomain; - cmd->he_ops = arg->he_ops; -+ cmd->mbssid_flags = arg->mbssid_flags; -+ cmd->mbssid_tx_vdev_id = arg->mbssid_tx_vdev_id; - - if (!restart) { - if (arg->ssid) { ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -137,6 +137,14 @@ enum { - WMI_AUTORATE_3200NS_GI = BIT(11), - }; - -+enum { -+ WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP = 0x00000001, -+ WMI_HOST_VDEV_FLAGS_TRANSMIT_AP = 0x00000002, -+ WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP = 0x00000004, -+ WMI_HOST_VDEV_FLAGS_EMA_MODE = 0x00000008, -+ WMI_HOST_VDEV_FLAGS_SCAN_MODE_VAP = 0x00000010, -+}; -+ - /* - * wmi command groups. - */ -@@ -2096,6 +2104,7 @@ enum wmi_tlv_service { - WMI_TLV_SERVICE_EXT2_MSG = 220, - WMI_TLV_SERVICE_PEER_POWER_SAVE_DURATION_SUPPORT = 246, - WMI_TLV_SERVICE_SRG_SRP_SPATIAL_REUSE_SUPPORT = 249, -+ WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT = 253, - WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE = 263, - - /* The second 128 bits */ -@@ -2583,6 +2592,8 @@ struct vdev_create_params { - u8 rx; - } chains[NUM_NL80211_BANDS]; - u32 pdev_id; -+ u32 mbssid_flags; -+ u32 mbssid_tx_vdev_id; - }; - - struct wmi_vdev_create_cmd { -@@ -2593,6 +2604,8 @@ struct wmi_vdev_create_cmd { - struct wmi_mac_addr vdev_macaddr; - u32 num_cfg_txrx_streams; - u32 pdev_id; -+ u32 mbssid_flags; -+ u32 mbssid_tx_vdev_id; - } __packed; - - struct wmi_vdev_txrx_streams { -@@ -2656,6 +2669,9 @@ struct wmi_vdev_start_request_cmd { - u32 he_ops; - u32 cac_duration_ms; - u32 regdomain; -+ u32 min_data_rate; -+ u32 mbssid_flags; -+ u32 mbssid_tx_vdev_id; - } __packed; - - #define MGMT_TX_DL_FRM_LEN 64 -@@ -2825,6 +2841,9 @@ struct wmi_vdev_start_req_arg { - u32 pref_rx_streams; - u32 pref_tx_streams; - u32 num_noa_descriptors; -+ u32 min_data_rate; -+ u32 mbssid_flags; -+ u32 mbssid_tx_vdev_id; - }; - - struct peer_create_params { diff --git a/package/kernel/mac80211/patches/ath11k/0073-wifi-ath11k-rename-MBSSID-fields-in-wmi_vdev_up_cmd.patch b/package/kernel/mac80211/patches/ath11k/0073-wifi-ath11k-rename-MBSSID-fields-in-wmi_vdev_up_cmd.patch deleted file mode 100644 index 023a1dbb9fc03e..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0073-wifi-ath11k-rename-MBSSID-fields-in-wmi_vdev_up_cmd.patch +++ /dev/null @@ -1,52 +0,0 @@ -From cf604e72bc6e6db68c7fcaa8779b03ec14b8d2fa Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Fri, 5 May 2023 16:11:27 +0300 -Subject: [PATCH 73/77] wifi: ath11k: rename MBSSID fields in wmi_vdev_up_cmd - -Rename trans_bssid to tx_vdev_bssid to make it similar to vdev_bssid. - -Rename profile_num to nontx_profile_cnt, and profile_idx to -nontx_profile_idx which makes it clear that these store configurations -related to MBSSID non-transmitting profiles. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aloka Dixit -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405221648.17950-4-quic_alokad@quicinc.com ---- - drivers/net/wireless/ath/ath11k/wmi.c | 6 +++--- - drivers/net/wireless/ath/ath11k/wmi.h | 6 +++--- - 2 files changed, 6 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -1029,10 +1029,10 @@ int ath11k_wmi_vdev_up(struct ath11k *ar - bss_conf = &arvif->vif->bss_conf; - - if (bss_conf->nontransmitted) { -- ether_addr_copy(cmd->trans_bssid.addr, -+ ether_addr_copy(cmd->tx_vdev_bssid.addr, - bss_conf->transmitter_bssid); -- cmd->profile_idx = bss_conf->bssid_index; -- cmd->profile_num = bss_conf->bssid_indicator; -+ cmd->nontx_profile_idx = bss_conf->bssid_index; -+ cmd->nontx_profile_cnt = bss_conf->bssid_indicator; - } - } - ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2625,9 +2625,9 @@ struct wmi_vdev_up_cmd { - u32 vdev_id; - u32 vdev_assoc_id; - struct wmi_mac_addr vdev_bssid; -- struct wmi_mac_addr trans_bssid; -- u32 profile_idx; -- u32 profile_num; -+ struct wmi_mac_addr tx_vdev_bssid; -+ u32 nontx_profile_idx; -+ u32 nontx_profile_cnt; - } __packed; - - struct wmi_vdev_stop_cmd { diff --git a/package/kernel/mac80211/patches/ath11k/0074-wifi-ath11k-MBSSID-parameter-configuration-in-AP-mod.patch b/package/kernel/mac80211/patches/ath11k/0074-wifi-ath11k-MBSSID-parameter-configuration-in-AP-mod.patch deleted file mode 100644 index d93e27dd42bb95..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0074-wifi-ath11k-MBSSID-parameter-configuration-in-AP-mod.patch +++ /dev/null @@ -1,138 +0,0 @@ -From c82dc33f252fd8883be66f2d0230af0fd734c683 Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Fri, 5 May 2023 16:11:27 +0300 -Subject: [PATCH 74/77] wifi: ath11k: MBSSID parameter configuration in AP mode - -Include MBSSID parameters in WMI vdev up operation. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aloka Dixit -Co-developed-by: John Crispin -Signed-off-by: John Crispin -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405221648.17950-5-quic_alokad@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 29 +++++++++++++++++++++------ - drivers/net/wireless/ath/ath11k/wmi.c | 8 +++++++- - drivers/net/wireless/ath/ath11k/wmi.h | 3 ++- - 3 files changed, 32 insertions(+), 8 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -964,7 +964,7 @@ static int ath11k_mac_monitor_vdev_start - return ret; - } - -- ret = ath11k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr); -+ ret = ath11k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr, NULL, 0, 0); - if (ret) { - ath11k_warn(ar->ab, "failed to put up monitor vdev %i: %d\n", - vdev_id, ret); -@@ -1423,6 +1423,7 @@ static void ath11k_control_beaconing(str - struct ieee80211_bss_conf *info) - { - struct ath11k *ar = arvif->ar; -+ struct ath11k_vif *tx_arvif = NULL; - int ret = 0; - - lockdep_assert_held(&arvif->ar->conf_mutex); -@@ -1451,8 +1452,14 @@ static void ath11k_control_beaconing(str - - ether_addr_copy(arvif->bssid, info->bssid); - -+ if (arvif->vif->mbssid_tx_vif) -+ tx_arvif = (struct ath11k_vif *)arvif->vif->mbssid_tx_vif->drv_priv; -+ - ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, -- arvif->bssid); -+ arvif->bssid, -+ tx_arvif ? tx_arvif->bssid : NULL, -+ info->bssid_index, -+ 1 << info->bssid_indicator); - if (ret) { - ath11k_warn(ar->ab, "failed to bring up vdev %d: %i\n", - arvif->vdev_id, ret); -@@ -2879,7 +2886,8 @@ static void ath11k_bss_assoc(struct ieee - arvif->aid = vif->cfg.aid; - ether_addr_copy(arvif->bssid, bss_conf->bssid); - -- ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid); -+ ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid, -+ NULL, 0, 0); - if (ret) { - ath11k_warn(ar->ab, "failed to set vdev %d up: %d\n", - arvif->vdev_id, ret); -@@ -7133,7 +7141,8 @@ ath11k_mac_update_vif_chan(struct ath11k - int n_vifs) - { - struct ath11k_base *ab = ar->ab; -- struct ath11k_vif *arvif; -+ struct ath11k_vif *arvif, *tx_arvif = NULL; -+ struct ieee80211_vif *mbssid_tx_vif; - int ret; - int i; - bool monitor_vif = false; -@@ -7187,8 +7196,15 @@ ath11k_mac_update_vif_chan(struct ath11k - ath11k_warn(ab, "failed to update bcn tmpl during csa: %d\n", - ret); - -+ mbssid_tx_vif = arvif->vif->mbssid_tx_vif; -+ if (mbssid_tx_vif) -+ tx_arvif = (struct ath11k_vif *)mbssid_tx_vif->drv_priv; -+ - ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, -- arvif->bssid); -+ arvif->bssid, -+ tx_arvif ? tx_arvif->bssid : NULL, -+ arvif->vif->bss_conf.bssid_index, -+ 1 << arvif->vif->bss_conf.bssid_indicator); - if (ret) { - ath11k_warn(ab, "failed to bring vdev up %d: %d\n", - arvif->vdev_id, ret); -@@ -7306,7 +7322,8 @@ static int ath11k_start_vdev_delay(struc - } - - if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { -- ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, 0, ar->mac_addr); -+ ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, 0, ar->mac_addr, -+ NULL, 0, 0); - if (ret) { - ath11k_warn(ab, "failed put monitor up: %d\n", ret); - return ret; ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -1001,7 +1001,8 @@ int ath11k_wmi_vdev_start(struct ath11k - return ret; - } - --int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid, const u8 *bssid) -+int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid, const u8 *bssid, -+ u8 *tx_bssid, u32 nontx_profile_idx, u32 nontx_profile_cnt) - { - struct ath11k_pdev_wmi *wmi = ar->wmi; - struct wmi_vdev_up_cmd *cmd; -@@ -1025,6 +1026,11 @@ int ath11k_wmi_vdev_up(struct ath11k *ar - - ether_addr_copy(cmd->vdev_bssid.addr, bssid); - -+ cmd->nontx_profile_idx = nontx_profile_idx; -+ cmd->nontx_profile_cnt = nontx_profile_cnt; -+ if (tx_bssid) -+ ether_addr_copy(cmd->tx_vdev_bssid.addr, tx_bssid); -+ - if (arvif && arvif->vif->type == NL80211_IFTYPE_STATION) { - bss_conf = &arvif->vif->bss_conf; - ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -6301,7 +6301,8 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *a - struct sk_buff *bcn); - int ath11k_wmi_vdev_down(struct ath11k *ar, u8 vdev_id); - int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid, -- const u8 *bssid); -+ const u8 *bssid, u8 *tx_bssid, u32 nontx_profile_idx, -+ u32 nontx_profile_cnt); - int ath11k_wmi_vdev_stop(struct ath11k *ar, u8 vdev_id); - int ath11k_wmi_vdev_start(struct ath11k *ar, struct wmi_vdev_start_req_arg *arg, - bool restart); diff --git a/package/kernel/mac80211/patches/ath11k/0075-wifi-ath11k-refactor-vif-parameter-configurations.patch b/package/kernel/mac80211/patches/ath11k/0075-wifi-ath11k-refactor-vif-parameter-configurations.patch deleted file mode 100644 index 8509e55978d75d..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0075-wifi-ath11k-refactor-vif-parameter-configurations.patch +++ /dev/null @@ -1,86 +0,0 @@ -From cb9bea773c85e372931cd7a177db4165adf29d95 Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Fri, 5 May 2023 16:11:28 +0300 -Subject: [PATCH 75/77] wifi: ath11k: refactor vif parameter configurations - -Security parameters for each non-transmitting profile can be -different when MBSSID is enabled and this information is included -in the MBSSID element in the Beacon frame. Current implementation -to set rsnie_present and wpaie_present does not parse this element -hence it applies only to the transmitting interface. - -Move the code to a separate function to make additions for -non-transmitting interfaces cleaner. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aloka Dixit -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405221648.17950-6-quic_alokad@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 41 ++++++++++++++++----------- - 1 file changed, 24 insertions(+), 17 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1351,28 +1351,14 @@ err_mon_del: - return ret; - } - --static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) -+static void ath11k_mac_set_vif_params(struct ath11k_vif *arvif, -+ struct sk_buff *bcn) - { -- struct ath11k *ar = arvif->ar; -- struct ath11k_base *ab = ar->ab; -- struct ieee80211_hw *hw = ar->hw; -- struct ieee80211_vif *vif = arvif->vif; -- struct ieee80211_mutable_offsets offs = {}; -- struct sk_buff *bcn; - struct ieee80211_mgmt *mgmt; - u8 *ies; -- int ret; -- -- if (arvif->vdev_type != WMI_VDEV_TYPE_AP) -- return 0; -- -- bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0); -- if (!bcn) { -- ath11k_warn(ab, "failed to get beacon template from mac80211\n"); -- return -EPERM; -- } - - ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn); -+ mgmt = (struct ieee80211_mgmt *)bcn->data; - ies += sizeof(mgmt->u.beacon); - - if (cfg80211_find_ie(WLAN_EID_RSN, ies, (skb_tail_pointer(bcn) - ies))) -@@ -1386,7 +1372,28 @@ static int ath11k_mac_setup_bcn_tmpl(str - arvif->wpaie_present = true; - else - arvif->wpaie_present = false; -+} -+ -+static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) -+{ -+ struct ath11k *ar = arvif->ar; -+ struct ath11k_base *ab = ar->ab; -+ struct ieee80211_hw *hw = ar->hw; -+ struct ieee80211_vif *vif = arvif->vif; -+ struct ieee80211_mutable_offsets offs = {}; -+ struct sk_buff *bcn; -+ int ret; -+ -+ if (arvif->vdev_type != WMI_VDEV_TYPE_AP) -+ return 0; -+ -+ bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0); -+ if (!bcn) { -+ ath11k_warn(ab, "failed to get beacon template from mac80211\n"); -+ return -EPERM; -+ } - -+ ath11k_mac_set_vif_params(arvif, bcn); - ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); - - kfree_skb(bcn); diff --git a/package/kernel/mac80211/patches/ath11k/0076-wifi-ath11k-MBSSID-beacon-support.patch b/package/kernel/mac80211/patches/ath11k/0076-wifi-ath11k-MBSSID-beacon-support.patch deleted file mode 100644 index d23ea8deeadc57..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0076-wifi-ath11k-MBSSID-beacon-support.patch +++ /dev/null @@ -1,190 +0,0 @@ -From 335a92765d308dfe22826f5562cd4b4389b45e71 Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Fri, 5 May 2023 16:11:28 +0300 -Subject: [PATCH 76/77] wifi: ath11k: MBSSID beacon support - -- Split ath11k_mac_setup_bcn_tmpl() to move the beacon retrieval and - WMI command to a new function, ath11k_mac_setup_bcn_tmpl_legacy(). - In the original function add checks to use the transmitting interface - when MBSSID is enabled. -- Set rsnie_present and wpaie_present fields for the non-transmitting - interfaces when MBSSID is enabled. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aloka Dixit -Co-developed-by: John Crispin -Signed-off-by: John Crispin -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405221648.17950-7-quic_alokad@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 116 ++++++++++++++++++++++++-- - drivers/net/wireless/ath/ath11k/wmi.c | 1 + - 2 files changed, 112 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1351,6 +1351,84 @@ err_mon_del: - return ret; - } - -+static void ath11k_mac_setup_nontx_vif_rsnie(struct ath11k_vif *arvif, -+ bool tx_arvif_rsnie_present, -+ const u8 *profile, u8 profile_len) -+{ -+ if (cfg80211_find_ie(WLAN_EID_RSN, profile, profile_len)) { -+ arvif->rsnie_present = true; -+ } else if (tx_arvif_rsnie_present) { -+ int i; -+ u8 nie_len; -+ const u8 *nie = cfg80211_find_ext_ie(WLAN_EID_EXT_NON_INHERITANCE, -+ profile, profile_len); -+ if (!nie) -+ return; -+ -+ nie_len = nie[1]; -+ nie += 2; -+ for (i = 0; i < nie_len; i++) { -+ if (nie[i] == WLAN_EID_RSN) { -+ arvif->rsnie_present = false; -+ break; -+ } -+ } -+ } -+} -+ -+static bool ath11k_mac_set_nontx_vif_params(struct ath11k_vif *tx_arvif, -+ struct ath11k_vif *arvif, -+ struct sk_buff *bcn) -+{ -+ struct ieee80211_mgmt *mgmt; -+ const u8 *ies, *profile, *next_profile; -+ int ies_len; -+ -+ ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn); -+ mgmt = (struct ieee80211_mgmt *)bcn->data; -+ ies += sizeof(mgmt->u.beacon); -+ ies_len = skb_tail_pointer(bcn) - ies; -+ -+ ies = cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, ies, ies_len); -+ arvif->rsnie_present = tx_arvif->rsnie_present; -+ -+ while (ies) { -+ u8 mbssid_len; -+ -+ ies_len -= (2 + ies[1]); -+ mbssid_len = ies[1] - 1; -+ profile = &ies[3]; -+ -+ while (mbssid_len) { -+ u8 profile_len; -+ -+ profile_len = profile[1]; -+ next_profile = profile + (2 + profile_len); -+ mbssid_len -= (2 + profile_len); -+ -+ profile += 2; -+ profile_len -= (2 + profile[1]); -+ profile += (2 + profile[1]); /* nontx capabilities */ -+ profile_len -= (2 + profile[1]); -+ profile += (2 + profile[1]); /* SSID */ -+ if (profile[2] == arvif->vif->bss_conf.bssid_index) { -+ profile_len -= 5; -+ profile = profile + 5; -+ ath11k_mac_setup_nontx_vif_rsnie(arvif, -+ tx_arvif->rsnie_present, -+ profile, -+ profile_len); -+ return true; -+ } -+ profile = next_profile; -+ } -+ ies = cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, profile, -+ ies_len); -+ } -+ -+ return false; -+} -+ - static void ath11k_mac_set_vif_params(struct ath11k_vif *arvif, - struct sk_buff *bcn) - { -@@ -1374,18 +1452,26 @@ static void ath11k_mac_set_vif_params(st - arvif->wpaie_present = false; - } - --static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) -+static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif) - { - struct ath11k *ar = arvif->ar; - struct ath11k_base *ab = ar->ab; -+ struct ath11k_vif *tx_arvif = arvif; - struct ieee80211_hw *hw = ar->hw; - struct ieee80211_vif *vif = arvif->vif; - struct ieee80211_mutable_offsets offs = {}; - struct sk_buff *bcn; - int ret; - -- if (arvif->vdev_type != WMI_VDEV_TYPE_AP) -- return 0; -+ if (arvif->vif->mbssid_tx_vif) { -+ tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv; -+ if (tx_arvif != arvif) { -+ ar = tx_arvif->ar; -+ ab = ar->ab; -+ hw = ar->hw; -+ vif = tx_arvif->vif; -+ } -+ } - - bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0); - if (!bcn) { -@@ -1393,9 +1479,12 @@ static int ath11k_mac_setup_bcn_tmpl(str - return -EPERM; - } - -- ath11k_mac_set_vif_params(arvif, bcn); -- ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); -+ if (tx_arvif == arvif) -+ ath11k_mac_set_vif_params(tx_arvif, bcn); -+ else if (!ath11k_mac_set_nontx_vif_params(tx_arvif, arvif, bcn)) -+ return -EINVAL; - -+ ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); - kfree_skb(bcn); - - if (ret) -@@ -1405,6 +1494,23 @@ static int ath11k_mac_setup_bcn_tmpl(str - return ret; - } - -+static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) -+{ -+ struct ieee80211_vif *vif = arvif->vif; -+ -+ if (arvif->vdev_type != WMI_VDEV_TYPE_AP) -+ return 0; -+ -+ /* Target does not expect beacon templates for the already up -+ * non-transmitting interfaces, and results in a crash if sent. -+ */ -+ if (vif->mbssid_tx_vif && -+ arvif != (void *)vif->mbssid_tx_vif->drv_priv && arvif->is_up) -+ return 0; -+ -+ return ath11k_mac_setup_bcn_tmpl_mbssid(arvif); -+} -+ - void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif) - { - struct ieee80211_vif *vif = arvif->vif; ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -1737,6 +1737,7 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *a - } - - cmd->buf_len = bcn->len; -+ cmd->mbssid_ie_offset = offs->mbssid_off; - - ptr = skb->data + sizeof(*cmd); - diff --git a/package/kernel/mac80211/patches/ath11k/0077-wifi-ath11k-EMA-beacon-support.patch b/package/kernel/mac80211/patches/ath11k/0077-wifi-ath11k-EMA-beacon-support.patch deleted file mode 100644 index 51353fa3e480f1..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0077-wifi-ath11k-EMA-beacon-support.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 87bd401138161008fdb82fbca6e213af117bfeb9 Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Fri, 5 May 2023 16:11:28 +0300 -Subject: [PATCH 77/77] wifi: ath11k: EMA beacon support - -Add new function ath11k_mac_setup_bcn_tmpl_ema() which invokes the new -API provided by MAC80211 to retrieve EMA beacons. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aloka Dixit -Co-developed-by: John Crispin -Signed-off-by: John Crispin -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405221648.17950-8-quic_alokad@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 59 ++++++++++++++++++++++++++- - drivers/net/wireless/ath/ath11k/wmi.c | 3 +- - drivers/net/wireless/ath/ath11k/wmi.h | 11 ++++- - 3 files changed, 70 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1452,6 +1452,60 @@ static void ath11k_mac_set_vif_params(st - arvif->wpaie_present = false; - } - -+static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif) -+{ -+ struct ath11k_vif *tx_arvif; -+ struct ieee80211_ema_beacons *beacons; -+ int ret = 0; -+ bool nontx_vif_params_set = false; -+ u32 params = 0; -+ u8 i = 0; -+ -+ tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv; -+ -+ beacons = ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw, -+ tx_arvif->vif, 0); -+ if (!beacons || !beacons->cnt) { -+ ath11k_warn(arvif->ar->ab, -+ "failed to get ema beacon templates from mac80211\n"); -+ return -EPERM; -+ } -+ -+ if (tx_arvif == arvif) -+ ath11k_mac_set_vif_params(tx_arvif, beacons->bcn[0].skb); -+ else -+ arvif->wpaie_present = tx_arvif->wpaie_present; -+ -+ for (i = 0; i < beacons->cnt; i++) { -+ if (tx_arvif != arvif && !nontx_vif_params_set) -+ nontx_vif_params_set = -+ ath11k_mac_set_nontx_vif_params(tx_arvif, arvif, -+ beacons->bcn[i].skb); -+ -+ params = beacons->cnt; -+ params |= (i << WMI_EMA_TMPL_IDX_SHIFT); -+ params |= ((!i ? 1 : 0) << WMI_EMA_FIRST_TMPL_SHIFT); -+ params |= ((i + 1 == beacons->cnt ? 1 : 0) << WMI_EMA_LAST_TMPL_SHIFT); -+ -+ ret = ath11k_wmi_bcn_tmpl(tx_arvif->ar, tx_arvif->vdev_id, -+ &beacons->bcn[i].offs, -+ beacons->bcn[i].skb, params); -+ if (ret) { -+ ath11k_warn(tx_arvif->ar->ab, -+ "failed to set ema beacon template id %i error %d\n", -+ i, ret); -+ break; -+ } -+ } -+ -+ ieee80211_beacon_free_ema_list(beacons); -+ -+ if (tx_arvif != arvif && !nontx_vif_params_set) -+ return -EINVAL; /* Profile not found in the beacons */ -+ -+ return ret; -+} -+ - static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif) - { - struct ath11k *ar = arvif->ar; -@@ -1484,7 +1538,7 @@ static int ath11k_mac_setup_bcn_tmpl_mbs - else if (!ath11k_mac_set_nontx_vif_params(tx_arvif, arvif, bcn)) - return -EINVAL; - -- ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); -+ ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn, 0); - kfree_skb(bcn); - - if (ret) -@@ -1508,6 +1562,9 @@ static int ath11k_mac_setup_bcn_tmpl(str - arvif != (void *)vif->mbssid_tx_vif->drv_priv && arvif->is_up) - return 0; - -+ if (vif->bss_conf.ema_ap && vif->mbssid_tx_vif) -+ return ath11k_mac_setup_bcn_tmpl_ema(arvif); -+ - return ath11k_mac_setup_bcn_tmpl_mbssid(arvif); - } - ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -1699,7 +1699,7 @@ int ath11k_wmi_send_bcn_offload_control_ - - int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id, - struct ieee80211_mutable_offsets *offs, -- struct sk_buff *bcn) -+ struct sk_buff *bcn, u32 ema_params) - { - struct ath11k_pdev_wmi *wmi = ar->wmi; - struct wmi_bcn_tmpl_cmd *cmd; -@@ -1738,6 +1738,7 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *a - - cmd->buf_len = bcn->len; - cmd->mbssid_ie_offset = offs->mbssid_off; -+ cmd->ema_params = ema_params; - - ptr = skb->data + sizeof(*cmd); - ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -3566,6 +3566,10 @@ struct wmi_get_pdev_temperature_cmd { - - #define WMI_BEACON_TX_BUFFER_SIZE 512 - -+#define WMI_EMA_TMPL_IDX_SHIFT 8 -+#define WMI_EMA_FIRST_TMPL_SHIFT 16 -+#define WMI_EMA_LAST_TMPL_SHIFT 24 -+ - struct wmi_bcn_tmpl_cmd { - u32 tlv_header; - u32 vdev_id; -@@ -3576,6 +3580,11 @@ struct wmi_bcn_tmpl_cmd { - u32 csa_event_bitmap; - u32 mbssid_ie_offset; - u32 esp_ie_offset; -+ u32 csc_switch_count_offset; -+ u32 csc_event_bitmap; -+ u32 mu_edca_ie_offset; -+ u32 feature_enable_bitmap; -+ u32 ema_params; - } __packed; - - struct wmi_key_seq_counter { -@@ -6298,7 +6307,7 @@ int ath11k_wmi_mgmt_send(struct ath11k * - struct sk_buff *frame); - int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id, - struct ieee80211_mutable_offsets *offs, -- struct sk_buff *bcn); -+ struct sk_buff *bcn, u32 ema_param); - int ath11k_wmi_vdev_down(struct ath11k *ar, u8 vdev_id); - int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid, - const u8 *bssid, u8 *tx_bssid, u32 nontx_profile_idx, diff --git a/package/kernel/mac80211/patches/ath11k/0078-wifi-ath11k-Relocate-the-func-ath11k_mac_bitrate_mas.patch b/package/kernel/mac80211/patches/ath11k/0078-wifi-ath11k-Relocate-the-func-ath11k_mac_bitrate_mas.patch deleted file mode 100644 index 610bf725149221..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0078-wifi-ath11k-Relocate-the-func-ath11k_mac_bitrate_mas.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 570eec3d40505c30babbe3b8f85a38496c975ab2 Mon Sep 17 00:00:00 2001 -From: Maharaja Kennadyrajan -Date: Tue, 9 May 2023 20:07:23 +0300 -Subject: [PATCH] wifi: ath11k: Relocate the func - ath11k_mac_bitrate_mask_num_ht_rates() and change hweight16 to hweight8 - -Relocate the function ath11k_mac_bitrate_mask_num_ht_rates() definition -to call this function from other functions which helps to avoid the -compilation error (function not defined). - -ht_mcs[] is 1 byte array and it is enough to use hweight8() instead -of hweight16(). Hence, fixed the same. - -Tested on: Compile tested only. - -Signed-off-by: Maharaja Kennadyrajan -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230504092033.3542456-2-quic_mkenna@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 30 +++++++++++++-------------- - 1 file changed, 15 insertions(+), 15 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BSD-3-Clause-Clear - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include -@@ -4338,6 +4338,20 @@ exit: - } - - static int -+ath11k_mac_bitrate_mask_num_ht_rates(struct ath11k *ar, -+ enum nl80211_band band, -+ const struct cfg80211_bitrate_mask *mask) -+{ -+ int num_rates = 0; -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) -+ num_rates += hweight8(mask->control[band].ht_mcs[i]); -+ -+ return num_rates; -+} -+ -+static int - ath11k_mac_bitrate_mask_num_vht_rates(struct ath11k *ar, - enum nl80211_band band, - const struct cfg80211_bitrate_mask *mask) -@@ -7791,20 +7805,6 @@ static void ath11k_mac_op_flush(struct i - ath11k_mac_flush_tx_complete(ar); - } - --static int --ath11k_mac_bitrate_mask_num_ht_rates(struct ath11k *ar, -- enum nl80211_band band, -- const struct cfg80211_bitrate_mask *mask) --{ -- int num_rates = 0; -- int i; -- -- for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) -- num_rates += hweight16(mask->control[band].ht_mcs[i]); -- -- return num_rates; --} -- - static bool - ath11k_mac_has_single_legacy_rate(struct ath11k *ar, - enum nl80211_band band, diff --git a/package/kernel/mac80211/patches/ath11k/0079-wifi-ath11k-Send-HT-fixed-rate-in-WMI-peer-fixed-par.patch b/package/kernel/mac80211/patches/ath11k/0079-wifi-ath11k-Send-HT-fixed-rate-in-WMI-peer-fixed-par.patch deleted file mode 100644 index 6282f4462e6b45..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0079-wifi-ath11k-Send-HT-fixed-rate-in-WMI-peer-fixed-par.patch +++ /dev/null @@ -1,141 +0,0 @@ -From df8e3729ffc0aa645839693f74ee7b6d999cdf64 Mon Sep 17 00:00:00 2001 -From: Maharaja Kennadyrajan -Date: Tue, 9 May 2023 20:07:24 +0300 -Subject: [PATCH] wifi: ath11k: Send HT fixed rate in WMI peer fixed param - -Due to the firmware behavior with HT fixed rate setting, -HT fixed rate MCS with NSS > 1 are treated as NSS = 1 -HT rates in the firmware and enables the HT fixed rate of -NSS = 1. - -This leads to HT fixed rate is always configured for NSS = 1 -even though the user sets NSS = 2 or > 1 HT fixed MCS in the -set bitrate command. - -Currently HT fixed MCS is sent via WMI peer assoc command. -Fix this issue, by sending the HT fixed rate MCS in WMI peer -fixed param instead of sending in peer assoc command. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Maharaja Kennadyrajan -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230504092033.3542456-3-quic_mkenna@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 63 ++++++++++++++++++++++++++- - 1 file changed, 61 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -4480,6 +4480,54 @@ ath11k_mac_set_peer_he_fixed_rate(struct - return ret; - } - -+static int -+ath11k_mac_set_peer_ht_fixed_rate(struct ath11k_vif *arvif, -+ struct ieee80211_sta *sta, -+ const struct cfg80211_bitrate_mask *mask, -+ enum nl80211_band band) -+{ -+ struct ath11k *ar = arvif->ar; -+ u8 ht_rate, nss = 0; -+ u32 rate_code; -+ int ret, i; -+ -+ lockdep_assert_held(&ar->conf_mutex); -+ -+ for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { -+ if (hweight8(mask->control[band].ht_mcs[i]) == 1) { -+ nss = i + 1; -+ ht_rate = ffs(mask->control[band].ht_mcs[i]) - 1; -+ } -+ } -+ -+ if (!nss) { -+ ath11k_warn(ar->ab, "No single HT Fixed rate found to set for %pM", -+ sta->addr); -+ return -EINVAL; -+ } -+ -+ /* Avoid updating invalid nss as fixed rate*/ -+ if (nss > sta->deflink.rx_nss) -+ return -EINVAL; -+ -+ ath11k_dbg(ar->ab, ATH11K_DBG_MAC, -+ "Setting Fixed HT Rate for peer %pM. Device will not switch to any other selected rates", -+ sta->addr); -+ -+ rate_code = ATH11K_HW_RATE_CODE(ht_rate, nss - 1, -+ WMI_RATE_PREAMBLE_HT); -+ ret = ath11k_wmi_set_peer_param(ar, sta->addr, -+ arvif->vdev_id, -+ WMI_PEER_PARAM_FIXED_RATE, -+ rate_code); -+ if (ret) -+ ath11k_warn(ar->ab, -+ "failed to update STA %pM HT Fixed Rate %d: %d\n", -+ sta->addr, rate_code, ret); -+ -+ return ret; -+} -+ - static int ath11k_station_assoc(struct ath11k *ar, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, -@@ -4491,7 +4539,7 @@ static int ath11k_station_assoc(struct a - struct cfg80211_chan_def def; - enum nl80211_band band; - struct cfg80211_bitrate_mask *mask; -- u8 num_vht_rates, num_he_rates; -+ u8 num_ht_rates, num_vht_rates, num_he_rates; - - lockdep_assert_held(&ar->conf_mutex); - -@@ -4519,6 +4567,7 @@ static int ath11k_station_assoc(struct a - - num_vht_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band, mask); - num_he_rates = ath11k_mac_bitrate_mask_num_he_rates(ar, band, mask); -+ num_ht_rates = ath11k_mac_bitrate_mask_num_ht_rates(ar, band, mask); - - /* If single VHT/HE rate is configured (by set_bitrate_mask()), - * peer_assoc will disable VHT/HE. This is now enabled by a peer specific -@@ -4535,6 +4584,11 @@ static int ath11k_station_assoc(struct a - band); - if (ret) - return ret; -+ } else if (sta->deflink.ht_cap.ht_supported && num_ht_rates == 1) { -+ ret = ath11k_mac_set_peer_ht_fixed_rate(arvif, sta, mask, -+ band); -+ if (ret) -+ return ret; - } - - /* Re-assoc is run only to update supported rates for given station. It -@@ -4608,7 +4662,7 @@ static void ath11k_sta_rc_update_wk(stru - const u16 *vht_mcs_mask; - const u16 *he_mcs_mask; - u32 changed, bw, nss, smps, bw_prev; -- int err, num_vht_rates, num_he_rates; -+ int err, num_ht_rates, num_vht_rates, num_he_rates; - const struct cfg80211_bitrate_mask *mask; - struct peer_assoc_params peer_arg; - enum wmi_phy_mode peer_phymode; -@@ -4724,6 +4778,8 @@ static void ath11k_sta_rc_update_wk(stru - - if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) { - mask = &arvif->bitrate_mask; -+ num_ht_rates = ath11k_mac_bitrate_mask_num_ht_rates(ar, band, -+ mask); - num_vht_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band, - mask); - num_he_rates = ath11k_mac_bitrate_mask_num_he_rates(ar, band, -@@ -4746,6 +4802,9 @@ static void ath11k_sta_rc_update_wk(stru - } else if (sta->deflink.he_cap.has_he && num_he_rates == 1) { - ath11k_mac_set_peer_he_fixed_rate(arvif, sta, mask, - band); -+ } else if (sta->deflink.ht_cap.ht_supported && num_ht_rates == 1) { -+ ath11k_mac_set_peer_ht_fixed_rate(arvif, sta, mask, -+ band); - } else { - /* If the peer is non-VHT/HE or no fixed VHT/HE rate - * is provided in the new bitrate mask we set the diff --git a/package/kernel/mac80211/patches/ath11k/0080-wifi-ath11k-add-support-default-regdb-while-searchin.patch b/package/kernel/mac80211/patches/ath11k/0080-wifi-ath11k-add-support-default-regdb-while-searchin.patch deleted file mode 100644 index 5ff40aac7a12d0..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0080-wifi-ath11k-add-support-default-regdb-while-searchin.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 88ca89202f8e8afb5225eb5244d79cd67c15d744 Mon Sep 17 00:00:00 2001 -From: Wen Gong -Date: Fri, 26 May 2023 12:41:06 +0300 -Subject: [PATCH] wifi: ath11k: add support default regdb while searching - board-2.bin for WCN6855 - -Sometimes board-2.bin does not have the regdb data which matched the -parameters such as vendor, device, subsystem-vendor, subsystem-device -and etc. Add default regdb data with 'bus=%s' into board-2.bin for -WCN6855, then ath11k use 'bus=pci' to search regdb data in board-2.bin -for WCN6855. - -kernel: [ 122.515808] ath11k_pci 0000:03:00.0: boot using board name 'bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=3374,qmi-chip-id=2,qmi-board-id=262' -kernel: [ 122.517240] ath11k_pci 0000:03:00.0: boot firmware request ath11k/WCN6855/hw2.0/board-2.bin size 6179564 -kernel: [ 122.517280] ath11k_pci 0000:03:00.0: failed to fetch regdb data for bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=3374,qmi-chip-id=2,qmi-board-id=262 from ath11k/WCN6855/hw2.0/board-2.bin -kernel: [ 122.517464] ath11k_pci 0000:03:00.0: boot using board name 'bus=pci' -kernel: [ 122.518901] ath11k_pci 0000:03:00.0: boot firmware request ath11k/WCN6855/hw2.0/board-2.bin size 6179564 -kernel: [ 122.518915] ath11k_pci 0000:03:00.0: board name -kernel: [ 122.518917] ath11k_pci 0000:03:00.0: 00000000: 62 75 73 3d 70 63 69 bus=pci -kernel: [ 122.518918] ath11k_pci 0000:03:00.0: boot found match regdb data for name 'bus=pci' -kernel: [ 122.518920] ath11k_pci 0000:03:00.0: boot found regdb data for 'bus=pci' -kernel: [ 122.518921] ath11k_pci 0000:03:00.0: fetched regdb - -Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 - -Signed-off-by: Wen Gong -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230517133959.8224-1-quic_wgong@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 53 +++++++++++++++++++------- - 1 file changed, 40 insertions(+), 13 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -961,7 +961,8 @@ int ath11k_core_check_dt(struct ath11k_b - } - - static int __ath11k_core_create_board_name(struct ath11k_base *ab, char *name, -- size_t name_len, bool with_variant) -+ size_t name_len, bool with_variant, -+ bool bus_type_mode) - { - /* strlen(',variant=') + strlen(ab->qmi.target.bdf_ext) */ - char variant[9 + ATH11K_QMI_BDF_EXT_STR_LENGTH] = { 0 }; -@@ -972,15 +973,20 @@ static int __ath11k_core_create_board_na - - switch (ab->id.bdf_search) { - case ATH11K_BDF_SEARCH_BUS_AND_BOARD: -- scnprintf(name, name_len, -- "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x,qmi-chip-id=%d,qmi-board-id=%d%s", -- ath11k_bus_str(ab->hif.bus), -- ab->id.vendor, ab->id.device, -- ab->id.subsystem_vendor, -- ab->id.subsystem_device, -- ab->qmi.target.chip_id, -- ab->qmi.target.board_id, -- variant); -+ if (bus_type_mode) -+ scnprintf(name, name_len, -+ "bus=%s", -+ ath11k_bus_str(ab->hif.bus)); -+ else -+ scnprintf(name, name_len, -+ "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x,qmi-chip-id=%d,qmi-board-id=%d%s", -+ ath11k_bus_str(ab->hif.bus), -+ ab->id.vendor, ab->id.device, -+ ab->id.subsystem_vendor, -+ ab->id.subsystem_device, -+ ab->qmi.target.chip_id, -+ ab->qmi.target.board_id, -+ variant); - break; - default: - scnprintf(name, name_len, -@@ -999,13 +1005,19 @@ static int __ath11k_core_create_board_na - static int ath11k_core_create_board_name(struct ath11k_base *ab, char *name, - size_t name_len) - { -- return __ath11k_core_create_board_name(ab, name, name_len, true); -+ return __ath11k_core_create_board_name(ab, name, name_len, true, false); - } - - static int ath11k_core_create_fallback_board_name(struct ath11k_base *ab, char *name, - size_t name_len) - { -- return __ath11k_core_create_board_name(ab, name, name_len, false); -+ return __ath11k_core_create_board_name(ab, name, name_len, false, false); -+} -+ -+static int ath11k_core_create_bus_type_board_name(struct ath11k_base *ab, char *name, -+ size_t name_len) -+{ -+ return __ath11k_core_create_board_name(ab, name, name_len, false, true); - } - - const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab, -@@ -1309,7 +1321,7 @@ success: - - int ath11k_core_fetch_regdb(struct ath11k_base *ab, struct ath11k_board_data *bd) - { -- char boardname[BOARD_NAME_SIZE]; -+ char boardname[BOARD_NAME_SIZE], default_boardname[BOARD_NAME_SIZE]; - int ret; - - ret = ath11k_core_create_board_name(ab, boardname, BOARD_NAME_SIZE); -@@ -1323,6 +1335,21 @@ int ath11k_core_fetch_regdb(struct ath11 - ATH11K_BD_IE_REGDB, - ATH11K_BD_IE_REGDB_NAME, - ATH11K_BD_IE_REGDB_DATA); -+ if (!ret) -+ goto exit; -+ -+ ret = ath11k_core_create_bus_type_board_name(ab, default_boardname, -+ BOARD_NAME_SIZE); -+ if (ret) { -+ ath11k_dbg(ab, ATH11K_DBG_BOOT, -+ "failed to create default board name for regdb: %d", ret); -+ goto exit; -+ } -+ -+ ret = ath11k_core_fetch_board_data_api_n(ab, bd, default_boardname, -+ ATH11K_BD_IE_REGDB, -+ ATH11K_BD_IE_REGDB_NAME, -+ ATH11K_BD_IE_REGDB_DATA); - if (!ret) - goto exit; - diff --git a/package/kernel/mac80211/patches/ath11k/0081-wifi-ath11k-remove-unused-function-ath11k_tm_event_w.patch b/package/kernel/mac80211/patches/ath11k/0081-wifi-ath11k-remove-unused-function-ath11k_tm_event_w.patch deleted file mode 100644 index b5dc83f007e3ab..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0081-wifi-ath11k-remove-unused-function-ath11k_tm_event_w.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 86f85575a3f6a20cef1c8bb98e78585fe3a53ccc Mon Sep 17 00:00:00 2001 -From: Govindaraj Saminathan -Date: Fri, 26 May 2023 12:41:06 +0300 -Subject: [PATCH 82/84] wifi: ath11k: remove unused function - ath11k_tm_event_wmi() - -The function ath11k_tm_event_wmi() is only defined and it is not used -anywhere. Hence remove the unused. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Govindaraj Saminathan -Signed-off-by: Raj Kumar Bhagat -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230517135934.16408-2-quic_rajkbhag@quicinc.com ---- - drivers/net/wireless/ath/ath11k/testmode.c | 64 +--------------------- - drivers/net/wireless/ath/ath11k/testmode.h | 8 +-- - 2 files changed, 2 insertions(+), 70 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/testmode.c -+++ b/drivers/net/wireless/ath/ath11k/testmode.c -@@ -1,6 +1,7 @@ - // SPDX-License-Identifier: BSD-3-Clause-Clear - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include "testmode.h" -@@ -20,69 +21,6 @@ static const struct nla_policy ath11k_tm - [ATH11K_TM_ATTR_VERSION_MINOR] = { .type = NLA_U32 }, - }; - --/* Returns true if callee consumes the skb and the skb should be discarded. -- * Returns false if skb is not used. Does not sleep. -- */ --bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id, struct sk_buff *skb) --{ -- struct sk_buff *nl_skb; -- bool consumed; -- int ret; -- -- ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, -- "testmode event wmi cmd_id %d skb %pK skb->len %d\n", -- cmd_id, skb, skb->len); -- -- ath11k_dbg_dump(ar->ab, ATH11K_DBG_TESTMODE, NULL, "", skb->data, skb->len); -- -- spin_lock_bh(&ar->data_lock); -- -- consumed = true; -- -- nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy, -- 2 * sizeof(u32) + skb->len, -- GFP_ATOMIC); -- if (!nl_skb) { -- ath11k_warn(ar->ab, -- "failed to allocate skb for testmode wmi event\n"); -- goto out; -- } -- -- ret = nla_put_u32(nl_skb, ATH11K_TM_ATTR_CMD, ATH11K_TM_CMD_WMI); -- if (ret) { -- ath11k_warn(ar->ab, -- "failed to put testmode wmi event cmd attribute: %d\n", -- ret); -- kfree_skb(nl_skb); -- goto out; -- } -- -- ret = nla_put_u32(nl_skb, ATH11K_TM_ATTR_WMI_CMDID, cmd_id); -- if (ret) { -- ath11k_warn(ar->ab, -- "failed to put testmode wmi even cmd_id: %d\n", -- ret); -- kfree_skb(nl_skb); -- goto out; -- } -- -- ret = nla_put(nl_skb, ATH11K_TM_ATTR_DATA, skb->len, skb->data); -- if (ret) { -- ath11k_warn(ar->ab, -- "failed to copy skb to testmode wmi event: %d\n", -- ret); -- kfree_skb(nl_skb); -- goto out; -- } -- -- cfg80211_testmode_event(nl_skb, GFP_ATOMIC); -- --out: -- spin_unlock_bh(&ar->data_lock); -- -- return consumed; --} -- - static int ath11k_tm_cmd_get_version(struct ath11k *ar, struct nlattr *tb[]) - { - struct sk_buff *skb; ---- a/drivers/net/wireless/ath/ath11k/testmode.h -+++ b/drivers/net/wireless/ath/ath11k/testmode.h -@@ -1,24 +1,18 @@ - /* SPDX-License-Identifier: BSD-3-Clause-Clear */ - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include "core.h" - - #ifdef CPTCFG_NL80211_TESTMODE - --bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id, struct sk_buff *skb); - int ath11k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - void *data, int len); - - #else - --static inline bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id, -- struct sk_buff *skb) --{ -- return false; --} -- - static inline int ath11k_tm_cmd(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - void *data, int len) diff --git a/package/kernel/mac80211/patches/ath11k/0082-wifi-ath11k-factory-test-mode-support.patch b/package/kernel/mac80211/patches/ath11k/0082-wifi-ath11k-factory-test-mode-support.patch deleted file mode 100644 index f1b262724f94eb..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0082-wifi-ath11k-factory-test-mode-support.patch +++ /dev/null @@ -1,850 +0,0 @@ -From b43310e44edc823a7f02af1e1e2b4e8a9abc7d91 Mon Sep 17 00:00:00 2001 -From: Govindaraj Saminathan -Date: Fri, 26 May 2023 12:41:07 +0300 -Subject: [PATCH 83/84] wifi: ath11k: factory test mode support - -Add support to process factory test mode commands (FTM) for calibration. -By default firmware start with NORMAL mode and to process the FTM commands -firmware needs to be restarted in FTM mode using module parameter ftm_mode. -The pre-request is all the radios should be down before starting the test. - -When start command ATH11K_TM_CMD_TESTMODE_START is received, ar->state -is set to Test Mode. If the FTM command or event length is greater -than 256 bytes, it will be broken down into multiple segments and -encoded with TLV header if it is segmented commands, else it is sent -to firmware as it is. - -On receiving UTF event from firmware, if it is segmented event, the driver -will wait until it receives all the segments and notify the complete -data to user application. In case the segmented sequence are missed or -lost from the firmware, driver will skip the already received partial data. - -In case of unsegmented UTF event from firmware, driver notifies the -data to the user application as it comes. Applications handles -the data further. - -Command to boot in ftm mode: - -insmod ath11k ftm_mode=1 - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Govindaraj Saminathan -Co-developed-by: Sowmiya Sree Elavalagan -Signed-off-by: Sowmiya Sree Elavalagan -Signed-off-by: Raj Kumar Bhagat -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230517135934.16408-4-quic_rajkbhag@quicinc.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 3 +- - drivers/net/wireless/ath/ath11k/core.c | 21 +- - drivers/net/wireless/ath/ath11k/core.h | 16 +- - drivers/net/wireless/ath/ath11k/debug.h | 1 + - drivers/net/wireless/ath/ath11k/mac.c | 11 +- - drivers/net/wireless/ath/ath11k/pci.c | 3 +- - drivers/net/wireless/ath/ath11k/testmode.c | 350 ++++++++++++++++++- - drivers/net/wireless/ath/ath11k/testmode.h | 6 + - drivers/net/wireless/ath/ath11k/testmode_i.h | 18 +- - drivers/net/wireless/ath/ath11k/wmi.c | 11 +- - drivers/net/wireless/ath/ath11k/wmi.h | 22 ++ - drivers/net/wireless/ath/ath11k/wow.c | 3 +- - 12 files changed, 444 insertions(+), 21 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BSD-3-Clause-Clear - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include -@@ -1155,6 +1155,7 @@ static int ath11k_ahb_probe(struct platf - ab->hif.ops = hif_ops; - ab->pdev = pdev; - ab->hw_rev = hw_rev; -+ ab->fw_mode = ATH11K_FIRMWARE_MODE_NORMAL; - platform_set_drvdata(pdev, ab); - - ret = ath11k_pcic_register_pci_ops(ab, pci_ops); ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BSD-3-Clause-Clear - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include -@@ -32,6 +32,10 @@ module_param_named(frame_mode, ath11k_fr - MODULE_PARM_DESC(frame_mode, - "Datapath frame mode (0: raw, 1: native wifi (default), 2: ethernet)"); - -+bool ath11k_ftm_mode; -+module_param_named(ftm_mode, ath11k_ftm_mode, bool, 0444); -+MODULE_PARM_DESC(ftm_mode, "Boots up in factory test mode"); -+ - static const struct ath11k_hw_params ath11k_hw_params[] = { - { - .hw_rev = ATH11K_HW_IPQ8074, -@@ -1381,6 +1385,11 @@ static int ath11k_core_soc_create(struct - { - int ret; - -+ if (ath11k_ftm_mode) { -+ ab->fw_mode = ATH11K_FIRMWARE_MODE_FTM; -+ ath11k_info(ab, "Booting in factory test mode\n"); -+ } -+ - ret = ath11k_qmi_init_service(ab); - if (ret) { - ath11k_err(ab, "failed to initialize qmi :%d\n", ret); -@@ -1607,7 +1616,7 @@ int ath11k_core_qmi_firmware_ready(struc - { - int ret; - -- ret = ath11k_core_start_firmware(ab, ATH11K_FIRMWARE_MODE_NORMAL); -+ ret = ath11k_core_start_firmware(ab, ab->fw_mode); - if (ret) { - ath11k_err(ab, "failed to start firmware: %d\n", ret); - return ret; -@@ -1772,7 +1781,8 @@ void ath11k_core_pre_reconfigure_recover - for (i = 0; i < ab->num_radios; i++) { - pdev = &ab->pdevs[i]; - ar = pdev->ar; -- if (!ar || ar->state == ATH11K_STATE_OFF) -+ if (!ar || ar->state == ATH11K_STATE_OFF || -+ ar->state == ATH11K_STATE_FTM) - continue; - - ieee80211_stop_queues(ar->hw); -@@ -1841,7 +1851,12 @@ static void ath11k_core_post_reconfigure - ath11k_warn(ab, - "device is wedged, will not restart radio %d\n", i); - break; -+ case ATH11K_STATE_FTM: -+ ath11k_dbg(ab, ATH11K_DBG_TESTMODE, -+ "fw mode reset done radio %d\n", i); -+ break; - } -+ - mutex_unlock(&ar->conf_mutex); - } - complete(&ab->driver_recovery); ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -1,7 +1,7 @@ - /* SPDX-License-Identifier: BSD-3-Clause-Clear */ - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #ifndef ATH11K_CORE_H -@@ -52,6 +52,7 @@ - #define ATH11K_SMBIOS_BDF_EXT_MAGIC "BDF_" - - extern unsigned int ath11k_frame_mode; -+extern bool ath11k_ftm_mode; - - #define ATH11K_SCAN_TIMEOUT_HZ (20 * HZ) - -@@ -277,6 +278,7 @@ enum ath11k_dev_flags { - ATH11K_FLAG_FIXED_MEM_RGN, - ATH11K_FLAG_DEVICE_INIT_DONE, - ATH11K_FLAG_MULTI_MSI_VECTORS, -+ ATH11K_FLAG_FTM_SEGMENTED, - }; - - enum ath11k_monitor_flags { -@@ -530,6 +532,7 @@ enum ath11k_state { - ATH11K_STATE_RESTARTING, - ATH11K_STATE_RESTARTED, - ATH11K_STATE_WEDGED, -+ ATH11K_STATE_FTM, - /* Add other states as required */ - }; - -@@ -709,6 +712,8 @@ struct ath11k { - u32 last_ppdu_id; - u32 cached_ppdu_id; - int monitor_vdev_id; -+ struct completion fw_mode_reset; -+ u8 ftm_msgref; - #ifdef CPTCFG_ATH11K_DEBUGFS - struct ath11k_debug debug; - #endif -@@ -838,6 +843,7 @@ struct ath11k_msi_config { - /* Master structure to hold the hw data which may be used in core module */ - struct ath11k_base { - enum ath11k_hw_rev hw_rev; -+ enum ath11k_firmware_mode fw_mode; - struct platform_device *pdev; - struct device *dev; - struct ath11k_qmi qmi; -@@ -978,6 +984,14 @@ struct ath11k_base { - const struct ath11k_pci_ops *ops; - } pci; - -+#ifdef CPTCFG_NL80211_TESTMODE -+ struct { -+ u32 data_pos; -+ u32 expected_seq; -+ u8 *eventdata; -+ } testmode; -+#endif -+ - /* must be last */ - u8 drv_priv[] __aligned(sizeof(void *)); - }; ---- a/drivers/net/wireless/ath/ath11k/debug.h -+++ b/drivers/net/wireless/ath/ath11k/debug.h -@@ -1,6 +1,7 @@ - /* SPDX-License-Identifier: BSD-3-Clause-Clear */ - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #ifndef _ATH11K_DEBUG_H_ ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -643,7 +643,10 @@ struct ath11k *ath11k_mac_get_ar_by_pdev - return NULL; - - for (i = 0; i < ab->num_radios; i++) { -- pdev = rcu_dereference(ab->pdevs_active[i]); -+ if (ab->fw_mode == ATH11K_FIRMWARE_MODE_FTM) -+ pdev = &ab->pdevs[i]; -+ else -+ pdev = rcu_dereference(ab->pdevs_active[i]); - - if (pdev && pdev->pdev_id == pdev_id) - return (pdev->ar ? pdev->ar : NULL); -@@ -6271,6 +6274,11 @@ static int ath11k_mac_op_start(struct ie - struct ath11k_pdev *pdev = ar->pdev; - int ret; - -+ if (ath11k_ftm_mode) { -+ ath11k_warn(ab, "mac operations not supported in factory test mode\n"); -+ return -EOPNOTSUPP; -+ } -+ - ath11k_mac_drain_tx(ar); - mutex_lock(&ar->conf_mutex); - -@@ -6285,6 +6293,7 @@ static int ath11k_mac_op_start(struct ie - case ATH11K_STATE_RESTARTED: - case ATH11K_STATE_WEDGED: - case ATH11K_STATE_ON: -+ case ATH11K_STATE_FTM: - WARN_ON(1); - ret = -EINVAL; - goto err; ---- a/drivers/net/wireless/ath/ath11k/pci.c -+++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BSD-3-Clause-Clear - /* - * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. -- * Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include -@@ -745,6 +745,7 @@ static int ath11k_pci_probe(struct pci_d - ab_pci->ab = ab; - ab_pci->pdev = pdev; - ab->hif.ops = &ath11k_pci_hif_ops; -+ ab->fw_mode = ATH11K_FIRMWARE_MODE_NORMAL; - pci_set_drvdata(pdev, ab); - spin_lock_init(&ab_pci->window_lock); - ---- a/drivers/net/wireless/ath/ath11k/testmode.c -+++ b/drivers/net/wireless/ath/ath11k/testmode.c -@@ -12,6 +12,9 @@ - #include "core.h" - #include "testmode_i.h" - -+#define ATH11K_FTM_SEGHDR_CURRENT_SEQ GENMASK(3, 0) -+#define ATH11K_FTM_SEGHDR_TOTAL_SEGMENTS GENMASK(7, 4) -+ - static const struct nla_policy ath11k_tm_policy[ATH11K_TM_ATTR_MAX + 1] = { - [ATH11K_TM_ATTR_CMD] = { .type = NLA_U32 }, - [ATH11K_TM_ATTR_DATA] = { .type = NLA_BINARY, -@@ -21,13 +24,217 @@ static const struct nla_policy ath11k_tm - [ATH11K_TM_ATTR_VERSION_MINOR] = { .type = NLA_U32 }, - }; - -+static struct ath11k *ath11k_tm_get_ar(struct ath11k_base *ab) -+{ -+ struct ath11k_pdev *pdev; -+ struct ath11k *ar = NULL; -+ int i; -+ -+ for (i = 0; i < ab->num_radios; i++) { -+ pdev = &ab->pdevs[i]; -+ ar = pdev->ar; -+ -+ if (ar && ar->state == ATH11K_STATE_FTM) -+ break; -+ } -+ -+ return ar; -+} -+ -+/* This function handles unsegmented events. Data in various events are aggregated -+ * in application layer, this event is unsegmented from host perspective. -+ */ -+static void ath11k_tm_wmi_event_unsegmented(struct ath11k_base *ab, u32 cmd_id, -+ struct sk_buff *skb) -+{ -+ struct sk_buff *nl_skb; -+ struct ath11k *ar; -+ -+ ath11k_dbg(ab, ATH11K_DBG_TESTMODE, -+ "event wmi cmd_id %d skb length %d\n", -+ cmd_id, skb->len); -+ ath11k_dbg_dump(ab, ATH11K_DBG_TESTMODE, NULL, "", skb->data, skb->len); -+ -+ ar = ath11k_tm_get_ar(ab); -+ if (!ar) { -+ ath11k_warn(ab, "testmode event not handled due to invalid pdev\n"); -+ return; -+ } -+ -+ spin_lock_bh(&ar->data_lock); -+ -+ nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy, -+ 2 * nla_total_size(sizeof(u32)) + -+ nla_total_size(skb->len), -+ GFP_ATOMIC); -+ if (!nl_skb) { -+ ath11k_warn(ab, -+ "failed to allocate skb for unsegmented testmode wmi event\n"); -+ goto out; -+ } -+ -+ if (nla_put_u32(nl_skb, ATH11K_TM_ATTR_CMD, ATH11K_TM_CMD_WMI) || -+ nla_put_u32(nl_skb, ATH11K_TM_ATTR_WMI_CMDID, cmd_id) || -+ nla_put(nl_skb, ATH11K_TM_ATTR_DATA, skb->len, skb->data)) { -+ ath11k_warn(ab, "failed to populate testmode unsegmented event\n"); -+ kfree_skb(nl_skb); -+ goto out; -+ } -+ -+ cfg80211_testmode_event(nl_skb, GFP_ATOMIC); -+ spin_unlock_bh(&ar->data_lock); -+ return; -+ -+out: -+ spin_unlock_bh(&ar->data_lock); -+ ath11k_warn(ab, "Failed to send testmode event to higher layers\n"); -+} -+ -+/* This function handles segmented events. Data of various events received -+ * from firmware is aggregated and sent to application layer -+ */ -+static int ath11k_tm_process_event(struct ath11k_base *ab, u32 cmd_id, -+ const struct wmi_ftm_event_msg *ftm_msg, -+ u16 length) -+{ -+ struct sk_buff *nl_skb; -+ int ret = 0; -+ struct ath11k *ar; -+ u8 const *buf_pos; -+ u16 datalen; -+ u8 total_segments, current_seq; -+ u32 data_pos; -+ u32 pdev_id; -+ -+ ath11k_dbg(ab, ATH11K_DBG_TESTMODE, -+ "event wmi cmd_id %d ftm event msg %pK datalen %d\n", -+ cmd_id, ftm_msg, length); -+ ath11k_dbg_dump(ab, ATH11K_DBG_TESTMODE, NULL, "", ftm_msg, length); -+ pdev_id = DP_HW2SW_MACID(ftm_msg->seg_hdr.pdev_id); -+ -+ if (pdev_id >= ab->num_radios) { -+ ath11k_warn(ab, "testmode event not handled due to invalid pdev id: %d\n", -+ pdev_id); -+ return -EINVAL; -+ } -+ -+ ar = ab->pdevs[pdev_id].ar; -+ if (!ar) { -+ ath11k_warn(ab, "testmode event not handled due to absence of pdev\n"); -+ return -ENODEV; -+ } -+ -+ current_seq = FIELD_GET(ATH11K_FTM_SEGHDR_CURRENT_SEQ, -+ ftm_msg->seg_hdr.segmentinfo); -+ total_segments = FIELD_GET(ATH11K_FTM_SEGHDR_TOTAL_SEGMENTS, -+ ftm_msg->seg_hdr.segmentinfo); -+ datalen = length - (sizeof(struct wmi_ftm_seg_hdr)); -+ buf_pos = ftm_msg->data; -+ -+ spin_lock_bh(&ar->data_lock); -+ -+ if (current_seq == 0) { -+ ab->testmode.expected_seq = 0; -+ ab->testmode.data_pos = 0; -+ } -+ -+ data_pos = ab->testmode.data_pos; -+ -+ if ((data_pos + datalen) > ATH11K_FTM_EVENT_MAX_BUF_LENGTH) { -+ ath11k_warn(ab, "Invalid ftm event length at %d: %d\n", -+ data_pos, datalen); -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ memcpy(&ab->testmode.eventdata[data_pos], buf_pos, datalen); -+ data_pos += datalen; -+ -+ if (++ab->testmode.expected_seq != total_segments) { -+ ab->testmode.data_pos = data_pos; -+ ath11k_dbg(ab, ATH11K_DBG_TESTMODE, -+ "partial data received current_seq %d total_seg %d\n", -+ current_seq, total_segments); -+ goto out; -+ } -+ -+ ath11k_dbg(ab, ATH11K_DBG_TESTMODE, -+ "total data length pos %d len %d\n", -+ data_pos, ftm_msg->seg_hdr.len); -+ nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy, -+ 2 * nla_total_size(sizeof(u32)) + -+ nla_total_size(data_pos), -+ GFP_ATOMIC); -+ if (!nl_skb) { -+ ath11k_warn(ab, -+ "failed to allocate skb for segmented testmode wmi event\n"); -+ ret = -ENOMEM; -+ goto out; -+ } -+ -+ if (nla_put_u32(nl_skb, ATH11K_TM_ATTR_CMD, -+ ATH11K_TM_CMD_WMI_FTM) || -+ nla_put_u32(nl_skb, ATH11K_TM_ATTR_WMI_CMDID, cmd_id) || -+ nla_put(nl_skb, ATH11K_TM_ATTR_DATA, data_pos, -+ &ab->testmode.eventdata[0])) { -+ ath11k_warn(ab, "failed to populate segmented testmode event"); -+ kfree_skb(nl_skb); -+ ret = -ENOBUFS; -+ goto out; -+ } -+ -+ cfg80211_testmode_event(nl_skb, GFP_ATOMIC); -+ -+out: -+ spin_unlock_bh(&ar->data_lock); -+ return ret; -+} -+ -+static void ath11k_tm_wmi_event_segmented(struct ath11k_base *ab, u32 cmd_id, -+ struct sk_buff *skb) -+{ -+ const void **tb; -+ const struct wmi_ftm_event_msg *ev; -+ u16 length; -+ int ret; -+ -+ tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); -+ if (IS_ERR(tb)) { -+ ret = PTR_ERR(tb); -+ ath11k_warn(ab, "failed to parse ftm event tlv: %d\n", ret); -+ return; -+ } -+ -+ ev = tb[WMI_TAG_ARRAY_BYTE]; -+ if (!ev) { -+ ath11k_warn(ab, "failed to fetch ftm msg\n"); -+ kfree(tb); -+ return; -+ } -+ -+ length = skb->len - TLV_HDR_SIZE; -+ ret = ath11k_tm_process_event(ab, cmd_id, ev, length); -+ if (ret) -+ ath11k_warn(ab, "Failed to process ftm event\n"); -+ -+ kfree(tb); -+} -+ -+void ath11k_tm_wmi_event(struct ath11k_base *ab, u32 cmd_id, struct sk_buff *skb) -+{ -+ if (test_bit(ATH11K_FLAG_FTM_SEGMENTED, &ab->dev_flags)) -+ ath11k_tm_wmi_event_segmented(ab, cmd_id, skb); -+ else -+ ath11k_tm_wmi_event_unsegmented(ab, cmd_id, skb); -+} -+ - static int ath11k_tm_cmd_get_version(struct ath11k *ar, struct nlattr *tb[]) - { - struct sk_buff *skb; - int ret; - - ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, -- "testmode cmd get version_major %d version_minor %d\n", -+ "cmd get version_major %d version_minor %d\n", - ATH11K_TESTMODE_VERSION_MAJOR, - ATH11K_TESTMODE_VERSION_MINOR); - -@@ -53,6 +260,43 @@ static int ath11k_tm_cmd_get_version(str - return cfg80211_testmode_reply(skb); - } - -+static int ath11k_tm_cmd_testmode_start(struct ath11k *ar, struct nlattr *tb[]) -+{ -+ int ret; -+ -+ mutex_lock(&ar->conf_mutex); -+ -+ if (ar->state == ATH11K_STATE_FTM) { -+ ret = -EALREADY; -+ goto err; -+ } -+ -+ /* start utf only when the driver is not in use */ -+ if (ar->state != ATH11K_STATE_OFF) { -+ ret = -EBUSY; -+ goto err; -+ } -+ -+ ar->ab->testmode.eventdata = kzalloc(ATH11K_FTM_EVENT_MAX_BUF_LENGTH, -+ GFP_KERNEL); -+ if (!ar->ab->testmode.eventdata) { -+ ret = -ENOMEM; -+ goto err; -+ } -+ -+ ar->state = ATH11K_STATE_FTM; -+ ar->ftm_msgref = 0; -+ -+ mutex_unlock(&ar->conf_mutex); -+ -+ ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, "cmd start\n"); -+ return 0; -+ -+err: -+ mutex_unlock(&ar->conf_mutex); -+ return ret; -+} -+ - static int ath11k_tm_cmd_wmi(struct ath11k *ar, struct nlattr *tb[]) - { - struct ath11k_pdev_wmi *wmi = ar->wmi; -@@ -63,11 +307,6 @@ static int ath11k_tm_cmd_wmi(struct ath1 - - mutex_lock(&ar->conf_mutex); - -- if (ar->state != ATH11K_STATE_ON) { -- ret = -ENETDOWN; -- goto out; -- } -- - if (!tb[ATH11K_TM_ATTR_DATA]) { - ret = -EINVAL; - goto out; -@@ -80,11 +319,17 @@ static int ath11k_tm_cmd_wmi(struct ath1 - - buf = nla_data(tb[ATH11K_TM_ATTR_DATA]); - buf_len = nla_len(tb[ATH11K_TM_ATTR_DATA]); -+ if (!buf_len) { -+ ath11k_warn(ar->ab, "No data present in testmode wmi command\n"); -+ ret = -EINVAL; -+ goto out; -+ } -+ - cmd_id = nla_get_u32(tb[ATH11K_TM_ATTR_WMI_CMDID]); - - ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, -- "testmode cmd wmi cmd_id %d buf %pK buf_len %d\n", -- cmd_id, buf, buf_len); -+ "cmd wmi cmd_id %d buf length %d\n", -+ cmd_id, buf_len); - - ath11k_dbg_dump(ar->ab, ATH11K_DBG_TESTMODE, NULL, "", buf, buf_len); - -@@ -111,6 +356,91 @@ out: - return ret; - } - -+static int ath11k_tm_cmd_wmi_ftm(struct ath11k *ar, struct nlattr *tb[]) -+{ -+ struct ath11k_pdev_wmi *wmi = ar->wmi; -+ struct ath11k_base *ab = ar->ab; -+ struct sk_buff *skb; -+ u32 cmd_id, buf_len, hdr_info; -+ int ret; -+ void *buf; -+ u8 segnumber = 0, seginfo; -+ u16 chunk_len, total_bytes, num_segments; -+ u8 *bufpos; -+ struct wmi_ftm_cmd *ftm_cmd; -+ -+ set_bit(ATH11K_FLAG_FTM_SEGMENTED, &ab->dev_flags); -+ -+ mutex_lock(&ar->conf_mutex); -+ -+ if (ar->state != ATH11K_STATE_FTM) { -+ ret = -ENETDOWN; -+ goto out; -+ } -+ -+ if (!tb[ATH11K_TM_ATTR_DATA]) { -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ buf = nla_data(tb[ATH11K_TM_ATTR_DATA]); -+ buf_len = nla_len(tb[ATH11K_TM_ATTR_DATA]); -+ cmd_id = WMI_PDEV_UTF_CMDID; -+ -+ ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, -+ "cmd wmi ftm cmd_id %d buffer length %d\n", -+ cmd_id, buf_len); -+ ath11k_dbg_dump(ar->ab, ATH11K_DBG_TESTMODE, NULL, "", buf, buf_len); -+ -+ bufpos = buf; -+ total_bytes = buf_len; -+ num_segments = total_bytes / MAX_WMI_UTF_LEN; -+ -+ if (buf_len - (num_segments * MAX_WMI_UTF_LEN)) -+ num_segments++; -+ -+ while (buf_len) { -+ chunk_len = min_t(u16, buf_len, MAX_WMI_UTF_LEN); -+ -+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, (chunk_len + -+ sizeof(struct wmi_ftm_cmd))); -+ if (!skb) { -+ ret = -ENOMEM; -+ goto out; -+ } -+ -+ ftm_cmd = (struct wmi_ftm_cmd *)skb->data; -+ hdr_info = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_BYTE) | -+ FIELD_PREP(WMI_TLV_LEN, (chunk_len + -+ sizeof(struct wmi_ftm_seg_hdr))); -+ ftm_cmd->tlv_header = hdr_info; -+ ftm_cmd->seg_hdr.len = total_bytes; -+ ftm_cmd->seg_hdr.msgref = ar->ftm_msgref; -+ seginfo = FIELD_PREP(ATH11K_FTM_SEGHDR_TOTAL_SEGMENTS, num_segments) | -+ FIELD_PREP(ATH11K_FTM_SEGHDR_CURRENT_SEQ, segnumber); -+ ftm_cmd->seg_hdr.segmentinfo = seginfo; -+ segnumber++; -+ -+ memcpy(&ftm_cmd->data, bufpos, chunk_len); -+ -+ ret = ath11k_wmi_cmd_send(wmi, skb, cmd_id); -+ if (ret) { -+ ath11k_warn(ar->ab, "failed to send wmi ftm command: %d\n", ret); -+ goto out; -+ } -+ -+ buf_len -= chunk_len; -+ bufpos += chunk_len; -+ } -+ -+ ar->ftm_msgref++; -+ ret = 0; -+ -+out: -+ mutex_unlock(&ar->conf_mutex); -+ return ret; -+} -+ - int ath11k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - void *data, int len) - { -@@ -131,6 +461,10 @@ int ath11k_tm_cmd(struct ieee80211_hw *h - return ath11k_tm_cmd_get_version(ar, tb); - case ATH11K_TM_CMD_WMI: - return ath11k_tm_cmd_wmi(ar, tb); -+ case ATH11K_TM_CMD_TESTMODE_START: -+ return ath11k_tm_cmd_testmode_start(ar, tb); -+ case ATH11K_TM_CMD_WMI_FTM: -+ return ath11k_tm_cmd_wmi_ftm(ar, tb); - default: - return -EOPNOTSUPP; - } ---- a/drivers/net/wireless/ath/ath11k/testmode.h -+++ b/drivers/net/wireless/ath/ath11k/testmode.h -@@ -8,11 +8,17 @@ - - #ifdef CPTCFG_NL80211_TESTMODE - -+void ath11k_tm_wmi_event(struct ath11k_base *ab, u32 cmd_id, struct sk_buff *skb); - int ath11k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - void *data, int len); - - #else - -+static inline void ath11k_tm_wmi_event(struct ath11k_base *ab, u32 cmd_id, -+ struct sk_buff *skb) -+{ -+} -+ - static inline int ath11k_tm_cmd(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - void *data, int len) ---- a/drivers/net/wireless/ath/ath11k/testmode_i.h -+++ b/drivers/net/wireless/ath/ath11k/testmode_i.h -@@ -1,6 +1,7 @@ - /* SPDX-License-Identifier: BSD-3-Clause-Clear */ - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - /* "API" level of the ath11k testmode interface. Bump it after every -@@ -11,9 +12,10 @@ - /* Bump this after every _compatible_ interface change, for example - * addition of a new command or an attribute. - */ --#define ATH11K_TESTMODE_VERSION_MINOR 0 -+#define ATH11K_TESTMODE_VERSION_MINOR 1 - - #define ATH11K_TM_DATA_MAX_LEN 5000 -+#define ATH11K_FTM_EVENT_MAX_BUF_LENGTH 2048 - - enum ath11k_tm_attr { - __ATH11K_TM_ATTR_INVALID = 0, -@@ -47,4 +49,18 @@ enum ath11k_tm_cmd { - * ATH11K_TM_ATTR_DATA. - */ - ATH11K_TM_CMD_WMI = 1, -+ -+ /* Boots the UTF firmware, the netdev interface must be down at the -+ * time. -+ */ -+ ATH11K_TM_CMD_TESTMODE_START = 2, -+ -+ /* The command used to transmit a FTM WMI command to the firmware -+ * and the event to receive WMI events from the firmware. The data -+ * received only contain the payload, need to add the tlv header -+ * and send the cmd to firmware with command id WMI_PDEV_UTF_CMDID. -+ * The data payload size could be large and the driver needs to -+ * send segmented data to firmware. -+ */ -+ ATH11K_TM_CMD_WMI_FTM = 3, - }; ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BSD-3-Clause-Clear - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -- * Copyright (c) 2021, Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2021, 2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - #include - #include -@@ -19,6 +19,7 @@ - #include "mac.h" - #include "hw.h" - #include "peer.h" -+#include "testmode.h" - - struct wmi_tlv_policy { - size_t min_len; -@@ -237,9 +238,8 @@ static int ath11k_wmi_tlv_parse(struct a - (void *)tb); - } - --static const void ** --ath11k_wmi_tlv_parse_alloc(struct ath11k_base *ab, const void *ptr, -- size_t len, gfp_t gfp) -+const void **ath11k_wmi_tlv_parse_alloc(struct ath11k_base *ab, const void *ptr, -+ size_t len, gfp_t gfp) - { - const void **tb; - int ret; -@@ -8628,6 +8628,9 @@ static void ath11k_wmi_tlv_op_rx(struct - case WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID: - ath11k_wmi_pdev_csa_switch_count_status_event(ab, skb); - break; -+ case WMI_PDEV_UTF_EVENTID: -+ ath11k_tm_wmi_event(ab, id, skb); -+ break; - case WMI_PDEV_TEMPERATURE_EVENTID: - ath11k_wmi_pdev_temperature_event(ab, skb); - break; ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -1,6 +1,7 @@ - /* SPDX-License-Identifier: BSD-3-Clause-Clear */ - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #ifndef ATH11K_WMI_H -@@ -68,6 +69,7 @@ struct wmi_tlv { - - #define WMI_APPEND_TO_EXISTING_CHAN_LIST_FLAG 1 - -+#define MAX_WMI_UTF_LEN 252 - #define WMI_BA_MODE_BUFFER_SIZE_256 3 - /* - * HW mode config type replicated from FW header -@@ -3564,6 +3566,24 @@ struct wmi_get_pdev_temperature_cmd { - u32 pdev_id; - } __packed; - -+struct wmi_ftm_seg_hdr { -+ u32 len; -+ u32 msgref; -+ u32 segmentinfo; -+ u32 pdev_id; -+} __packed; -+ -+struct wmi_ftm_cmd { -+ u32 tlv_header; -+ struct wmi_ftm_seg_hdr seg_hdr; -+ u8 data[]; -+} __packed; -+ -+struct wmi_ftm_event_msg { -+ struct wmi_ftm_seg_hdr seg_hdr; -+ u8 data[]; -+} __packed; -+ - #define WMI_BEACON_TX_BUFFER_SIZE 512 - - #define WMI_EMA_TMPL_IDX_SHIFT 8 -@@ -6300,6 +6320,8 @@ enum wmi_sta_keepalive_method { - #define WMI_STA_KEEPALIVE_INTERVAL_DEFAULT 30 - #define WMI_STA_KEEPALIVE_INTERVAL_DISABLE 0 - -+const void **ath11k_wmi_tlv_parse_alloc(struct ath11k_base *ab, const void *ptr, -+ size_t len, gfp_t gfp); - int ath11k_wmi_cmd_send(struct ath11k_pdev_wmi *wmi, struct sk_buff *skb, - u32 cmd_id); - struct sk_buff *ath11k_wmi_alloc_skb(struct ath11k_wmi_base *wmi_sc, u32 len); ---- a/drivers/net/wireless/ath/ath11k/wow.c -+++ b/drivers/net/wireless/ath/ath11k/wow.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BSD-3-Clause-Clear - /* - * Copyright (c) 2020 The Linux Foundation. All rights reserved. -- * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include -@@ -838,6 +838,7 @@ exit: - case ATH11K_STATE_RESTARTING: - case ATH11K_STATE_RESTARTED: - case ATH11K_STATE_WEDGED: -+ case ATH11K_STATE_FTM: - ath11k_warn(ar->ab, "encountered unexpected device state %d on resume, cannot recover\n", - ar->state); - ret = -EIO; diff --git a/package/kernel/mac80211/patches/ath11k/0083-wifi-ath11k-Allow-ath11k-to-boot-without-caldata-in-.patch b/package/kernel/mac80211/patches/ath11k/0083-wifi-ath11k-Allow-ath11k-to-boot-without-caldata-in-.patch deleted file mode 100644 index 5a1fa882948e5a..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0083-wifi-ath11k-Allow-ath11k-to-boot-without-caldata-in-.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 8aeba427296bff6a6051686f1d139c89a0b00e4c Mon Sep 17 00:00:00 2001 -From: Sowmiya Sree Elavalagan -Date: Fri, 26 May 2023 12:41:07 +0300 -Subject: [PATCH 84/84] wifi: ath11k: Allow ath11k to boot without caldata in - ftm mode - -Currently, if ath11k is unable to load the calibration data file it will -always exit. However the calibration data may not be present in factory -test mode, so update the logic to allow the driver to execute in FTM mode -even if downloading the calibration data fails. - -Tested-on : IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sowmiya Sree Elavalagan -Signed-off-by: Raj Kumar Bhagat -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230517135934.16408-5-quic_rajkbhag@quicinc.com ---- - drivers/net/wireless/ath/ath11k/qmi.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/qmi.c -+++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BSD-3-Clause-Clear - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include -@@ -2460,6 +2460,14 @@ static int ath11k_qmi_load_bdf_qmi(struc - - fw_entry = ath11k_core_firmware_request(ab, ATH11K_DEFAULT_CAL_FILE); - if (IS_ERR(fw_entry)) { -+ /* Caldata may not be present during first time calibration in -+ * factory hence allow to boot without loading caldata in ftm mode -+ */ -+ if (ath11k_ftm_mode) { -+ ath11k_info(ab, -+ "Booting without cal data file in factory test mode\n"); -+ return 0; -+ } - ret = PTR_ERR(fw_entry); - ath11k_warn(ab, - "qmi failed to load CAL data file:%s\n", diff --git a/package/kernel/mac80211/patches/ath11k/0084-wifi-ath11k-Add-HTT-stats-for-PHY-reset-case.patch b/package/kernel/mac80211/patches/ath11k/0084-wifi-ath11k-Add-HTT-stats-for-PHY-reset-case.patch deleted file mode 100644 index 946f5f7b5786bb..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0084-wifi-ath11k-Add-HTT-stats-for-PHY-reset-case.patch +++ /dev/null @@ -1,261 +0,0 @@ -From 2d4f9093e2d8531ad0a2bb98fe5b36dc8addf2a2 Mon Sep 17 00:00:00 2001 -From: Nidhi Jain -Date: Fri, 26 May 2023 12:41:07 +0300 -Subject: [PATCH] wifi: ath11k: Add HTT stats for PHY reset case - -New HTT stats are added with stats type 37 to -provide PHY reset stats and PHY reset counter stats. - -PHY reset stats are used to display the current -PHY-related operation information such as band, CCA -threshold, current operating channel etc., - -PHY reset counter stats are used to display the -PHY reset counter values like calibration counts, -temperature based recalibration counts etc., - -Usage: -echo 37 > /sys/kernel/debug/ieee80211/phyX/ath11k/htt_stats_type -cat /sys/kernel/debug/ieee80211/phyx/ath11k/htt_stats - -Output: - -HTT_PHY_RESET_STATS_TLV: -pdev_id = 0 -chan_mhz = 5180 -chan_band_center_freq1 = 5210 -chan_band_center_freq2 = 0 -chan_phy_mode = 18 -chan_flags = 0x8 -chan_num = 36 -reset_cause = 0x50000 -prev_reset_cause = 0x50000 -phy_warm_reset_src = 0x0 -rx_gain_tbl_mode = 0 -xbar_val = 0xfac688 -force_calibration = 0 -phyrf_mode = 0 -phy_homechan = 0 -phy_tx_ch_mask = 0x3 -phy_rx_ch_mask = 0x3 -phybb_ini_mask = 0x5 -phyrf_ini_mask = 0x0 -phy_dfs_en_mask = 0x0 -phy_sscan_en_mask = 0x0 -phy_synth_sel_mask = 0x0 -phy_adfs_freq = 0 -cck_fir_settings = 0x0 -phy_dyn_pri_chan = 6 -cca_thresh = 0x26232020 -dyn_cca_status = 0 -rxdesense_thresh_hw = 0xcfe0afe -rxdesense_thresh_sw = 0xcfe0afe - -HTT_PHY_RESET_COUNTERS_TLV: -pdev_id = 0 -cf_active_low_fail_cnt = 0 -cf_active_low_pass_cnt = 0 -phy_off_through_vreg_cnt = 0 -force_calibration_cnt = 0 -rf_mode_switch_phy_off_cnt = 0 - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Nidhi Jain -Signed-off-by: Maharaja Kennadyrajan -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230517141242.2754293-1-quic_mkenna@quicinc.com ---- - .../wireless/ath/ath11k/debugfs_htt_stats.c | 114 ++++++++++++++++++ - .../wireless/ath/ath11k/debugfs_htt_stats.h | 43 +++++++ - 2 files changed, 157 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c -+++ b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c -@@ -4011,6 +4011,114 @@ void htt_print_phy_stats_tlv(const void - stats_req->buf_len = len; - } - -+static inline void -+htt_print_phy_reset_counters_tlv(const void *tag_buf, -+ u16 tag_len, -+ struct debug_htt_stats_req *stats_req) -+{ -+ const struct htt_phy_reset_counters_tlv *htt_stats_buf = tag_buf; -+ u8 *buf = stats_req->buf; -+ u32 len = stats_req->buf_len; -+ u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; -+ -+ if (tag_len < sizeof(*htt_stats_buf)) -+ return; -+ -+ len += scnprintf(buf + len, buf_len - len, "HTT_PHY_RESET_COUNTERS_TLV:\n"); -+ -+ len += scnprintf(buf + len, buf_len - len, "pdev_id = %u\n", -+ htt_stats_buf->pdev_id); -+ len += scnprintf(buf + len, buf_len - len, "cf_active_low_fail_cnt = %u\n", -+ htt_stats_buf->cf_active_low_fail_cnt); -+ len += scnprintf(buf + len, buf_len - len, "cf_active_low_pass_cnt = %u\n", -+ htt_stats_buf->cf_active_low_pass_cnt); -+ len += scnprintf(buf + len, buf_len - len, "phy_off_through_vreg_cnt = %u\n", -+ htt_stats_buf->phy_off_through_vreg_cnt); -+ len += scnprintf(buf + len, buf_len - len, "force_calibration_cnt = %u\n", -+ htt_stats_buf->force_calibration_cnt); -+ len += scnprintf(buf + len, buf_len - len, "rf_mode_switch_phy_off_cnt = %u\n", -+ htt_stats_buf->rf_mode_switch_phy_off_cnt); -+ -+ stats_req->buf_len = len; -+} -+ -+static inline void -+htt_print_phy_reset_stats_tlv(const void *tag_buf, -+ u16 tag_len, -+ struct debug_htt_stats_req *stats_req) -+{ -+ const struct htt_phy_reset_stats_tlv *htt_stats_buf = tag_buf; -+ u8 *buf = stats_req->buf; -+ u32 len = stats_req->buf_len; -+ u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; -+ -+ if (tag_len < sizeof(*htt_stats_buf)) -+ return; -+ -+ len += scnprintf(buf + len, buf_len - len, "HTT_PHY_RESET_STATS_TLV:\n"); -+ -+ len += scnprintf(buf + len, buf_len - len, "pdev_id = %u\n", -+ htt_stats_buf->pdev_id); -+ len += scnprintf(buf + len, buf_len - len, "chan_mhz = %u\n", -+ htt_stats_buf->chan_mhz); -+ len += scnprintf(buf + len, buf_len - len, "chan_band_center_freq1 = %u\n", -+ htt_stats_buf->chan_band_center_freq1); -+ len += scnprintf(buf + len, buf_len - len, "chan_band_center_freq2 = %u\n", -+ htt_stats_buf->chan_band_center_freq2); -+ len += scnprintf(buf + len, buf_len - len, "chan_phy_mode = %u\n", -+ htt_stats_buf->chan_phy_mode); -+ len += scnprintf(buf + len, buf_len - len, "chan_flags = 0x%0x\n", -+ htt_stats_buf->chan_flags); -+ len += scnprintf(buf + len, buf_len - len, "chan_num = %u\n", -+ htt_stats_buf->chan_num); -+ len += scnprintf(buf + len, buf_len - len, "reset_cause = 0x%0x\n", -+ htt_stats_buf->reset_cause); -+ len += scnprintf(buf + len, buf_len - len, "prev_reset_cause = 0x%0x\n", -+ htt_stats_buf->prev_reset_cause); -+ len += scnprintf(buf + len, buf_len - len, "phy_warm_reset_src = 0x%0x\n", -+ htt_stats_buf->phy_warm_reset_src); -+ len += scnprintf(buf + len, buf_len - len, "rx_gain_tbl_mode = %d\n", -+ htt_stats_buf->rx_gain_tbl_mode); -+ len += scnprintf(buf + len, buf_len - len, "xbar_val = 0x%0x\n", -+ htt_stats_buf->xbar_val); -+ len += scnprintf(buf + len, buf_len - len, "force_calibration = %u\n", -+ htt_stats_buf->force_calibration); -+ len += scnprintf(buf + len, buf_len - len, "phyrf_mode = %u\n", -+ htt_stats_buf->phyrf_mode); -+ len += scnprintf(buf + len, buf_len - len, "phy_homechan = %u\n", -+ htt_stats_buf->phy_homechan); -+ len += scnprintf(buf + len, buf_len - len, "phy_tx_ch_mask = 0x%0x\n", -+ htt_stats_buf->phy_tx_ch_mask); -+ len += scnprintf(buf + len, buf_len - len, "phy_rx_ch_mask = 0x%0x\n", -+ htt_stats_buf->phy_rx_ch_mask); -+ len += scnprintf(buf + len, buf_len - len, "phybb_ini_mask = 0x%0x\n", -+ htt_stats_buf->phybb_ini_mask); -+ len += scnprintf(buf + len, buf_len - len, "phyrf_ini_mask = 0x%0x\n", -+ htt_stats_buf->phyrf_ini_mask); -+ len += scnprintf(buf + len, buf_len - len, "phy_dfs_en_mask = 0x%0x\n", -+ htt_stats_buf->phy_dfs_en_mask); -+ len += scnprintf(buf + len, buf_len - len, "phy_sscan_en_mask = 0x%0x\n", -+ htt_stats_buf->phy_sscan_en_mask); -+ len += scnprintf(buf + len, buf_len - len, "phy_synth_sel_mask = 0x%0x\n", -+ htt_stats_buf->phy_synth_sel_mask); -+ len += scnprintf(buf + len, buf_len - len, "phy_adfs_freq = %u\n", -+ htt_stats_buf->phy_adfs_freq); -+ len += scnprintf(buf + len, buf_len - len, "cck_fir_settings = 0x%0x\n", -+ htt_stats_buf->cck_fir_settings); -+ len += scnprintf(buf + len, buf_len - len, "phy_dyn_pri_chan = %u\n", -+ htt_stats_buf->phy_dyn_pri_chan); -+ len += scnprintf(buf + len, buf_len - len, "cca_thresh = 0x%0x\n", -+ htt_stats_buf->cca_thresh); -+ len += scnprintf(buf + len, buf_len - len, "dyn_cca_status = %u\n", -+ htt_stats_buf->dyn_cca_status); -+ len += scnprintf(buf + len, buf_len - len, "rxdesense_thresh_hw = 0x%x\n", -+ htt_stats_buf->rxdesense_thresh_hw); -+ len += scnprintf(buf + len, buf_len - len, "rxdesense_thresh_sw = 0x%x\n", -+ htt_stats_buf->rxdesense_thresh_sw); -+ -+ stats_req->buf_len = len; -+} -+ - static inline - void htt_print_peer_ctrl_path_txrx_stats_tlv(const void *tag_buf, - struct debug_htt_stats_req *stats_req) -@@ -4425,6 +4533,12 @@ static int ath11k_dbg_htt_ext_stats_pars - case HTT_STATS_PHY_STATS_TAG: - htt_print_phy_stats_tlv(tag_buf, stats_req); - break; -+ case HTT_STATS_PHY_RESET_COUNTERS_TAG: -+ htt_print_phy_reset_counters_tlv(tag_buf, len, stats_req); -+ break; -+ case HTT_STATS_PHY_RESET_STATS_TAG: -+ htt_print_phy_reset_stats_tlv(tag_buf, len, stats_req); -+ break; - case HTT_STATS_PEER_CTRL_PATH_TXRX_STATS_TAG: - htt_print_peer_ctrl_path_txrx_stats_tlv(tag_buf, stats_req); - break; ---- a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h -+++ b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h -@@ -111,6 +111,8 @@ enum htt_tlv_tag_t { - HTT_STATS_TXBF_OFDMA_STEER_STATS_TAG = 116, - HTT_STATS_PHY_COUNTERS_TAG = 121, - HTT_STATS_PHY_STATS_TAG = 122, -+ HTT_STATS_PHY_RESET_COUNTERS_TAG = 123, -+ HTT_STATS_PHY_RESET_STATS_TAG = 124, - - HTT_STATS_MAX_TAG, - }; -@@ -1964,6 +1966,47 @@ struct htt_phy_stats_tlv { - u32 fw_run_time; - }; - -+struct htt_phy_reset_counters_tlv { -+ u32 pdev_id; -+ u32 cf_active_low_fail_cnt; -+ u32 cf_active_low_pass_cnt; -+ u32 phy_off_through_vreg_cnt; -+ u32 force_calibration_cnt; -+ u32 rf_mode_switch_phy_off_cnt; -+}; -+ -+struct htt_phy_reset_stats_tlv { -+ u32 pdev_id; -+ u32 chan_mhz; -+ u32 chan_band_center_freq1; -+ u32 chan_band_center_freq2; -+ u32 chan_phy_mode; -+ u32 chan_flags; -+ u32 chan_num; -+ u32 reset_cause; -+ u32 prev_reset_cause; -+ u32 phy_warm_reset_src; -+ u32 rx_gain_tbl_mode; -+ u32 xbar_val; -+ u32 force_calibration; -+ u32 phyrf_mode; -+ u32 phy_homechan; -+ u32 phy_tx_ch_mask; -+ u32 phy_rx_ch_mask; -+ u32 phybb_ini_mask; -+ u32 phyrf_ini_mask; -+ u32 phy_dfs_en_mask; -+ u32 phy_sscan_en_mask; -+ u32 phy_synth_sel_mask; -+ u32 phy_adfs_freq; -+ u32 cck_fir_settings; -+ u32 phy_dyn_pri_chan; -+ u32 cca_thresh; -+ u32 dyn_cca_status; -+ u32 rxdesense_thresh_hw; -+ u32 rxdesense_thresh_sw; -+}; -+ - struct htt_peer_ctrl_path_txrx_stats_tlv { - /* peer mac address */ - u8 peer_mac_addr[ETH_ALEN]; diff --git a/package/kernel/mac80211/patches/ath11k/100-wifi-ath11k-use-unique-QRTR-instance-ID.patch b/package/kernel/mac80211/patches/ath11k/100-wifi-ath11k-use-unique-QRTR-instance-ID.patch index 39d5a61d5a1ed8..30472b322987d1 100644 --- a/package/kernel/mac80211/patches/ath11k/100-wifi-ath11k-use-unique-QRTR-instance-ID.patch +++ b/package/kernel/mac80211/patches/ath11k/100-wifi-ath11k-use-unique-QRTR-instance-ID.patch @@ -93,7 +93,7 @@ Signed-off-by: Robert Marko default: return "UNKNOWN"; } -@@ -336,27 +366,14 @@ static void ath11k_mhi_op_status_cb(stru +@@ -337,27 +367,14 @@ static void ath11k_mhi_op_status_cb(stru if (!(test_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags))) queue_work(ab->workqueue_aux, &ab->reset_work); break; @@ -138,7 +138,7 @@ Signed-off-by: Robert Marko int ath11k_mhi_register(struct ath11k_pci *ar_pci); --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -370,13 +370,20 @@ static void ath11k_pci_sw_reset(struct a +@@ -371,13 +371,20 @@ static void ath11k_pci_sw_reset(struct a static void ath11k_pci_init_qmi_ce_config(struct ath11k_base *ab) { struct ath11k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; diff --git a/package/kernel/mac80211/patches/ath11k/900-ath11k-control-thermal-support-via-symbol.patch b/package/kernel/mac80211/patches/ath11k/900-ath11k-control-thermal-support-via-symbol.patch index 60720a721e30ee..dcfb4b5ac8b1c3 100644 --- a/package/kernel/mac80211/patches/ath11k/900-ath11k-control-thermal-support-via-symbol.patch +++ b/package/kernel/mac80211/patches/ath11k/900-ath11k-control-thermal-support-via-symbol.patch @@ -56,11 +56,11 @@ Signed-off-by: Robert Marko int ath11k_thermal_set_throttling(struct ath11k *ar, u32 throttle_state); --- a/local-symbols +++ b/local-symbols -@@ -174,6 +174,7 @@ ATH11K_DEBUG= +@@ -173,6 +173,7 @@ ATH11K_DEBUG= ATH11K_DEBUGFS= ATH11K_TRACING= ATH11K_SPECTRAL= +ATH11K_THERMAL= - WLAN_VENDOR_ATMEL= - ATMEL= - PCI_ATMEL= + ATH12K= + ATH12K_DEBUG= + ATH12K_TRACING= diff --git a/package/kernel/mac80211/patches/ath11k/901-wifi-ath11k-pci-fix-compilation-in-5.16-and-older.patch b/package/kernel/mac80211/patches/ath11k/901-wifi-ath11k-pci-fix-compilation-in-5.16-and-older.patch index 72156563899370..9a0ca80090da8d 100644 --- a/package/kernel/mac80211/patches/ath11k/901-wifi-ath11k-pci-fix-compilation-in-5.16-and-older.patch +++ b/package/kernel/mac80211/patches/ath11k/901-wifi-ath11k-pci-fix-compilation-in-5.16-and-older.patch @@ -15,7 +15,7 @@ Signed-off-by: Robert Marko --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -458,7 +458,11 @@ static int ath11k_pci_alloc_msi(struct a +@@ -459,7 +459,11 @@ static int ath11k_pci_alloc_msi(struct a pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_LO, &ab->pci.msi.addr_lo); diff --git a/package/kernel/mac80211/patches/ath11k/902-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch b/package/kernel/mac80211/patches/ath11k/902-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch index 5454fa75e4c62d..cff62eea908ec5 100644 --- a/package/kernel/mac80211/patches/ath11k/902-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch +++ b/package/kernel/mac80211/patches/ath11k/902-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch @@ -8,17 +8,19 @@ so until that is resolved disabled it to allow using the radio. Signed-off-by: Robert Marko --- - drivers/net/wireless/ath/ath11k/core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + drivers/net/wireless/ath/ath11k/core.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -86,7 +86,7 @@ static const struct ath11k_hw_params ath +@@ -86,8 +86,8 @@ static const struct ath11k_hw_params ath .supports_shadow_regs = false, .idle_ps = false, .supports_sta_ps = false, -- .cold_boot_calib = true, -+ .cold_boot_calib = false, +- .coldboot_cal_mm = true, +- .coldboot_cal_ftm = true, ++ .coldboot_cal_mm = false, ++ .coldboot_cal_ftm = false, .cbcal_restart_fw = true, .fw_mem_mode = 0, .num_vdevs = 16 + 1, diff --git a/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch b/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch index 22c2493ca9d1e0..71373b2136f76a 100644 --- a/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch +++ b/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch @@ -31,7 +31,7 @@ Signed-off-by: Robert Marko { .hw_rev = ATH11K_HW_IPQ8074, .name = "ipq8074 hw2.0", -@@ -1953,7 +1953,8 @@ static void ath11k_core_reset(struct wor +@@ -2040,7 +2040,8 @@ static void ath11k_core_reset(struct wor static int ath11k_init_hw_params(struct ath11k_base *ab) { const struct ath11k_hw_params *hw_params = NULL; @@ -41,7 +41,7 @@ Signed-off-by: Robert Marko for (i = 0; i < ARRAY_SIZE(ath11k_hw_params); i++) { hw_params = &ath11k_hw_params[i]; -@@ -1969,7 +1970,30 @@ static int ath11k_init_hw_params(struct +@@ -2056,7 +2057,31 @@ static int ath11k_init_hw_params(struct ab->hw_params = *hw_params; @@ -62,7 +62,8 @@ Signed-off-by: Robert Marko + ab->hw_params.fw_mem_mode = 2; + ab->hw_params.num_vdevs = 8; + ab->hw_params.num_peers = 128; -+ ab->hw_params.cold_boot_calib = false; ++ ab->hw_params.coldboot_cal_mm = false; ++ ab->hw_params.coldboot_cal_ftm = false; + } else + ath11k_info(ab, "Unsupported FW memory mode: %u\n", fw_mem_mode); + } diff --git a/package/kernel/mac80211/patches/ath11k/905-ath11k-remove-intersection-support-for-regulatory-ru.patch b/package/kernel/mac80211/patches/ath11k/905-ath11k-remove-intersection-support-for-regulatory-ru.patch index b0ceb00ba034e0..74317e0262a44d 100644 --- a/package/kernel/mac80211/patches/ath11k/905-ath11k-remove-intersection-support-for-regulatory-ru.patch +++ b/package/kernel/mac80211/patches/ath11k/905-ath11k-remove-intersection-support-for-regulatory-ru.patch @@ -23,7 +23,7 @@ Signed-off-by: Aditya Kumar Singh --- a/drivers/net/wireless/ath/ath11k/reg.c +++ b/drivers/net/wireless/ath/ath11k/reg.c -@@ -352,129 +352,6 @@ static u32 ath11k_map_fw_reg_flags(u16 r +@@ -362,129 +362,6 @@ static u32 ath11k_map_fw_phy_flags(u32 p return flags; } @@ -153,7 +153,7 @@ Signed-off-by: Aditya Kumar Singh static const char * ath11k_reg_get_regdom_str(enum nl80211_dfs_regions dfs_region) { -@@ -609,9 +486,9 @@ ath11k_reg_update_weather_radar_band(str +@@ -619,9 +496,9 @@ ath11k_reg_update_weather_radar_band(str struct ieee80211_regdomain * ath11k_reg_build_regd(struct ath11k_base *ab, @@ -165,7 +165,7 @@ Signed-off-by: Aditya Kumar Singh struct cur_reg_rule *reg_rule; u8 i = 0, j = 0, k = 0; u8 num_rules; -@@ -628,26 +505,26 @@ ath11k_reg_build_regd(struct ath11k_base +@@ -638,26 +515,26 @@ ath11k_reg_build_regd(struct ath11k_base num_rules += reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP]; if (!num_rules) @@ -199,16 +199,16 @@ Signed-off-by: Aditya Kumar Singh reg_info->dfs_region, num_rules); /* Update reg_rules[] below. Firmware is expected to * send these rules in order(2 GHz rules first and then 5 GHz) -@@ -686,7 +563,7 @@ ath11k_reg_build_regd(struct ath11k_base - +@@ -697,7 +574,7 @@ ath11k_reg_build_regd(struct ath11k_base flags |= ath11k_map_fw_reg_flags(reg_rule->flags); + flags |= ath11k_map_fw_phy_flags(reg_info->phybitmap); - ath11k_reg_update_rule(tmp_regd->reg_rules + i, + ath11k_reg_update_rule(new_regd->reg_rules + i, reg_rule->start_freq, reg_rule->end_freq, max_bw, reg_rule->ant_gain, reg_rule->reg_power, -@@ -701,7 +578,7 @@ ath11k_reg_build_regd(struct ath11k_base +@@ -712,7 +589,7 @@ ath11k_reg_build_regd(struct ath11k_base reg_info->dfs_region == ATH11K_DFS_REG_ETSI && (reg_rule->end_freq > ETSI_WEATHER_RADAR_BAND_LOW && reg_rule->start_freq < ETSI_WEATHER_RADAR_BAND_HIGH)){ @@ -217,7 +217,7 @@ Signed-off-by: Aditya Kumar Singh reg_rule, &i, flags, max_bw); continue; -@@ -712,37 +589,20 @@ ath11k_reg_build_regd(struct ath11k_base +@@ -723,37 +600,20 @@ ath11k_reg_build_regd(struct ath11k_base "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d) (%d, %d)\n", i + 1, reg_rule->start_freq, reg_rule->end_freq, max_bw, reg_rule->ant_gain, reg_rule->reg_power, @@ -260,7 +260,7 @@ Signed-off-by: Aditya Kumar Singh --- a/drivers/net/wireless/ath/ath11k/reg.h +++ b/drivers/net/wireless/ath/ath11k/reg.h -@@ -30,7 +30,7 @@ void ath11k_reg_free(struct ath11k_base +@@ -33,7 +33,7 @@ void ath11k_reg_free(struct ath11k_base void ath11k_regd_update_work(struct work_struct *work); struct ieee80211_regdomain * ath11k_reg_build_regd(struct ath11k_base *ab, @@ -271,7 +271,7 @@ Signed-off-by: Aditya Kumar Singh #endif --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -6996,24 +6996,12 @@ static void ath11k_wmi_htc_tx_complete(s +@@ -7060,24 +7060,12 @@ static void ath11k_wmi_htc_tx_complete(s wake_up(&wmi->tx_ce_desc_wq); } @@ -296,7 +296,7 @@ Signed-off-by: Aditya Kumar Singh int ret = 0, pdev_idx, i, j; struct ath11k *ar; -@@ -7075,17 +7063,7 @@ static int ath11k_reg_chan_list_event(st +@@ -7141,17 +7129,7 @@ static int ath11k_reg_chan_list_event(st (char *)reg_info->alpha2, 2)) goto mem_free; diff --git a/package/kernel/mac80211/patches/ath9k/351-ath9k_hw-issue-external-reset-for-QCA955x.patch b/package/kernel/mac80211/patches/ath9k/351-ath9k_hw-issue-external-reset-for-QCA955x.patch index 53b7ba08bc1587..aac7e139249673 100644 --- a/package/kernel/mac80211/patches/ath9k/351-ath9k_hw-issue-external-reset-for-QCA955x.patch +++ b/package/kernel/mac80211/patches/ath9k/351-ath9k_hw-issue-external-reset-for-QCA955x.patch @@ -75,7 +75,7 @@ Signed-off-by: Felix Fietkau + ath_dbg(ath9k_hw_common(ah), RESET, + "reset MAC via external reset\n"); -- REG_WRITE(ah, AR_RTC_RESET, 1); +- REG_WRITE(ah, AR_RTC_RESET(ah), 1); + err = ah->external_reset(); + if (err) { + ath_err(ath9k_hw_common(ah), @@ -84,11 +84,11 @@ Signed-off-by: Felix Fietkau } + if (AR_SREV_9550(ah)) { -+ REG_WRITE(ah, AR_RTC_RESET, 0); ++ REG_WRITE(ah, AR_RTC_RESET(ah), 0); + udelay(10); + } + -+ REG_WRITE(ah, AR_RTC_RESET, 1); ++ REG_WRITE(ah, AR_RTC_RESET(ah), 1); + udelay(10); + return true; @@ -124,6 +124,6 @@ Signed-off-by: Felix Fietkau + if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) + REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ); + - REG_WRITE(ah, AR_RTC_RC, rst_flags); + REG_WRITE(ah, AR_RTC_RC(ah), rst_flags); REGWRITE_BUFFER_FLUSH(ah); diff --git a/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch index 2f5e75be8a3051..d23d70b2ce7d17 100644 --- a/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch +++ b/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch @@ -1,14 +1,24 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1413,6 +1413,54 @@ void ath9k_deinit_debug(struct ath_softc - ath9k_cmn_spectral_deinit_debug(&sc->spec_priv); - } +@@ -1471,6 +1471,7 @@ int ath9k_init_debug(struct ath_hw *ah) + + ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah); + ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah); ++ ath9k_cmn_debug_eeprom(sc->debug.debugfs_phy, sc->sc_ah); + debugfs_create_u32("gpio_mask", 0600, + sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); +--- a/drivers/net/wireless/ath/ath9k/common-debug.c ++++ b/drivers/net/wireless/ath/ath9k/common-debug.c +@@ -260,3 +260,58 @@ void ath9k_cmn_debug_phy_err(struct dent + &fops_phy_err); + } + EXPORT_SYMBOL(ath9k_cmn_debug_phy_err); ++ +static ssize_t read_file_eeprom(struct file *file, char __user *user_buf, + size_t count, loff_t *ppos) +{ -+ struct ath_softc *sc = file->private_data; -+ struct ath_hw *ah = sc->sc_ah; ++ struct ath_hw *ah = file->private_data; + struct ath_common *common = ath9k_hw_common(ah); + int bytes = 0; + int pos = *ppos; @@ -52,15 +62,31 @@ + .owner = THIS_MODULE +}; + - int ath9k_init_debug(struct ath_hw *ah) - { - struct ath_common *common = ath9k_hw_common(ah); -@@ -1432,6 +1480,8 @@ int ath9k_init_debug(struct ath_hw *ah) - ath9k_tx99_init_debug(sc); - ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); - -+ debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, ++void ath9k_cmn_debug_eeprom(struct dentry *debugfs_phy, ++ struct ath_hw *ah) ++{ ++ debugfs_create_file("eeprom", S_IRUSR, debugfs_phy, ah, + &fops_eeprom); - debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy, - read_file_dma); - debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy, ++} ++EXPORT_SYMBOL(ath9k_cmn_debug_eeprom); +--- a/drivers/net/wireless/ath/ath9k/common-debug.h ++++ b/drivers/net/wireless/ath/ath9k/common-debug.h +@@ -69,6 +69,8 @@ void ath9k_cmn_debug_modal_eeprom(struct + struct ath_hw *ah); + void ath9k_cmn_debug_base_eeprom(struct dentry *debugfs_phy, + struct ath_hw *ah); ++void ath9k_cmn_debug_eeprom(struct dentry *debugfs_phy, ++ struct ath_hw *ah); + void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats, + struct ath_rx_status *rs); + void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, +--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +@@ -519,6 +519,7 @@ int ath9k_htc_init_debug(struct ath_hw * + + ath9k_cmn_debug_base_eeprom(priv->debug.debugfs_phy, priv->ah); + ath9k_cmn_debug_modal_eeprom(priv->debug.debugfs_phy, priv->ah); ++ ath9k_cmn_debug_eeprom(priv->debug.debugfs_phy, priv->ah); + + return 0; + } diff --git a/package/kernel/mac80211/patches/ath9k/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/ath9k/511-ath9k_reduce_rxbuf.patch index 15b8d7b86b137b..3abf16b03e3931 100644 --- a/package/kernel/mac80211/patches/ath9k/511-ath9k_reduce_rxbuf.patch +++ b/package/kernel/mac80211/patches/ath9k/511-ath9k_reduce_rxbuf.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -88,7 +88,7 @@ int ath_descdma_setup(struct ath_softc * +@@ -89,7 +89,7 @@ int ath_descdma_setup(struct ath_softc * (_l) &= ((_sz) - 1); \ } while (0) diff --git a/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch index a871e458a4e7e9..54abb4d4254087 100644 --- a/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch +++ b/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch @@ -1,70 +1,16 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1461,6 +1461,52 @@ static const struct file_operations fops - .owner = THIS_MODULE - }; +@@ -1472,6 +1472,7 @@ int ath9k_init_debug(struct ath_hw *ah) + ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah); + ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah); + ath9k_cmn_debug_eeprom(sc->debug.debugfs_phy, sc->sc_ah); ++ ath9k_cmn_debug_chanbw(sc->debug.debugfs_phy, sc->sc_ah); -+ -+static ssize_t read_file_chan_bw(struct file *file, char __user *user_buf, -+ size_t count, loff_t *ppos) -+{ -+ struct ath_softc *sc = file->private_data; -+ struct ath_common *common = ath9k_hw_common(sc->sc_ah); -+ char buf[32]; -+ unsigned int len; -+ -+ len = sprintf(buf, "0x%08x\n", common->chan_bw); -+ return simple_read_from_buffer(user_buf, count, ppos, buf, len); -+} -+ -+static ssize_t write_file_chan_bw(struct file *file, const char __user *user_buf, -+ size_t count, loff_t *ppos) -+{ -+ struct ath_softc *sc = file->private_data; -+ struct ath_common *common = ath9k_hw_common(sc->sc_ah); -+ unsigned long chan_bw; -+ char buf[32]; -+ ssize_t len; -+ -+ len = min(count, sizeof(buf) - 1); -+ if (copy_from_user(buf, user_buf, len)) -+ return -EFAULT; -+ -+ buf[len] = '\0'; -+ if (kstrtoul(buf, 0, &chan_bw)) -+ return -EINVAL; -+ -+ common->chan_bw = chan_bw; -+ if (!test_bit(ATH_OP_INVALID, &common->op_flags)) -+ ath9k_ops.config(sc->hw, IEEE80211_CONF_CHANGE_CHANNEL); -+ -+ return count; -+} -+ -+static const struct file_operations fops_chanbw = { -+ .read = read_file_chan_bw, -+ .write = write_file_chan_bw, -+ .open = simple_open, -+ .owner = THIS_MODULE, -+ .llseek = default_llseek, -+}; -+ -+ - int ath9k_init_debug(struct ath_hw *ah) - { - struct ath_common *common = ath9k_hw_common(ah); -@@ -1482,6 +1528,8 @@ int ath9k_init_debug(struct ath_hw *ah) - - debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_eeprom); -+ debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, -+ sc, &fops_chanbw); - debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy, - read_file_dma); - debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy, + debugfs_create_u32("gpio_mask", 0600, + sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h -@@ -149,6 +149,7 @@ struct ath_common { +@@ -153,6 +153,7 @@ struct ath_common { int debug_mask; enum ath_device_state state; unsigned long op_flags; @@ -72,6 +18,14 @@ struct ath_ani ani; +@@ -181,6 +182,7 @@ struct ath_common { + const struct ath_ops *ops; + const struct ath_bus_ops *bus_ops; + const struct ath_ps_ops *ps_ops; ++ const struct ieee80211_ops *ieee_ops; + + bool btcoex_enabled; + bool disable_ani; --- a/drivers/net/wireless/ath/ath9k/common.c +++ b/drivers/net/wireless/ath/ath9k/common.c @@ -297,11 +297,13 @@ EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_ke @@ -123,3 +77,115 @@ return channel; } +--- a/drivers/net/wireless/ath/ath9k/common-debug.c ++++ b/drivers/net/wireless/ath/ath9k/common-debug.c +@@ -316,3 +316,55 @@ void ath9k_cmn_debug_eeprom(struct dentr + &fops_eeprom); + } + EXPORT_SYMBOL(ath9k_cmn_debug_eeprom); ++ ++static ssize_t read_file_chan_bw(struct file *file, char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_hw *ah = file->private_data; ++ struct ath_common *common = ath9k_hw_common(ah); ++ char buf[32]; ++ unsigned int len; ++ ++ len = sprintf(buf, "0x%08x\n", common->chan_bw); ++ return simple_read_from_buffer(user_buf, count, ppos, buf, len); ++} ++ ++static ssize_t write_file_chan_bw(struct file *file, const char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_hw *ah = file->private_data; ++ struct ath_common *common = ath9k_hw_common(ah); ++ unsigned long chan_bw; ++ char buf[32]; ++ ssize_t len; ++ ++ len = min(count, sizeof(buf) - 1); ++ if (copy_from_user(buf, user_buf, len)) ++ return -EFAULT; ++ ++ buf[len] = '\0'; ++ if (kstrtoul(buf, 0, &chan_bw)) ++ return -EINVAL; ++ ++ common->chan_bw = chan_bw; ++ if (!test_bit(ATH_OP_INVALID, &common->op_flags)) ++ common->ieee_ops->config(ah->hw, IEEE80211_CONF_CHANGE_CHANNEL); ++ ++ return count; ++} ++ ++static const struct file_operations fops_chanbw = { ++ .read = read_file_chan_bw, ++ .write = write_file_chan_bw, ++ .open = simple_open, ++ .owner = THIS_MODULE, ++ .llseek = default_llseek, ++}; ++ ++void ath9k_cmn_debug_chanbw(struct dentry *debugfs_phy, ++ struct ath_hw *ah) ++{ ++ debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, debugfs_phy, ah, ++ &fops_chanbw); ++} ++EXPORT_SYMBOL(ath9k_cmn_debug_chanbw); +--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +@@ -520,6 +520,7 @@ int ath9k_htc_init_debug(struct ath_hw * + ath9k_cmn_debug_base_eeprom(priv->debug.debugfs_phy, priv->ah); + ath9k_cmn_debug_modal_eeprom(priv->debug.debugfs_phy, priv->ah); + ath9k_cmn_debug_eeprom(priv->debug.debugfs_phy, priv->ah); ++ ath9k_cmn_debug_chanbw(priv->debug.debugfs_phy, priv->ah); + + return 0; + } +--- a/drivers/net/wireless/ath/ath9k/common-debug.h ++++ b/drivers/net/wireless/ath/ath9k/common-debug.h +@@ -71,6 +71,8 @@ void ath9k_cmn_debug_base_eeprom(struct + struct ath_hw *ah); + void ath9k_cmn_debug_eeprom(struct dentry *debugfs_phy, + struct ath_hw *ah); ++void ath9k_cmn_debug_chanbw(struct dentry *debugfs_phy, ++ struct ath_hw *ah); + void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats, + struct ath_rx_status *rs); + void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, +--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c +@@ -631,6 +631,7 @@ static int ath9k_init_priv(struct ath9k_ + priv->ah = ah; + + common = ath9k_hw_common(ah); ++ common->ieee_ops = &ath9k_htc_ops; + common->ops = &ah->reg_ops; + common->ps_ops = &ath9k_htc_ps_ops; + common->bus_ops = &ath9k_usb_bus_ops; +@@ -746,9 +747,9 @@ static void ath9k_set_hw_capab(struct at + + hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN | + WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL | +- WIPHY_FLAG_HAS_CHANNEL_SWITCH; +- +- hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; ++ WIPHY_FLAG_HAS_CHANNEL_SWITCH | ++ WIPHY_FLAG_SUPPORTS_5_10_MHZ | ++ WIPHY_FLAG_SUPPORTS_TDLS; + + hw->queues = 4; + hw->max_listen_interval = 1; +--- a/drivers/net/wireless/ath/ath9k/init.c ++++ b/drivers/net/wireless/ath/ath9k/init.c +@@ -733,6 +733,7 @@ static int ath9k_init_softc(u16 devid, s + if (!ath9k_is_chanctx_enabled()) + sc->cur_chan->hw_queue_base = 0; + ++ common->ieee_ops = &ath9k_ops; + common->ops = &ah->reg_ops; + common->bus_ops = bus_ops; + common->ps_ops = &ath9k_ps_ops; diff --git a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch index 74506657e0f26c..9568b091de3c13 100644 --- a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -843,6 +843,9 @@ static inline int ath9k_dump_btcoex(stru +@@ -844,6 +844,9 @@ static inline int ath9k_dump_btcoex(stru #ifdef CPTCFG_MAC80211_LEDS void ath_init_leds(struct ath_softc *sc); void ath_deinit_leds(struct ath_softc *sc); @@ -10,7 +10,7 @@ #else static inline void ath_init_leds(struct ath_softc *sc) { -@@ -979,6 +982,13 @@ void ath_ant_comb_scan(struct ath_softc +@@ -980,6 +983,13 @@ void ath_ant_comb_scan(struct ath_softc #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */ @@ -24,7 +24,7 @@ struct ath_softc { struct ieee80211_hw *hw; struct device *dev; -@@ -1032,9 +1042,8 @@ struct ath_softc { +@@ -1033,9 +1043,8 @@ struct ath_softc { spinlock_t chan_lock; #ifdef CPTCFG_MAC80211_LEDS @@ -181,7 +181,7 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1088,7 +1088,7 @@ int ath9k_init_device(u16 devid, struct +@@ -1089,7 +1089,7 @@ int ath9k_init_device(u16 devid, struct #ifdef CPTCFG_MAC80211_LEDS /* must be initialized before ieee80211_register_hw */ @@ -192,9 +192,9 @@ #endif --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1506,6 +1506,61 @@ static const struct file_operations fops - .llseek = default_llseek, - }; +@@ -128,6 +128,61 @@ static const struct file_operations fops + + #define DMA_BUF_LEN 1024 +#ifdef CONFIG_MAC80211_LEDS + @@ -252,12 +252,12 @@ +#endif + - int ath9k_init_debug(struct ath_hw *ah) - { -@@ -1530,6 +1585,10 @@ int ath9k_init_debug(struct ath_hw *ah) - &fops_eeprom); - debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, - sc, &fops_chanbw); + static ssize_t read_file_ani(struct file *file, char __user *user_buf, + size_t count, loff_t *ppos) +@@ -1432,6 +1487,10 @@ int ath9k_init_debug(struct ath_hw *ah) + ath9k_tx99_init_debug(sc); + ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); + +#ifdef CONFIG_MAC80211_LEDS + debugfs_create_file("gpio_led", S_IWUSR, + sc->debug.debugfs_phy, sc, &fops_gpio_led); diff --git a/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch index 6acc864d1e10e6..00451061f2bd05 100644 --- a/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch +++ b/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch @@ -26,9 +26,9 @@ +{ + int i, j; + -+ REG_RMW_FIELD(ah, AR_PHY_TEST, AR_PHY_TEST_BBB_OBS_SEL, 1); -+ REG_CLR_BIT(ah, AR_PHY_TEST, AR_PHY_TEST_RX_OBS_SEL_BIT5); -+ REG_RMW_FIELD(ah, AR_PHY_TEST_CTL_STATUS, AR_PHY_TEST_CTL_RX_OBS_SEL, 0); ++ REG_RMW_FIELD(ah, AR_PHY_TEST(ah), AR_PHY_TEST_BBB_OBS_SEL, 1); ++ REG_CLR_BIT(ah, AR_PHY_TEST(ah), AR_PHY_TEST_RX_OBS_SEL_BIT5); ++ REG_RMW_FIELD(ah, AR_PHY_TEST_CTL_STATUS(ah), AR_PHY_TEST_CTL_RX_OBS_SEL, 0); + + memset(buf, 0, len); + for (i = 0; i < len; i++) { diff --git a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch index 78206d286015a3..643d51285b0952 100644 --- a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch +++ b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -24,6 +24,7 @@ +@@ -25,6 +25,7 @@ #include #include #include @@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau #include "common.h" #include "debug.h" -@@ -989,6 +990,14 @@ struct ath_led { +@@ -990,6 +991,14 @@ struct ath_led { struct led_classdev cdev; }; @@ -33,7 +33,7 @@ Signed-off-by: Felix Fietkau struct ath_softc { struct ieee80211_hw *hw; struct device *dev; -@@ -1044,6 +1053,9 @@ struct ath_softc { +@@ -1045,6 +1054,9 @@ struct ath_softc { #ifdef CPTCFG_MAC80211_LEDS const char *led_default_trigger; struct list_head leds; @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau + gchip); + struct ath_hw *ah = gc->sc->sc_ah; + -+ return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3); ++ return !((REG_READ(ah, AR_GPIO_OE_OUT(ah)) >> (offset * 2)) & 3); +} + +/* gpio_chip handler : get GPIO pin value */ diff --git a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch index 716e09f351eb6d..83076b8ae49177 100644 --- a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch +++ b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -1055,6 +1055,7 @@ struct ath_softc { +@@ -1056,6 +1056,7 @@ struct ath_softc { struct list_head leds; #ifdef CONFIG_GPIOLIB struct ath9k_gpio_chip *gpiochip; diff --git a/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch b/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch index efc4b9187c0f7f..efd2932446d790 100644 --- a/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch +++ b/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch @@ -371,7 +371,7 @@ --- a/local-symbols +++ b/local-symbols -@@ -129,6 +129,7 @@ ATH9K_WOW= +@@ -128,6 +128,7 @@ ATH9K_WOW= ATH9K_RFKILL= ATH9K_CHANNEL_CONTEXT= ATH9K_PCOEM= diff --git a/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch b/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch index 57eef54e8977a0..637e607e366b5c 100644 --- a/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch +++ b/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch @@ -311,7 +311,7 @@ }; --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -25,6 +25,7 @@ +@@ -26,6 +26,7 @@ #include #include #include @@ -319,7 +319,7 @@ #include "common.h" #include "debug.h" -@@ -1011,6 +1012,9 @@ struct ath_softc { +@@ -1012,6 +1013,9 @@ struct ath_softc { struct ath_hw *sc_ah; void __iomem *mem; int irq; diff --git a/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch b/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch index b82b442a1e1f4c..b06172ec0ef35e 100644 --- a/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch +++ b/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch @@ -10,7 +10,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -713,8 +713,36 @@ static struct wireless_dev *brcmf_cfg802 +@@ -979,8 +979,36 @@ static struct wireless_dev *brcmf_cfg802 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct brcmf_pub *drvr = cfg->pub; struct wireless_dev *wdev; diff --git a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch index 080ab8f7efd8e4..92e647816b49eb 100644 --- a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch +++ b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2976,6 +2976,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip +@@ -3327,6 +3327,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip * preference in cfg struct to apply this to * FW later while initializing the dongle */ diff --git a/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch index 25191b6439ee54..f873528e2632df 100644 --- a/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch +++ b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch @@ -49,7 +49,7 @@ Signed-off-by: Rafał Miłecki void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, struct brcmf_mp_device *settings) { -@@ -106,6 +136,8 @@ void brcmf_of_probe(struct device *dev, +@@ -113,6 +143,8 @@ void brcmf_of_probe(struct device *dev, of_node_put(root); } diff --git a/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch b/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch index 8df285f8b13781..22e26e7698571b 100644 --- a/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch +++ b/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch @@ -24,7 +24,7 @@ Signed-off-by: Phil Elwell #include "of.h" static int brcmf_of_get_country_codes(struct device *dev, -@@ -168,3 +169,38 @@ void brcmf_of_probe(struct device *dev, +@@ -175,3 +176,38 @@ void brcmf_of_probe(struct device *dev, sdio->oob_irq_nr = irq; sdio->oob_irq_flags = irqf; } @@ -96,7 +96,7 @@ Signed-off-by: Phil Elwell #define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500) #define CTL_DONE_TIMEOUT msecs_to_jiffies(2500) -@@ -634,7 +635,7 @@ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "b +@@ -632,7 +633,7 @@ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "b /* per-board firmware binaries */ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "brcmfmac*-sdio.*.bin"); @@ -105,7 +105,7 @@ Signed-off-by: Phil Elwell BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0), BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4), -@@ -662,6 +663,9 @@ static const struct brcmf_firmware_mappi +@@ -660,6 +661,9 @@ static const struct brcmf_firmware_mappi BRCMF_FW_ENTRY(CY_CC_43752_CHIP_ID, 0xFFFFFFFF, 43752) }; @@ -115,7 +115,7 @@ Signed-off-by: Phil Elwell #define TXCTL_CREDITS 2 static void pkt_align(struct sk_buff *p, int len, int align) -@@ -4193,6 +4197,9 @@ static const struct brcmf_bus_ops brcmf_ +@@ -4201,6 +4205,9 @@ static const struct brcmf_bus_ops brcmf_ #define BRCMF_SDIO_FW_NVRAM 1 #define BRCMF_SDIO_FW_CLM 2 @@ -125,7 +125,7 @@ Signed-off-by: Phil Elwell static void brcmf_sdio_firmware_callback(struct device *dev, int err, struct brcmf_fw_request *fwreq) { -@@ -4208,6 +4215,22 @@ static void brcmf_sdio_firmware_callback +@@ -4216,6 +4223,22 @@ static void brcmf_sdio_firmware_callback brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err); @@ -148,7 +148,7 @@ Signed-off-by: Phil Elwell if (err) goto fail; -@@ -4418,7 +4441,7 @@ brcmf_sdio_prepare_fw_request(struct brc +@@ -4426,7 +4449,7 @@ brcmf_sdio_prepare_fw_request(struct brc fwreq = brcmf_fw_alloc_request(bus->ci->chip, bus->ci->chiprev, brcmf_sdio_fwnames, @@ -157,7 +157,7 @@ Signed-off-by: Phil Elwell fwnames, ARRAY_SIZE(fwnames)); if (!fwreq) return NULL; -@@ -4438,6 +4461,9 @@ struct brcmf_sdio *brcmf_sdio_probe(stru +@@ -4446,6 +4469,9 @@ struct brcmf_sdio *brcmf_sdio_probe(stru struct brcmf_sdio *bus; struct workqueue_struct *wq; struct brcmf_fw_request *fwreq; @@ -167,7 +167,7 @@ Signed-off-by: Phil Elwell brcmf_dbg(TRACE, "Enter\n"); -@@ -4520,6 +4546,21 @@ struct brcmf_sdio *brcmf_sdio_probe(stru +@@ -4528,6 +4554,21 @@ struct brcmf_sdio *brcmf_sdio_probe(stru brcmf_dbg(INFO, "completed!!\n"); diff --git a/package/kernel/mac80211/patches/build/004-fix-kconf-compiling.patch b/package/kernel/mac80211/patches/build/004-fix-kconf-compiling.patch new file mode 100644 index 00000000000000..8bae8367f7666a --- /dev/null +++ b/package/kernel/mac80211/patches/build/004-fix-kconf-compiling.patch @@ -0,0 +1,47 @@ +--- a/Makefile.real ++++ b/Makefile.real +@@ -6,6 +6,18 @@ else + export BACKPORTS_GIT_TRACKER_DEF= + endif + ++ifneq ($(LLVM),) ++ifneq ($(filter %/,$(LLVM)),) ++LLVM_PREFIX := $(LLVM) ++else ifneq ($(filter -%,$(LLVM)),) ++LLVM_SUFFIX := $(LLVM) ++endif ++ ++HOSTCC = $(LLVM_PREFIX)clang$(LLVM_SUFFIX) ++else ++HOSTCC = gcc ++endif ++ + # disable built-in rules for this file + .SUFFIXES: + +@@ -24,21 +36,21 @@ listnewconfig oldaskconfig oldconfig \ + silentoldconfig olddefconfig oldnoconfig \ + allnoconfig allyesconfig allmodconfig \ + alldefconfig randconfig: +- @$(MAKE) -C kconf conf ++ @$(MAKE) -C kconf CC=$(HOSTCC) conf + @./kconf/conf --$@ Kconfig + + .PHONY: usedefconfig + usedefconfig: +- @$(MAKE) -C kconf conf ++ @$(MAKE) -C kconf CC=$(HOSTCC) conf + @./kconf/conf --defconfig=defconfig Kconfig + + .PHONY: savedefconfig + savedefconfig: +- @$(MAKE) -C kconf conf ++ @$(MAKE) -C kconf CC=$(HOSTCC) conf + @./kconf/conf --savedefconfig=defconfig Kconfig + + defconfig-%:: +- @$(MAKE) -C kconf conf ++ @$(MAKE) -C kconf CC=$(HOSTCC) conf + @./kconf/conf --defconfig=defconfigs/$(@:defconfig-%=%) Kconfig + + .config: diff --git a/package/kernel/mac80211/patches/build/050-lib80211_option.patch b/package/kernel/mac80211/patches/build/050-lib80211_option.patch deleted file mode 100644 index c1b1bc757f2d52..00000000000000 --- a/package/kernel/mac80211/patches/build/050-lib80211_option.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- a/net/wireless/Kconfig -+++ b/net/wireless/Kconfig -@@ -188,7 +188,7 @@ config CFG80211_WEXT_EXPORT - endif # CFG80211 - - config LIB80211 -- tristate -+ tristate "lib80211" - depends on m - default n - help -@@ -198,19 +198,19 @@ config LIB80211 - Drivers should select this themselves if needed. - - config LIB80211_CRYPT_WEP -- tristate -+ tristate "lib80211 WEP support" - depends on m - select BPAUTO_CRYPTO_LIB_ARC4 - - config LIB80211_CRYPT_CCMP -- tristate -+ tristate "lib80211 CCMP support" - depends on m - depends on CRYPTO - depends on CRYPTO_AES - depends on CRYPTO_CCM - - config LIB80211_CRYPT_TKIP -- tristate -+ tristate "lib80211 TKIP support" - depends on m - select BPAUTO_CRYPTO_LIB_ARC4 - diff --git a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch index 4ad2ac081a6761..451d0b79fcc854 100644 --- a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch +++ b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch @@ -1,6 +1,6 @@ --- a/local-symbols +++ b/local-symbols -@@ -470,43 +470,6 @@ USB_VL600= +@@ -491,43 +491,6 @@ USB_VL600= USB_NET_CH9200= USB_NET_AQC111= USB_RTL8153_ECM= @@ -171,7 +171,7 @@ depends on CORDIC --- a/Kconfig.local +++ b/Kconfig.local -@@ -1414,117 +1414,6 @@ config BACKPORTED_USB_NET_AQC111 +@@ -1477,117 +1477,6 @@ config BACKPORTED_USB_NET_AQC111 config BACKPORTED_USB_RTL8153_ECM tristate default USB_RTL8153_ECM diff --git a/package/kernel/mac80211/patches/build/080-resv_start_op.patch b/package/kernel/mac80211/patches/build/080-resv_start_op.patch index 40b8e94a201c6e..802a0e3fc8af3c 100644 --- a/package/kernel/mac80211/patches/build/080-resv_start_op.patch +++ b/package/kernel/mac80211/patches/build/080-resv_start_op.patch @@ -1,18 +1,18 @@ ---- a/drivers/net/wireless/mac80211_hwsim.c -+++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -5363,7 +5363,9 @@ static struct genl_family hwsim_genl_fam +--- a/drivers/net/wireless/virtual/mac80211_hwsim.c ++++ b/drivers/net/wireless/virtual/mac80211_hwsim.c +@@ -6179,7 +6179,9 @@ static struct genl_family hwsim_genl_fam .module = THIS_MODULE, .small_ops = hwsim_ops, .n_small_ops = ARRAY_SIZE(hwsim_ops), +#if LINUX_VERSION_IS_GEQ(6,1,0) - .resv_start_op = HWSIM_CMD_DEL_MAC_ADDR + 1, + .resv_start_op = HWSIM_CMD_REPORT_PMSR + 1, // match with __HWSIM_CMD_MAX +#endif .mcgrps = hwsim_mcgrps, .n_mcgrps = ARRAY_SIZE(hwsim_mcgrps), }; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -17233,7 +17233,9 @@ static struct genl_family nl80211_fam __ +@@ -17509,7 +17509,9 @@ static struct genl_family nl80211_fam __ .n_ops = ARRAY_SIZE(nl80211_ops), .small_ops = nl80211_small_ops, .n_small_ops = ARRAY_SIZE(nl80211_small_ops), diff --git a/package/kernel/mac80211/patches/build/110-backport_namepace_const.patch b/package/kernel/mac80211/patches/build/110-backport_namepace_const.patch new file mode 100644 index 00000000000000..6dca708edf7759 --- /dev/null +++ b/package/kernel/mac80211/patches/build/110-backport_namepace_const.patch @@ -0,0 +1,14 @@ +--- a/net/wireless/sysfs.c ++++ b/net/wireless/sysfs.c +@@ -154,7 +154,11 @@ static SIMPLE_DEV_PM_OPS(wiphy_pm_ops, w + #define WIPHY_PM_OPS NULL + #endif + ++#if LINUX_VERSION_IS_GEQ(6,2,0) + static const void *wiphy_namespace(const struct device *d) ++#else ++static const void *wiphy_namespace(struct device *d) ++#endif + { + struct wiphy *wiphy = container_of(d, struct wiphy, dev); + diff --git a/package/kernel/mac80211/patches/build/110-backport_napi_build_skb.patch b/package/kernel/mac80211/patches/build/110-backport_napi_build_skb.patch deleted file mode 100644 index 1e152feceac6c3..00000000000000 --- a/package/kernel/mac80211/patches/build/110-backport_napi_build_skb.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/backport-include/linux/skbuff.h -+++ b/backport-include/linux/skbuff.h -@@ -144,4 +144,8 @@ static inline u64 skb_get_kcov_handle(st - #define napi_build_skb build_skb - #endif - -+#if LINUX_VERSION_IS_LESS(5,11,0) -+#define napi_build_skb build_skb -+#endif -+ - #endif /* __BACKPORT_SKBUFF_H */ diff --git a/package/kernel/mac80211/patches/build/120-headers_version_fix.patch b/package/kernel/mac80211/patches/build/120-headers_version_fix.patch new file mode 100644 index 00000000000000..9a8c4749b2f037 --- /dev/null +++ b/package/kernel/mac80211/patches/build/120-headers_version_fix.patch @@ -0,0 +1,25 @@ +--- a/backport-include/linux/random.h ++++ b/backport-include/linux/random.h +@@ -23,7 +23,7 @@ static inline u16 get_random_u16(void) + } + #endif + +-#if LINUX_VERSION_IS_LESS(6,2,0) ++#if LINUX_VERSION_IS_LESS(6,1,4) + static inline u32 __get_random_u32_below(u32 ceil) + { + /* +--- a/backport-include/net/dropreason.h ++++ b/backport-include/net/dropreason.h +@@ -3,10 +3,9 @@ + + #include + ++#include + #if LINUX_VERSION_IS_GEQ(6,0,0) + #include_next +-#else +-#include + #endif + + #if LINUX_VERSION_IS_LESS(6,4,0) diff --git a/package/kernel/mac80211/patches/build/130-iommu_backport.patch b/package/kernel/mac80211/patches/build/130-iommu_backport.patch new file mode 100644 index 00000000000000..2d3ef88d645591 --- /dev/null +++ b/package/kernel/mac80211/patches/build/130-iommu_backport.patch @@ -0,0 +1,26 @@ +--- /dev/null ++++ b/backport-include/linux/iommu.h +@@ -0,0 +1,23 @@ ++#ifndef __BACKPORT_LINUX_IOMMU_H ++#define __BACKPORT_LINUX_IOMMU_H ++ ++#include_next ++#include ++ ++#if LINUX_VERSION_IS_LESS(6,3,0) ++ ++static inline int LINUX_BACKPORT(iommu_map)(struct iommu_domain *domain, ++ unsigned long iova, ++ phys_addr_t paddr, size_t size, ++ int prot, gfp_t gfp) ++{ ++ if (gfp == GFP_ATOMIC) ++ return iommu_map_atomic(domain, iova, paddr, size, prot); ++ ++ return iommu_map(domain, iova, paddr, size, prot); ++} ++#define iommu_map LINUX_BACKPORT(iommu_map) ++ ++#endif /* < 6.3 */ ++ ++#endif diff --git a/package/kernel/mac80211/patches/build/200-Revert-wifi-iwlwifi-Use-generic-thermal_zone_get_tri.patch b/package/kernel/mac80211/patches/build/200-Revert-wifi-iwlwifi-Use-generic-thermal_zone_get_tri.patch new file mode 100644 index 00000000000000..3a5285d2f35892 --- /dev/null +++ b/package/kernel/mac80211/patches/build/200-Revert-wifi-iwlwifi-Use-generic-thermal_zone_get_tri.patch @@ -0,0 +1,159 @@ +From: Felix Fietkau +Date: Mon, 17 Apr 2023 19:42:38 +0200 +Subject: [PATCH] Revert "wifi: iwlwifi: Use generic thermal_zone_get_trip() + function" + +This reverts commit 3d2f20ad46f83b333025f5e8e4afc34be8f13c4c. +--- + +--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +@@ -531,7 +531,7 @@ struct iwl_mvm_tt_mgmt { + * @tzone: thermal zone device data + */ + struct iwl_mvm_thermal_device { +- struct thermal_trip trips[IWL_MAX_DTS_TRIPS]; ++ s16 temp_trips[IWL_MAX_DTS_TRIPS]; + u8 fw_trips_index[IWL_MAX_DTS_TRIPS]; + struct thermal_zone_device *tzone; + }; +--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c +@@ -573,11 +573,11 @@ int iwl_mvm_send_temp_report_ths_cmd(str + * and uncompressed, the FW should get it compressed and sorted + */ + +- /* compress trips to cmd array, remove uninitialized values*/ ++ /* compress temp_trips to cmd array, remove uninitialized values*/ + for (i = 0; i < IWL_MAX_DTS_TRIPS; i++) { +- if (mvm->tz_device.trips[i].temperature != INT_MIN) { ++ if (mvm->tz_device.temp_trips[i] != S16_MIN) { + cmd.thresholds[idx++] = +- cpu_to_le16((s16)(mvm->tz_device.trips[i].temperature / 1000)); ++ cpu_to_le16(mvm->tz_device.temp_trips[i]); + } + } + cmd.num_temps = cpu_to_le32(idx); +@@ -593,8 +593,8 @@ int iwl_mvm_send_temp_report_ths_cmd(str + */ + for (i = 0; i < idx; i++) { + for (j = 0; j < IWL_MAX_DTS_TRIPS; j++) { +- if ((int)(le16_to_cpu(cmd.thresholds[i]) * 1000) == +- mvm->tz_device.trips[j].temperature) ++ if (le16_to_cpu(cmd.thresholds[i]) == ++ mvm->tz_device.temp_trips[j]) + mvm->tz_device.fw_trips_index[i] = j; + } + } +@@ -638,12 +638,37 @@ out: + return ret; + } + ++static int iwl_mvm_tzone_get_trip_temp(struct thermal_zone_device *device, ++ int trip, int *temp) ++{ ++ struct iwl_mvm *mvm = (struct iwl_mvm *)device->devdata; ++ ++ if (trip < 0 || trip >= IWL_MAX_DTS_TRIPS) ++ return -EINVAL; ++ ++ *temp = mvm->tz_device.temp_trips[trip] * 1000; ++ ++ return 0; ++} ++ ++static int iwl_mvm_tzone_get_trip_type(struct thermal_zone_device *device, ++ int trip, enum thermal_trip_type *type) ++{ ++ if (trip < 0 || trip >= IWL_MAX_DTS_TRIPS) ++ return -EINVAL; ++ ++ *type = THERMAL_TRIP_PASSIVE; ++ ++ return 0; ++} ++ + static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device, + int trip, int temp) + { + struct iwl_mvm *mvm = thermal_zone_device_priv(device); + struct iwl_mvm_thermal_device *tzone; +- int ret; ++ int i, ret; ++ s16 temperature; + + mutex_lock(&mvm->mutex); + +@@ -653,17 +678,40 @@ static int iwl_mvm_tzone_set_trip_temp(s + goto out; + } + ++ if (trip < 0 || trip >= IWL_MAX_DTS_TRIPS) { ++ ret = -EINVAL; ++ goto out; ++ } ++ + if ((temp / 1000) > S16_MAX) { + ret = -EINVAL; + goto out; + } + ++ temperature = (s16)(temp / 1000); + tzone = &mvm->tz_device; ++ + if (!tzone) { + ret = -EIO; + goto out; + } + ++ /* no updates*/ ++ if (tzone->temp_trips[trip] == temperature) { ++ ret = 0; ++ goto out; ++ } ++ ++ /* already existing temperature */ ++ for (i = 0; i < IWL_MAX_DTS_TRIPS; i++) { ++ if (tzone->temp_trips[i] == temperature) { ++ ret = -EINVAL; ++ goto out; ++ } ++ } ++ ++ tzone->temp_trips[trip] = temperature; ++ + ret = iwl_mvm_send_temp_report_ths_cmd(mvm); + out: + mutex_unlock(&mvm->mutex); +@@ -672,6 +720,8 @@ out: + + static struct thermal_zone_device_ops tzone_ops = { + .get_temp = iwl_mvm_tzone_get_temp, ++ .get_trip_temp = iwl_mvm_tzone_get_trip_temp, ++ .get_trip_type = iwl_mvm_tzone_get_trip_type, + .set_trip_temp = iwl_mvm_tzone_set_trip_temp, + }; + +@@ -693,8 +743,7 @@ static void iwl_mvm_thermal_zone_registe + BUILD_BUG_ON(ARRAY_SIZE(name) >= THERMAL_NAME_LENGTH); + + sprintf(name, "iwlwifi_%u", atomic_inc_return(&counter) & 0xFF); +- mvm->tz_device.tzone = thermal_zone_device_register_with_trips(name, +- mvm->tz_device.trips, ++ mvm->tz_device.tzone = thermal_zone_device_register(name, + IWL_MAX_DTS_TRIPS, + IWL_WRITABLE_TRIPS_MSK, + mvm, &tzone_ops, +@@ -717,10 +766,8 @@ static void iwl_mvm_thermal_zone_registe + /* 0 is a valid temperature, + * so initialize the array with S16_MIN which invalid temperature + */ +- for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) { +- mvm->tz_device.trips[i].temperature = INT_MIN; +- mvm->tz_device.trips[i].type = THERMAL_TRIP_PASSIVE; +- } ++ for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) ++ mvm->tz_device.temp_trips[i] = S16_MIN; + } + + static int iwl_mvm_tcool_get_max_state(struct thermal_cooling_device *cdev, diff --git a/package/kernel/mac80211/patches/build/210-revert-split-op.patch b/package/kernel/mac80211/patches/build/210-revert-split-op.patch new file mode 100644 index 00000000000000..a1fae5e07da561 --- /dev/null +++ b/package/kernel/mac80211/patches/build/210-revert-split-op.patch @@ -0,0 +1,22 @@ +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -16400,8 +16400,7 @@ static u32 nl80211_internal_flags[] = { + #undef SELECTOR + }; + +-static int nl80211_pre_doit(const struct genl_split_ops *ops, +- struct sk_buff *skb, ++static int nl80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb, + struct genl_info *info) + { + struct cfg80211_registered_device *rdev = NULL; +@@ -16502,8 +16501,7 @@ out_unlock: + return err; + } + +-static void nl80211_post_doit(const struct genl_split_ops *ops, +- struct sk_buff *skb, ++static void nl80211_post_doit(const struct genl_ops *ops, struct sk_buff *skb, + struct genl_info *info) + { + u32 internal_flags = nl80211_internal_flags[ops->internal_flags]; diff --git a/package/kernel/mac80211/patches/mwl/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/mwl/801-libertas-configure-sysfs-links.patch index 1dbcb1bfef3f7b..4d9d3de4655fae 100644 --- a/package/kernel/mac80211/patches/mwl/801-libertas-configure-sysfs-links.patch +++ b/package/kernel/mac80211/patches/mwl/801-libertas-configure-sysfs-links.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/libertas/cfg.c +++ b/drivers/net/wireless/marvell/libertas/cfg.c -@@ -2052,6 +2052,8 @@ struct wireless_dev *lbs_cfg_alloc(struc +@@ -2101,6 +2101,8 @@ struct wireless_dev *lbs_cfg_alloc(struc goto err_wiphy_new; } diff --git a/package/kernel/mac80211/patches/mwl/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/mwl/802-libertas-set-wireless-macaddr.patch index b47aee54908a88..9aa559979c34b7 100644 --- a/package/kernel/mac80211/patches/mwl/802-libertas-set-wireless-macaddr.patch +++ b/package/kernel/mac80211/patches/mwl/802-libertas-set-wireless-macaddr.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/libertas/cfg.c +++ b/drivers/net/wireless/marvell/libertas/cfg.c -@@ -2128,6 +2128,8 @@ int lbs_cfg_register(struct lbs_private +@@ -2178,6 +2178,8 @@ int lbs_cfg_register(struct lbs_private wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); wdev->wiphy->reg_notifier = lbs_reg_notifier; diff --git a/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch b/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch index 98ed9e60e98337..628b9f8a1237cc 100644 --- a/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch +++ b/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch @@ -152,7 +152,7 @@ Signed-off-by: Pali Rohár --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h -@@ -1099,6 +1099,8 @@ void mwifiex_cancel_all_pending_cmd(stru +@@ -1100,6 +1100,8 @@ void mwifiex_cancel_all_pending_cmd(stru void mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter); void mwifiex_cancel_scan(struct mwifiex_adapter *adapter); diff --git a/package/kernel/mac80211/patches/rt2x00/000-v6.6-wifi-rt2x00-correct-MAC_SYS_CTRL-register-RX-mask-i.patch b/package/kernel/mac80211/patches/rt2x00/000-v6.6-wifi-rt2x00-correct-MAC_SYS_CTRL-register-RX-mask-i.patch new file mode 100644 index 00000000000000..c84b5a140840e4 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/000-v6.6-wifi-rt2x00-correct-MAC_SYS_CTRL-register-RX-mask-i.patch @@ -0,0 +1,28 @@ +From 186f2432741f6d28d86ff723ac7830446affddfc Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sat, 5 Aug 2023 17:17:28 +0800 +Subject: wifi: rt2x00: correct MAC_SYS_CTRL register RX mask in R-Calibration + +For MAC_SYS_CTRL register, Bit[2] controls MAC_TX_EN and Bit[3] +controls MAC_RX_EN (Bit index starts from 0). Therefore, 0x08 is +the correct mask for RX. + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB03150B571B67B896A504AC34BC0EA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -8561,7 +8561,7 @@ static void rt2800_r_calibration(struct + rt2x00_warn(rt2x00dev, "Wait MAC Tx Status to MAX !!!\n"); + + maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); +- maccfg &= (~0x04); ++ maccfg &= (~0x08); + rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg); + + if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX))) diff --git a/package/kernel/mac80211/patches/rt2x00/001-v6.6-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom.patch b/package/kernel/mac80211/patches/rt2x00/001-v6.6-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom.patch new file mode 100644 index 00000000000000..aa843d4219878d --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/001-v6.6-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom.patch @@ -0,0 +1,115 @@ +From 821b5192c955144bd2f0aeea6cd153e1aedd16e1 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Fri, 11 Aug 2023 14:34:54 +0800 +Subject: wifi: rt2x00: limit MT7620 TX power based on eeprom calibration + +In the vendor driver, the current channel power is queried from +EEPROM_TXPOWER_BG1 and EEPROM_TXPOWER_BG2. And then the mixed value +will be written into the low half-word of the TX_ALC_CFG_0 register. +The high half-word of the TX_ALC_CFG_0 is a fixed value 0x2f2f. + +We can't get the accurate TX power. Based on my tests and the new +MediaTek mt76 driver source code, the real TX power is approximately +equal to channel_power + (max) rate_power. Usually max rate_power is +the gain of the OFDM 6M rate, which can be readed from the offset +EEPROM_TXPOWER_BYRATE +1. + +Based on these eeprom values, this patch adds basic TX power control +for the MT7620 and limits its maximum TX power. This can avoid the +link speed decrease caused by chip overheating. rt2800_config_alc() +function has also been renamed to rt2800_config_alc_rt6352() because +it's only used by RT6352 (MT7620). + +Notice: +It's still need some work to sync the max channel power to the user +interface. This part is missing from the rt2x00 driver framework. If +we set the power exceed the calibration value, it won't take effect. + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB03159090ED14044215E59FD6BC10A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 57 ++++++++++++++++++-------- + 1 file changed, 40 insertions(+), 17 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -3865,28 +3865,51 @@ static void rt2800_config_channel_rf7620 + } + } + +-static void rt2800_config_alc(struct rt2x00_dev *rt2x00dev, +- struct ieee80211_channel *chan, +- int power_level) { +- u16 eeprom, target_power, max_power; ++static void rt2800_config_alc_rt6352(struct rt2x00_dev *rt2x00dev, ++ struct ieee80211_channel *chan, ++ int power_level) ++{ ++ int cur_channel = rt2x00dev->rf_channel; ++ u16 eeprom, chan_power, rate_power, target_power; ++ u16 tx_power[2]; ++ s8 *power_group[2]; + u32 mac_sys_ctrl; +- u32 reg; ++ u32 cnt, reg; + u8 bbp; + +- /* hardware unit is 0.5dBm, limited to 23.5dBm */ +- power_level *= 2; +- if (power_level > 0x2f) +- power_level = 0x2f; +- +- max_power = chan->max_power * 2; +- if (max_power > 0x2f) +- max_power = 0x2f; ++ if (WARN_ON(cur_channel < 1 || cur_channel > 14)) ++ return; ++ ++ /* get per chain power, 2 chains in total, unit is 0.5dBm */ ++ power_level = (power_level - 3) * 2; ++ ++ /* We can't get the accurate TX power. Based on some tests, the real ++ * TX power is approximately equal to channel_power + (max)rate_power. ++ * Usually max rate_power is the gain of the OFDM 6M rate. The antenna ++ * gain and externel PA gain are not included as we are unable to ++ * obtain these values. ++ */ ++ rate_power = rt2800_eeprom_read_from_array(rt2x00dev, ++ EEPROM_TXPOWER_BYRATE, 1); ++ rate_power &= 0x3f; ++ power_level -= rate_power; ++ if (power_level < 1) ++ power_level = 1; ++ ++ power_group[0] = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1); ++ power_group[1] = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2); ++ for (cnt = 0; cnt < 2; cnt++) { ++ chan_power = power_group[cnt][cur_channel - 1]; ++ if (chan_power >= 0x20 || chan_power == 0) ++ chan_power = 0x10; ++ tx_power[cnt] = power_level < chan_power ? power_level : chan_power; ++ } + + reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_0); +- rt2x00_set_field32(®, TX_ALC_CFG_0_CH_INIT_0, power_level); +- rt2x00_set_field32(®, TX_ALC_CFG_0_CH_INIT_1, power_level); +- rt2x00_set_field32(®, TX_ALC_CFG_0_LIMIT_0, max_power); +- rt2x00_set_field32(®, TX_ALC_CFG_0_LIMIT_1, max_power); ++ rt2x00_set_field32(®, TX_ALC_CFG_0_CH_INIT_0, tx_power[0]); ++ rt2x00_set_field32(®, TX_ALC_CFG_0_CH_INIT_1, tx_power[1]); ++ rt2x00_set_field32(®, TX_ALC_CFG_0_LIMIT_0, 0x2f); ++ rt2x00_set_field32(®, TX_ALC_CFG_0_LIMIT_1, 0x2f); + + eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); + if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_INTERNAL_TX_ALC)) { +@@ -5268,7 +5291,7 @@ static void rt2800_config_txpower_rt6352 + rt2x00_set_field32(&pwreg, TX_PWR_CFG_9B_STBC_MCS7, t); + rt2800_register_write(rt2x00dev, TX_PWR_CFG_9, pwreg); + +- rt2800_config_alc(rt2x00dev, chan, power_level); ++ rt2800_config_alc_rt6352(rt2x00dev, chan, power_level); + + /* TODO: temperature compensation code! */ + } diff --git a/package/kernel/mac80211/patches/rt2x00/002-v6.7-wifi-rt2x00-fix-MT7620-low-RSSI-issue.patch b/package/kernel/mac80211/patches/rt2x00/002-v6.7-wifi-rt2x00-fix-MT7620-low-RSSI-issue.patch new file mode 100644 index 00000000000000..ffb66559d173a1 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/002-v6.7-wifi-rt2x00-fix-MT7620-low-RSSI-issue.patch @@ -0,0 +1,43 @@ +From 2ecfe6f07e8e6257cad3d3290c5aec2102120041 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sat, 23 Sep 2023 09:01:01 +0800 +Subject: wifi: rt2x00: fix MT7620 low RSSI issue + +On Mediatek vendor driver[1], MT7620 (RT6352) uses different RSSI +base value '-2' compared to the other RT2x00 chips. This patch +introduces the SoC specific base value to fix the low RSSI value +reports on MT7620. + +[1] Found on MT76x2E_MT7620_LinuxAP_V3.0.4.0_P3 ConvertToRssi(). + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB031571CDB146C414A908A66DBCFEA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -856,6 +856,7 @@ static int rt2800_agc_to_rssi(struct rt2 + s8 rssi0 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI0); + s8 rssi1 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI1); + s8 rssi2 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI2); ++ s8 base_val = rt2x00_rt(rt2x00dev, RT6352) ? -2 : -12; + u16 eeprom; + u8 offset0; + u8 offset1; +@@ -880,9 +881,9 @@ static int rt2800_agc_to_rssi(struct rt2 + * If the value in the descriptor is 0, it is considered invalid + * and the default (extremely low) rssi value is assumed + */ +- rssi0 = (rssi0) ? (-12 - offset0 - rt2x00dev->lna_gain - rssi0) : -128; +- rssi1 = (rssi1) ? (-12 - offset1 - rt2x00dev->lna_gain - rssi1) : -128; +- rssi2 = (rssi2) ? (-12 - offset2 - rt2x00dev->lna_gain - rssi2) : -128; ++ rssi0 = (rssi0) ? (base_val - offset0 - rt2x00dev->lna_gain - rssi0) : -128; ++ rssi1 = (rssi1) ? (base_val - offset1 - rt2x00dev->lna_gain - rssi1) : -128; ++ rssi2 = (rssi2) ? (base_val - offset2 - rt2x00dev->lna_gain - rssi2) : -128; + + /* + * mac80211 only accepts a single RSSI value. Calculating the diff --git a/package/kernel/mac80211/patches/rt2x00/003-v6.7-wifi-rt2x00-fix-rt2800-watchdog-function.patch b/package/kernel/mac80211/patches/rt2x00/003-v6.7-wifi-rt2x00-fix-rt2800-watchdog-function.patch new file mode 100644 index 00000000000000..f253dacf2b2242 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/003-v6.7-wifi-rt2x00-fix-rt2800-watchdog-function.patch @@ -0,0 +1,78 @@ +From 69708fbb2c698f262e03360d064c7066e0679953 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sat, 14 Oct 2023 14:55:01 +0800 +Subject: wifi: rt2x00: fix rt2800 watchdog function + +The watchdog function is broken on rt2800 series SoCs. This patch +fixes the incorrect watchdog logic to make it work again. + +1. Update current wdt queue index if it's not equal to the previous + index. Watchdog compares the current and previous queue index to + judge if the queue hung. +2. Make sure hung_{rx,tx} 'true' status won't be override by the + normal queue. Any queue hangs should trigger a reset action. +3. Clear the watchdog counter of all queues before resetting the + hardware. This change may help to avoid the reset loop. +4. Change hang check function return type to bool as we only need + to return two status, yes or no. + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB0315BC1D83D31154924F0D39BCD1A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 17 +++++++++++------ + 1 file changed, 11 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1237,13 +1237,14 @@ void rt2800_txdone_nostatus(struct rt2x0 + } + EXPORT_SYMBOL_GPL(rt2800_txdone_nostatus); + +-static int rt2800_check_hung(struct data_queue *queue) ++static bool rt2800_check_hung(struct data_queue *queue) + { + unsigned int cur_idx = rt2800_drv_get_dma_done(queue); + +- if (queue->wd_idx != cur_idx) ++ if (queue->wd_idx != cur_idx) { ++ queue->wd_idx = cur_idx; + queue->wd_count = 0; +- else ++ } else + queue->wd_count++; + + return queue->wd_count > 16; +@@ -1280,7 +1281,7 @@ void rt2800_watchdog(struct rt2x00_dev * + case QID_MGMT: + if (rt2x00queue_empty(queue)) + continue; +- hung_tx = rt2800_check_hung(queue); ++ hung_tx = hung_tx || rt2800_check_hung(queue); + break; + case QID_RX: + /* For station mode we should reactive at least +@@ -1289,7 +1290,7 @@ void rt2800_watchdog(struct rt2x00_dev * + */ + if (rt2x00dev->intf_sta_count == 0) + continue; +- hung_rx = rt2800_check_hung(queue); ++ hung_rx = hung_rx || rt2800_check_hung(queue); + break; + default: + break; +@@ -1302,8 +1303,12 @@ void rt2800_watchdog(struct rt2x00_dev * + if (hung_rx) + rt2x00_warn(rt2x00dev, "Watchdog RX hung detected\n"); + +- if (hung_tx || hung_rx) ++ if (hung_tx || hung_rx) { ++ queue_for_each(rt2x00dev, queue) ++ queue->wd_count = 0; ++ + ieee80211_restart_hw(rt2x00dev->hw); ++ } + } + EXPORT_SYMBOL_GPL(rt2800_watchdog); + diff --git a/package/kernel/mac80211/patches/rt2x00/004-1-v6.7-wifi-rt2x00-improve-MT7620-register-initialization.patch b/package/kernel/mac80211/patches/rt2x00/004-1-v6.7-wifi-rt2x00-improve-MT7620-register-initialization.patch new file mode 100644 index 00000000000000..9f4dbb8346e171 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/004-1-v6.7-wifi-rt2x00-improve-MT7620-register-initialization.patch @@ -0,0 +1,124 @@ +From 1ffe76d5ae78553948d67a978acd9945c2f0a175 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Thu, 19 Oct 2023 19:58:56 +0800 +Subject: wifi: rt2x00: improve MT7620 register initialization + +1. Do not hard reset the BBP. We can use soft reset instead. This + change has some help to the calibration failure issue. +2. Enable falling back to legacy rate from the HT/RTS rate by + setting the HT_FBK_TO_LEGACY register. +3. Implement MCS rate specific maximum PSDU size. It can improve + the transmission quality under the low RSSI condition. +4. Set BBP_84 register value to 0x19. This is used for extension + channel overlapping IOT. + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB031553CCD4B7A3B89C85935DBCD4A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800.h | 18 ++++++++++++++++++ + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 24 ++++++++++++++++++++++++ + drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 3 +++ + 3 files changed, 45 insertions(+) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h +@@ -871,6 +871,18 @@ + #define LED_CFG_LED_POLAR FIELD32(0x40000000) + + /* ++ * AMPDU_MAX_LEN_20M1S: Per MCS max A-MPDU length, 20 MHz, MCS 0-7 ++ * AMPDU_MAX_LEN_20M2S: Per MCS max A-MPDU length, 20 MHz, MCS 8-15 ++ * AMPDU_MAX_LEN_40M1S: Per MCS max A-MPDU length, 40 MHz, MCS 0-7 ++ * AMPDU_MAX_LEN_40M2S: Per MCS max A-MPDU length, 40 MHz, MCS 8-15 ++ * Maximum A-MPDU length = 2^(AMPDU_MAX - 5) kilobytes ++ */ ++#define AMPDU_MAX_LEN_20M1S 0x1030 ++#define AMPDU_MAX_LEN_20M2S 0x1034 ++#define AMPDU_MAX_LEN_40M1S 0x1038 ++#define AMPDU_MAX_LEN_40M2S 0x103C ++ ++/* + * AMPDU_BA_WINSIZE: Force BlockAck window size + * FORCE_WINSIZE_ENABLE: + * 0: Disable forcing of BlockAck window size +@@ -1545,6 +1557,12 @@ + */ + #define EXP_ACK_TIME 0x1380 + ++/* ++ * HT_FBK_TO_LEGACY: Enable/Disable HT/RTS fallback to OFDM/CCK rate ++ * Not available for legacy SoCs ++ */ ++#define HT_FBK_TO_LEGACY 0x1384 ++ + /* TX_PWR_CFG_5 */ + #define TX_PWR_CFG_5 0x1384 + #define TX_PWR_CFG_5_MCS16_CH0 FIELD32(0x0000000f) +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -5851,6 +5851,7 @@ static int rt2800_init_registers(struct + struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; + u32 reg; + u16 eeprom; ++ u8 bbp; + unsigned int i; + int ret; + +@@ -5860,6 +5861,19 @@ static int rt2800_init_registers(struct + if (ret) + return ret; + ++ if (rt2x00_rt(rt2x00dev, RT6352)) { ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x01); ++ ++ bbp = rt2800_bbp_read(rt2x00dev, 21); ++ bbp |= 0x01; ++ rt2800_bbp_write(rt2x00dev, 21, bbp); ++ bbp = rt2800_bbp_read(rt2x00dev, 21); ++ bbp &= (~0x01); ++ rt2800_bbp_write(rt2x00dev, 21, bbp); ++ ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00); ++ } ++ + rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, 0x0000013f); + rt2800_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003); + +@@ -6013,6 +6027,14 @@ static int rt2800_init_registers(struct + reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_1); + rt2x00_set_field32(®, TX_ALC_CFG_1_ROS_BUSY_EN, 0); + rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg); ++ ++ rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_20M1S, 0x77754433); ++ rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_20M2S, 0x77765543); ++ rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_40M1S, 0x77765544); ++ rt2800_register_write(rt2x00dev, AMPDU_MAX_LEN_40M2S, 0x77765544); ++ ++ rt2800_register_write(rt2x00dev, HT_FBK_TO_LEGACY, 0x1010); ++ + } else { + rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000); + rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); +@@ -7231,6 +7253,8 @@ static void rt2800_init_bbp_6352(struct + rt2800_bbp_dcoc_write(rt2x00dev, 159, 0x64); + + rt2800_bbp4_mac_if_ctrl(rt2x00dev); ++ ++ rt2800_bbp_write(rt2x00dev, 84, 0x19); + } + + static void rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c +@@ -760,6 +760,9 @@ int rt2800mmio_init_registers(struct rt2 + + rt2x00mmio_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); + ++ if (rt2x00_rt(rt2x00dev, RT6352)) ++ return 0; ++ + reg = 0; + rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_CSR, 1); + rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_BBP, 1); diff --git a/package/kernel/mac80211/patches/rt2x00/004-2-v6.7-wifi-rt2x00-rework-MT7620-channel-config-function.patch b/package/kernel/mac80211/patches/rt2x00/004-2-v6.7-wifi-rt2x00-rework-MT7620-channel-config-function.patch new file mode 100644 index 00000000000000..1aec73d7622150 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/004-2-v6.7-wifi-rt2x00-rework-MT7620-channel-config-function.patch @@ -0,0 +1,146 @@ +From a28533c6be1711584bf3ec978309d5c590029821 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Thu, 19 Oct 2023 19:58:57 +0800 +Subject: wifi: rt2x00: rework MT7620 channel config function + +1. Move the channel configuration code from rt2800_vco_calibration() + to the rt2800_config_channel(). +2. Use MT7620 SoC specific AGC initial LNA value instead of the + RT5592's value. +3. BBP{195,196} pairing write has been replaced with + rt2800_bbp_glrt_write() to reduce redundant code. + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB0315622A4340BFFA530B1B86BCD4A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 91 ++++++++++---------------- + 1 file changed, 35 insertions(+), 56 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -3861,14 +3861,6 @@ static void rt2800_config_channel_rf7620 + rfcsr |= tx_agc_fc; + rt2800_rfcsr_write_bank(rt2x00dev, 7, 59, rfcsr); + } +- +- if (conf_is_ht40(conf)) { +- rt2800_bbp_glrt_write(rt2x00dev, 141, 0x10); +- rt2800_bbp_glrt_write(rt2x00dev, 157, 0x2f); +- } else { +- rt2800_bbp_glrt_write(rt2x00dev, 141, 0x1a); +- rt2800_bbp_glrt_write(rt2x00dev, 157, 0x40); +- } + } + + static void rt2800_config_alc_rt6352(struct rt2x00_dev *rt2x00dev, +@@ -4437,32 +4429,46 @@ static void rt2800_config_channel(struct + usleep_range(1000, 1500); + } + +- if (rt2x00_rt(rt2x00dev, RT5592) || rt2x00_rt(rt2x00dev, RT6352)) { +- reg = 0x10; +- if (!conf_is_ht40(conf)) { +- if (rt2x00_rt(rt2x00dev, RT6352) && +- rt2x00_has_cap_external_lna_bg(rt2x00dev)) { +- reg |= 0x5; +- } else { +- reg |= 0xa; +- } +- } +- rt2800_bbp_write(rt2x00dev, 195, 141); +- rt2800_bbp_write(rt2x00dev, 196, reg); ++ if (rt2x00_rt(rt2x00dev, RT5592)) { ++ bbp = conf_is_ht40(conf) ? 0x10 : 0x1a; ++ rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); + +- /* AGC init. +- * Despite the vendor driver using different values here for +- * RT6352 chip, we use 0x1c for now. This may have to be changed +- * once TSSI got implemented. +- */ +- reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2*rt2x00dev->lna_gain; +- rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); ++ bbp = (rf->channel <= 14 ? 0x1c : 0x24) + 2 * rt2x00dev->lna_gain; ++ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp); + +- if (rt2x00_rt(rt2x00dev, RT5592)) +- rt2800_iq_calibrate(rt2x00dev, rf->channel); ++ rt2800_iq_calibrate(rt2x00dev, rf->channel); + } + + if (rt2x00_rt(rt2x00dev, RT6352)) { ++ /* BBP for GLRT BW */ ++ bbp = conf_is_ht40(conf) ? ++ 0x10 : rt2x00_has_cap_external_lna_bg(rt2x00dev) ? ++ 0x15 : 0x1a; ++ rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); ++ ++ bbp = conf_is_ht40(conf) ? 0x2f : 0x40; ++ rt2800_bbp_glrt_write(rt2x00dev, 157, bbp); ++ ++ if (rt2x00dev->default_ant.rx_chain_num == 1) { ++ rt2800_bbp_write(rt2x00dev, 91, 0x07); ++ rt2800_bbp_write(rt2x00dev, 95, 0x1a); ++ rt2800_bbp_glrt_write(rt2x00dev, 128, 0xa0); ++ rt2800_bbp_glrt_write(rt2x00dev, 170, 0x12); ++ rt2800_bbp_glrt_write(rt2x00dev, 171, 0x10); ++ } else { ++ rt2800_bbp_write(rt2x00dev, 91, 0x06); ++ rt2800_bbp_write(rt2x00dev, 95, 0x9a); ++ rt2800_bbp_glrt_write(rt2x00dev, 128, 0xe0); ++ rt2800_bbp_glrt_write(rt2x00dev, 170, 0x30); ++ rt2800_bbp_glrt_write(rt2x00dev, 171, 0x30); ++ } ++ ++ /* AGC init */ ++ bbp = rf->channel <= 14 ? 0x04 + 2 * rt2x00dev->lna_gain : 0; ++ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp); ++ ++ usleep_range(1000, 1500); ++ + if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, + &rt2x00dev->cap_flags)) { + reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); +@@ -5608,26 +5614,6 @@ void rt2800_vco_calibration(struct rt2x0 + rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); + + if (rt2x00_rt(rt2x00dev, RT6352)) { +- if (rt2x00dev->default_ant.rx_chain_num == 1) { +- rt2800_bbp_write(rt2x00dev, 91, 0x07); +- rt2800_bbp_write(rt2x00dev, 95, 0x1A); +- rt2800_bbp_write(rt2x00dev, 195, 128); +- rt2800_bbp_write(rt2x00dev, 196, 0xA0); +- rt2800_bbp_write(rt2x00dev, 195, 170); +- rt2800_bbp_write(rt2x00dev, 196, 0x12); +- rt2800_bbp_write(rt2x00dev, 195, 171); +- rt2800_bbp_write(rt2x00dev, 196, 0x10); +- } else { +- rt2800_bbp_write(rt2x00dev, 91, 0x06); +- rt2800_bbp_write(rt2x00dev, 95, 0x9A); +- rt2800_bbp_write(rt2x00dev, 195, 128); +- rt2800_bbp_write(rt2x00dev, 196, 0xE0); +- rt2800_bbp_write(rt2x00dev, 195, 170); +- rt2800_bbp_write(rt2x00dev, 196, 0x30); +- rt2800_bbp_write(rt2x00dev, 195, 171); +- rt2800_bbp_write(rt2x00dev, 196, 0x30); +- } +- + if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + rt2800_bbp_write(rt2x00dev, 75, 0x68); + rt2800_bbp_write(rt2x00dev, 76, 0x4C); +@@ -5635,13 +5621,6 @@ void rt2800_vco_calibration(struct rt2x0 + rt2800_bbp_write(rt2x00dev, 80, 0x0C); + rt2800_bbp_write(rt2x00dev, 82, 0xB6); + } +- +- /* On 11A, We should delay and wait RF/BBP to be stable +- * and the appropriate time should be 1000 micro seconds +- * 2005/06/05 - On 11G, we also need this delay time. +- * Otherwise it's difficult to pass the WHQL. +- */ +- usleep_range(1000, 1500); + } + } + EXPORT_SYMBOL_GPL(rt2800_vco_calibration); diff --git a/package/kernel/mac80211/patches/rt2x00/004-3-v6.7-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch b/package/kernel/mac80211/patches/rt2x00/004-3-v6.7-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch new file mode 100644 index 00000000000000..64cd599c02b360 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/004-3-v6.7-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch @@ -0,0 +1,241 @@ +From cca74bed37af1c8217bcd8282d9b384efdbf73bd Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Thu, 19 Oct 2023 19:58:58 +0800 +Subject: wifi: rt2x00: rework MT7620 PA/LNA RF calibration + +1. Move MT7620 PA/LNA calibration code to dedicated functions. +2. For external PA/LNA devices, restore RF and BBP registers before + R-Calibration. +3. Do Rx DCOC calibration again before RXIQ calibration. +4. Add some missing LNA related registers' initialization. + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB0315979F92DC563019B8F238BCD4A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 176 +++++++++++++++++-------- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 6 + + 2 files changed, 130 insertions(+), 52 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -4468,41 +4468,6 @@ static void rt2800_config_channel(struct + rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp); + + usleep_range(1000, 1500); +- +- if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, +- &rt2x00dev->cap_flags)) { +- reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); +- reg |= 0x00000101; +- rt2800_register_write(rt2x00dev, RF_CONTROL3, reg); +- +- reg = rt2800_register_read(rt2x00dev, RF_BYPASS3); +- reg |= 0x00000101; +- rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); +- +- rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05); +- rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00); +- +- rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, +- 0x36303636); +- rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, +- 0x6C6C6B6C); +- rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, +- 0x6C6C6B6C); +- } + } + + bbp = rt2800_bbp_read(rt2x00dev, 4); +@@ -5612,16 +5577,6 @@ void rt2800_vco_calibration(struct rt2x0 + } + } + rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); +- +- if (rt2x00_rt(rt2x00dev, RT6352)) { +- if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { +- rt2800_bbp_write(rt2x00dev, 75, 0x68); +- rt2800_bbp_write(rt2x00dev, 76, 0x4C); +- rt2800_bbp_write(rt2x00dev, 79, 0x1C); +- rt2800_bbp_write(rt2x00dev, 80, 0x0C); +- rt2800_bbp_write(rt2x00dev, 82, 0xB6); +- } +- } + } + EXPORT_SYMBOL_GPL(rt2800_vco_calibration); + +@@ -10348,6 +10303,128 @@ do_cal: + rt2800_register_write(rt2x00dev, RF_BYPASS0, MAC_RF_BYPASS0); + } + ++static void rt2800_restore_rf_bbp_rt6352(struct rt2x00_dev *rt2x00dev) ++{ ++ if (rt2x00_has_cap_external_pa(rt2x00dev)) { ++ rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0); ++ rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0); ++ } ++ ++ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x02); ++ } ++ ++ if (rt2x00_has_cap_external_pa(rt2x00dev)) { ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xd3); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xb3); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xd5); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6c); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xfc); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1f); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xff); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x1c); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x20); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6b); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xf7); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09); ++ } ++ ++ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ rt2800_bbp_write(rt2x00dev, 75, 0x60); ++ rt2800_bbp_write(rt2x00dev, 76, 0x44); ++ rt2800_bbp_write(rt2x00dev, 79, 0x1c); ++ rt2800_bbp_write(rt2x00dev, 80, 0x0c); ++ rt2800_bbp_write(rt2x00dev, 82, 0xB6); ++ } ++ ++ if (rt2x00_has_cap_external_pa(rt2x00dev)) { ++ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x3630363a); ++ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6c6c666c); ++ rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6c6c666c); ++ } ++} ++ ++static void rt2800_calibration_rt6352(struct rt2x00_dev *rt2x00dev) ++{ ++ u32 reg; ++ ++ if (rt2x00_has_cap_external_pa(rt2x00dev) || ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) ++ rt2800_restore_rf_bbp_rt6352(rt2x00dev); ++ ++ rt2800_r_calibration(rt2x00dev); ++ rt2800_rf_self_txdc_cal(rt2x00dev); ++ rt2800_rxdcoc_calibration(rt2x00dev); ++ rt2800_bw_filter_calibration(rt2x00dev, true); ++ rt2800_bw_filter_calibration(rt2x00dev, false); ++ rt2800_loft_iq_calibration(rt2x00dev); ++ ++ /* missing DPD calibration for internal PA devices */ ++ ++ rt2800_rxdcoc_calibration(rt2x00dev); ++ rt2800_rxiq_calibration(rt2x00dev); ++ ++ if (!rt2x00_has_cap_external_pa(rt2x00dev) && ++ !rt2x00_has_cap_external_lna_bg(rt2x00dev)) ++ return; ++ ++ if (rt2x00_has_cap_external_pa(rt2x00dev)) { ++ reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); ++ reg |= 0x00000101; ++ rt2800_register_write(rt2x00dev, RF_CONTROL3, reg); ++ ++ reg = rt2800_register_read(rt2x00dev, RF_BYPASS3); ++ reg |= 0x00000101; ++ rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); ++ } ++ ++ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42); ++ } ++ ++ if (rt2x00_has_cap_external_pa(rt2x00dev)) { ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xc8); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xa4); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xc8); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xa4); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xc8); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xa4); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05); ++ } ++ ++ if (rt2x00_has_cap_external_pa(rt2x00dev)) ++ rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00); ++ ++ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ rt2800_bbp_write(rt2x00dev, 75, 0x68); ++ rt2800_bbp_write(rt2x00dev, 76, 0x4c); ++ rt2800_bbp_write(rt2x00dev, 79, 0x1c); ++ rt2800_bbp_write(rt2x00dev, 80, 0x0c); ++ rt2800_bbp_write(rt2x00dev, 82, 0xb6); ++ } ++ ++ if (rt2x00_has_cap_external_pa(rt2x00dev)) { ++ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x36303636); ++ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6c6c6b6c); ++ rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6c6c6b6c); ++ } ++} ++ + static void rt2800_init_rfcsr_6352(struct rt2x00_dev *rt2x00dev) + { + /* Initialize RF central register to default value */ +@@ -10612,13 +10689,8 @@ static void rt2800_init_rfcsr_6352(struc + rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); + rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); + +- rt2800_r_calibration(rt2x00dev); +- rt2800_rf_self_txdc_cal(rt2x00dev); +- rt2800_rxdcoc_calibration(rt2x00dev); +- rt2800_bw_filter_calibration(rt2x00dev, true); +- rt2800_bw_filter_calibration(rt2x00dev, false); +- rt2800_loft_iq_calibration(rt2x00dev); +- rt2800_rxiq_calibration(rt2x00dev); ++ /* Do calibration and init PA/LNA */ ++ rt2800_calibration_rt6352(rt2x00dev); + } + + static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -1263,6 +1263,12 @@ rt2x00_has_cap_external_lna_bg(struct rt + } + + static inline bool ++rt2x00_has_cap_external_pa(struct rt2x00_dev *rt2x00dev) ++{ ++ return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_EXTERNAL_PA_TX0); ++} ++ ++static inline bool + rt2x00_has_cap_double_antenna(struct rt2x00_dev *rt2x00dev) + { + return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_DOUBLE_ANTENNA); diff --git a/package/kernel/mac80211/patches/rt2x00/005-1-v6.8-wifi-rt2x00-introduce-DMA-busy-check-watchdog-for-rt.patch b/package/kernel/mac80211/patches/rt2x00/005-1-v6.8-wifi-rt2x00-introduce-DMA-busy-check-watchdog-for-rt.patch new file mode 100644 index 00000000000000..c1c322573305b8 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/005-1-v6.8-wifi-rt2x00-introduce-DMA-busy-check-watchdog-for-rt.patch @@ -0,0 +1,177 @@ +From b1275cdd7456ef811747dfb4f3c46310ddd300cd Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sat, 4 Nov 2023 16:57:58 +0800 +Subject: wifi: rt2x00: introduce DMA busy check watchdog for rt2800 + +When I tried to fix the watchdog of rt2800, I found that sometimes +the watchdog can not reset the hung device. This is because the +queue is not completely stuck, it just becomes very slow. The MTK +vendor driver for the new chip MT7603/MT7612 has a DMA busy watchdog +to detect device hangs by checking DMA busy status. This watchdog +implementation is something similar to it. To reduce unnecessary +reset, we can check the INT_SOURCE_CSR register together as I found +that when the radio hung, the RX/TX coherent interrupt will always +stuck at triggered state. + +The 'watchdog' module parameter has been extended to control all +watchdogs(0=disabled, 1=hang watchdog, 2=DMA watchdog, 3=both). This +new watchdog function is a slight schedule and it won't affect the +transmission speed. So we can turn on it by default. Due to the +INT_SOURCE_CSR register is invalid on rt2800 USB NICs, the DMA busy +watchdog will be automatically disabled for them. + +Tested on MT7620 and RT5350. + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB0315D7462CE08A119A99DE34BCA4A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800.h | 4 ++ + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 77 ++++++++++++++++++++++---- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 3 + + 3 files changed, 73 insertions(+), 11 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h +@@ -3194,4 +3194,8 @@ enum rt2800_eeprom_word { + */ + #define BCN_TBTT_OFFSET 64 + ++/* Watchdog type mask */ ++#define RT2800_WATCHDOG_HANG BIT(0) ++#define RT2800_WATCHDOG_DMA_BUSY BIT(1) ++ + #endif /* RT2800_H */ +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -30,9 +30,10 @@ + #include "rt2800lib.h" + #include "rt2800.h" + +-static bool modparam_watchdog; +-module_param_named(watchdog, modparam_watchdog, bool, S_IRUGO); +-MODULE_PARM_DESC(watchdog, "Enable watchdog to detect tx/rx hangs and reset hardware if detected"); ++static unsigned int modparam_watchdog = RT2800_WATCHDOG_DMA_BUSY; ++module_param_named(watchdog, modparam_watchdog, uint, 0444); ++MODULE_PARM_DESC(watchdog, "Enable watchdog to recover tx/rx hangs.\n" ++ "\t\t(0=disabled, 1=hang watchdog, 2=DMA watchdog(default), 3=both)"); + + /* + * Register access. +@@ -1261,15 +1262,12 @@ static void rt2800_update_survey(struct + chan_survey->time_ext_busy += rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC); + } + +-void rt2800_watchdog(struct rt2x00_dev *rt2x00dev) ++static bool rt2800_watchdog_hung(struct rt2x00_dev *rt2x00dev) + { + struct data_queue *queue; + bool hung_tx = false; + bool hung_rx = false; + +- if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) +- return; +- + rt2800_update_survey(rt2x00dev); + + queue_for_each(rt2x00dev, queue) { +@@ -1297,18 +1295,72 @@ void rt2800_watchdog(struct rt2x00_dev * + } + } + ++ if (!hung_tx && !hung_rx) ++ return false; ++ + if (hung_tx) + rt2x00_warn(rt2x00dev, "Watchdog TX hung detected\n"); + + if (hung_rx) + rt2x00_warn(rt2x00dev, "Watchdog RX hung detected\n"); + +- if (hung_tx || hung_rx) { +- queue_for_each(rt2x00dev, queue) +- queue->wd_count = 0; ++ queue_for_each(rt2x00dev, queue) ++ queue->wd_count = 0; ++ ++ return true; ++} ++ ++static bool rt2800_watchdog_dma_busy(struct rt2x00_dev *rt2x00dev) ++{ ++ bool busy_rx, busy_tx; ++ u32 reg_cfg = rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG); ++ u32 reg_int = rt2800_register_read(rt2x00dev, INT_SOURCE_CSR); ++ ++ if (rt2x00_get_field32(reg_cfg, WPDMA_GLO_CFG_RX_DMA_BUSY) && ++ rt2x00_get_field32(reg_int, INT_SOURCE_CSR_RX_COHERENT)) ++ rt2x00dev->rxdma_busy++; ++ else ++ rt2x00dev->rxdma_busy = 0; + ++ if (rt2x00_get_field32(reg_cfg, WPDMA_GLO_CFG_TX_DMA_BUSY) && ++ rt2x00_get_field32(reg_int, INT_SOURCE_CSR_TX_COHERENT)) ++ rt2x00dev->txdma_busy++; ++ else ++ rt2x00dev->txdma_busy = 0; ++ ++ busy_rx = rt2x00dev->rxdma_busy > 30 ? true : false; ++ busy_tx = rt2x00dev->txdma_busy > 30 ? true : false; ++ ++ if (!busy_rx && !busy_tx) ++ return false; ++ ++ if (busy_rx) ++ rt2x00_warn(rt2x00dev, "Watchdog RX DMA busy detected\n"); ++ ++ if (busy_tx) ++ rt2x00_warn(rt2x00dev, "Watchdog TX DMA busy detected\n"); ++ ++ rt2x00dev->rxdma_busy = 0; ++ rt2x00dev->txdma_busy = 0; ++ ++ return true; ++} ++ ++void rt2800_watchdog(struct rt2x00_dev *rt2x00dev) ++{ ++ bool reset = false; ++ ++ if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) ++ return; ++ ++ if (modparam_watchdog & RT2800_WATCHDOG_DMA_BUSY) ++ reset = rt2800_watchdog_dma_busy(rt2x00dev); ++ ++ if (modparam_watchdog & RT2800_WATCHDOG_HANG) ++ reset = rt2800_watchdog_hung(rt2x00dev) || reset; ++ ++ if (reset) + ieee80211_restart_hw(rt2x00dev->hw); +- } + } + EXPORT_SYMBOL_GPL(rt2800_watchdog); + +@@ -12016,6 +12068,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r + __set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags); + } + ++ /* USB NICs don't support DMA watchdog as INT_SOURCE_CSR is invalid */ ++ if (rt2x00_is_usb(rt2x00dev)) ++ modparam_watchdog &= ~RT2800_WATCHDOG_DMA_BUSY; + if (modparam_watchdog) { + __set_bit(CAPABILITY_RESTART_HW, &rt2x00dev->cap_flags); + rt2x00dev->link.watchdog_interval = msecs_to_jiffies(100); +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -926,6 +926,9 @@ struct rt2x00_dev { + */ + u16 beacon_int; + ++ /* Rx/Tx DMA busy watchdog counter */ ++ u16 rxdma_busy, txdma_busy; ++ + /** + * Timestamp of last received beacon + */ diff --git a/package/kernel/mac80211/patches/rt2x00/005-2-v6.8-wifi-rt2x00-disable-RTS-threshold-for-rt2800-by-defa.patch b/package/kernel/mac80211/patches/rt2x00/005-2-v6.8-wifi-rt2x00-disable-RTS-threshold-for-rt2800-by-defa.patch new file mode 100644 index 00000000000000..b3e95da5a60d0b --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/005-2-v6.8-wifi-rt2x00-disable-RTS-threshold-for-rt2800-by-defa.patch @@ -0,0 +1,43 @@ +From 570beb6285fd355904b22625da20809f477096c5 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sat, 4 Nov 2023 16:57:59 +0800 +Subject: wifi: rt2x00: disable RTS threshold for rt2800 by default + +rt2800 has a lot of registers to control the RTS enable/disable +status for different rates. And the driver control them via +rt2800_set_rts_threshold(). When RTS was disabled in user +interface, this function won't be called at all. This means that +the RTS is still 'on' for CCK and OFDM rates. So we'd better to +disable them by default because it should be like this. The RTS +for HT20 and HT40 is already default off so we don't need to +touch them. If we toggle the RTS status, these register bits +will be enable/disable again by rt2800_set_rts_threshold(). + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB03155DDB953155B7A2DE849ABCA4A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -6100,7 +6100,7 @@ static int rt2800_init_registers(struct + rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_MM40, 0); + rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_GF20, 1); + rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_GF40, 0); +- rt2x00_set_field32(®, CCK_PROT_CFG_RTS_TH_EN, 1); ++ rt2x00_set_field32(®, CCK_PROT_CFG_RTS_TH_EN, 0); + rt2800_register_write(rt2x00dev, CCK_PROT_CFG, reg); + + reg = rt2800_register_read(rt2x00dev, OFDM_PROT_CFG); +@@ -6113,7 +6113,7 @@ static int rt2800_init_registers(struct + rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_MM40, 0); + rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_GF20, 1); + rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_GF40, 0); +- rt2x00_set_field32(®, OFDM_PROT_CFG_RTS_TH_EN, 1); ++ rt2x00_set_field32(®, OFDM_PROT_CFG_RTS_TH_EN, 0); + rt2800_register_write(rt2x00dev, OFDM_PROT_CFG, reg); + + reg = rt2800_register_read(rt2x00dev, MM20_PROT_CFG); diff --git a/package/kernel/mac80211/patches/rt2x00/005-3-v6.8-wifi-rt2x00-restart-beacon-queue-when-hardware-reset.patch b/package/kernel/mac80211/patches/rt2x00/005-3-v6.8-wifi-rt2x00-restart-beacon-queue-when-hardware-reset.patch new file mode 100644 index 00000000000000..1fa7b8b0fb99cc --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/005-3-v6.8-wifi-rt2x00-restart-beacon-queue-when-hardware-reset.patch @@ -0,0 +1,67 @@ +From a11d965a218f0cd95b13fe44d0bcd8a20ce134a8 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Sat, 4 Nov 2023 16:58:00 +0800 +Subject: wifi: rt2x00: restart beacon queue when hardware reset + +When a hardware reset is triggered, all registers are reset, so all +queues are forced to stop in hardware interface. However, mac80211 +will not automatically stop the queue. If we don't manually stop the +beacon queue, the queue will be deadlocked and unable to start again. +This patch fixes the issue where Apple devices cannot connect to the +AP after calling ieee80211_restart_hw(). + +Signed-off-by: Shiji Yang +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/TYAP286MB031530EB6D98DCE4DF20766CBCA4A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 3 +++ + drivers/net/wireless/ralink/rt2x00/rt2x00mac.c | 11 +++++++++++ + 2 files changed, 14 insertions(+) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +@@ -101,6 +101,7 @@ void rt2x00lib_disable_radio(struct rt2x + rt2x00link_stop_tuner(rt2x00dev); + rt2x00queue_stop_queues(rt2x00dev); + rt2x00queue_flush_queues(rt2x00dev, true); ++ rt2x00queue_stop_queue(rt2x00dev->bcn); + + /* + * Disable radio. +@@ -1286,6 +1287,7 @@ int rt2x00lib_start(struct rt2x00_dev *r + rt2x00dev->intf_ap_count = 0; + rt2x00dev->intf_sta_count = 0; + rt2x00dev->intf_associated = 0; ++ rt2x00dev->intf_beaconing = 0; + + /* Enable the radio */ + retval = rt2x00lib_enable_radio(rt2x00dev); +@@ -1312,6 +1314,7 @@ void rt2x00lib_stop(struct rt2x00_dev *r + rt2x00dev->intf_ap_count = 0; + rt2x00dev->intf_sta_count = 0; + rt2x00dev->intf_associated = 0; ++ rt2x00dev->intf_beaconing = 0; + } + + static inline void rt2x00lib_set_if_combinations(struct rt2x00_dev *rt2x00dev) +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c +@@ -598,6 +598,17 @@ void rt2x00mac_bss_info_changed(struct i + */ + if (changes & BSS_CHANGED_BEACON_ENABLED) { + mutex_lock(&intf->beacon_skb_mutex); ++ ++ /* ++ * Clear the 'enable_beacon' flag and clear beacon because ++ * the beacon queue has been stopped after hardware reset. ++ */ ++ if (test_bit(DEVICE_STATE_RESET, &rt2x00dev->flags) && ++ intf->enable_beacon) { ++ intf->enable_beacon = false; ++ rt2x00queue_clear_beacon(rt2x00dev, vif); ++ } ++ + if (!bss_conf->enable_beacon && intf->enable_beacon) { + rt2x00dev->intf_beaconing--; + intf->enable_beacon = false; diff --git a/package/kernel/mac80211/patches/rt2x00/101-wifi-rt2x00-correct-wrong-BBP-register-in-RxDCOC-cal.patch b/package/kernel/mac80211/patches/rt2x00/101-wifi-rt2x00-correct-wrong-BBP-register-in-RxDCOC-cal.patch new file mode 100644 index 00000000000000..253d1d9c1964c6 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/101-wifi-rt2x00-correct-wrong-BBP-register-in-RxDCOC-cal.patch @@ -0,0 +1,26 @@ +From: Shiji Yang +Date: Thu, 9 Nov 2023 12:01:18 +0800 +Subject: [PATCH] wifi: rt2x00: correct wrong BBP register in RxDCOC + calibration + +Refer to Mediatek vendor driver RxDCOC_Calibration() function, when +performing gainfreeze calibration, we should write register 140 +instead of 141. This fix can reduce the total calibration time from +6 seconds to 1 second. + +Signed-off-by: Shiji Yang +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -8711,7 +8711,7 @@ static void rt2800_rxdcoc_calibration(st + rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, saverfb5r4); + rt2800_rfcsr_write_bank(rt2x00dev, 7, 4, saverfb7r4); + +- rt2800_bbp_write(rt2x00dev, 158, 141); ++ rt2800_bbp_write(rt2x00dev, 158, 140); + bbpreg = rt2800_bbp_read(rt2x00dev, 159); + bbpreg = bbpreg & (~0x40); + rt2800_bbp_write(rt2x00dev, 159, bbpreg); diff --git a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/rt2x00/602-01-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch similarity index 53% rename from package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch rename to package/kernel/mac80211/patches/rt2x00/602-01-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch index ab0fa3670d6b3d..5040b5af621ea1 100644 --- a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-01-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch @@ -1,6 +1,27 @@ +From 1046fc9e98936991aeb0b0656c84833d96a63c0f Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sun, 15 Oct 2023 14:22:49 +0200 +Subject: [PATCH 1/5] wifi: rt2x00: Add support for loading EEPROM from + userspace + +Add support for loading EEPROM from userspace. + +Signed-off-by: Christian Marangi +--- + drivers/net/wireless/ralink/rt2x00/Kconfig | 5 ++ + drivers/net/wireless/ralink/rt2x00/Makefile | 1 + + .../net/wireless/ralink/rt2x00/rt2800soc.c | 15 +--- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 1 + + .../net/wireless/ralink/rt2x00/rt2x00dev.c | 9 +++ + .../net/wireless/ralink/rt2x00/rt2x00eeprom.c | 75 +++++++++++++++++++ + .../net/wireless/ralink/rt2x00/rt2x00soc.c | 1 + + .../net/wireless/ralink/rt2x00/rt2x00soc.h | 9 +++ + 8 files changed, 102 insertions(+), 14 deletions(-) + create mode 100644 drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c + --- a/local-symbols +++ b/local-symbols -@@ -347,6 +347,7 @@ RT2X00_LIB_FIRMWARE= +@@ -350,6 +350,7 @@ RT2X00_LIB_FIRMWARE= RT2X00_LIB_CRYPTO= RT2X00_LIB_LEDS= RT2X00_LIB_DEBUGFS= @@ -46,33 +67,6 @@ obj-$(CPTCFG_RT2X00_LIB) += rt2x00lib.o obj-$(CPTCFG_RT2X00_LIB_MMIO) += rt2x00mmio.o ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -@@ -47,6 +47,8 @@ struct rt2800_drv_data { - struct ieee80211_sta *wcid_to_sta[STA_IDS_SIZE]; - }; - -+#include "rt2800.h" -+ - struct rt2800_ops { - u32 (*register_read)(struct rt2x00_dev *rt2x00dev, - const unsigned int offset); -@@ -145,6 +147,15 @@ static inline int rt2800_read_eeprom(str - { - const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; - -+ if (rt2x00dev->eeprom_file) { -+ memcpy(rt2x00dev->eeprom, rt2x00dev->eeprom_file->data, -+ EEPROM_SIZE); -+ return 0; -+ } -+ -+ if (!rt2800ops->read_eeprom) -+ return -EINVAL; -+ - return rt2800ops->read_eeprom(rt2x00dev); - } - --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c @@ -90,19 +90,6 @@ static int rt2800soc_set_device_state(st @@ -95,11 +89,12 @@ /* Firmware functions */ static char *rt2800soc_get_firmware_name(struct rt2x00_dev *rt2x00dev) { -@@ -168,7 +155,6 @@ static const struct rt2800_ops rt2800soc +@@ -168,7 +155,7 @@ static const struct rt2800_ops rt2800soc .register_multiread = rt2x00mmio_register_multiread, .register_multiwrite = rt2x00mmio_register_multiwrite, .regbusy_read = rt2x00mmio_regbusy_read, - .read_eeprom = rt2800soc_read_eeprom, ++ .read_eeprom = rt2x00lib_read_eeprom, .hwcrypt_disabled = rt2800soc_hwcrypt_disabled, .drv_write_firmware = rt2800soc_write_firmware, .drv_init_registers = rt2800mmio_init_registers, @@ -113,77 +108,24 @@ /* * Capabilities -@@ -980,6 +981,11 @@ struct rt2x00_dev { - const struct firmware *fw; - - /* -+ * EEPROM image. -+ */ -+ const struct firmware *eeprom_file; -+ -+ /* - * FIFO for storing tx status reports between isr and tasklet. - */ - DECLARE_KFIFO_PTR(txstatus_fifo, u32); ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1419,6 +1419,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de - INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); - INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep); - -+ retval = rt2x00lib_load_eeprom_file(rt2x00dev); -+ if (retval) -+ goto exit; -+ - /* - * Let the driver probe the device to detect the capabilities. - */ -@@ -1559,6 +1563,11 @@ void rt2x00lib_remove_dev(struct rt2x00_ - * Free the driver data. - */ - kfree(rt2x00dev->drv_data); -+ -+ /* -+ * Free EEPROM image. -+ */ -+ rt2x00lib_free_eeprom_file(rt2x00dev); - } - EXPORT_SYMBOL_GPL(rt2x00lib_remove_dev); - --- /dev/null +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c -@@ -0,0 +1,106 @@ -+/* -+ Copyright (C) 2004 - 2009 Ivo van Doorn -+ Copyright (C) 2004 - 2009 Gertjan van Wingerde -+ -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the -+ Free Software Foundation, Inc., -+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +@@ -0,0 +1,77 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++/* Copyright (C) 2004 - 2009 Ivo van Doorn ++ * Copyright (C) 2004 - 2009 Gertjan van Wingerde ++ * + */ + -+/* -+ Module: rt2x00lib -+ Abstract: rt2x00 eeprom file loading routines. ++/* Module: rt2x00lib ++ * Abstract: rt2x00 eeprom file loading routines. + */ + +#include +#include + +#include "rt2x00.h" -+#include "rt2x00lib.h" ++#include "rt2x00soc.h" + +static const char * +rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev) @@ -196,7 +138,7 @@ + return NULL; +} + -+static int rt2x00lib_request_eeprom_file(struct rt2x00_dev *rt2x00dev) ++static int rt2x00lib_read_eeprom_file(struct rt2x00_dev *rt2x00dev) +{ + const struct firmware *ee; + const char *ee_name; @@ -233,8 +175,7 @@ + goto err_release_ee; + } + -+ rt2x00dev->eeprom_file = ee; -+ return 0; ++ memcpy(rt2x00dev->eeprom, ee->data, rt2x00dev->ops->eeprom_size); + +err_release_ee: + release_firmware(ee); @@ -242,48 +183,11 @@ + return retval; +} + -+int rt2x00lib_load_eeprom_file(struct rt2x00_dev *rt2x00dev) -+{ -+ int retval; -+ -+ retval = rt2x00lib_request_eeprom_file(rt2x00dev); -+ if (retval) -+ return retval; -+ -+ return 0; -+} -+ -+void rt2x00lib_free_eeprom_file(struct rt2x00_dev *rt2x00dev) -+{ -+ if (rt2x00dev->eeprom_file && rt2x00dev->eeprom_file->size) -+ release_firmware(rt2x00dev->eeprom_file); -+ rt2x00dev->eeprom_file = NULL; -+} ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00lib.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00lib.h -@@ -286,6 +286,22 @@ static inline void rt2x00lib_free_firmwa - #endif /* CPTCFG_RT2X00_LIB_FIRMWARE */ - - /* -+ * EEPROM file handlers. -+ */ -+#ifdef CPTCFG_RT2X00_LIB_EEPROM -+int rt2x00lib_load_eeprom_file(struct rt2x00_dev *rt2x00dev); -+void rt2x00lib_free_eeprom_file(struct rt2x00_dev *rt2x00dev); -+#else -+static inline int rt2x00lib_load_eeprom_file(struct rt2x00_dev *rt2x00dev) ++int rt2x00lib_read_eeprom(struct rt2x00_dev *rt2x00dev) +{ -+ return 0; ++ return rt2x00lib_read_eeprom_file(rt2x00dev); +} -+static inline void rt2x00lib_free_eeprom_file(struct rt2x00_dev *rt2x00dev) -+{ -+} -+#endif /* CPTCFG_RT2X00_LIB_EEPROM */ -+ -+/* - * Debugfs handlers. - */ - #ifdef CPTCFG_RT2X00_LIB_DEBUGFS ++EXPORT_SYMBOL_GPL(rt2x00lib_read_eeprom); --- a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c @@ -86,6 +86,7 @@ int rt2x00soc_probe(struct platform_devi @@ -294,3 +198,19 @@ rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC); retval = rt2x00soc_alloc_reg(rt2x00dev); +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.h +@@ -26,4 +26,13 @@ int rt2x00soc_resume(struct platform_dev + #define rt2x00soc_resume NULL + #endif /* CONFIG_PM */ + ++/* ++ * EEPROM file handlers. ++ */ ++#ifdef CPTCFG_RT2X00_LIB_EEPROM ++int rt2x00lib_read_eeprom(struct rt2x00_dev *rt2x00dev); ++#else ++#define rt2x00lib_read_eeprom NULL ++#endif /* CPTCFG_RT2X00_LIB_EEPROM */ ++ + #endif /* RT2X00SOC_H */ diff --git a/package/kernel/mac80211/patches/rt2x00/602-02-wifi-rt2x00-Add-option-to-pass-EEPROM-file-name-from.patch b/package/kernel/mac80211/patches/rt2x00/602-02-wifi-rt2x00-Add-option-to-pass-EEPROM-file-name-from.patch new file mode 100644 index 00000000000000..90055b911f0fff --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/602-02-wifi-rt2x00-Add-option-to-pass-EEPROM-file-name-from.patch @@ -0,0 +1,43 @@ +From 15329d8b206d9c04ffad49aecd37f5d0bfb85768 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sun, 15 Oct 2023 14:23:19 +0200 +Subject: [PATCH 2/5] wifi: rt2x00: Add option to pass EEPROM file name from DT + +Add option to pass EEPROM file name from DT using ralink,eeprom binding. + +Signed-off-by: Christian Marangi +--- + drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c +@@ -10,6 +10,7 @@ + + #include + #include ++#include + + #include "rt2x00.h" + #include "rt2x00soc.h" +@@ -18,10 +19,20 @@ static const char * + rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev) + { + struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data; ++#ifdef CONFIG_OF ++ struct device_node *np; ++ const char *eep; ++#endif + + if (pdata && pdata->eeprom_file_name) + return pdata->eeprom_file_name; + ++#ifdef CONFIG_OF ++ np = rt2x00dev->dev->of_node; ++ if (np && !of_property_read_string(np, "ralink,eeprom", &eep)) ++ return eep; ++#endif ++ + return NULL; + } + diff --git a/package/kernel/mac80211/patches/rt2x00/604-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch b/package/kernel/mac80211/patches/rt2x00/602-03-wifi-rt2x00-Add-support-for-loading-EEPROM-from-MTD.patch similarity index 63% rename from package/kernel/mac80211/patches/rt2x00/604-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch rename to package/kernel/mac80211/patches/rt2x00/602-03-wifi-rt2x00-Add-support-for-loading-EEPROM-from-MTD.patch index 7338eb15b20e91..fab4bf39c05a98 100644 --- a/package/kernel/mac80211/patches/rt2x00/604-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-03-wifi-rt2x00-Add-support-for-loading-EEPROM-from-MTD.patch @@ -1,14 +1,16 @@ -From 339fe73f340161a624cc08e738d2244814852c3e Mon Sep 17 00:00:00 2001 +From 71261ca81b491a4c3b08690347c12e96a75ad0d0 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sun, 17 Mar 2013 00:55:04 +0100 -Subject: [PATCH] rt2x00: load eeprom on SoC from a mtd device defines inside - OF +Subject: [PATCH 3/5] wifi: rt2x00: Add support for loading EEPROM from MTD + +Add support for loading EEPROM from MTD. Signed-off-by: John Crispin +Signed-off-by: Christian Marangi --- - drivers/net/wireless/ralink/rt2x00/Kconfig | 1 + - drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c | 65 +++++++++++++++++++++++ - 2 files changed, 66 insertions(+) + drivers/net/wireless/ralink/rt2x00/Kconfig | 1 + + .../net/wireless/ralink/rt2x00/rt2x00eeprom.c | 66 +++++++++++++++++++ + 2 files changed, 67 insertions(+) --- a/drivers/net/wireless/ralink/rt2x00/Kconfig +++ b/drivers/net/wireless/ralink/rt2x00/Kconfig @@ -22,7 +24,7 @@ Signed-off-by: John Crispin Supported chips: RT2880, RT3050, RT3052, RT3350, RT3352. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c -@@ -26,11 +26,76 @@ +@@ -10,11 +10,69 @@ #include #include @@ -33,21 +35,20 @@ Signed-off-by: John Crispin #include #include "rt2x00.h" - #include "rt2x00lib.h" + #include "rt2x00soc.h" +#if IS_ENABLED(CONFIG_MTD) +static int rt2800lib_read_eeprom_mtd(struct rt2x00_dev *rt2x00dev) +{ + int ret = -EINVAL; +#ifdef CONFIG_OF -+ static struct firmware mtd_fw; + struct device_node *np = rt2x00dev->dev->of_node, *mtd_np = NULL; -+ size_t retlen, len = rt2x00dev->ops->eeprom_size; -+ int i, size, offset = 0; ++ int size, offset = 0; + struct mtd_info *mtd; + const char *part; + const __be32 *list; + phandle phandle; ++ size_t retlen; + + list = of_get_property(np, "ralink,mtd-eeprom", &size); + if (!list) @@ -74,21 +75,15 @@ Signed-off-by: John Crispin + if (size > sizeof(*list)) + offset = be32_to_cpup(list); + -+ ret = mtd_read(mtd, offset, len, &retlen, (u_char *) rt2x00dev->eeprom); ++ ret = mtd_read(mtd, offset, rt2x00dev->ops->eeprom_size, ++ &retlen, (u_char *)rt2x00dev->eeprom); + put_mtd_device(mtd); + -+ if ((retlen != rt2x00dev->ops->eeprom_size) || ret) { ++ if (retlen != rt2x00dev->ops->eeprom_size || ret) { + dev_err(rt2x00dev->dev, "failed to load eeprom from device \"%s\"\n", part); + return ret; + } + -+ if (of_find_property(np, "ralink,mtd-eeprom-swap", NULL)) -+ for (i = 0; i < len/sizeof(u16); i++) -+ rt2x00dev->eeprom[i] = swab16(rt2x00dev->eeprom[i]); -+ -+ rt2x00dev->eeprom_file = &mtd_fw; -+ mtd_fw.data = (const u8 *) rt2x00dev->eeprom; -+ + dev_info(rt2x00dev->dev, "loaded eeprom from mtd device \"%s\"\n", part); +#endif + @@ -99,15 +94,18 @@ Signed-off-by: John Crispin static const char * rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev) { -@@ -58,6 +123,11 @@ static int rt2x00lib_request_eeprom_file - const char *ee_name; - int retval; +@@ -83,6 +141,14 @@ err_exit: + int rt2x00lib_read_eeprom(struct rt2x00_dev *rt2x00dev) + { ++ int ret; ++ +#if IS_ENABLED(CONFIG_MTD) -+ if (!rt2800lib_read_eeprom_mtd(rt2x00dev)) ++ ret = rt2800lib_read_eeprom_mtd(rt2x00dev); ++ if (!ret) + return 0; +#endif + - ee_name = rt2x00lib_get_eeprom_file_name(rt2x00dev); - if (!ee_name && test_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags)) { - rt2x00_err(rt2x00dev, "Required EEPROM name is missing."); + return rt2x00lib_read_eeprom_file(rt2x00dev); + } + EXPORT_SYMBOL_GPL(rt2x00lib_read_eeprom); diff --git a/package/kernel/mac80211/patches/rt2x00/602-04-wifi-rt2x00-Support-EEPROM-swap-binding.patch b/package/kernel/mac80211/patches/rt2x00/602-04-wifi-rt2x00-Support-EEPROM-swap-binding.patch new file mode 100644 index 00000000000000..392910d224b9e6 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/602-04-wifi-rt2x00-Support-EEPROM-swap-binding.patch @@ -0,0 +1,44 @@ +From 9c9a3c27b96e057f3c3f47151d7a170d84e3bb5f Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sun, 15 Oct 2023 15:31:47 +0200 +Subject: [PATCH 4/5] wifi: rt2x00: Support EEPROM swap binding + +Add binding "ralink,eeprom-swap" to swap bytes of EEPROM before using +it. + +Signed-off-by: Christian Marangi +--- + drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c +@@ -20,6 +20,19 @@ + #include "rt2x00soc.h" + + #if IS_ENABLED(CONFIG_MTD) ++static void rt2800lib_eeprom_swap(struct rt2x00_dev *rt2x00dev) ++{ ++ struct device_node *np = rt2x00dev->dev->of_node; ++ size_t len = rt2x00dev->ops->eeprom_size; ++ int i; ++ ++ if (!of_find_property(np, "ralink,eeprom-swap", NULL)) ++ return; ++ ++ for (i = 0; i < len / sizeof(u16); i++) ++ rt2x00dev->eeprom[i] = swab16(rt2x00dev->eeprom[i]); ++} ++ + static int rt2800lib_read_eeprom_mtd(struct rt2x00_dev *rt2x00dev) + { + int ret = -EINVAL; +@@ -66,6 +79,8 @@ static int rt2800lib_read_eeprom_mtd(str + return ret; + } + ++ rt2800lib_eeprom_swap(rt2x00dev); ++ + dev_info(rt2x00dev->dev, "loaded eeprom from mtd device \"%s\"\n", part); + #endif + diff --git a/package/kernel/mac80211/patches/rt2x00/602-05-wifi-rt2x00-support-loading-eeprom-from-NVMEM-cells.patch b/package/kernel/mac80211/patches/rt2x00/602-05-wifi-rt2x00-support-loading-eeprom-from-NVMEM-cells.patch new file mode 100644 index 00000000000000..e6633363bd380c --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/602-05-wifi-rt2x00-support-loading-eeprom-from-NVMEM-cells.patch @@ -0,0 +1,97 @@ +From 9008cdacdc41f8233f4444b86cf3a17201686e2d Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Tue, 18 Jul 2023 20:18:16 +0800 +Subject: [PATCH 5/5] wifi: rt2x00: support loading eeprom from NVMEM cells + +This patch allows rt2x00 to load eeprom from "eeprom" NVMEM cell. + +Example: + +/* load eeprom from NVMEM provider 'eep' */ +&wmac { + nvmem-cells = <&eep>; + nvmem-cell-names = "eeprom"; +}; + +Signed-off-by: Shiji Yang +Signed-off-by: Christian Marangi +--- + .../net/wireless/ralink/rt2x00/rt2x00eeprom.c | 41 ++++++++++++++++++- + 1 file changed, 40 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c +@@ -14,12 +14,12 @@ + #include + #include + #endif ++#include + #include + + #include "rt2x00.h" + #include "rt2x00soc.h" + +-#if IS_ENABLED(CONFIG_MTD) + static void rt2800lib_eeprom_swap(struct rt2x00_dev *rt2x00dev) + { + struct device_node *np = rt2x00dev->dev->of_node; +@@ -33,6 +33,7 @@ static void rt2800lib_eeprom_swap(struct + rt2x00dev->eeprom[i] = swab16(rt2x00dev->eeprom[i]); + } + ++#if IS_ENABLED(CONFIG_MTD) + static int rt2800lib_read_eeprom_mtd(struct rt2x00_dev *rt2x00dev) + { + int ret = -EINVAL; +@@ -88,6 +89,40 @@ static int rt2800lib_read_eeprom_mtd(str + } + #endif + ++static int rt2800lib_read_eeprom_nvmem(struct rt2x00_dev *rt2x00dev) ++{ ++ struct device_node *np = rt2x00dev->dev->of_node; ++ unsigned int len = rt2x00dev->ops->eeprom_size; ++ struct nvmem_cell *cell; ++ const void *data; ++ size_t retlen; ++ int ret = 0; ++ ++ cell = of_nvmem_cell_get(np, "eeprom"); ++ if (IS_ERR(cell)) ++ return PTR_ERR(cell); ++ ++ data = nvmem_cell_read(cell, &retlen); ++ nvmem_cell_put(cell); ++ ++ if (IS_ERR(data)) ++ return PTR_ERR(data); ++ ++ if (retlen != len) { ++ dev_err(rt2x00dev->dev, "invalid eeprom size, required: 0x%04x\n", len); ++ ret = -EINVAL; ++ goto exit; ++ } ++ ++ memcpy(rt2x00dev->eeprom, data, len); ++ ++ rt2800lib_eeprom_swap(rt2x00dev); ++ ++exit: ++ kfree(data); ++ return ret; ++} ++ + static const char * + rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev) + { +@@ -164,6 +199,10 @@ int rt2x00lib_read_eeprom(struct rt2x00_ + return 0; + #endif + ++ ret = rt2800lib_read_eeprom_nvmem(rt2x00dev); ++ if (!ret) ++ return 0; ++ + return rt2x00lib_read_eeprom_file(rt2x00dev); + } + EXPORT_SYMBOL_GPL(rt2x00lib_read_eeprom); diff --git a/package/kernel/mac80211/patches/rt2x00/603-rt2x00-of_load_eeprom_filename.patch b/package/kernel/mac80211/patches/rt2x00/603-rt2x00-of_load_eeprom_filename.patch deleted file mode 100644 index 431e090237286d..00000000000000 --- a/package/kernel/mac80211/patches/rt2x00/603-rt2x00-of_load_eeprom_filename.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c -@@ -26,6 +26,7 @@ - - #include - #include -+#include - - #include "rt2x00.h" - #include "rt2x00lib.h" -@@ -34,10 +35,20 @@ static const char * - rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev) - { - struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data; -+#ifdef CONFIG_OF -+ struct device_node *np; -+ const char *eep; -+#endif - - if (pdata && pdata->eeprom_file_name) - return pdata->eeprom_file_name; - -+#ifdef CONFIG_OF -+ np = rt2x00dev->dev->of_node; -+ if (np && of_property_read_string(np, "ralink,eeprom", &eep) == 0) -+ return eep; -+#endif -+ - return NULL; - } - diff --git a/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch b/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch index ffee2189d2d3b1..ab09a68297fdaa 100644 --- a/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch +++ b/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch @@ -12,7 +12,7 @@ #endif /* _RT2X00_PLATFORM_H */ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1007,6 +1007,22 @@ static int rt2x00lib_probe_hw_modes(stru +@@ -1008,6 +1008,22 @@ static int rt2x00lib_probe_hw_modes(stru unsigned int num_rates; unsigned int i; diff --git a/package/kernel/mac80211/patches/rt2x00/607-rt2x00-add_platform_data_mac_addr.patch b/package/kernel/mac80211/patches/rt2x00/607-rt2x00-add_platform_data_mac_addr.patch index 37553bb80a07c5..79f99ffdf4a23e 100644 --- a/package/kernel/mac80211/patches/rt2x00/607-rt2x00-add_platform_data_mac_addr.patch +++ b/package/kernel/mac80211/patches/rt2x00/607-rt2x00-add_platform_data_mac_addr.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -989,6 +989,12 @@ static void rt2x00lib_rate(struct ieee80 +@@ -990,6 +990,12 @@ static void rt2x00lib_rate(struct ieee80 void rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr) { diff --git a/package/kernel/mac80211/patches/rt2x00/608-rt2x00-allow_disabling_bands_through_dts.patch b/package/kernel/mac80211/patches/rt2x00/608-rt2x00-allow_disabling_bands_through_dts.patch index 6211809c0a0c40..31f2f0261fd5e3 100644 --- a/package/kernel/mac80211/patches/rt2x00/608-rt2x00-allow_disabling_bands_through_dts.patch +++ b/package/kernel/mac80211/patches/rt2x00/608-rt2x00-allow_disabling_bands_through_dts.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1012,6 +1012,16 @@ static int rt2x00lib_probe_hw_modes(stru +@@ -1013,6 +1013,16 @@ static int rt2x00lib_probe_hw_modes(stru struct ieee80211_rate *rates; unsigned int num_rates; unsigned int i; diff --git a/package/kernel/mac80211/patches/rt2x00/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch b/package/kernel/mac80211/patches/rt2x00/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch index 8964f8bf1057b6..c06ed07030e753 100644 --- a/package/kernel/mac80211/patches/rt2x00/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch +++ b/package/kernel/mac80211/patches/rt2x00/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch @@ -13,7 +13,7 @@ Signed-off-by: John Crispin --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c -@@ -225,10 +225,17 @@ static int rt2800soc_probe(struct platfo +@@ -226,10 +226,17 @@ static int rt2800soc_probe(struct platfo return rt2x00soc_probe(pdev, &rt2800soc_ops); } diff --git a/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch b/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch index acc8a8edb8ca94..8ee4e6cafa6aba 100644 --- a/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch +++ b/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch @@ -8,7 +8,7 @@ #include "rt2x00.h" #include "rt2800lib.h" -@@ -11131,6 +11132,17 @@ static int rt2800_init_eeprom(struct rt2 +@@ -11285,6 +11286,17 @@ static int rt2800_init_eeprom(struct rt2 rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC); rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY); diff --git a/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch b/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch index 5ef5fc8def623d..9564f02eddec52 100644 --- a/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch +++ b/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1358,7 +1358,7 @@ static inline void rt2x00lib_set_if_comb +@@ -1362,7 +1362,7 @@ static inline void rt2x00lib_set_if_comb */ if_limit = &rt2x00dev->if_limits_ap; if_limit->max = rt2x00dev->ops->max_ap_intf; diff --git a/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch index deaa03be6c036d..3e48eab5d20225 100644 --- a/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch @@ -27,7 +27,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -304,6 +304,24 @@ static void rt2800_rf_write(struct rt2x0 +@@ -305,6 +305,24 @@ static void rt2800_rf_write(struct rt2x0 mutex_unlock(&rt2x00dev->csr_mutex); } @@ -52,67 +52,27 @@ Signed-off-by: Daniel Golle static const unsigned int rt2800_eeprom_map[EEPROM_WORD_COUNT] = { [EEPROM_CHIP_ID] = 0x0000, [EEPROM_VERSION] = 0x0001, -@@ -4469,6 +4487,29 @@ static void rt2800_config_channel(struct - rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, - 0x6C6C6B6C); - } -+ -+ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { -+ reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); -+ reg |= 0x00000101; -+ rt2800_register_write(rt2x00dev, RF_CONTROL3, reg); -+ -+ reg = rt2800_register_read(rt2x00dev, RF_BYPASS3); -+ reg |= 0x00000101; -+ rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); -+ -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42); -+ rt2800_bbp_write(rt2x00dev, 75, 0x68); -+ rt2800_bbp_write(rt2x00dev, 76, 0x4C); -+ rt2800_bbp_write(rt2x00dev, 79, 0x1C); -+ rt2800_bbp_write(rt2x00dev, 80, 0x0C); -+ rt2800_bbp_write(rt2x00dev, 82, 0xB6); -+ /* bank 0 RF reg 42 and glrt BBP reg 141 will be set in -+ * config channel function in dependence of channel and -+ * HT20/HT40 so don't touch it -+ */ -+ } - } +@@ -10407,8 +10425,10 @@ static void rt2800_calibration_rt6352(st + u32 reg; - bbp = rt2800_bbp_read(rt2x00dev, 4); -@@ -10583,6 +10624,7 @@ static void rt2800_init_rfcsr_6352(struc - rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); - rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); + if (rt2x00_has_cap_external_pa(rt2x00dev) || +- rt2x00_has_cap_external_lna_bg(rt2x00dev)) ++ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { ++ rt6352_enable_pa_pin(rt2x00dev, 0); + rt2800_restore_rf_bbp_rt6352(rt2x00dev); ++ } -+ rt6352_enable_pa_pin(rt2x00dev, 0); rt2800_r_calibration(rt2x00dev); rt2800_rf_self_txdc_cal(rt2x00dev); - rt2800_rxdcoc_calibration(rt2x00dev); -@@ -10590,6 +10632,22 @@ static void rt2800_init_rfcsr_6352(struc - rt2800_bw_filter_calibration(rt2x00dev, false); - rt2800_loft_iq_calibration(rt2x00dev); - rt2800_rxiq_calibration(rt2x00dev); +@@ -10426,6 +10446,8 @@ static void rt2800_calibration_rt6352(st + !rt2x00_has_cap_external_lna_bg(rt2x00dev)) + return; + + rt6352_enable_pa_pin(rt2x00dev, 1); + -+ if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42); -+ rt2800_bbp_write(rt2x00dev, 75, 0x68); -+ rt2800_bbp_write(rt2x00dev, 76, 0x4C); -+ rt2800_bbp_write(rt2x00dev, 79, 0x1C); -+ rt2800_bbp_write(rt2x00dev, 80, 0x0C); -+ rt2800_bbp_write(rt2x00dev, 82, 0xB6); -+ /* bank 0 RF reg 42 and glrt BBP reg 141 will be set in config -+ * channel function in dependence of channel and HT20/HT40, -+ * so don't touch them here. -+ */ -+ } - } - - static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) + if (rt2x00_has_cap_external_pa(rt2x00dev)) { + reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); + reg |= 0x00000101; --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h @@ -28,6 +28,7 @@ @@ -123,7 +83,7 @@ Signed-off-by: Daniel Golle #include #include -@@ -1029,6 +1030,11 @@ struct rt2x00_dev { +@@ -1027,6 +1028,11 @@ struct rt2x00_dev { /* Clock for System On Chip devices. */ struct clk *clk; diff --git a/package/kernel/mac80211/patches/rt2x00/995-rt2x00-mt7620-introduce-accessors-for-CHIP_VER-register.patch b/package/kernel/mac80211/patches/rt2x00/995-rt2x00-mt7620-introduce-accessors-for-CHIP_VER-register.patch index 97a56de2b3d844..19f1edc928bce9 100644 --- a/package/kernel/mac80211/patches/rt2x00/995-rt2x00-mt7620-introduce-accessors-for-CHIP_VER-register.patch +++ b/package/kernel/mac80211/patches/rt2x00/995-rt2x00-mt7620-introduce-accessors-for-CHIP_VER-register.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -@@ -78,6 +78,9 @@ struct rt2800_ops { +@@ -76,6 +76,9 @@ struct rt2800_ops { int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev); __le32 *(*drv_get_txwi)(struct queue_entry *entry); unsigned int (*drv_get_dma_done)(struct data_queue *queue); @@ -10,7 +10,7 @@ }; static inline u32 rt2800_register_read(struct rt2x00_dev *rt2x00dev, -@@ -195,6 +198,27 @@ static inline unsigned int rt2800_drv_ge +@@ -184,6 +187,27 @@ static inline unsigned int rt2800_drv_ge return rt2800ops->drv_get_dma_done(queue); } @@ -104,7 +104,7 @@ static const struct ieee80211_ops rt2800soc_mac80211_ops = { .tx = rt2x00mac_tx, .wake_tx_queue = ieee80211_handle_wake_tx_queue, -@@ -160,6 +187,9 @@ static const struct rt2800_ops rt2800soc +@@ -161,6 +188,9 @@ static const struct rt2800_ops rt2800soc .drv_init_registers = rt2800mmio_init_registers, .drv_get_txwi = rt2800mmio_get_txwi, .drv_get_dma_done = rt2800mmio_get_dma_done, diff --git a/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch b/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch index dab6e05ffd2c5c..0f699f5e18b013 100644 --- a/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch +++ b/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h -@@ -1044,6 +1044,11 @@ +@@ -1056,6 +1056,11 @@ #define MIMO_PS_CFG_RX_STBY_POL FIELD32(0x00000010) #define MIMO_PS_CFG_RX_RX_STBY0 FIELD32(0x00000020) @@ -14,7 +14,7 @@ */ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -3778,14 +3778,16 @@ static void rt2800_config_channel_rf7620 +@@ -3836,14 +3836,16 @@ static void rt2800_config_channel_rf7620 rt2x00_set_field8(&rfcsr, RFCSR19_K, rf->rf4); rt2800_rfcsr_write(rt2x00dev, 19, rfcsr); @@ -39,7 +39,7 @@ rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); rt2x00_set_field8(&rfcsr, RFCSR1_TX2_EN_MT7620, -@@ -3819,18 +3821,23 @@ static void rt2800_config_channel_rf7620 +@@ -3877,18 +3879,23 @@ static void rt2800_config_channel_rf7620 rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x20); } @@ -73,7 +73,7 @@ if (!test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) { if (conf_is_ht40(conf)) { -@@ -3929,25 +3936,29 @@ static void rt2800_config_alc(struct rt2 +@@ -4002,25 +4009,29 @@ static void rt2800_config_alc_rt6352(str if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY))) rt2x00_warn(rt2x00dev, "RF busy while configuring ALC\n"); @@ -121,7 +121,17 @@ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl); rt2800_vco_calibration(rt2x00dev); -@@ -6011,18 +6022,33 @@ static int rt2800_init_registers(struct +@@ -4513,7 +4524,8 @@ static void rt2800_config_channel(struct + if (rt2x00_rt(rt2x00dev, RT6352)) { + /* BBP for GLRT BW */ + bbp = conf_is_ht40(conf) ? +- 0x10 : rt2x00_has_cap_external_lna_bg(rt2x00dev) ? ++ 0x10 : !rt2x00_has_cap_external_lna_bg(rt2x00dev) ? ++ 0x1a : rt2800_hw_get_chippkg(rt2x00dev) == 1 ? + 0x15 : 0x1a; + rt2800_bbp_glrt_write(rt2x00dev, 141, bbp); + +@@ -6017,18 +6029,33 @@ static int rt2800_init_registers(struct } else if (rt2x00_rt(rt2x00dev, RT5350)) { rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); } else if (rt2x00_rt(rt2x00dev, RT6352)) { @@ -167,7 +177,7 @@ reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_1); rt2x00_set_field32(®, TX_ALC_CFG_1_ROS_BUSY_EN, 0); rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg); -@@ -7127,14 +7153,16 @@ static void rt2800_init_bbp_6352(struct +@@ -7141,14 +7168,16 @@ static void rt2800_init_bbp_6352(struct rt2800_bbp_write(rt2x00dev, 188, 0x00); rt2800_bbp_write(rt2x00dev, 189, 0x00); @@ -192,7 +202,27 @@ /* BBP for G band GLRT function (BBP_128 ~ BBP_221) */ rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00); -@@ -10408,31 +10436,36 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10381,6 +10410,9 @@ static void rt2800_restore_rf_bbp_rt6352 + rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0); + } + ++ if (rt2800_hw_get_chippkg(rt2x00dev) != 1) ++ return; ++ + if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); + rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); +@@ -10458,6 +10490,9 @@ static void rt2800_calibration_rt6352(st + rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); + } + ++ if (rt2800_hw_get_chippkg(rt2x00dev) != 1) ++ return; ++ + if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); + rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); +@@ -10548,31 +10583,36 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write(rt2x00dev, 42, 0x5B); rt2800_rfcsr_write(rt2x00dev, 43, 0x00); @@ -254,7 +284,7 @@ /* Initialize RF channel register to default value */ rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03); -@@ -10498,63 +10531,71 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10638,63 +10678,71 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5); @@ -288,33 +318,6 @@ - rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B); - rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xF7); - rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09); -- -- rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x51); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x06); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0xA7); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 28, 0x2C); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x64); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 8, 0x51); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x36); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x53); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); -- -- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6C); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFC); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1F); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B); -- -- /* Initialize RF channel register for DRQFN */ -- rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xE3); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xE5); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x28); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x68); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xF7); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x02); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xC7); + if (rt2800_hw_get_chipver(rt2x00dev) > 1) { + rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x47); + rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x71); @@ -347,7 +350,16 @@ + rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xF7); + rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09); + } -+ + +- rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x51); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x06); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0xA7); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 28, 0x2C); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x64); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 8, 0x51); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 9, 0x36); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 11, 0x53); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); + if (rt2800_hw_get_chipver(rt2x00dev) > 1 && + rt2800_hw_get_chipeco(rt2x00dev) >= 2) { + rt2800_rfcsr_write_chanreg(rt2x00dev, 10, 0x51); @@ -367,7 +379,23 @@ + rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66); + rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B); + } -+ + +- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6C); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFC); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1F); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B); +- +- /* Initialize RF channel register for DRQFN */ +- rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xE3); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xE5); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x28); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x68); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xF7); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x02); +- rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xC7); + if (rt2800_hw_get_chippkg(rt2x00dev) == 0 && + rt2800_hw_get_chipver(rt2x00dev) == 1) { + /* Initialize RF channel register for DRQFN */ @@ -383,7 +411,7 @@ /* Initialize RF DC calibration register to default value */ rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47); -@@ -10617,12 +10658,17 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10757,12 +10805,17 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00); @@ -404,5 +432,5 @@ + rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); + } - rt6352_enable_pa_pin(rt2x00dev, 0); - rt2800_r_calibration(rt2x00dev); + /* Do calibration and init PA/LNA */ + rt2800_calibration_rt6352(rt2x00dev); diff --git a/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch deleted file mode 100644 index 5f6f5140d9e900..00000000000000 --- a/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch +++ /dev/null @@ -1,413 +0,0 @@ -From: Shiji Yang -Date: Tue, 25 Jul 2023 20:05:06 +0800 -Subject: [PATCH] wifi: rt2x00: rework MT7620 PA/LNA RF calibration - -1. Move MT7620 PA/LNA calibration code to dedicated functions. -2. For external PA/LNA devices, restore RF and BBP registers before - R-Calibration. -3. Do Rx DCOC calibration again before RXIQ calibration. -4. Correct MAC_SYS_CTRL register RX mask to 0x08 in R-Calibration - function. For MAC_SYS_CTRL register, Bit[2] controls MAC_TX_EN - and Bit[3] controls MAC_RX_EN (Bit index starts from 0). -5. Move the channel configuration code from rt2800_vco_calibration() - to the rt2800_config_channel(). -6. Use MT7620 SOC specific AGC initial LNA value instead of the - RT5592's value. -7. Adjust the register operation sequence according to the vendor - driver code. This may not be useful, but it can make things - clearer when developers try to review it. - -Signed-off-by: Shiji Yang ---- - .../net/wireless/ralink/rt2x00/rt2800lib.c | 306 ++++++++++-------- - drivers/net/wireless/ralink/rt2x00/rt2x00.h | 6 + - 2 files changed, 182 insertions(+), 130 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -3881,14 +3881,6 @@ static void rt2800_config_channel_rf7620 - rfcsr |= tx_agc_fc; - rt2800_rfcsr_write_bank(rt2x00dev, 7, 59, rfcsr); - } -- -- if (conf_is_ht40(conf)) { -- rt2800_bbp_glrt_write(rt2x00dev, 141, 0x10); -- rt2800_bbp_glrt_write(rt2x00dev, 157, 0x2f); -- } else { -- rt2800_bbp_glrt_write(rt2x00dev, 141, 0x1a); -- rt2800_bbp_glrt_write(rt2x00dev, 157, 0x40); -- } - } - - static void rt2800_config_alc_rt6352(struct rt2x00_dev *rt2x00dev, -@@ -4457,89 +4449,63 @@ static void rt2800_config_channel(struct - usleep_range(1000, 1500); - } - -- if (rt2x00_rt(rt2x00dev, RT5592) || rt2x00_rt(rt2x00dev, RT6352)) { -+ if (rt2x00_rt(rt2x00dev, RT5592)) { - reg = 0x10; -- if (!conf_is_ht40(conf)) { -- if (rt2x00_rt(rt2x00dev, RT6352) && -- rt2x00_has_cap_external_lna_bg(rt2x00dev)) { -- reg |= 0x5; -- } else { -- reg |= 0xa; -- } -- } -+ if (!conf_is_ht40(conf)) -+ reg |= 0xa; - rt2800_bbp_write(rt2x00dev, 195, 141); - rt2800_bbp_write(rt2x00dev, 196, reg); - -- /* AGC init. -- * Despite the vendor driver using different values here for -- * RT6352 chip, we use 0x1c for now. This may have to be changed -- * once TSSI got implemented. -- */ - reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2*rt2x00dev->lna_gain; - rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); -- -- if (rt2x00_rt(rt2x00dev, RT5592)) -- rt2800_iq_calibrate(rt2x00dev, rf->channel); -+ -+ rt2800_iq_calibrate(rt2x00dev, rf->channel); - } - - if (rt2x00_rt(rt2x00dev, RT6352)) { -- if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, -- &rt2x00dev->cap_flags)) { -- reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); -- reg |= 0x00000101; -- rt2800_register_write(rt2x00dev, RF_CONTROL3, reg); -- -- reg = rt2800_register_read(rt2x00dev, RF_BYPASS3); -- reg |= 0x00000101; -- rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); -- -- rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05); -- rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00); -+ /* BBP for GLRT BW */ -+ if (conf_is_ht40(conf)) { -+ rt2800_bbp_glrt_write(rt2x00dev, 141, 0x10); -+ rt2800_bbp_glrt_write(rt2x00dev, 157, 0x2f); -+ } else { -+ rt2800_bbp_glrt_write(rt2x00dev, 141, 0x1a); -+ rt2800_bbp_glrt_write(rt2x00dev, 157, 0x40); - -- rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, -- 0x36303636); -- rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, -- 0x6C6C6B6C); -- rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, -- 0x6C6C6B6C); -+ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_lna_bg(rt2x00dev)) -+ rt2800_bbp_glrt_write(rt2x00dev, 141, 0x15); - } - -- if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { -- reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); -- reg |= 0x00000101; -- rt2800_register_write(rt2x00dev, RF_CONTROL3, reg); -- -- reg = rt2800_register_read(rt2x00dev, RF_BYPASS3); -- reg |= 0x00000101; -- rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); -- -- rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); -- rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42); -- rt2800_bbp_write(rt2x00dev, 75, 0x68); -- rt2800_bbp_write(rt2x00dev, 76, 0x4C); -- rt2800_bbp_write(rt2x00dev, 79, 0x1C); -- rt2800_bbp_write(rt2x00dev, 80, 0x0C); -- rt2800_bbp_write(rt2x00dev, 82, 0xB6); -- /* bank 0 RF reg 42 and glrt BBP reg 141 will be set in -- * config channel function in dependence of channel and -- * HT20/HT40 so don't touch it -- */ -+ if (rt2x00dev->default_ant.rx_chain_num == 1) { -+ rt2800_bbp_write(rt2x00dev, 91, 0x07); -+ rt2800_bbp_write(rt2x00dev, 95, 0x1A); -+ rt2800_bbp_write(rt2x00dev, 195, 128); -+ rt2800_bbp_write(rt2x00dev, 196, 0xA0); -+ rt2800_bbp_write(rt2x00dev, 195, 170); -+ rt2800_bbp_write(rt2x00dev, 196, 0x12); -+ rt2800_bbp_write(rt2x00dev, 195, 171); -+ rt2800_bbp_write(rt2x00dev, 196, 0x10); -+ } else { -+ rt2800_bbp_write(rt2x00dev, 91, 0x06); -+ rt2800_bbp_write(rt2x00dev, 95, 0x9A); -+ rt2800_bbp_write(rt2x00dev, 195, 128); -+ rt2800_bbp_write(rt2x00dev, 196, 0xE0); -+ rt2800_bbp_write(rt2x00dev, 195, 170); -+ rt2800_bbp_write(rt2x00dev, 196, 0x30); -+ rt2800_bbp_write(rt2x00dev, 195, 171); -+ rt2800_bbp_write(rt2x00dev, 196, 0x30); - } -+ -+ /* AGC init */ -+ reg = rf->channel <= 14 ? 0x04 + 2 * rt2x00dev->lna_gain : 0; -+ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); -+ -+ /* On 11A, We should delay and wait RF/BBP to be stable -+ * and the appropriate time should be 1000 micro seconds -+ * 2005/06/05 - On 11G, we also need this delay time. -+ * Otherwise it's difficult to pass the WHQL. -+ */ -+ usleep_range(1000, 1500); - } - - bbp = rt2800_bbp_read(rt2x00dev, 4); -@@ -5649,43 +5615,6 @@ void rt2800_vco_calibration(struct rt2x0 - } - } - rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); -- -- if (rt2x00_rt(rt2x00dev, RT6352)) { -- if (rt2x00dev->default_ant.rx_chain_num == 1) { -- rt2800_bbp_write(rt2x00dev, 91, 0x07); -- rt2800_bbp_write(rt2x00dev, 95, 0x1A); -- rt2800_bbp_write(rt2x00dev, 195, 128); -- rt2800_bbp_write(rt2x00dev, 196, 0xA0); -- rt2800_bbp_write(rt2x00dev, 195, 170); -- rt2800_bbp_write(rt2x00dev, 196, 0x12); -- rt2800_bbp_write(rt2x00dev, 195, 171); -- rt2800_bbp_write(rt2x00dev, 196, 0x10); -- } else { -- rt2800_bbp_write(rt2x00dev, 91, 0x06); -- rt2800_bbp_write(rt2x00dev, 95, 0x9A); -- rt2800_bbp_write(rt2x00dev, 195, 128); -- rt2800_bbp_write(rt2x00dev, 196, 0xE0); -- rt2800_bbp_write(rt2x00dev, 195, 170); -- rt2800_bbp_write(rt2x00dev, 196, 0x30); -- rt2800_bbp_write(rt2x00dev, 195, 171); -- rt2800_bbp_write(rt2x00dev, 196, 0x30); -- } -- -- if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { -- rt2800_bbp_write(rt2x00dev, 75, 0x68); -- rt2800_bbp_write(rt2x00dev, 76, 0x4C); -- rt2800_bbp_write(rt2x00dev, 79, 0x1C); -- rt2800_bbp_write(rt2x00dev, 80, 0x0C); -- rt2800_bbp_write(rt2x00dev, 82, 0xB6); -- } -- -- /* On 11A, We should delay and wait RF/BBP to be stable -- * and the appropriate time should be 1000 micro seconds -- * 2005/06/05 - On 11G, we also need this delay time. -- * Otherwise it's difficult to pass the WHQL. -- */ -- usleep_range(1000, 1500); -- } - } - EXPORT_SYMBOL_GPL(rt2800_vco_calibration); - -@@ -8650,7 +8579,7 @@ static void rt2800_r_calibration(struct - rt2x00_warn(rt2x00dev, "Wait MAC Tx Status to MAX !!!\n"); - - maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); -- maccfg &= (~0x04); -+ maccfg &= (~0x08); - rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg); - - if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX))) -@@ -10688,30 +10617,143 @@ static void rt2800_init_rfcsr_6352(struc - rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); - rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); - } -+} - -- rt6352_enable_pa_pin(rt2x00dev, 0); -- rt2800_r_calibration(rt2x00dev); -- rt2800_rf_self_txdc_cal(rt2x00dev); -- rt2800_rxdcoc_calibration(rt2x00dev); -- rt2800_bw_filter_calibration(rt2x00dev, true); -- rt2800_bw_filter_calibration(rt2x00dev, false); -- rt2800_loft_iq_calibration(rt2x00dev); -- rt2800_rxiq_calibration(rt2x00dev); -- rt6352_enable_pa_pin(rt2x00dev, 1); -+static void rt2800_init_palna_rt6352(struct rt2x00_dev *rt2x00dev) -+{ -+ u32 reg; -+ -+ if (rt2x00_has_cap_external_pa(rt2x00dev)) { -+ reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); -+ reg |= 0x00000101; -+ rt2800_register_write(rt2x00dev, RF_CONTROL3, reg); -+ -+ reg = rt2800_register_read(rt2x00dev, RF_BYPASS3); -+ reg |= 0x00000101; -+ rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); -+ } - -- if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { -+ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { - rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x66); - rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x20); - rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x42); -+ } -+ -+ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_pa(rt2x00dev)) { -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05); -+ } -+ -+ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_pa(rt2x00dev)) -+ rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00); -+ -+ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { - rt2800_bbp_write(rt2x00dev, 75, 0x68); - rt2800_bbp_write(rt2x00dev, 76, 0x4C); - rt2800_bbp_write(rt2x00dev, 79, 0x1C); - rt2800_bbp_write(rt2x00dev, 80, 0x0C); - rt2800_bbp_write(rt2x00dev, 82, 0xB6); -- /* bank 0 RF reg 42 and glrt BBP reg 141 will be set in config -- * channel function in dependence of channel and HT20/HT40, -- * so don't touch them here. -- */ -+ } -+ -+ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_pa(rt2x00dev)) { -+ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x36303636); -+ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C6B6C); -+ rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C6B6C); -+ } -+} -+ -+static void rt2800_restore_rf_bbp_rt6352(struct rt2x00_dev *rt2x00dev) -+{ -+ if (rt2x00_has_cap_external_pa(rt2x00dev)) { -+ rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0); -+ rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0); -+ } -+ -+ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 14, 0x16); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 17, 0x23); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 18, 0x02); -+ } -+ -+ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_pa(rt2x00dev)) { -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0xD3); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0xB3); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0xD5); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0x6C); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xFC); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x1F); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0x66); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xFF); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x1C); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x20); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0x6B); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xF7); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x09); -+ } -+ -+ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { -+ rt2800_bbp_write(rt2x00dev, 75, 0x60); -+ rt2800_bbp_write(rt2x00dev, 76, 0x44); -+ rt2800_bbp_write(rt2x00dev, 79, 0x1C); -+ rt2800_bbp_write(rt2x00dev, 80, 0x0C); -+ rt2800_bbp_write(rt2x00dev, 82, 0xB6); -+ } -+ -+ if (rt2800_hw_get_chippkg(rt2x00dev) == 1 && -+ rt2x00_has_cap_external_pa(rt2x00dev)) { -+ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, 0x3630363A); -+ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C); -+ rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, 0x6C6C666C); -+ } -+} -+ -+static void rt2800_calibration_rt6352(struct rt2x00_dev *rt2x00dev) -+{ -+ if (rt2x00_has_cap_external_pa(rt2x00dev) || -+ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { -+ rt6352_enable_pa_pin(rt2x00dev, 0); -+ rt2800_restore_rf_bbp_rt6352(rt2x00dev); -+ } -+ -+ rt2800_r_calibration(rt2x00dev); -+ rt2800_rf_self_txdc_cal(rt2x00dev); -+ rt2800_rxdcoc_calibration(rt2x00dev); -+ rt2800_bw_filter_calibration(rt2x00dev, true); -+ rt2800_bw_filter_calibration(rt2x00dev, false); -+ rt2800_loft_iq_calibration(rt2x00dev); -+ -+ /* missing DPD Calibration for devices using internal PA */ -+ -+ rt2800_rxdcoc_calibration(rt2x00dev); -+ rt2800_rxiq_calibration(rt2x00dev); -+ -+ if (rt2x00_has_cap_external_pa(rt2x00dev) || -+ rt2x00_has_cap_external_lna_bg(rt2x00dev)) { -+ rt6352_enable_pa_pin(rt2x00dev, 1); -+ rt2800_init_palna_rt6352(rt2x00dev); - } - } - -@@ -10804,6 +10846,10 @@ int rt2800_enable_radio(struct rt2x00_de - rt2800_init_bbp(rt2x00dev); - rt2800_init_rfcsr(rt2x00dev); - -+ /* Do calibration and init PA/LNA for RT6352 */ -+ if (rt2x00_rt(rt2x00dev, RT6352)) -+ rt2800_calibration_rt6352(rt2x00dev); -+ - if (rt2x00_is_usb(rt2x00dev) && - (rt2x00_rt(rt2x00dev, RT3070) || - rt2x00_rt(rt2x00dev, RT3071) || ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -1277,6 +1277,12 @@ rt2x00_has_cap_external_lna_bg(struct rt - } - - static inline bool -+rt2x00_has_cap_external_pa(struct rt2x00_dev *rt2x00dev) -+{ -+ return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_EXTERNAL_PA_TX0); -+} -+ -+static inline bool - rt2x00_has_cap_double_antenna(struct rt2x00_dev *rt2x00dev) - { - return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_DOUBLE_ANTENNA); diff --git a/package/kernel/mac80211/patches/subsys/001-wifi-mac80211-do-not-pass-ap_vlan-vif-pointer-to-dri.patch b/package/kernel/mac80211/patches/subsys/001-wifi-mac80211-do-not-pass-ap_vlan-vif-pointer-to-dri.patch new file mode 100644 index 00000000000000..43724aee1aeb84 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/001-wifi-mac80211-do-not-pass-ap_vlan-vif-pointer-to-dri.patch @@ -0,0 +1,64 @@ +From ee0db868ee4d88493dfdc82f59e3b4e449ddddd5 Mon Sep 17 00:00:00 2001 +From: Oldřich Jedlička +Date: Sat, 4 Nov 2023 15:13:33 +0100 +Subject: wifi: mac80211: do not pass AP_VLAN vif pointer to drivers during + flush +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ Upstream commit 3e3a2b645c043f7e3e488d5011478cefb69bbe8b ] + +This fixes WARN_ONs when using AP_VLANs after station removal. The flush +call passed AP_VLAN vif to driver, but because these vifs are virtual and +not registered with drivers, we need to translate to the correct AP vif +first. + +Closes: https://github.com/openwrt/openwrt/issues/12420 +Fixes: 0b75a1b1e42e ("wifi: mac80211: flush queues on STA removal") +Fixes: d00800a289c9 ("wifi: mac80211: add flush_sta method") +Tested-by: Konstantin Demin +Tested-by: Koen Vandeputte +Signed-off-by: Oldřich Jedlička +Link: https://lore.kernel.org/r/20231104141333.3710-1-oldium.pro@gmail.com +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/driver-ops.h | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/net/mac80211/driver-ops.h ++++ b/net/mac80211/driver-ops.h +@@ -23,7 +23,7 @@ + static inline struct ieee80211_sub_if_data * + get_bss_sdata(struct ieee80211_sub_if_data *sdata) + { +- if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) ++ if (sdata && sdata->vif.type == NL80211_IFTYPE_AP_VLAN) + sdata = container_of(sdata->bss, struct ieee80211_sub_if_data, + u.ap); + +@@ -638,10 +638,13 @@ static inline void drv_flush(struct ieee + struct ieee80211_sub_if_data *sdata, + u32 queues, bool drop) + { +- struct ieee80211_vif *vif = sdata ? &sdata->vif : NULL; ++ struct ieee80211_vif *vif; + + might_sleep(); + ++ sdata = get_bss_sdata(sdata); ++ vif = sdata ? &sdata->vif : NULL; ++ + if (sdata && !check_sdata_in_driver(sdata)) + return; + +@@ -657,6 +660,8 @@ static inline void drv_flush_sta(struct + { + might_sleep(); + ++ sdata = get_bss_sdata(sdata); ++ + if (sdata && !check_sdata_in_driver(sdata)) + return; + diff --git a/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch index 4d4a2a8f5e8d2f..e3349dabd0b9c7 100644 --- a/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch +++ b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch @@ -9,7 +9,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnect --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -1519,7 +1519,6 @@ static int ieee80211_stop_ap(struct wiph +@@ -1632,7 +1632,6 @@ static int ieee80211_stop_ap(struct wiph link_conf->bssid_indicator = 0; __sta_info_flush(sdata, true); diff --git a/package/kernel/mac80211/patches/subsys/130-disable_auto_vif.patch b/package/kernel/mac80211/patches/subsys/130-disable_auto_vif.patch new file mode 100644 index 00000000000000..9d8f781ac41ffa --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/130-disable_auto_vif.patch @@ -0,0 +1,27 @@ +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -1396,24 +1396,6 @@ int ieee80211_register_hw(struct ieee802 + debugfs_hw_add(local); + rate_control_add_debugfs(local); + +- rtnl_lock(); +- wiphy_lock(hw->wiphy); +- +- /* add one default STA interface if supported */ +- if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) && +- !ieee80211_hw_check(hw, NO_AUTO_VIF)) { +- struct vif_params params = {0}; +- +- result = ieee80211_if_add(local, "wlan%d", NET_NAME_ENUM, NULL, +- NL80211_IFTYPE_STATION, ¶ms); +- if (result) +- wiphy_warn(local->hw.wiphy, +- "Failed to add default virtual iface\n"); +- } +- +- wiphy_unlock(hw->wiphy); +- rtnl_unlock(); +- + #ifdef CONFIG_INET + local->ifa_notifier.notifier_call = ieee80211_ifa_changed; + result = register_inetaddr_notifier(&local->ifa_notifier); diff --git a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch index 10b842d9af39a6..25b844a21b2ec9 100644 --- a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch +++ b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch @@ -8,7 +8,7 @@ Subject: [PATCH] mac80211: allow scans in access point mode (for site survey) --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2727,6 +2727,8 @@ static int ieee80211_scan(struct wiphy * +@@ -2843,6 +2843,8 @@ static int ieee80211_scan(struct wiphy * */ fallthrough; case NL80211_IFTYPE_AP: diff --git a/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch b/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch index 63b21774719bf3..ffa5c17e487fe6 100644 --- a/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch +++ b/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch @@ -28,7 +28,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c -@@ -554,6 +554,7 @@ __sta_info_alloc(struct ieee80211_sub_if +@@ -558,6 +558,7 @@ __sta_info_alloc(struct ieee80211_sub_if INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames); INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work); mutex_init(&sta->ampdu_mlme.mtx); diff --git a/package/kernel/mac80211/patches/subsys/305-mac80211-increase-quantum-for-airtime-scheduler.patch b/package/kernel/mac80211/patches/subsys/305-mac80211-increase-quantum-for-airtime-scheduler.patch index 0ac972955f0210..a27925e64ee77b 100644 --- a/package/kernel/mac80211/patches/subsys/305-mac80211-increase-quantum-for-airtime-scheduler.patch +++ b/package/kernel/mac80211/patches/subsys/305-mac80211-increase-quantum-for-airtime-scheduler.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -90,6 +90,8 @@ extern const u8 ieee80211_ac_to_qos_mask +@@ -92,6 +92,8 @@ extern const u8 ieee80211_ac_to_qos_mask */ #define AIRTIME_ACTIVE_DURATION (HZ / 10) @@ -23,7 +23,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3984,7 +3984,7 @@ struct ieee80211_txq *ieee80211_next_txq +@@ -4059,7 +4059,7 @@ struct ieee80211_txq *ieee80211_next_txq if (deficit < 0) sta->airtime[txqi->txq.ac].deficit += @@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau if (deficit < 0 || !aql_check) { list_move_tail(&txqi->schedule_order, -@@ -4127,7 +4127,8 @@ bool ieee80211_txq_may_transmit(struct i +@@ -4202,7 +4202,8 @@ bool ieee80211_txq_may_transmit(struct i } sta = container_of(iter->txq.sta, struct sta_info, sta); if (ieee80211_sta_deficit(sta, ac) < 0) @@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau list_move_tail(&iter->schedule_order, &local->active_txqs[ac]); } -@@ -4135,7 +4136,7 @@ bool ieee80211_txq_may_transmit(struct i +@@ -4210,7 +4211,7 @@ bool ieee80211_txq_may_transmit(struct i if (sta->airtime[ac].deficit >= 0) goto out; diff --git a/package/kernel/mac80211/patches/subsys/306-01-v6.2-wifi-mac80211-add-internal-handler-for-wake_tx_queue.patch b/package/kernel/mac80211/patches/subsys/306-01-v6.2-wifi-mac80211-add-internal-handler-for-wake_tx_queue.patch deleted file mode 100644 index d14ba05e695c8f..00000000000000 --- a/package/kernel/mac80211/patches/subsys/306-01-v6.2-wifi-mac80211-add-internal-handler-for-wake_tx_queue.patch +++ /dev/null @@ -1,183 +0,0 @@ -From: Alexander Wetzel -Date: Sun, 9 Oct 2022 18:30:38 +0200 -Subject: [PATCH] wifi: mac80211: add internal handler for wake_tx_queue - -Start to align the TX handling to only use internal TX queues (iTXQs): - -Provide a handler for drivers not having a custom wake_tx_queue -callback and update the documentation. - -Signed-off-by: Alexander Wetzel -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -89,15 +89,13 @@ - /** - * DOC: mac80211 software tx queueing - * -- * mac80211 provides an optional intermediate queueing implementation designed -- * to allow the driver to keep hardware queues short and provide some fairness -- * between different stations/interfaces. -- * In this model, the driver pulls data frames from the mac80211 queue instead -- * of letting mac80211 push them via drv_tx(). -- * Other frames (e.g. control or management) are still pushed using drv_tx(). -+ * mac80211 uses an intermediate queueing implementation, designed to allow the -+ * driver to keep hardware queues short and to provide some fairness between -+ * different stations/interfaces. - * -- * Drivers indicate that they use this model by implementing the .wake_tx_queue -- * driver operation. -+ * Drivers must provide the .wake_tx_queue driver operation by either -+ * linking it to ieee80211_handle_wake_tx_queue() or implementing a custom -+ * handler. - * - * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with - * another per-sta for non-data/non-mgmt and bufferable management frames, and -@@ -106,9 +104,12 @@ - * The driver is expected to initialize its private per-queue data for stations - * and interfaces in the .add_interface and .sta_add ops. - * -- * The driver can't access the queue directly. To dequeue a frame from a -- * txq, it calls ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a -- * queue, it calls the .wake_tx_queue driver op. -+ * The driver can't access the internal TX queues (iTXQs) directly. -+ * Whenever mac80211 adds a new frame to a queue, it calls the .wake_tx_queue -+ * driver op. -+ * Drivers implementing a custom .wake_tx_queue op can get them by calling -+ * ieee80211_tx_dequeue(). Drivers using ieee80211_handle_wake_tx_queue() will -+ * simply get the individual frames pushed via the .tx driver operation. - * - * Drivers can optionally delegate responsibility for scheduling queues to - * mac80211, to take advantage of airtime fairness accounting. In this case, to -@@ -2248,8 +2249,8 @@ struct ieee80211_link_sta { - * For non MLO STA it will point to the deflink data. For MLO STA - * ieee80211_sta_recalc_aggregates() must be called to update it. - * @support_p2p_ps: indicates whether the STA supports P2P PS mechanism or not. -- * @txq: per-TID data TX queues (if driver uses the TXQ abstraction); note that -- * the last entry (%IEEE80211_NUM_TIDS) is used for non-data frames -+ * @txq: per-TID data TX queues; note that the last entry (%IEEE80211_NUM_TIDS) -+ * is used for non-data frames - * @deflink: This holds the default link STA information, for non MLO STA all link - * specific STA information is accessed through @deflink or through - * link[0] which points to address of @deflink. For MLO Link STA -@@ -5687,7 +5688,7 @@ void ieee80211_key_replay(struct ieee802 - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * @queue: queue number (counted from zero). - * -- * Drivers should use this function instead of netif_wake_queue. -+ * Drivers must use this function instead of netif_wake_queue. - */ - void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue); - -@@ -5696,7 +5697,7 @@ void ieee80211_wake_queue(struct ieee802 - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * @queue: queue number (counted from zero). - * -- * Drivers should use this function instead of netif_stop_queue. -+ * Drivers must use this function instead of netif_stop_queue. - */ - void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue); - -@@ -5705,7 +5706,7 @@ void ieee80211_stop_queue(struct ieee802 - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * @queue: queue number (counted from zero). - * -- * Drivers should use this function instead of netif_stop_queue. -+ * Drivers must use this function instead of netif_queue_stopped. - * - * Return: %true if the queue is stopped. %false otherwise. - */ -@@ -5716,7 +5717,7 @@ int ieee80211_queue_stopped(struct ieee8 - * ieee80211_stop_queues - stop all queues - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * -- * Drivers should use this function instead of netif_stop_queue. -+ * Drivers must use this function instead of netif_tx_stop_all_queues. - */ - void ieee80211_stop_queues(struct ieee80211_hw *hw); - -@@ -5724,7 +5725,7 @@ void ieee80211_stop_queues(struct ieee80 - * ieee80211_wake_queues - wake all queues - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * -- * Drivers should use this function instead of netif_wake_queue. -+ * Drivers must use this function instead of netif_tx_wake_all_queues. - */ - void ieee80211_wake_queues(struct ieee80211_hw *hw); - -@@ -6946,6 +6947,18 @@ static inline struct sk_buff *ieee80211_ - } - - /** -+ * ieee80211_handle_wake_tx_queue - mac80211 handler for wake_tx_queue callback -+ * -+ * @hw: pointer as obtained from wake_tx_queue() callback(). -+ * @txq: pointer as obtained from wake_tx_queue() callback(). -+ * -+ * Drivers can use this function for the mandatory mac80211 wake_tx_queue -+ * callback in struct ieee80211_ops. They should not call this function. -+ */ -+void ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw, -+ struct ieee80211_txq *txq); -+ -+/** - * ieee80211_next_txq - get next tx queue to pull packets from - * - * @hw: pointer as obtained from ieee80211_alloc_hw() ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -288,6 +288,52 @@ __le16 ieee80211_ctstoself_duration(stru - } - EXPORT_SYMBOL(ieee80211_ctstoself_duration); - -+static void wake_tx_push_queue(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct ieee80211_txq *queue) -+{ -+ int q = sdata->vif.hw_queue[queue->ac]; -+ struct ieee80211_tx_control control = { -+ .sta = queue->sta, -+ }; -+ struct sk_buff *skb; -+ unsigned long flags; -+ bool q_stopped; -+ -+ while (1) { -+ spin_lock_irqsave(&local->queue_stop_reason_lock, flags); -+ q_stopped = local->queue_stop_reasons[q]; -+ spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); -+ -+ if (q_stopped) -+ break; -+ -+ skb = ieee80211_tx_dequeue(&local->hw, queue); -+ if (!skb) -+ break; -+ -+ drv_tx(local, &control, skb); -+ } -+} -+ -+/* wake_tx_queue handler for driver not implementing a custom one*/ -+void ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw, -+ struct ieee80211_txq *txq) -+{ -+ struct ieee80211_local *local = hw_to_local(hw); -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif); -+ struct ieee80211_txq *queue; -+ -+ /* Use ieee80211_next_txq() for airtime fairness accounting */ -+ ieee80211_txq_schedule_start(hw, txq->ac); -+ while ((queue = ieee80211_next_txq(hw, txq->ac))) { -+ wake_tx_push_queue(local, sdata, queue); -+ ieee80211_return_txq(hw, queue, false); -+ } -+ ieee80211_txq_schedule_end(hw, txq->ac); -+} -+EXPORT_SYMBOL(ieee80211_handle_wake_tx_queue); -+ - static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) - { - struct ieee80211_local *local = sdata->local; diff --git a/package/kernel/mac80211/patches/subsys/306-02-v6.2-wifi-mac80211-add-wake_tx_queue-callback-to-drivers.patch b/package/kernel/mac80211/patches/subsys/306-02-v6.2-wifi-mac80211-add-wake_tx_queue-callback-to-drivers.patch deleted file mode 100644 index fee038d90c5c72..00000000000000 --- a/package/kernel/mac80211/patches/subsys/306-02-v6.2-wifi-mac80211-add-wake_tx_queue-callback-to-drivers.patch +++ /dev/null @@ -1,396 +0,0 @@ -From: Alexander Wetzel -Date: Sun, 9 Oct 2022 18:30:39 +0200 -Subject: [PATCH] wifi: mac80211: add wake_tx_queue callback to drivers - -mac80211 is fully switching over to the internal TX queue (iTXQ) -implementation. Update all drivers not yet providing the now mandatory -wake_tx_queue() callback. - -As an side effect the netdev interfaces of all updated drivers will -switch to the noqueue qdisc. - -Signed-off-by: Alexander Wetzel -[add staging drivers] -Signed-off-by: Johannes Berg ---- - ---- a/drivers/net/wireless/admtek/adm8211.c -+++ b/drivers/net/wireless/admtek/adm8211.c -@@ -1760,6 +1760,7 @@ static int adm8211_alloc_rings(struct ie - - static const struct ieee80211_ops adm8211_ops = { - .tx = adm8211_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = adm8211_start, - .stop = adm8211_stop, - .add_interface = adm8211_add_interface, ---- a/drivers/net/wireless/ath/ar5523/ar5523.c -+++ b/drivers/net/wireless/ath/ar5523/ar5523.c -@@ -1361,6 +1361,7 @@ static const struct ieee80211_ops ar5523 - .start = ar5523_start, - .stop = ar5523_stop, - .tx = ar5523_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .set_rts_threshold = ar5523_set_rts_threshold, - .add_interface = ar5523_add_interface, - .remove_interface = ar5523_remove_interface, ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -8587,6 +8587,7 @@ err_fallback: - - static const struct ieee80211_ops ath11k_ops = { - .tx = ath11k_mac_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = ath11k_mac_op_start, - .stop = ath11k_mac_op_stop, - .reconfig_complete = ath11k_mac_op_reconfig_complete, ---- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c -+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c -@@ -781,6 +781,7 @@ static int ath5k_set_ringparam(struct ie - - const struct ieee80211_ops ath5k_hw_ops = { - .tx = ath5k_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = ath5k_start, - .stop = ath5k_stop, - .add_interface = ath5k_add_interface, ---- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c -+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c -@@ -1870,6 +1870,7 @@ static void ath9k_htc_channel_switch_bea - - struct ieee80211_ops ath9k_htc_ops = { - .tx = ath9k_htc_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = ath9k_htc_start, - .stop = ath9k_htc_stop, - .add_interface = ath9k_htc_add_interface, ---- a/drivers/net/wireless/ath/carl9170/main.c -+++ b/drivers/net/wireless/ath/carl9170/main.c -@@ -1715,6 +1715,7 @@ static const struct ieee80211_ops carl91 - .start = carl9170_op_start, - .stop = carl9170_op_stop, - .tx = carl9170_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .flush = carl9170_op_flush, - .add_interface = carl9170_op_add_interface, - .remove_interface = carl9170_op_remove_interface, ---- a/drivers/net/wireless/ath/wcn36xx/main.c -+++ b/drivers/net/wireless/ath/wcn36xx/main.c -@@ -1362,6 +1362,7 @@ static const struct ieee80211_ops wcn36x - .prepare_multicast = wcn36xx_prepare_multicast, - .configure_filter = wcn36xx_configure_filter, - .tx = wcn36xx_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .set_key = wcn36xx_set_key, - .hw_scan = wcn36xx_hw_scan, - .cancel_hw_scan = wcn36xx_cancel_hw_scan, ---- a/drivers/net/wireless/atmel/at76c50x-usb.c -+++ b/drivers/net/wireless/atmel/at76c50x-usb.c -@@ -2187,6 +2187,7 @@ static int at76_set_key(struct ieee80211 - - static const struct ieee80211_ops at76_ops = { - .tx = at76_mac80211_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .add_interface = at76_add_interface, - .remove_interface = at76_remove_interface, - .config = at76_config, ---- a/drivers/net/wireless/broadcom/b43/main.c -+++ b/drivers/net/wireless/broadcom/b43/main.c -@@ -5171,6 +5171,7 @@ static int b43_op_get_survey(struct ieee - - static const struct ieee80211_ops b43_hw_ops = { - .tx = b43_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .conf_tx = b43_op_conf_tx, - .add_interface = b43_op_add_interface, - .remove_interface = b43_op_remove_interface, ---- a/drivers/net/wireless/broadcom/b43legacy/main.c -+++ b/drivers/net/wireless/broadcom/b43legacy/main.c -@@ -3532,6 +3532,7 @@ static int b43legacy_op_get_survey(struc - - static const struct ieee80211_ops b43legacy_hw_ops = { - .tx = b43legacy_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .conf_tx = b43legacy_op_conf_tx, - .add_interface = b43legacy_op_add_interface, - .remove_interface = b43legacy_op_remove_interface, ---- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c -@@ -962,6 +962,7 @@ static int brcms_ops_beacon_set_tim(stru - - static const struct ieee80211_ops brcms_ops = { - .tx = brcms_ops_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = brcms_ops_start, - .stop = brcms_ops_stop, - .add_interface = brcms_ops_add_interface, ---- a/drivers/net/wireless/intel/iwlegacy/3945-mac.c -+++ b/drivers/net/wireless/intel/iwlegacy/3945-mac.c -@@ -3439,6 +3439,7 @@ static const struct attribute_group il39 - - static struct ieee80211_ops il3945_mac_ops __ro_after_init = { - .tx = il3945_mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = il3945_mac_start, - .stop = il3945_mac_stop, - .add_interface = il_mac_add_interface, ---- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c -+++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c -@@ -6308,6 +6308,7 @@ il4965_tx_queue_set_status(struct il_pri - - static const struct ieee80211_ops il4965_mac_ops = { - .tx = il4965_mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = il4965_mac_start, - .stop = il4965_mac_stop, - .add_interface = il_mac_add_interface, ---- a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c -+++ b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c -@@ -1571,6 +1571,7 @@ static void iwlagn_mac_sta_notify(struct - - const struct ieee80211_ops iwlagn_hw_ops = { - .tx = iwlagn_mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = iwlagn_mac_start, - .stop = iwlagn_mac_stop, - #ifdef CONFIG_PM_SLEEP ---- a/drivers/net/wireless/intersil/p54/main.c -+++ b/drivers/net/wireless/intersil/p54/main.c -@@ -705,6 +705,7 @@ static void p54_set_coverage_class(struc - - static const struct ieee80211_ops p54_ops = { - .tx = p54_tx_80211, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = p54_start, - .stop = p54_stop, - .add_interface = p54_add_interface, ---- a/drivers/net/wireless/mac80211_hwsim.c -+++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -3109,6 +3109,7 @@ static int mac80211_hwsim_change_sta_lin - - #define HWSIM_COMMON_OPS \ - .tx = mac80211_hwsim_tx, \ -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, \ - .start = mac80211_hwsim_start, \ - .stop = mac80211_hwsim_stop, \ - .add_interface = mac80211_hwsim_add_interface, \ ---- a/drivers/net/wireless/marvell/libertas_tf/main.c -+++ b/drivers/net/wireless/marvell/libertas_tf/main.c -@@ -474,6 +474,7 @@ static int lbtf_op_get_survey(struct iee - - static const struct ieee80211_ops lbtf_ops = { - .tx = lbtf_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = lbtf_op_start, - .stop = lbtf_op_stop, - .add_interface = lbtf_op_add_interface, ---- a/drivers/net/wireless/marvell/mwl8k.c -+++ b/drivers/net/wireless/marvell/mwl8k.c -@@ -5611,6 +5611,7 @@ static void mwl8k_sw_scan_complete(struc - - static const struct ieee80211_ops mwl8k_ops = { - .tx = mwl8k_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = mwl8k_start, - .stop = mwl8k_stop, - .add_interface = mwl8k_add_interface, ---- a/drivers/net/wireless/mediatek/mt7601u/main.c -+++ b/drivers/net/wireless/mediatek/mt7601u/main.c -@@ -406,6 +406,7 @@ out: - - const struct ieee80211_ops mt7601u_ops = { - .tx = mt7601u_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = mt7601u_start, - .stop = mt7601u_stop, - .add_interface = mt7601u_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c -@@ -1706,6 +1706,7 @@ static int rt2400pci_tx_last_beacon(stru - - static const struct ieee80211_ops rt2400pci_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c -@@ -2004,6 +2004,7 @@ static int rt2500pci_tx_last_beacon(stru - - static const struct ieee80211_ops rt2500pci_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c -@@ -1795,6 +1795,7 @@ static int rt2500usb_probe_hw(struct rt2 - - static const struct ieee80211_ops rt2500usb_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c -@@ -288,6 +288,7 @@ static int rt2800pci_read_eeprom(struct - - static const struct ieee80211_ops rt2800pci_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c -@@ -133,6 +133,7 @@ static int rt2800soc_write_firmware(stru - - static const struct ieee80211_ops rt2800soc_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c -@@ -630,6 +630,7 @@ static int rt2800usb_probe_hw(struct rt2 - - static const struct ieee80211_ops rt2800usb_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c -@@ -2873,6 +2873,7 @@ static u64 rt61pci_get_tsf(struct ieee80 - - static const struct ieee80211_ops rt61pci_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c -@@ -2292,6 +2292,7 @@ static u64 rt73usb_get_tsf(struct ieee80 - - static const struct ieee80211_ops rt73usb_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c -+++ b/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c -@@ -1608,6 +1608,7 @@ static void rtl8180_configure_filter(str - - static const struct ieee80211_ops rtl8180_ops = { - .tx = rtl8180_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rtl8180_start, - .stop = rtl8180_stop, - .add_interface = rtl8180_add_interface, ---- a/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c -+++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c -@@ -1378,6 +1378,7 @@ static int rtl8187_conf_tx(struct ieee80 - - static const struct ieee80211_ops rtl8187_ops = { - .tx = rtl8187_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rtl8187_start, - .stop = rtl8187_stop, - .add_interface = rtl8187_add_interface, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -6548,6 +6548,7 @@ static void rtl8xxxu_stop(struct ieee802 - - static const struct ieee80211_ops rtl8xxxu_ops = { - .tx = rtl8xxxu_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .add_interface = rtl8xxxu_add_interface, - .remove_interface = rtl8xxxu_remove_interface, - .config = rtl8xxxu_config, ---- a/drivers/net/wireless/realtek/rtlwifi/core.c -+++ b/drivers/net/wireless/realtek/rtlwifi/core.c -@@ -1912,6 +1912,7 @@ const struct ieee80211_ops rtl_ops = { - .start = rtl_op_start, - .stop = rtl_op_stop, - .tx = rtl_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .add_interface = rtl_op_add_interface, - .remove_interface = rtl_op_remove_interface, - .change_interface = rtl_op_change_interface, ---- a/drivers/net/wireless/realtek/rtw88/mac80211.c -+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c -@@ -896,6 +896,7 @@ static void rtw_ops_sta_rc_update(struct - - const struct ieee80211_ops rtw_ops = { - .tx = rtw_ops_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .wake_tx_queue = rtw_ops_wake_tx_queue, - .start = rtw_ops_start, - .stop = rtw_ops_stop, ---- a/drivers/net/wireless/realtek/rtw89/mac80211.c -+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c -@@ -918,6 +918,7 @@ static int rtw89_ops_set_tid_config(stru - - const struct ieee80211_ops rtw89_ops = { - .tx = rtw89_ops_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .wake_tx_queue = rtw89_ops_wake_tx_queue, - .start = rtw89_ops_start, - .stop = rtw89_ops_stop, ---- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c -+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c -@@ -1958,6 +1958,7 @@ static int rsi_mac80211_resume(struct ie - - static const struct ieee80211_ops mac80211_ops = { - .tx = rsi_mac80211_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rsi_mac80211_start, - .stop = rsi_mac80211_stop, - .add_interface = rsi_mac80211_add_interface, ---- a/drivers/net/wireless/st/cw1200/main.c -+++ b/drivers/net/wireless/st/cw1200/main.c -@@ -209,6 +209,7 @@ static const struct ieee80211_ops cw1200 - .remove_interface = cw1200_remove_interface, - .change_interface = cw1200_change_interface, - .tx = cw1200_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .hw_scan = cw1200_hw_scan, - .set_tim = cw1200_set_tim, - .sta_notify = cw1200_sta_notify, ---- a/drivers/net/wireless/ti/wl1251/main.c -+++ b/drivers/net/wireless/ti/wl1251/main.c -@@ -1359,6 +1359,7 @@ static const struct ieee80211_ops wl1251 - .prepare_multicast = wl1251_op_prepare_multicast, - .configure_filter = wl1251_op_configure_filter, - .tx = wl1251_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .set_key = wl1251_op_set_key, - .hw_scan = wl1251_op_hw_scan, - .bss_info_changed = wl1251_op_bss_info_changed, ---- a/drivers/net/wireless/ti/wlcore/main.c -+++ b/drivers/net/wireless/ti/wlcore/main.c -@@ -5942,6 +5942,7 @@ static const struct ieee80211_ops wl1271 - .prepare_multicast = wl1271_op_prepare_multicast, - .configure_filter = wl1271_op_configure_filter, - .tx = wl1271_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .set_key = wlcore_op_set_key, - .hw_scan = wl1271_op_hw_scan, - .cancel_hw_scan = wl1271_op_cancel_hw_scan, ---- a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c -+++ b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c -@@ -1344,6 +1344,7 @@ static u64 zd_op_get_tsf(struct ieee8021 - - static const struct ieee80211_ops zd_ops = { - .tx = zd_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = zd_op_start, - .stop = zd_op_stop, - .add_interface = zd_op_add_interface, diff --git a/package/kernel/mac80211/patches/subsys/306-03-v6.2-wifi-mac80211-Drop-support-for-TX-push-path.patch b/package/kernel/mac80211/patches/subsys/306-03-v6.2-wifi-mac80211-Drop-support-for-TX-push-path.patch deleted file mode 100644 index f9f9977cee5ef0..00000000000000 --- a/package/kernel/mac80211/patches/subsys/306-03-v6.2-wifi-mac80211-Drop-support-for-TX-push-path.patch +++ /dev/null @@ -1,683 +0,0 @@ -From: Alexander Wetzel -Date: Sun, 9 Oct 2022 18:30:40 +0200 -Subject: [PATCH] wifi: mac80211: Drop support for TX push path - -All drivers are now using mac80211 internal queues (iTXQs). -Drop mac80211 internal support for the old push path. - -Signed-off-by: Alexander Wetzel -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -4346,9 +4346,6 @@ static int ieee80211_get_txq_stats(struc - struct ieee80211_sub_if_data *sdata; - int ret = 0; - -- if (!local->ops->wake_tx_queue) -- return 1; -- - spin_lock_bh(&local->fq.lock); - rcu_read_lock(); - ---- a/net/mac80211/debugfs.c -+++ b/net/mac80211/debugfs.c -@@ -663,9 +663,7 @@ void debugfs_hw_add(struct ieee80211_loc - DEBUGFS_ADD_MODE(force_tx_status, 0600); - DEBUGFS_ADD_MODE(aql_enable, 0600); - DEBUGFS_ADD(aql_pending); -- -- if (local->ops->wake_tx_queue) -- DEBUGFS_ADD_MODE(aqm, 0600); -+ DEBUGFS_ADD_MODE(aqm, 0600); - - DEBUGFS_ADD_MODE(airtime_flags, 0600); - ---- a/net/mac80211/debugfs_netdev.c -+++ b/net/mac80211/debugfs_netdev.c -@@ -677,8 +677,7 @@ static void add_common_files(struct ieee - DEBUGFS_ADD(rc_rateidx_vht_mcs_mask_5ghz); - DEBUGFS_ADD(hw_queues); - -- if (sdata->local->ops->wake_tx_queue && -- sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && -+ if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && - sdata->vif.type != NL80211_IFTYPE_NAN) - DEBUGFS_ADD(aqm); - } ---- a/net/mac80211/debugfs_sta.c -+++ b/net/mac80211/debugfs_sta.c -@@ -1057,10 +1057,8 @@ void ieee80211_sta_debugfs_add(struct st - DEBUGFS_ADD_COUNTER(rx_fragments, deflink.rx_stats.fragments); - DEBUGFS_ADD_COUNTER(tx_filtered, deflink.status_stats.filtered); - -- if (local->ops->wake_tx_queue) { -- DEBUGFS_ADD(aqm); -- DEBUGFS_ADD(airtime); -- } -+ DEBUGFS_ADD(aqm); -+ DEBUGFS_ADD(airtime); - - if (wiphy_ext_feature_isset(local->hw.wiphy, - NL80211_EXT_FEATURE_AQL)) ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -2294,7 +2294,6 @@ void ieee80211_wake_queue_by_reason(stru - void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, - enum queue_stop_reason reason, - bool refcounted); --void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue); - void ieee80211_add_pending_skb(struct ieee80211_local *local, - struct sk_buff *skb); - void ieee80211_add_pending_skbs(struct ieee80211_local *local, ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -460,12 +460,6 @@ static void ieee80211_do_stop(struct iee - if (cancel_scan) - ieee80211_scan_cancel(local); - -- /* -- * Stop TX on this interface first. -- */ -- if (!local->ops->wake_tx_queue && sdata->dev) -- netif_tx_stop_all_queues(sdata->dev); -- - ieee80211_roc_purge(local, sdata); - - switch (sdata->vif.type) { -@@ -813,13 +807,6 @@ static void ieee80211_uninit(struct net_ - ieee80211_teardown_sdata(IEEE80211_DEV_TO_SUB_IF(dev)); - } - --static u16 ieee80211_netdev_select_queue(struct net_device *dev, -- struct sk_buff *skb, -- struct net_device *sb_dev) --{ -- return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb); --} -- - static void - ieee80211_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) - { -@@ -833,7 +820,6 @@ static const struct net_device_ops ieee8 - .ndo_start_xmit = ieee80211_subif_start_xmit, - .ndo_set_rx_mode = ieee80211_set_multicast_list, - .ndo_set_mac_address = ieee80211_change_mac, -- .ndo_select_queue = ieee80211_netdev_select_queue, - .ndo_get_stats64 = ieee80211_get_stats64, - }; - -@@ -941,7 +927,6 @@ static const struct net_device_ops ieee8 - .ndo_start_xmit = ieee80211_subif_start_xmit_8023, - .ndo_set_rx_mode = ieee80211_set_multicast_list, - .ndo_set_mac_address = ieee80211_change_mac, -- .ndo_select_queue = ieee80211_netdev_select_queue, - .ndo_get_stats64 = ieee80211_get_stats64, - .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path, - }; -@@ -1443,35 +1428,6 @@ int ieee80211_do_open(struct wireless_de - - ieee80211_recalc_ps(local); - -- if (sdata->vif.type == NL80211_IFTYPE_MONITOR || -- sdata->vif.type == NL80211_IFTYPE_AP_VLAN || -- local->ops->wake_tx_queue) { -- /* XXX: for AP_VLAN, actually track AP queues */ -- if (dev) -- netif_tx_start_all_queues(dev); -- } else if (dev) { -- unsigned long flags; -- int n_acs = IEEE80211_NUM_ACS; -- int ac; -- -- if (local->hw.queues < IEEE80211_NUM_ACS) -- n_acs = 1; -- -- spin_lock_irqsave(&local->queue_stop_reason_lock, flags); -- if (sdata->vif.cab_queue == IEEE80211_INVAL_HW_QUEUE || -- (local->queue_stop_reasons[sdata->vif.cab_queue] == 0 && -- skb_queue_empty(&local->pending[sdata->vif.cab_queue]))) { -- for (ac = 0; ac < n_acs; ac++) { -- int ac_queue = sdata->vif.hw_queue[ac]; -- -- if (local->queue_stop_reasons[ac_queue] == 0 && -- skb_queue_empty(&local->pending[ac_queue])) -- netif_start_subqueue(dev, ac); -- } -- } -- spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); -- } -- - set_bit(SDATA_STATE_RUNNING, &sdata->state); - - return 0; -@@ -1501,17 +1457,12 @@ static void ieee80211_if_setup(struct ne - { - ether_setup(dev); - dev->priv_flags &= ~IFF_TX_SKB_SHARING; -+ dev->priv_flags |= IFF_NO_QUEUE; - dev->netdev_ops = &ieee80211_dataif_ops; - dev->needs_free_netdev = true; - dev->priv_destructor = ieee80211_if_free; - } - --static void ieee80211_if_setup_no_queue(struct net_device *dev) --{ -- ieee80211_if_setup(dev); -- dev->priv_flags |= IFF_NO_QUEUE; --} -- - static void ieee80211_iface_process_skb(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb) -@@ -2096,9 +2047,7 @@ int ieee80211_if_add(struct ieee80211_lo - struct net_device *ndev = NULL; - struct ieee80211_sub_if_data *sdata = NULL; - struct txq_info *txqi; -- void (*if_setup)(struct net_device *dev); - int ret, i; -- int txqs = 1; - - ASSERT_RTNL(); - -@@ -2121,30 +2070,18 @@ int ieee80211_if_add(struct ieee80211_lo - sizeof(void *)); - int txq_size = 0; - -- if (local->ops->wake_tx_queue && -- type != NL80211_IFTYPE_AP_VLAN && -+ if (type != NL80211_IFTYPE_AP_VLAN && - (type != NL80211_IFTYPE_MONITOR || - (params->flags & MONITOR_FLAG_ACTIVE))) - txq_size += sizeof(struct txq_info) + - local->hw.txq_data_size; - -- if (local->ops->wake_tx_queue) { -- if_setup = ieee80211_if_setup_no_queue; -- } else { -- if_setup = ieee80211_if_setup; -- if (local->hw.queues >= IEEE80211_NUM_ACS) -- txqs = IEEE80211_NUM_ACS; -- } -- - ndev = alloc_netdev_mqs(size + txq_size, - name, name_assign_type, -- if_setup, txqs, 1); -+ ieee80211_if_setup, 1, 1); - if (!ndev) - return -ENOMEM; - -- if (!local->ops->wake_tx_queue && local->hw.wiphy->tx_queue_len) -- ndev->tx_queue_len = local->hw.wiphy->tx_queue_len; -- - dev_net_set(ndev, wiphy_net(local->hw.wiphy)); - - ndev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -630,7 +630,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ - - if (WARN_ON(!ops->tx || !ops->start || !ops->stop || !ops->config || - !ops->add_interface || !ops->remove_interface || -- !ops->configure_filter)) -+ !ops->configure_filter || !ops->wake_tx_queue)) - return NULL; - - if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove))) -@@ -719,9 +719,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ - if (!ops->set_key) - wiphy->flags |= WIPHY_FLAG_IBSS_RSN; - -- if (ops->wake_tx_queue) -- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_TXQS); -- -+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_TXQS); - wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_RRM); - - wiphy->bss_priv_size = sizeof(struct ieee80211_bss); -@@ -834,10 +832,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ - atomic_set(&local->agg_queue_stop[i], 0); - } - tasklet_setup(&local->tx_pending_tasklet, ieee80211_tx_pending); -- -- if (ops->wake_tx_queue) -- tasklet_setup(&local->wake_txqs_tasklet, ieee80211_wake_txqs); -- -+ tasklet_setup(&local->wake_txqs_tasklet, ieee80211_wake_txqs); - tasklet_setup(&local->tasklet, ieee80211_tasklet_handler); - - skb_queue_head_init(&local->skb_queue); ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -1571,9 +1571,6 @@ static void sta_ps_start(struct sta_info - - ieee80211_clear_fast_xmit(sta); - -- if (!sta->sta.txq[0]) -- return; -- - for (tid = 0; tid < IEEE80211_NUM_TIDS; tid++) { - struct ieee80211_txq *txq = sta->sta.txq[tid]; - struct txq_info *txqi = to_txq_info(txq); ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -140,17 +140,15 @@ static void __cleanup_single_sta(struct - atomic_dec(&ps->num_sta_ps); - } - -- if (sta->sta.txq[0]) { -- for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { -- struct txq_info *txqi; -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { -+ struct txq_info *txqi; - -- if (!sta->sta.txq[i]) -- continue; -+ if (!sta->sta.txq[i]) -+ continue; - -- txqi = to_txq_info(sta->sta.txq[i]); -+ txqi = to_txq_info(sta->sta.txq[i]); - -- ieee80211_txq_purge(local, txqi); -- } -+ ieee80211_txq_purge(local, txqi); - } - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { -@@ -425,8 +423,7 @@ void sta_info_free(struct ieee80211_loca - - sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr); - -- if (sta->sta.txq[0]) -- kfree(to_txq_info(sta->sta.txq[0])); -+ kfree(to_txq_info(sta->sta.txq[0])); - kfree(rcu_dereference_raw(sta->sta.rates)); - #ifdef CPTCFG_MAC80211_MESH - kfree(sta->mesh); -@@ -527,6 +524,8 @@ __sta_info_alloc(struct ieee80211_sub_if - struct ieee80211_local *local = sdata->local; - struct ieee80211_hw *hw = &local->hw; - struct sta_info *sta; -+ void *txq_data; -+ int size; - int i; - - sta = kzalloc(sizeof(*sta) + hw->sta_data_size, gfp); -@@ -597,21 +596,18 @@ __sta_info_alloc(struct ieee80211_sub_if - - sta->last_connected = ktime_get_seconds(); - -- if (local->ops->wake_tx_queue) { -- void *txq_data; -- int size = sizeof(struct txq_info) + -- ALIGN(hw->txq_data_size, sizeof(void *)); -+ size = sizeof(struct txq_info) + -+ ALIGN(hw->txq_data_size, sizeof(void *)); - -- txq_data = kcalloc(ARRAY_SIZE(sta->sta.txq), size, gfp); -- if (!txq_data) -- goto free; -+ txq_data = kcalloc(ARRAY_SIZE(sta->sta.txq), size, gfp); -+ if (!txq_data) -+ goto free; - -- for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { -- struct txq_info *txq = txq_data + i * size; -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { -+ struct txq_info *txq = txq_data + i * size; - -- /* might not do anything for the bufferable MMPDU TXQ */ -- ieee80211_txq_init(sdata, sta, txq, i); -- } -+ /* might not do anything for the (bufferable) MMPDU TXQ */ -+ ieee80211_txq_init(sdata, sta, txq, i); - } - - if (sta_prepare_rate_control(local, sta, gfp)) -@@ -685,8 +681,7 @@ __sta_info_alloc(struct ieee80211_sub_if - return sta; - - free_txq: -- if (sta->sta.txq[0]) -- kfree(to_txq_info(sta->sta.txq[0])); -+ kfree(to_txq_info(sta->sta.txq[0])); - free: - sta_info_free_link(&sta->deflink); - #ifdef CPTCFG_MAC80211_MESH -@@ -1960,9 +1955,6 @@ ieee80211_sta_ps_deliver_response(struct - * TIM recalculation. - */ - -- if (!sta->sta.txq[0]) -- return; -- - for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) { - if (!sta->sta.txq[tid] || - !(driver_release_tids & BIT(tid)) || -@@ -2447,7 +2439,7 @@ static void sta_set_tidstats(struct sta_ - tidstats->tx_msdu_failed = sta->deflink.status_stats.msdu_failed[tid]; - } - -- if (local->ops->wake_tx_queue && tid < IEEE80211_NUM_TIDS) { -+ if (tid < IEEE80211_NUM_TIDS) { - spin_lock_bh(&local->fq.lock); - rcu_read_lock(); - -@@ -2775,9 +2767,6 @@ unsigned long ieee80211_sta_last_active( - - static void sta_update_codel_params(struct sta_info *sta, u32 thr) - { -- if (!sta->sdata->local->ops->wake_tx_queue) -- return; -- - if (thr && thr < STA_SLOW_THRESHOLD * sta->local->num_sta) { - sta->cparams.target = MS2TIME(50); - sta->cparams.interval = MS2TIME(300); ---- a/net/mac80211/tdls.c -+++ b/net/mac80211/tdls.c -@@ -1016,7 +1016,6 @@ ieee80211_tdls_prep_mgmt_packet(struct w - skb->priority = 256 + 5; - break; - } -- skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, skb)); - - /* - * Set the WLAN_TDLS_TEARDOWN flag to indicate a teardown in progress. ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1600,9 +1600,6 @@ int ieee80211_txq_setup_flows(struct iee - bool supp_vht = false; - enum nl80211_band band; - -- if (!local->ops->wake_tx_queue) -- return 0; -- - ret = fq_init(fq, 4096); - if (ret) - return ret; -@@ -1650,9 +1647,6 @@ void ieee80211_txq_teardown_flows(struct - { - struct fq *fq = &local->fq; - -- if (!local->ops->wake_tx_queue) -- return; -- - kfree(local->cvars); - local->cvars = NULL; - -@@ -1669,8 +1663,7 @@ static bool ieee80211_queue_skb(struct i - struct ieee80211_vif *vif; - struct txq_info *txqi; - -- if (!local->ops->wake_tx_queue || -- sdata->vif.type == NL80211_IFTYPE_MONITOR) -+ if (sdata->vif.type == NL80211_IFTYPE_MONITOR) - return false; - - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) -@@ -4193,12 +4186,7 @@ void __ieee80211_subif_start_xmit(struct - if (IS_ERR(sta)) - sta = NULL; - -- if (local->ops->wake_tx_queue) { -- u16 queue = __ieee80211_select_queue(sdata, sta, skb); -- skb_set_queue_mapping(skb, queue); -- skb_get_hash(skb); -- } -- -+ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); - ieee80211_aggr_check(sdata, sta, skb); - - sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift); -@@ -4509,11 +4497,7 @@ static void ieee80211_8023_xmit(struct i - struct tid_ampdu_tx *tid_tx; - u8 tid; - -- if (local->ops->wake_tx_queue) { -- u16 queue = __ieee80211_select_queue(sdata, sta, skb); -- skb_set_queue_mapping(skb, queue); -- skb_get_hash(skb); -- } -+ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); - - if (unlikely(test_bit(SCAN_SW_SCANNING, &local->scanning)) && - test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) -@@ -4767,9 +4751,6 @@ void ieee80211_tx_pending(struct tasklet - if (!txok) - break; - } -- -- if (skb_queue_empty(&local->pending[i])) -- ieee80211_propagate_queue_wake(local, i); - } - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); - -@@ -5962,10 +5943,9 @@ int ieee80211_tx_control_port(struct wip - } - - if (!IS_ERR(sta)) { -- u16 queue = __ieee80211_select_queue(sdata, sta, skb); -+ u16 queue = ieee80211_select_queue(sdata, sta, skb); - - skb_set_queue_mapping(skb, queue); -- skb_get_hash(skb); - - /* - * for MLO STA, the SA should be the AP MLD address, but ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -444,39 +444,6 @@ void ieee80211_wake_txqs(struct tasklet_ - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); - } - --void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue) --{ -- struct ieee80211_sub_if_data *sdata; -- int n_acs = IEEE80211_NUM_ACS; -- -- if (local->ops->wake_tx_queue) -- return; -- -- if (local->hw.queues < IEEE80211_NUM_ACS) -- n_acs = 1; -- -- list_for_each_entry_rcu(sdata, &local->interfaces, list) { -- int ac; -- -- if (!sdata->dev) -- continue; -- -- if (sdata->vif.cab_queue != IEEE80211_INVAL_HW_QUEUE && -- local->queue_stop_reasons[sdata->vif.cab_queue] != 0) -- continue; -- -- for (ac = 0; ac < n_acs; ac++) { -- int ac_queue = sdata->vif.hw_queue[ac]; -- -- if (ac_queue == queue || -- (sdata->vif.cab_queue == queue && -- local->queue_stop_reasons[ac_queue] == 0 && -- skb_queue_empty(&local->pending[ac_queue]))) -- netif_wake_subqueue(sdata->dev, ac); -- } -- } --} -- - static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue, - enum queue_stop_reason reason, - bool refcounted, -@@ -507,11 +474,7 @@ static void __ieee80211_wake_queue(struc - /* someone still has this queue stopped */ - return; - -- if (skb_queue_empty(&local->pending[queue])) { -- rcu_read_lock(); -- ieee80211_propagate_queue_wake(local, queue); -- rcu_read_unlock(); -- } else -+ if (!skb_queue_empty(&local->pending[queue])) - tasklet_schedule(&local->tx_pending_tasklet); - - /* -@@ -521,12 +484,10 @@ static void __ieee80211_wake_queue(struc - * release someone's lock, but it is fine because all the callers of - * __ieee80211_wake_queue call it right before releasing the lock. - */ -- if (local->ops->wake_tx_queue) { -- if (reason == IEEE80211_QUEUE_STOP_REASON_DRIVER) -- tasklet_schedule(&local->wake_txqs_tasklet); -- else -- _ieee80211_wake_txqs(local, flags); -- } -+ if (reason == IEEE80211_QUEUE_STOP_REASON_DRIVER) -+ tasklet_schedule(&local->wake_txqs_tasklet); -+ else -+ _ieee80211_wake_txqs(local, flags); - } - - void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, -@@ -554,8 +515,6 @@ static void __ieee80211_stop_queue(struc - bool refcounted) - { - struct ieee80211_local *local = hw_to_local(hw); -- struct ieee80211_sub_if_data *sdata; -- int n_acs = IEEE80211_NUM_ACS; - - trace_stop_queue(local, queue, reason); - -@@ -567,27 +526,7 @@ static void __ieee80211_stop_queue(struc - else - local->q_stop_reasons[queue][reason]++; - -- if (__test_and_set_bit(reason, &local->queue_stop_reasons[queue])) -- return; -- -- if (local->hw.queues < IEEE80211_NUM_ACS) -- n_acs = 1; -- -- rcu_read_lock(); -- list_for_each_entry_rcu(sdata, &local->interfaces, list) { -- int ac; -- -- if (!sdata->dev) -- continue; -- -- for (ac = 0; ac < n_acs; ac++) { -- if (!local->ops->wake_tx_queue && -- (sdata->vif.hw_queue[ac] == queue || -- sdata->vif.cab_queue == queue)) -- netif_stop_subqueue(sdata->dev, ac); -- } -- } -- rcu_read_unlock(); -+ set_bit(reason, &local->queue_stop_reasons[queue]); - } - - void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, ---- a/net/mac80211/wme.c -+++ b/net/mac80211/wme.c -@@ -122,6 +122,9 @@ u16 ieee80211_select_queue_80211(struct - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - u8 *p; - -+ /* Ensure hash is set prior to potential SW encryption */ -+ skb_get_hash(skb); -+ - if ((info->control.flags & IEEE80211_TX_CTRL_DONT_REORDER) || - local->hw.queues < IEEE80211_NUM_ACS) - return 0; -@@ -141,13 +144,16 @@ u16 ieee80211_select_queue_80211(struct - return ieee80211_downgrade_queue(sdata, NULL, skb); - } - --u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, -- struct sta_info *sta, struct sk_buff *skb) -+u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, struct sk_buff *skb) - { - const struct ethhdr *eth = (void *)skb->data; - struct mac80211_qos_map *qos_map; - bool qos; - -+ /* Ensure hash is set prior to potential SW encryption */ -+ skb_get_hash(skb); -+ - /* all mesh/ocb stations are required to support WME */ - if ((sdata->vif.type == NL80211_IFTYPE_MESH_POINT && - !is_multicast_ether_addr(eth->h_dest)) || -@@ -178,59 +184,6 @@ u16 __ieee80211_select_queue(struct ieee - return ieee80211_downgrade_queue(sdata, sta, skb); - } - -- --/* Indicate which queue to use. */ --u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, -- struct sk_buff *skb) --{ -- struct ieee80211_local *local = sdata->local; -- struct sta_info *sta = NULL; -- const u8 *ra = NULL; -- u16 ret; -- -- /* when using iTXQ, we can do this later */ -- if (local->ops->wake_tx_queue) -- return 0; -- -- if (local->hw.queues < IEEE80211_NUM_ACS || skb->len < 6) { -- skb->priority = 0; /* required for correct WPA/11i MIC */ -- return 0; -- } -- -- rcu_read_lock(); -- switch (sdata->vif.type) { -- case NL80211_IFTYPE_AP_VLAN: -- sta = rcu_dereference(sdata->u.vlan.sta); -- if (sta) -- break; -- fallthrough; -- case NL80211_IFTYPE_AP: -- ra = skb->data; -- break; -- case NL80211_IFTYPE_STATION: -- /* might be a TDLS station */ -- sta = sta_info_get(sdata, skb->data); -- if (sta) -- break; -- -- ra = sdata->deflink.u.mgd.bssid; -- break; -- case NL80211_IFTYPE_ADHOC: -- ra = skb->data; -- break; -- default: -- break; -- } -- -- if (!sta && ra && !is_multicast_ether_addr(ra)) -- sta = sta_info_get(sdata, ra); -- -- ret = __ieee80211_select_queue(sdata, sta, skb); -- -- rcu_read_unlock(); -- return ret; --} -- - /** - * ieee80211_set_qos_hdr - Fill in the QoS header if there is one. - * ---- a/net/mac80211/wme.h -+++ b/net/mac80211/wme.h -@@ -13,10 +13,8 @@ - u16 ieee80211_select_queue_80211(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb, - struct ieee80211_hdr *hdr); --u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, -- struct sta_info *sta, struct sk_buff *skb); - u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, -- struct sk_buff *skb); -+ struct sta_info *sta, struct sk_buff *skb); - void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb); - diff --git a/package/kernel/mac80211/patches/subsys/306-04-v6.2-wifi-realtek-remove-duplicated-wake_tx_queue.patch b/package/kernel/mac80211/patches/subsys/306-04-v6.2-wifi-realtek-remove-duplicated-wake_tx_queue.patch deleted file mode 100644 index f0dfc75a788727..00000000000000 --- a/package/kernel/mac80211/patches/subsys/306-04-v6.2-wifi-realtek-remove-duplicated-wake_tx_queue.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Johannes Berg -Date: Mon, 10 Oct 2022 19:17:46 +0200 -Subject: [PATCH] wifi: realtek: remove duplicated wake_tx_queue - -By accident, the previous patch duplicated the initialization -of the wake_tx_queue callback. Fix that by removing the new -initializations. - -Fixes: a790cc3a4fad ("wifi: mac80211: add wake_tx_queue callback to drivers") -Signed-off-by: Johannes Berg ---- - ---- a/drivers/net/wireless/realtek/rtw88/mac80211.c -+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c -@@ -896,7 +896,6 @@ static void rtw_ops_sta_rc_update(struct - - const struct ieee80211_ops rtw_ops = { - .tx = rtw_ops_tx, -- .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .wake_tx_queue = rtw_ops_wake_tx_queue, - .start = rtw_ops_start, - .stop = rtw_ops_stop, ---- a/drivers/net/wireless/realtek/rtw89/mac80211.c -+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c -@@ -918,7 +918,6 @@ static int rtw89_ops_set_tid_config(stru - - const struct ieee80211_ops rtw89_ops = { - .tx = rtw89_ops_tx, -- .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .wake_tx_queue = rtw89_ops_wake_tx_queue, - .start = rtw89_ops_start, - .stop = rtw89_ops_stop, diff --git a/package/kernel/mac80211/patches/subsys/310-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch b/package/kernel/mac80211/patches/subsys/310-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch new file mode 100644 index 00000000000000..f362751e0a3ba4 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/310-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch @@ -0,0 +1,219 @@ +From: Felix Fietkau +Date: Fri, 30 Jun 2023 13:11:51 +0200 +Subject: [PATCH] mac80211: split mesh fast tx cache into + local/proxied/forwarded + +Depending on the origin of the packets (and their SA), 802.11 + mesh headers +could be filled in differently. In order to properly deal with that, add a +new field to the lookup key, indicating the type (local, proxied or +forwarded). This can fix spurious packet drop issues that depend on the order +in which nodes/hosts communicate with each other. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/mesh.c ++++ b/net/mac80211/mesh.c +@@ -765,6 +765,9 @@ bool ieee80211_mesh_xmit_fast(struct iee + struct sk_buff *skb, u32 ctrl_flags) + { + struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; ++ struct ieee80211_mesh_fast_tx_key key = { ++ .type = MESH_FAST_TX_TYPE_LOCAL ++ }; + struct ieee80211_mesh_fast_tx *entry; + struct ieee80211s_hdr *meshhdr; + u8 sa[ETH_ALEN] __aligned(2); +@@ -800,7 +803,10 @@ bool ieee80211_mesh_xmit_fast(struct iee + return false; + } + +- entry = mesh_fast_tx_get(sdata, skb->data); ++ ether_addr_copy(key.addr, skb->data); ++ if (!ether_addr_equal(skb->data + ETH_ALEN, sdata->vif.addr)) ++ key.type = MESH_FAST_TX_TYPE_PROXIED; ++ entry = mesh_fast_tx_get(sdata, &key); + if (!entry) + return false; + +--- a/net/mac80211/mesh.h ++++ b/net/mac80211/mesh.h +@@ -134,9 +134,33 @@ struct mesh_path { + #define MESH_FAST_TX_CACHE_TIMEOUT 8000 /* msecs */ + + /** ++ * enum ieee80211_mesh_fast_tx_type - cached mesh fast tx entry type ++ * ++ * @MESH_FAST_TX_TYPE_LOCAL: tx from the local vif address as SA ++ * @MESH_FAST_TX_TYPE_PROXIED: local tx with a different SA (e.g. bridged) ++ * @MESH_FAST_TX_TYPE_FORWARDED: forwarded from a different mesh point ++ */ ++enum ieee80211_mesh_fast_tx_type { ++ MESH_FAST_TX_TYPE_LOCAL, ++ MESH_FAST_TX_TYPE_PROXIED, ++ MESH_FAST_TX_TYPE_FORWARDED, ++}; ++ ++/** ++ * struct ieee80211_mesh_fast_tx_key - cached mesh fast tx entry key ++ * ++ * @addr: The Ethernet DA for this entry ++ * @type: cache entry type ++ */ ++struct ieee80211_mesh_fast_tx_key { ++ u8 addr[ETH_ALEN] __aligned(2); ++ enum ieee80211_mesh_fast_tx_type type; ++}; ++ ++/** + * struct ieee80211_mesh_fast_tx - cached mesh fast tx entry + * @rhash: rhashtable pointer +- * @addr_key: The Ethernet DA which is the key for this entry ++ * @key: the lookup key for this cache entry + * @fast_tx: base fast_tx data + * @hdr: cached mesh and rfc1042 headers + * @hdrlen: length of mesh + rfc1042 +@@ -147,7 +171,7 @@ struct mesh_path { + */ + struct ieee80211_mesh_fast_tx { + struct rhash_head rhash; +- u8 addr_key[ETH_ALEN] __aligned(2); ++ struct ieee80211_mesh_fast_tx_key key; + + struct ieee80211_fast_tx fast_tx; + u8 hdr[sizeof(struct ieee80211s_hdr) + sizeof(rfc1042_header)]; +@@ -334,7 +358,8 @@ void mesh_path_tx_root_frame(struct ieee + + bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt); + struct ieee80211_mesh_fast_tx * +-mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, const u8 *addr); ++mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, ++ struct ieee80211_mesh_fast_tx_key *key); + bool ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata, + struct sk_buff *skb, u32 ctrl_flags); + void mesh_fast_tx_cache(struct ieee80211_sub_if_data *sdata, +--- a/net/mac80211/mesh_pathtbl.c ++++ b/net/mac80211/mesh_pathtbl.c +@@ -36,8 +36,8 @@ static const struct rhashtable_params me + static const struct rhashtable_params fast_tx_rht_params = { + .nelem_hint = 10, + .automatic_shrinking = true, +- .key_len = ETH_ALEN, +- .key_offset = offsetof(struct ieee80211_mesh_fast_tx, addr_key), ++ .key_len = sizeof(struct ieee80211_mesh_fast_tx_key), ++ .key_offset = offsetof(struct ieee80211_mesh_fast_tx, key), + .head_offset = offsetof(struct ieee80211_mesh_fast_tx, rhash), + .hashfn = mesh_table_hash, + }; +@@ -426,20 +426,21 @@ static void mesh_fast_tx_entry_free(stru + } + + struct ieee80211_mesh_fast_tx * +-mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, const u8 *addr) ++mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, ++ struct ieee80211_mesh_fast_tx_key *key) + { + struct ieee80211_mesh_fast_tx *entry; + struct mesh_tx_cache *cache; + + cache = &sdata->u.mesh.tx_cache; +- entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params); ++ entry = rhashtable_lookup(&cache->rht, key, fast_tx_rht_params); + if (!entry) + return NULL; + + if (!(entry->mpath->flags & MESH_PATH_ACTIVE) || + mpath_expired(entry->mpath)) { + spin_lock_bh(&cache->walk_lock); +- entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params); ++ entry = rhashtable_lookup(&cache->rht, key, fast_tx_rht_params); + if (entry) + mesh_fast_tx_entry_free(cache, entry); + spin_unlock_bh(&cache->walk_lock); +@@ -484,18 +485,24 @@ void mesh_fast_tx_cache(struct ieee80211 + if (!sta) + return; + ++ build.key.type = MESH_FAST_TX_TYPE_LOCAL; + if ((meshhdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) { + /* This is required to keep the mppath alive */ + mppath = mpp_path_lookup(sdata, meshhdr->eaddr1); + if (!mppath) + return; + build.mppath = mppath; ++ if (!ether_addr_equal(meshhdr->eaddr2, sdata->vif.addr)) ++ build.key.type = MESH_FAST_TX_TYPE_PROXIED; + } else if (ieee80211_has_a4(hdr->frame_control)) { + mppath = mpath; + } else { + return; + } + ++ if (!ether_addr_equal(hdr->addr4, sdata->vif.addr)) ++ build.key.type = MESH_FAST_TX_TYPE_FORWARDED; ++ + /* rate limit, in case fast xmit can't be enabled */ + if (mppath->fast_tx_check == jiffies) + return; +@@ -542,7 +549,7 @@ void mesh_fast_tx_cache(struct ieee80211 + } + } + +- memcpy(build.addr_key, mppath->dst, ETH_ALEN); ++ memcpy(build.key.addr, mppath->dst, ETH_ALEN); + build.timestamp = jiffies; + build.fast_tx.band = info->band; + build.fast_tx.da_offs = offsetof(struct ieee80211_hdr, addr3); +@@ -644,13 +651,19 @@ void mesh_fast_tx_flush_addr(struct ieee + const u8 *addr) + { + struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache; ++ struct ieee80211_mesh_fast_tx_key key = {}; + struct ieee80211_mesh_fast_tx *entry; ++ int i; + ++ ether_addr_copy(key.addr, addr); + cache = &sdata->u.mesh.tx_cache; + spin_lock_bh(&cache->walk_lock); +- entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params); +- if (entry) +- mesh_fast_tx_entry_free(cache, entry); ++ for (i = MESH_FAST_TX_TYPE_LOCAL; i < MESH_FAST_TX_TYPE_FORWARDED; i++) { ++ key.type = i; ++ entry = rhashtable_lookup(&cache->rht, &key, fast_tx_rht_params); ++ if (entry) ++ mesh_fast_tx_entry_free(cache, entry); ++ } + spin_unlock_bh(&cache->walk_lock); + } + +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -2727,7 +2727,10 @@ ieee80211_rx_mesh_fast_forward(struct ie + struct sk_buff *skb, int hdrlen) + { + struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; +- struct ieee80211_mesh_fast_tx *entry = NULL; ++ struct ieee80211_mesh_fast_tx_key key = { ++ .type = MESH_FAST_TX_TYPE_FORWARDED ++ }; ++ struct ieee80211_mesh_fast_tx *entry; + struct ieee80211s_hdr *mesh_hdr; + struct tid_ampdu_tx *tid_tx; + struct sta_info *sta; +@@ -2736,9 +2739,13 @@ ieee80211_rx_mesh_fast_forward(struct ie + + mesh_hdr = (struct ieee80211s_hdr *)(skb->data + sizeof(eth)); + if ((mesh_hdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) +- entry = mesh_fast_tx_get(sdata, mesh_hdr->eaddr1); ++ ether_addr_copy(key.addr, mesh_hdr->eaddr1); + else if (!(mesh_hdr->flags & MESH_FLAGS_AE)) +- entry = mesh_fast_tx_get(sdata, skb->data); ++ ether_addr_copy(key.addr, skb->data); ++ else ++ return false; ++ ++ entry = mesh_fast_tx_get(sdata, &key); + if (!entry) + return false; + diff --git a/package/kernel/mac80211/patches/subsys/310-v6.2-mac80211-add-support-for-restricting-netdev-features.patch b/package/kernel/mac80211/patches/subsys/310-v6.2-mac80211-add-support-for-restricting-netdev-features.patch deleted file mode 100644 index 812b12189c4754..00000000000000 --- a/package/kernel/mac80211/patches/subsys/310-v6.2-mac80211-add-support-for-restricting-netdev-features.patch +++ /dev/null @@ -1,506 +0,0 @@ -From: Felix Fietkau -Date: Sun, 9 Oct 2022 20:15:46 +0200 -Subject: [PATCH] mac80211: add support for restricting netdev features per vif - -This can be used to selectively disable feature flags for checksum offload, -scatter/gather or GSO by changing vif->netdev_features. -Removing features from vif->netdev_features does not affect the netdev -features themselves, but instead fixes up skbs in the tx path so that the -offloads are not needed in the driver. - -Aside from making it easier to deal with vif type based hardware limitations, -this also makes it possible to optimize performance on hardware without native -GSO support by declaring GSO support in hw->netdev_features and removing it -from vif->netdev_features. This allows mac80211 to handle GSO segmentation -after the sta lookup, but before itxq enqueue, thus reducing the number of -unnecessary sta lookups, as well as some other per-packet processing. - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/fq_impl.h -+++ b/include/net/fq_impl.h -@@ -200,6 +200,7 @@ static void fq_tin_enqueue(struct fq *fq - fq_skb_free_t free_func) - { - struct fq_flow *flow; -+ struct sk_buff *next; - bool oom; - - lockdep_assert_held(&fq->lock); -@@ -214,11 +215,15 @@ static void fq_tin_enqueue(struct fq *fq - } - - flow->tin = tin; -- flow->backlog += skb->len; -- tin->backlog_bytes += skb->len; -- tin->backlog_packets++; -- fq->memory_usage += skb->truesize; -- fq->backlog++; -+ skb_list_walk_safe(skb, skb, next) { -+ skb_mark_not_on_list(skb); -+ flow->backlog += skb->len; -+ tin->backlog_bytes += skb->len; -+ tin->backlog_packets++; -+ fq->memory_usage += skb->truesize; -+ fq->backlog++; -+ __skb_queue_tail(&flow->queue, skb); -+ } - - if (list_empty(&flow->flowchain)) { - flow->deficit = fq->quantum; -@@ -226,7 +231,6 @@ static void fq_tin_enqueue(struct fq *fq - &tin->new_flows); - } - -- __skb_queue_tail(&flow->queue, skb); - oom = (fq->memory_usage > fq->memory_limit); - while (fq->backlog > fq->limit || oom) { - flow = fq_find_fattest_flow(fq); ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -1807,6 +1807,10 @@ struct ieee80211_vif_cfg { - * @addr: address of this interface - * @p2p: indicates whether this AP or STA interface is a p2p - * interface, i.e. a GO or p2p-sta respectively -+ * @netdev_features: tx netdev features supported by the hardware for this -+ * vif. mac80211 initializes this to hw->netdev_features, and the driver -+ * can mask out specific tx features. mac80211 will handle software fixup -+ * for masked offloads (GSO, CSUM) - * @driver_flags: flags/capabilities the driver has for this interface, - * these need to be set (or cleared) when the interface is added - * or, if supported by the driver, the interface type is changed -@@ -1846,6 +1850,7 @@ struct ieee80211_vif { - - struct ieee80211_txq *txq; - -+ netdev_features_t netdev_features; - u32 driver_flags; - u32 offload_flags; - ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -2181,6 +2181,7 @@ int ieee80211_if_add(struct ieee80211_lo - ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE; - ndev->hw_features |= ndev->features & - MAC80211_SUPPORTED_FEATURES_TX; -+ sdata->vif.netdev_features = local->hw.netdev_features; - - netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops); - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1356,7 +1356,11 @@ static struct txq_info *ieee80211_get_tx - - static void ieee80211_set_skb_enqueue_time(struct sk_buff *skb) - { -- IEEE80211_SKB_CB(skb)->control.enqueue_time = codel_get_time(); -+ struct sk_buff *next; -+ codel_time_t now = codel_get_time(); -+ -+ skb_list_walk_safe(skb, skb, next) -+ IEEE80211_SKB_CB(skb)->control.enqueue_time = now; - } - - static u32 codel_skb_len_func(const struct sk_buff *skb) -@@ -3579,55 +3583,79 @@ ieee80211_xmit_fast_finish(struct ieee80 - return TX_CONTINUE; - } - --static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -- struct sta_info *sta, -- struct ieee80211_fast_tx *fast_tx, -- struct sk_buff *skb) -+static netdev_features_t -+ieee80211_sdata_netdev_features(struct ieee80211_sub_if_data *sdata) - { -- struct ieee80211_local *local = sdata->local; -- u16 ethertype = (skb->data[12] << 8) | skb->data[13]; -- int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); -- int hw_headroom = sdata->local->hw.extra_tx_headroom; -- struct ethhdr eth; -- struct ieee80211_tx_info *info; -- struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; -- struct ieee80211_tx_data tx; -- ieee80211_tx_result r; -- struct tid_ampdu_tx *tid_tx = NULL; -- u8 tid = IEEE80211_NUM_TIDS; -+ if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN) -+ return sdata->vif.netdev_features; - -- /* control port protocol needs a lot of special handling */ -- if (cpu_to_be16(ethertype) == sdata->control_port_protocol) -- return false; -+ if (!sdata->bss) -+ return 0; - -- /* only RFC 1042 SNAP */ -- if (ethertype < ETH_P_802_3_MIN) -- return false; -+ sdata = container_of(sdata->bss, struct ieee80211_sub_if_data, u.ap); -+ return sdata->vif.netdev_features; -+} - -- /* don't handle TX status request here either */ -- if (skb->sk && skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS) -- return false; -+static struct sk_buff * -+ieee80211_tx_skb_fixup(struct sk_buff *skb, netdev_features_t features) -+{ -+ if (skb_is_gso(skb)) { -+ struct sk_buff *segs; - -- if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { -- tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -- tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); -- if (tid_tx) { -- if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) -- return false; -- if (tid_tx->timeout) -- tid_tx->last_tx = jiffies; -- } -+ segs = skb_gso_segment(skb, features); -+ if (!segs) -+ return skb; -+ if (IS_ERR(segs)) -+ goto free; -+ -+ consume_skb(skb); -+ return segs; - } - -- /* after this point (skb is modified) we cannot return false */ -+ if (skb_needs_linearize(skb, features) && __skb_linearize(skb)) -+ goto free; -+ -+ if (skb->ip_summed == CHECKSUM_PARTIAL) { -+ int ofs = skb_checksum_start_offset(skb); -+ -+ if (skb->encapsulation) -+ skb_set_inner_transport_header(skb, ofs); -+ else -+ skb_set_transport_header(skb, ofs); -+ -+ if (skb_csum_hwoffload_help(skb, features)) -+ goto free; -+ } -+ -+ skb_mark_not_on_list(skb); -+ return skb; -+ -+free: -+ kfree_skb(skb); -+ return NULL; -+} -+ -+static void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, -+ struct ieee80211_fast_tx *fast_tx, -+ struct sk_buff *skb, u8 tid, bool ampdu) -+{ -+ struct ieee80211_local *local = sdata->local; -+ struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; -+ struct ieee80211_tx_info *info; -+ struct ieee80211_tx_data tx; -+ ieee80211_tx_result r; -+ int hw_headroom = sdata->local->hw.extra_tx_headroom; -+ int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); -+ struct ethhdr eth; - - skb = skb_share_check(skb, GFP_ATOMIC); - if (unlikely(!skb)) -- return true; -+ return; - - if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) && - ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb)) -- return true; -+ return; - - /* will not be crypto-handled beyond what we do here, so use false - * as the may-encrypt argument for the resize to not account for -@@ -3636,10 +3664,8 @@ static bool ieee80211_xmit_fast(struct i - if (unlikely(ieee80211_skb_resize(sdata, skb, - max_t(int, extra_head + hw_headroom - - skb_headroom(skb), 0), -- ENCRYPT_NO))) { -- kfree_skb(skb); -- return true; -- } -+ ENCRYPT_NO))) -+ goto free; - - memcpy(ð, skb->data, ETH_HLEN - 2); - hdr = skb_push(skb, extra_head); -@@ -3653,7 +3679,7 @@ static bool ieee80211_xmit_fast(struct i - info->control.vif = &sdata->vif; - info->flags = IEEE80211_TX_CTL_FIRST_FRAGMENT | - IEEE80211_TX_CTL_DONTFRAG | -- (tid_tx ? IEEE80211_TX_CTL_AMPDU : 0); -+ (ampdu ? IEEE80211_TX_CTL_AMPDU : 0); - info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT | - u32_encode_bits(IEEE80211_LINK_UNSPECIFIED, - IEEE80211_TX_CTRL_MLO_LINK); -@@ -3677,16 +3703,14 @@ static bool ieee80211_xmit_fast(struct i - tx.key = fast_tx->key; - - if (ieee80211_queue_skb(local, sdata, sta, skb)) -- return true; -+ return; - - tx.skb = skb; - r = ieee80211_xmit_fast_finish(sdata, sta, fast_tx->pn_offs, - fast_tx->key, &tx); - tx.skb = NULL; -- if (r == TX_DROP) { -- kfree_skb(skb); -- return true; -- } -+ if (r == TX_DROP) -+ goto free; - - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) - sdata = container_of(sdata->bss, -@@ -3694,6 +3718,56 @@ static bool ieee80211_xmit_fast(struct i - - __skb_queue_tail(&tx.skbs, skb); - ieee80211_tx_frags(local, &sdata->vif, sta, &tx.skbs, false); -+ return; -+ -+free: -+ kfree_skb(skb); -+} -+ -+static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, -+ struct ieee80211_fast_tx *fast_tx, -+ struct sk_buff *skb) -+{ -+ u16 ethertype = (skb->data[12] << 8) | skb->data[13]; -+ struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; -+ struct tid_ampdu_tx *tid_tx = NULL; -+ struct sk_buff *next; -+ u8 tid = IEEE80211_NUM_TIDS; -+ -+ /* control port protocol needs a lot of special handling */ -+ if (cpu_to_be16(ethertype) == sdata->control_port_protocol) -+ return false; -+ -+ /* only RFC 1042 SNAP */ -+ if (ethertype < ETH_P_802_3_MIN) -+ return false; -+ -+ /* don't handle TX status request here either */ -+ if (skb->sk && skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS) -+ return false; -+ -+ if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { -+ tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -+ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); -+ if (tid_tx) { -+ if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) -+ return false; -+ if (tid_tx->timeout) -+ tid_tx->last_tx = jiffies; -+ } -+ } -+ -+ /* after this point (skb is modified) we cannot return false */ -+ skb = ieee80211_tx_skb_fixup(skb, ieee80211_sdata_netdev_features(sdata)); -+ if (!skb) -+ return true; -+ -+ skb_list_walk_safe(skb, skb, next) { -+ skb_mark_not_on_list(skb); -+ __ieee80211_xmit_fast(sdata, sta, fast_tx, skb, tid, tid_tx); -+ } -+ - return true; - } - -@@ -4201,31 +4275,14 @@ void __ieee80211_subif_start_xmit(struct - goto out; - } - -- if (skb_is_gso(skb)) { -- struct sk_buff *segs; -- -- segs = skb_gso_segment(skb, 0); -- if (IS_ERR(segs)) { -- goto out_free; -- } else if (segs) { -- consume_skb(skb); -- skb = segs; -- } -- } else { -- /* we cannot process non-linear frames on this path */ -- if (skb_linearize(skb)) -- goto out_free; -- -- /* the frame could be fragmented, software-encrypted, and other -- * things so we cannot really handle checksum offload with it - -- * fix it up in software before we handle anything else. -- */ -- if (skb->ip_summed == CHECKSUM_PARTIAL) { -- skb_set_transport_header(skb, -- skb_checksum_start_offset(skb)); -- if (skb_checksum_help(skb)) -- goto out_free; -- } -+ /* the frame could be fragmented, software-encrypted, and other -+ * things so we cannot really handle checksum or GSO offload. -+ * fix it up in software before we handle anything else. -+ */ -+ skb = ieee80211_tx_skb_fixup(skb, 0); -+ if (!skb) { -+ len = 0; -+ goto out; - } - - skb_list_walk_safe(skb, skb, next) { -@@ -4443,9 +4500,11 @@ normal: - return NETDEV_TX_OK; - } - --static bool ieee80211_tx_8023(struct ieee80211_sub_if_data *sdata, -- struct sk_buff *skb, struct sta_info *sta, -- bool txpending) -+ -+ -+static bool __ieee80211_tx_8023(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, struct sta_info *sta, -+ bool txpending) - { - struct ieee80211_local *local = sdata->local; - struct ieee80211_tx_control control = {}; -@@ -4454,14 +4513,6 @@ static bool ieee80211_tx_8023(struct iee - unsigned long flags; - int q = info->hw_queue; - -- if (sta) -- sk_pacing_shift_update(skb->sk, local->hw.tx_sk_pacing_shift); -- -- ieee80211_tpt_led_trig_tx(local, skb->len); -- -- if (ieee80211_queue_skb(local, sdata, sta, skb)) -- return true; -- - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - - if (local->queue_stop_reasons[q] || -@@ -4488,6 +4539,26 @@ static bool ieee80211_tx_8023(struct iee - return true; - } - -+static bool ieee80211_tx_8023(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, struct sta_info *sta, -+ bool txpending) -+{ -+ struct ieee80211_local *local = sdata->local; -+ struct sk_buff *next; -+ bool ret = true; -+ -+ if (ieee80211_queue_skb(local, sdata, sta, skb)) -+ return true; -+ -+ skb_list_walk_safe(skb, skb, next) { -+ skb_mark_not_on_list(skb); -+ if (!__ieee80211_tx_8023(sdata, skb, sta, txpending)) -+ ret = false; -+ } -+ -+ return ret; -+} -+ - static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata, - struct net_device *dev, struct sta_info *sta, - struct ieee80211_key *key, struct sk_buff *skb) -@@ -4495,9 +4566,13 @@ static void ieee80211_8023_xmit(struct i - struct ieee80211_tx_info *info; - struct ieee80211_local *local = sdata->local; - struct tid_ampdu_tx *tid_tx; -+ struct sk_buff *seg, *next; -+ unsigned int skbs = 0, len = 0; -+ u16 queue; - u8 tid; - -- skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); -+ queue = ieee80211_select_queue(sdata, sta, skb); -+ skb_set_queue_mapping(skb, queue); - - if (unlikely(test_bit(SCAN_SW_SCANNING, &local->scanning)) && - test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) -@@ -4507,9 +4582,6 @@ static void ieee80211_8023_xmit(struct i - if (unlikely(!skb)) - return; - -- info = IEEE80211_SKB_CB(skb); -- memset(info, 0, sizeof(*info)); -- - ieee80211_aggr_check(sdata, sta, skb); - - tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -@@ -4523,22 +4595,20 @@ static void ieee80211_8023_xmit(struct i - return; - } - -- info->flags |= IEEE80211_TX_CTL_AMPDU; - if (tid_tx->timeout) - tid_tx->last_tx = jiffies; - } - -- if (unlikely(skb->sk && -- skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)) -- info->ack_frame_id = ieee80211_store_ack_skb(local, skb, -- &info->flags, NULL); -+ skb = ieee80211_tx_skb_fixup(skb, ieee80211_sdata_netdev_features(sdata)); -+ if (!skb) -+ return; - -- info->hw_queue = sdata->vif.hw_queue[skb_get_queue_mapping(skb)]; -+ info = IEEE80211_SKB_CB(skb); -+ memset(info, 0, sizeof(*info)); -+ if (tid_tx) -+ info->flags |= IEEE80211_TX_CTL_AMPDU; - -- dev_sw_netstats_tx_add(dev, 1, skb->len); -- -- sta->deflink.tx_stats.bytes[skb_get_queue_mapping(skb)] += skb->len; -- sta->deflink.tx_stats.packets[skb_get_queue_mapping(skb)]++; -+ info->hw_queue = sdata->vif.hw_queue[queue]; - - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) - sdata = container_of(sdata->bss, -@@ -4550,6 +4620,24 @@ static void ieee80211_8023_xmit(struct i - if (key) - info->control.hw_key = &key->conf; - -+ skb_list_walk_safe(skb, seg, next) { -+ skbs++; -+ len += seg->len; -+ if (seg != skb) -+ memcpy(IEEE80211_SKB_CB(seg), info, sizeof(*info)); -+ } -+ -+ if (unlikely(skb->sk && -+ skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)) -+ info->ack_frame_id = ieee80211_store_ack_skb(local, skb, -+ &info->flags, NULL); -+ -+ dev_sw_netstats_tx_add(dev, skbs, len); -+ sta->deflink.tx_stats.packets[queue] += skbs; -+ sta->deflink.tx_stats.bytes[queue] += len; -+ -+ ieee80211_tpt_led_trig_tx(local, len); -+ - ieee80211_tx_8023(sdata, skb, sta, false); - - return; -@@ -4591,6 +4679,7 @@ netdev_tx_t ieee80211_subif_start_xmit_8 - key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)) - goto skip_offload; - -+ sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift); - ieee80211_8023_xmit(sdata, dev, sta, key, skb); - goto out; - diff --git a/package/kernel/mac80211/patches/subsys/311-mac80211-fix-mesh-id-corruption-on-32-bit-systems.patch b/package/kernel/mac80211/patches/subsys/311-mac80211-fix-mesh-id-corruption-on-32-bit-systems.patch new file mode 100644 index 00000000000000..c0c774a89d5bb9 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/311-mac80211-fix-mesh-id-corruption-on-32-bit-systems.patch @@ -0,0 +1,62 @@ +From: Felix Fietkau +Date: Tue, 12 Sep 2023 15:09:27 +0200 +Subject: [PATCH] mac80211: fix mesh id corruption on 32 bit systems +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since the changed field size was increased to u64, mesh_bss_info_changed +pulls invalid bits from the first 3 bytes of the mesh id, clears them, and +passes them on to ieee80211_link_info_change_notify, because +ifmsh->mbss_changed was not updated to match its size. +Fix this by turning into ifmsh->mbss_changed into an unsigned long array with +64 bit size. + +Fixes: 15ddba5f4311 ("wifi: mac80211: consistently use u64 for BSS changes") +Reported-by: Thomas Hühn +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -678,7 +678,7 @@ struct ieee80211_if_mesh { + struct timer_list mesh_path_root_timer; + + unsigned long wrkq_flags; +- unsigned long mbss_changed; ++ unsigned long mbss_changed[64 / BITS_PER_LONG]; + + bool userspace_handles_dfs; + +--- a/net/mac80211/mesh.c ++++ b/net/mac80211/mesh.c +@@ -1181,7 +1181,7 @@ void ieee80211_mbss_info_change_notify(s + + /* if we race with running work, worst case this work becomes a noop */ + for_each_set_bit(bit, &bits, sizeof(changed) * BITS_PER_BYTE) +- set_bit(bit, &ifmsh->mbss_changed); ++ set_bit(bit, ifmsh->mbss_changed); + set_bit(MESH_WORK_MBSS_CHANGED, &ifmsh->wrkq_flags); + wiphy_work_queue(sdata->local->hw.wiphy, &sdata->work); + } +@@ -1263,7 +1263,7 @@ void ieee80211_stop_mesh(struct ieee8021 + + /* clear any mesh work (for next join) we may have accrued */ + ifmsh->wrkq_flags = 0; +- ifmsh->mbss_changed = 0; ++ memset(ifmsh->mbss_changed, 0, sizeof(ifmsh->mbss_changed)); + + local->fif_other_bss--; + atomic_dec(&local->iff_allmultis); +@@ -1730,9 +1730,9 @@ static void mesh_bss_info_changed(struct + u32 bit; + u64 changed = 0; + +- for_each_set_bit(bit, &ifmsh->mbss_changed, ++ for_each_set_bit(bit, ifmsh->mbss_changed, + sizeof(changed) * BITS_PER_BYTE) { +- clear_bit(bit, &ifmsh->mbss_changed); ++ clear_bit(bit, ifmsh->mbss_changed); + changed |= BIT(bit); + } + diff --git a/package/kernel/mac80211/patches/subsys/311-v6.2-wifi-mac80211-fix-and-simplify-unencrypted-drop-chec.patch b/package/kernel/mac80211/patches/subsys/311-v6.2-wifi-mac80211-fix-and-simplify-unencrypted-drop-chec.patch deleted file mode 100644 index 804b02eb3063e5..00000000000000 --- a/package/kernel/mac80211/patches/subsys/311-v6.2-wifi-mac80211-fix-and-simplify-unencrypted-drop-chec.patch +++ /dev/null @@ -1,87 +0,0 @@ -From: Felix Fietkau -Date: Thu, 1 Dec 2022 14:57:30 +0100 -Subject: [PATCH] wifi: mac80211: fix and simplify unencrypted drop check for - mesh - -ieee80211_drop_unencrypted is called from ieee80211_rx_h_mesh_fwding and -ieee80211_frame_allowed. - -Since ieee80211_rx_h_mesh_fwding can forward packets for other mesh nodes -and is called earlier, it needs to check the decryptions status and if the -packet is using the control protocol on its own, instead of deferring to -the later call from ieee80211_frame_allowed. - -Because of that, ieee80211_drop_unencrypted has a mesh specific check -that skips over the mesh header in order to check the payload protocol. -This code is invalid when called from ieee80211_frame_allowed, since that -happens after the 802.11->802.3 conversion. - -Fix this by moving the mesh specific check directly into -ieee80211_rx_h_mesh_fwding. - -Signed-off-by: Felix Fietkau -Link: https://lore.kernel.org/r/20221201135730.19723-1-nbd@nbd.name -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2403,7 +2403,6 @@ static int ieee80211_802_1x_port_control - - static int ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc) - { -- struct ieee80211_hdr *hdr = (void *)rx->skb->data; - struct sk_buff *skb = rx->skb; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - -@@ -2414,31 +2413,6 @@ static int ieee80211_drop_unencrypted(st - if (status->flag & RX_FLAG_DECRYPTED) - return 0; - -- /* check mesh EAPOL frames first */ -- if (unlikely(rx->sta && ieee80211_vif_is_mesh(&rx->sdata->vif) && -- ieee80211_is_data(fc))) { -- struct ieee80211s_hdr *mesh_hdr; -- u16 hdr_len = ieee80211_hdrlen(fc); -- u16 ethertype_offset; -- __be16 ethertype; -- -- if (!ether_addr_equal(hdr->addr1, rx->sdata->vif.addr)) -- goto drop_check; -- -- /* make sure fixed part of mesh header is there, also checks skb len */ -- if (!pskb_may_pull(rx->skb, hdr_len + 6)) -- goto drop_check; -- -- mesh_hdr = (struct ieee80211s_hdr *)(skb->data + hdr_len); -- ethertype_offset = hdr_len + ieee80211_get_mesh_hdrlen(mesh_hdr) + -- sizeof(rfc1042_header); -- -- if (skb_copy_bits(rx->skb, ethertype_offset, ðertype, 2) == 0 && -- ethertype == rx->sdata->control_port_protocol) -- return 0; -- } -- --drop_check: - /* Drop unencrypted frames if key is set. */ - if (unlikely(!ieee80211_has_protected(fc) && - !ieee80211_is_any_nullfunc(fc) && -@@ -2892,8 +2866,16 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 - hdr = (struct ieee80211_hdr *) skb->data; - mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); - -- if (ieee80211_drop_unencrypted(rx, hdr->frame_control)) -- return RX_DROP_MONITOR; -+ if (ieee80211_drop_unencrypted(rx, hdr->frame_control)) { -+ int offset = hdrlen + ieee80211_get_mesh_hdrlen(mesh_hdr) + -+ sizeof(rfc1042_header); -+ __be16 ethertype; -+ -+ if (!ether_addr_equal(hdr->addr1, rx->sdata->vif.addr) || -+ skb_copy_bits(rx->skb, offset, ðertype, 2) != 0 || -+ ethertype != rx->sdata->control_port_protocol) -+ return RX_DROP_MONITOR; -+ } - - /* frame is in RMC, don't forward */ - if (ieee80211_is_data(hdr->frame_control) && diff --git a/package/kernel/mac80211/patches/subsys/312-v6.3-wifi-cfg80211-move-A-MSDU-check-in-ieee80211_data_to.patch b/package/kernel/mac80211/patches/subsys/312-v6.3-wifi-cfg80211-move-A-MSDU-check-in-ieee80211_data_to.patch deleted file mode 100644 index f668905ccaae19..00000000000000 --- a/package/kernel/mac80211/patches/subsys/312-v6.3-wifi-cfg80211-move-A-MSDU-check-in-ieee80211_data_to.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Felix Fietkau -Date: Fri, 2 Dec 2022 13:53:11 +0100 -Subject: [PATCH] wifi: cfg80211: move A-MSDU check in - ieee80211_data_to_8023_exthdr - -When parsing the outer A-MSDU header, don't check for inner bridge tunnel -or RFC1042 headers. This is handled by ieee80211_amsdu_to_8023s already. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -631,8 +631,9 @@ int ieee80211_data_to_8023_exthdr(struct - break; - } - -- if (likely(skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)) == 0 && -- ((!is_amsdu && ether_addr_equal(payload.hdr, rfc1042_header) && -+ if (likely(!is_amsdu && -+ skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)) == 0 && -+ ((ether_addr_equal(payload.hdr, rfc1042_header) && - payload.proto != htons(ETH_P_AARP) && - payload.proto != htons(ETH_P_IPX)) || - ether_addr_equal(payload.hdr, bridge_tunnel_header)))) { diff --git a/package/kernel/mac80211/patches/subsys/312-wifi-cfg80211-annotate-iftype_data-pointer-with-spar.patch b/package/kernel/mac80211/patches/subsys/312-wifi-cfg80211-annotate-iftype_data-pointer-with-spar.patch new file mode 100644 index 00000000000000..18420a80cf9e84 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/312-wifi-cfg80211-annotate-iftype_data-pointer-with-spar.patch @@ -0,0 +1,467 @@ +From: Johannes Berg +Date: Mon, 28 Aug 2023 09:54:39 +0200 +Subject: [PATCH] wifi: cfg80211: annotate iftype_data pointer with sparse + +There were are a number of cases in mac80211 and iwlwifi (at +least) that used the sband->iftype_data pointer directly, +instead of using the accessors to find the right array entry +to use. + +Make sparse warn when such a thing is done. + +To not have a lot of casts, add two helper functions/macros + + - ieee80211_set_sband_iftype_data() + - for_each_sband_iftype_data() + +Signed-off-by: Johannes Berg +--- + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -5893,8 +5893,9 @@ static void ath11k_mac_setup_he_cap(stru + ar->mac.iftype[NL80211_BAND_2GHZ], + NL80211_BAND_2GHZ); + band = &ar->mac.sbands[NL80211_BAND_2GHZ]; +- band->iftype_data = ar->mac.iftype[NL80211_BAND_2GHZ]; +- band->n_iftype_data = count; ++ _ieee80211_set_sband_iftype_data(band, ++ ar->mac.iftype[NL80211_BAND_2GHZ], ++ count); + } + + if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP) { +@@ -5902,8 +5903,9 @@ static void ath11k_mac_setup_he_cap(stru + ar->mac.iftype[NL80211_BAND_5GHZ], + NL80211_BAND_5GHZ); + band = &ar->mac.sbands[NL80211_BAND_5GHZ]; +- band->iftype_data = ar->mac.iftype[NL80211_BAND_5GHZ]; +- band->n_iftype_data = count; ++ _ieee80211_set_sband_iftype_data(band, ++ ar->mac.iftype[NL80211_BAND_5GHZ], ++ count); + } + + if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP && +@@ -5912,8 +5914,9 @@ static void ath11k_mac_setup_he_cap(stru + ar->mac.iftype[NL80211_BAND_6GHZ], + NL80211_BAND_6GHZ); + band = &ar->mac.sbands[NL80211_BAND_6GHZ]; +- band->iftype_data = ar->mac.iftype[NL80211_BAND_6GHZ]; +- band->n_iftype_data = count; ++ _ieee80211_set_sband_iftype_data(band, ++ ar->mac.iftype[NL80211_BAND_6GHZ], ++ count); + } + } + +--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +@@ -1075,8 +1075,8 @@ static void iwl_init_he_hw_capab(struct + + memcpy(iftype_data, iwl_he_eht_capa, sizeof(iwl_he_eht_capa)); + +- sband->iftype_data = iftype_data; +- sband->n_iftype_data = ARRAY_SIZE(iwl_he_eht_capa); ++ _ieee80211_set_sband_iftype_data(sband, iftype_data, ++ ARRAY_SIZE(iwl_he_eht_capa)); + + for (i = 0; i < sband->n_iftype_data; i++) + iwl_nvm_fixup_sband_iftd(trans, data, sband, &iftype_data[i], +--- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c +@@ -1119,8 +1119,7 @@ void mt7915_set_stream_he_caps(struct mt + n = mt7915_init_he_caps(phy, NL80211_BAND_2GHZ, data); + + band = &phy->mt76->sband_2g.sband; +- band->iftype_data = data; +- band->n_iftype_data = n; ++ _ieee80211_set_sband_iftype_data(band, data, n); + } + + if (phy->mt76->cap.has_5ghz) { +@@ -1128,8 +1127,7 @@ void mt7915_set_stream_he_caps(struct mt + n = mt7915_init_he_caps(phy, NL80211_BAND_5GHZ, data); + + band = &phy->mt76->sband_5g.sband; +- band->iftype_data = data; +- band->n_iftype_data = n; ++ _ieee80211_set_sband_iftype_data(band, data, n); + } + + if (phy->mt76->cap.has_6ghz) { +@@ -1137,8 +1135,7 @@ void mt7915_set_stream_he_caps(struct mt + n = mt7915_init_he_caps(phy, NL80211_BAND_6GHZ, data); + + band = &phy->mt76->sband_6g.sband; +- band->iftype_data = data; +- band->n_iftype_data = n; ++ _ieee80211_set_sband_iftype_data(band, data, n); + } + } + +--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c +@@ -196,8 +196,7 @@ void mt7921_set_stream_he_caps(struct mt + n = mt7921_init_he_caps(phy, NL80211_BAND_2GHZ, data); + + band = &phy->mt76->sband_2g.sband; +- band->iftype_data = data; +- band->n_iftype_data = n; ++ _ieee80211_set_sband_iftype_data(band, data, n); + } + + if (phy->mt76->cap.has_5ghz) { +@@ -205,16 +204,14 @@ void mt7921_set_stream_he_caps(struct mt + n = mt7921_init_he_caps(phy, NL80211_BAND_5GHZ, data); + + band = &phy->mt76->sband_5g.sband; +- band->iftype_data = data; +- band->n_iftype_data = n; ++ _ieee80211_set_sband_iftype_data(band, data, n); + + if (phy->mt76->cap.has_6ghz) { + data = phy->iftype[NL80211_BAND_6GHZ]; + n = mt7921_init_he_caps(phy, NL80211_BAND_6GHZ, data); + + band = &phy->mt76->sband_6g.sband; +- band->iftype_data = data; +- band->n_iftype_data = n; ++ _ieee80211_set_sband_iftype_data(band, data, n); + } + } + } +--- a/drivers/net/wireless/mediatek/mt76/mt7996/init.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7996/init.c +@@ -823,8 +823,7 @@ __mt7996_set_stream_he_eht_caps(struct m + n++; + } + +- sband->iftype_data = data; +- sband->n_iftype_data = n; ++ _ieee80211_set_sband_iftype_data(sband, data, n); + } + + void mt7996_set_stream_he_eht_caps(struct mt7996_phy *phy) +--- a/drivers/net/wireless/quantenna/qtnfmac/commands.c ++++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c +@@ -1335,7 +1335,7 @@ static int qtnf_cmd_band_fill_iftype(con + return -EINVAL; + } + +- kfree(band->iftype_data); ++ kfree((__force void *)band->iftype_data); + band->iftype_data = NULL; + band->n_iftype_data = tlv->n_iftype_data; + if (band->n_iftype_data == 0) +@@ -1347,7 +1347,8 @@ static int qtnf_cmd_band_fill_iftype(con + band->n_iftype_data = 0; + return -ENOMEM; + } +- band->iftype_data = iftype_data; ++ ++ _ieee80211_set_sband_iftype_data(band, iftype_data, tlv->n_iftype_data); + + for (i = 0; i < band->n_iftype_data; i++) + qtnf_cmd_conv_iftype(iftype_data++, &tlv->iftype_data[i]); +--- a/drivers/net/wireless/quantenna/qtnfmac/core.c ++++ b/drivers/net/wireless/quantenna/qtnfmac/core.c +@@ -549,7 +549,7 @@ static void qtnf_core_mac_detach(struct + if (!wiphy->bands[band]) + continue; + +- kfree(wiphy->bands[band]->iftype_data); ++ kfree((__force void *)wiphy->bands[band]->iftype_data); + wiphy->bands[band]->n_iftype_data = 0; + + kfree(wiphy->bands[band]->channels); +--- a/drivers/net/wireless/realtek/rtw89/core.c ++++ b/drivers/net/wireless/realtek/rtw89/core.c +@@ -3328,8 +3328,7 @@ static void rtw89_init_he_cap(struct rtw + idx++; + } + +- sband->iftype_data = iftype_data; +- sband->n_iftype_data = idx; ++ _ieee80211_set_sband_iftype_data(sband, iftype_data, idx); + } + + static int rtw89_core_set_supported_band(struct rtw89_dev *rtwdev) +@@ -3374,11 +3373,11 @@ err: + hw->wiphy->bands[NL80211_BAND_5GHZ] = NULL; + hw->wiphy->bands[NL80211_BAND_6GHZ] = NULL; + if (sband_2ghz) +- kfree(sband_2ghz->iftype_data); ++ kfree((__force void *)sband_2ghz->iftype_data); + if (sband_5ghz) +- kfree(sband_5ghz->iftype_data); ++ kfree((__force void *)sband_5ghz->iftype_data); + if (sband_6ghz) +- kfree(sband_6ghz->iftype_data); ++ kfree((__force void *)sband_6ghz->iftype_data); + kfree(sband_2ghz); + kfree(sband_5ghz); + kfree(sband_6ghz); +@@ -3390,11 +3389,11 @@ static void rtw89_core_clr_supported_ban + struct ieee80211_hw *hw = rtwdev->hw; + + if (hw->wiphy->bands[NL80211_BAND_2GHZ]) +- kfree(hw->wiphy->bands[NL80211_BAND_2GHZ]->iftype_data); ++ kfree((__force void *)hw->wiphy->bands[NL80211_BAND_2GHZ]->iftype_data); + if (hw->wiphy->bands[NL80211_BAND_5GHZ]) +- kfree(hw->wiphy->bands[NL80211_BAND_5GHZ]->iftype_data); ++ kfree((__force void *)hw->wiphy->bands[NL80211_BAND_5GHZ]->iftype_data); + if (hw->wiphy->bands[NL80211_BAND_6GHZ]) +- kfree(hw->wiphy->bands[NL80211_BAND_6GHZ]->iftype_data); ++ kfree((__force void *)hw->wiphy->bands[NL80211_BAND_6GHZ]->iftype_data); + kfree(hw->wiphy->bands[NL80211_BAND_2GHZ]); + kfree(hw->wiphy->bands[NL80211_BAND_5GHZ]); + kfree(hw->wiphy->bands[NL80211_BAND_6GHZ]); +--- a/drivers/net/wireless/realtek/rtw89/regd.c ++++ b/drivers/net/wireless/realtek/rtw89/regd.c +@@ -376,7 +376,7 @@ bottom: + return; + + wiphy->bands[NL80211_BAND_6GHZ] = NULL; +- kfree(sband->iftype_data); ++ kfree((__force void *)sband->iftype_data); + kfree(sband); + } + +--- a/drivers/net/wireless/virtual/mac80211_hwsim.c ++++ b/drivers/net/wireless/virtual/mac80211_hwsim.c +@@ -4900,25 +4900,19 @@ static const struct ieee80211_sband_ifty + + static void mac80211_hwsim_sband_capab(struct ieee80211_supported_band *sband) + { +- u16 n_iftype_data; +- +- if (sband->band == NL80211_BAND_2GHZ) { +- n_iftype_data = ARRAY_SIZE(sband_capa_2ghz); +- sband->iftype_data = +- (struct ieee80211_sband_iftype_data *)sband_capa_2ghz; +- } else if (sband->band == NL80211_BAND_5GHZ) { +- n_iftype_data = ARRAY_SIZE(sband_capa_5ghz); +- sband->iftype_data = +- (struct ieee80211_sband_iftype_data *)sband_capa_5ghz; +- } else if (sband->band == NL80211_BAND_6GHZ) { +- n_iftype_data = ARRAY_SIZE(sband_capa_6ghz); +- sband->iftype_data = +- (struct ieee80211_sband_iftype_data *)sband_capa_6ghz; +- } else { +- return; ++ switch (sband->band) { ++ case NL80211_BAND_2GHZ: ++ ieee80211_set_sband_iftype_data(sband, sband_capa_2ghz); ++ break; ++ case NL80211_BAND_5GHZ: ++ ieee80211_set_sband_iftype_data(sband, sband_capa_5ghz); ++ break; ++ case NL80211_BAND_6GHZ: ++ ieee80211_set_sband_iftype_data(sband, sband_capa_6ghz); ++ break; ++ default: ++ break; + } +- +- sband->n_iftype_data = n_iftype_data; + } + + #ifdef CPTCFG_MAC80211_MESH +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -415,6 +415,19 @@ struct ieee80211_sta_eht_cap { + u8 eht_ppe_thres[IEEE80211_EHT_PPE_THRES_MAX_LEN]; + }; + ++/* sparse defines __CHECKER__; see Documentation/dev-tools/sparse.rst */ ++#ifdef __CHECKER__ ++/* ++ * This is used to mark the sband->iftype_data pointer which is supposed ++ * to be an array with special access semantics (per iftype), but a lot ++ * of code got it wrong in the past, so with this marking sparse will be ++ * noisy when the pointer is used directly. ++ */ ++# define __iftd __attribute__((noderef, address_space(__iftype_data))) ++#else ++# define __iftd ++#endif /* __CHECKER__ */ ++ + /** + * struct ieee80211_sband_iftype_data - sband data per interface type + * +@@ -548,10 +561,48 @@ struct ieee80211_supported_band { + struct ieee80211_sta_s1g_cap s1g_cap; + struct ieee80211_edmg edmg_cap; + u16 n_iftype_data; +- const struct ieee80211_sband_iftype_data *iftype_data; ++ const struct ieee80211_sband_iftype_data __iftd *iftype_data; + }; + + /** ++ * _ieee80211_set_sband_iftype_data - set sband iftype data array ++ * @sband: the sband to initialize ++ * @iftd: the iftype data array pointer ++ * @n_iftd: the length of the iftype data array ++ * ++ * Set the sband iftype data array; use this where the length cannot ++ * be derived from the ARRAY_SIZE() of the argument, but prefer ++ * ieee80211_set_sband_iftype_data() where it can be used. ++ */ ++static inline void ++_ieee80211_set_sband_iftype_data(struct ieee80211_supported_band *sband, ++ const struct ieee80211_sband_iftype_data *iftd, ++ u16 n_iftd) ++{ ++ sband->iftype_data = (const void __iftd __force *)iftd; ++ sband->n_iftype_data = n_iftd; ++} ++ ++/** ++ * ieee80211_set_sband_iftype_data - set sband iftype data array ++ * @sband: the sband to initialize ++ * @iftd: the iftype data array ++ */ ++#define ieee80211_set_sband_iftype_data(sband, iftd) \ ++ _ieee80211_set_sband_iftype_data(sband, iftd, ARRAY_SIZE(iftd)) ++ ++/** ++ * for_each_sband_iftype_data - iterate sband iftype data entries ++ * @sband: the sband whose iftype_data array to iterate ++ * @i: iterator counter ++ * @iftd: iftype data pointer to set ++ */ ++#define for_each_sband_iftype_data(sband, i, iftd) \ ++ for (i = 0, iftd = (const void __force *)&(sband)->iftype_data[i]; \ ++ i < (sband)->n_iftype_data; \ ++ i++, iftd = (const void __force *)&(sband)->iftype_data[i]) ++ ++/** + * ieee80211_get_sband_iftype_data - return sband data for a given iftype + * @sband: the sband to search for the STA on + * @iftype: enum nl80211_iftype +@@ -562,6 +613,7 @@ static inline const struct ieee80211_sba + ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband, + u8 iftype) + { ++ const struct ieee80211_sband_iftype_data *data; + int i; + + if (WARN_ON(iftype >= NL80211_IFTYPE_MAX)) +@@ -570,10 +622,7 @@ ieee80211_get_sband_iftype_data(const st + if (iftype == NL80211_IFTYPE_AP_VLAN) + iftype = NL80211_IFTYPE_AP; + +- for (i = 0; i < sband->n_iftype_data; i++) { +- const struct ieee80211_sband_iftype_data *data = +- &sband->iftype_data[i]; +- ++ for_each_sband_iftype_data(sband, i, data) { + if (data->types_mask & BIT(iftype)) + return data; + } +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -1055,6 +1055,7 @@ int ieee80211_register_hw(struct ieee802 + supp_he = false; + supp_eht = false; + for (band = 0; band < NUM_NL80211_BANDS; band++) { ++ const struct ieee80211_sband_iftype_data *iftd; + struct ieee80211_supported_band *sband; + + sband = local->hw.wiphy->bands[band]; +@@ -1101,11 +1102,7 @@ int ieee80211_register_hw(struct ieee802 + supp_ht = supp_ht || sband->ht_cap.ht_supported; + supp_vht = supp_vht || sband->vht_cap.vht_supported; + +- for (i = 0; i < sband->n_iftype_data; i++) { +- const struct ieee80211_sband_iftype_data *iftd; +- +- iftd = &sband->iftype_data[i]; +- ++ for_each_sband_iftype_data(sband, i, iftd) { + supp_he = supp_he || iftd->he_cap.has_he; + supp_eht = supp_eht || iftd->eht_cap.has_eht; + } +--- a/net/wireless/chan.c ++++ b/net/wireless/chan.c +@@ -6,7 +6,7 @@ + * + * Copyright 2009 Johannes Berg + * Copyright 2013-2014 Intel Mobile Communications GmbH +- * Copyright 2018-2022 Intel Corporation ++ * Copyright 2018-2023 Intel Corporation + */ + + #include +@@ -1162,8 +1162,7 @@ bool cfg80211_chandef_usable(struct wiph + if (!sband) + return false; + +- for (i = 0; i < sband->n_iftype_data; i++) { +- iftd = &sband->iftype_data[i]; ++ for_each_sband_iftype_data(sband, i, iftd) { + if (!iftd->eht_cap.has_eht) + continue; + +--- a/net/wireless/core.c ++++ b/net/wireless/core.c +@@ -5,7 +5,7 @@ + * Copyright 2006-2010 Johannes Berg + * Copyright 2013-2014 Intel Mobile Communications GmbH + * Copyright 2015-2017 Intel Deutschland GmbH +- * Copyright (C) 2018-2022 Intel Corporation ++ * Copyright (C) 2018-2023 Intel Corporation + */ + + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +@@ -817,6 +817,7 @@ int wiphy_register(struct wiphy *wiphy) + + /* sanity check supported bands/channels */ + for (band = 0; band < NUM_NL80211_BANDS; band++) { ++ const struct ieee80211_sband_iftype_data *iftd; + u16 types = 0; + bool have_he = false; + +@@ -873,14 +874,11 @@ int wiphy_register(struct wiphy *wiphy) + return -EINVAL; + } + +- for (i = 0; i < sband->n_iftype_data; i++) { +- const struct ieee80211_sband_iftype_data *iftd; ++ for_each_sband_iftype_data(sband, i, iftd) { + bool has_ap, has_non_ap; + u32 ap_bits = BIT(NL80211_IFTYPE_AP) | + BIT(NL80211_IFTYPE_P2P_GO); + +- iftd = &sband->iftype_data[i]; +- + if (WARN_ON(!iftd->types_mask)) + return -EINVAL; + if (WARN_ON(types & iftd->types_mask)) +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -1906,20 +1906,20 @@ static int nl80211_send_band_rateinfo(st + struct nlattr *nl_iftype_data = + nla_nest_start_noflag(msg, + NL80211_BAND_ATTR_IFTYPE_DATA); ++ const struct ieee80211_sband_iftype_data *iftd; + int err; + + if (!nl_iftype_data) + return -ENOBUFS; + +- for (i = 0; i < sband->n_iftype_data; i++) { ++ for_each_sband_iftype_data(sband, i, iftd) { + struct nlattr *iftdata; + + iftdata = nla_nest_start_noflag(msg, i + 1); + if (!iftdata) + return -ENOBUFS; + +- err = nl80211_send_iftype_data(msg, sband, +- &sband->iftype_data[i]); ++ err = nl80211_send_iftype_data(msg, sband, iftd); + if (err) + return err; + diff --git a/package/kernel/mac80211/patches/subsys/313-v6.3-wifi-cfg80211-factor-out-bridge-tunnel-RFC1042-heade.patch b/package/kernel/mac80211/patches/subsys/313-v6.3-wifi-cfg80211-factor-out-bridge-tunnel-RFC1042-heade.patch deleted file mode 100644 index 86410578694c14..00000000000000 --- a/package/kernel/mac80211/patches/subsys/313-v6.3-wifi-cfg80211-factor-out-bridge-tunnel-RFC1042-heade.patch +++ /dev/null @@ -1,76 +0,0 @@ -From: Felix Fietkau -Date: Fri, 2 Dec 2022 13:54:15 +0100 -Subject: [PATCH] wifi: cfg80211: factor out bridge tunnel / RFC1042 header - check - -The same check is done in multiple places, unify it. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -542,6 +542,21 @@ unsigned int ieee80211_get_mesh_hdrlen(s - } - EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen); - -+static bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto) -+{ -+ const __be16 *hdr_proto = hdr + ETH_ALEN; -+ -+ if (!(ether_addr_equal(hdr, rfc1042_header) && -+ *hdr_proto != htons(ETH_P_AARP) && -+ *hdr_proto != htons(ETH_P_IPX)) && -+ !ether_addr_equal(hdr, bridge_tunnel_header)) -+ return false; -+ -+ *proto = *hdr_proto; -+ -+ return true; -+} -+ - int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, - const u8 *addr, enum nl80211_iftype iftype, - u8 data_offset, bool is_amsdu) -@@ -633,14 +648,9 @@ int ieee80211_data_to_8023_exthdr(struct - - if (likely(!is_amsdu && - skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)) == 0 && -- ((ether_addr_equal(payload.hdr, rfc1042_header) && -- payload.proto != htons(ETH_P_AARP) && -- payload.proto != htons(ETH_P_IPX)) || -- ether_addr_equal(payload.hdr, bridge_tunnel_header)))) { -- /* remove RFC1042 or Bridge-Tunnel encapsulation and -- * replace EtherType */ -+ ieee80211_get_8023_tunnel_proto(&payload, &tmp.h_proto))) { -+ /* remove RFC1042 or Bridge-Tunnel encapsulation */ - hdrlen += ETH_ALEN + 2; -- tmp.h_proto = payload.proto; - skb_postpull_rcsum(skb, &payload, ETH_ALEN + 2); - } else { - tmp.h_proto = htons(skb->len - hdrlen); -@@ -756,8 +766,6 @@ void ieee80211_amsdu_to_8023s(struct sk_ - { - unsigned int hlen = ALIGN(extra_headroom, 4); - struct sk_buff *frame = NULL; -- u16 ethertype; -- u8 *payload; - int offset = 0, remaining; - struct ethhdr eth; - bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb); -@@ -811,14 +819,8 @@ void ieee80211_amsdu_to_8023s(struct sk_ - frame->dev = skb->dev; - frame->priority = skb->priority; - -- payload = frame->data; -- ethertype = (payload[6] << 8) | payload[7]; -- if (likely((ether_addr_equal(payload, rfc1042_header) && -- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || -- ether_addr_equal(payload, bridge_tunnel_header))) { -- eth.h_proto = htons(ethertype); -+ if (likely(ieee80211_get_8023_tunnel_proto(frame->data, ð.h_proto))) - skb_pull(frame, ETH_ALEN + 2); -- } - - memcpy(skb_push(frame, sizeof(eth)), ð, sizeof(eth)); - __skb_queue_tail(list, frame); diff --git a/package/kernel/mac80211/patches/subsys/313-wifi-cfg80211-export-DFS-CAC-time-and-usable-state-h.patch b/package/kernel/mac80211/patches/subsys/313-wifi-cfg80211-export-DFS-CAC-time-and-usable-state-h.patch new file mode 100644 index 00000000000000..78ec030e18b772 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/313-wifi-cfg80211-export-DFS-CAC-time-and-usable-state-h.patch @@ -0,0 +1,111 @@ +From 30ca8b0c4d6c9fb1d76e5894b1e8bf7c6a12224d Mon Sep 17 00:00:00 2001 +From: Aditya Kumar Singh +Date: Tue, 12 Sep 2023 10:48:55 +0530 +Subject: [PATCH] wifi: cfg80211: export DFS CAC time and usable state helper + functions + +cfg80211 has cfg80211_chandef_dfs_usable() function to know whether +at least one channel in the chandef is in usable state or not. Also, +cfg80211_chandef_dfs_cac_time() function is there which tells the CAC +time required for the given chandef. + +Make these two functions visible to drivers by exporting their symbol +to global list of kernel symbols. + +Lower level drivers can make use of these two functions to be aware +if CAC is required on the given chandef and for how long. For example +drivers which maintains the CAC state internally can make use of these. + +Signed-off-by: Aditya Kumar Singh +Reviewed-by: Jeff Johnson +Link: https://lore.kernel.org/r/20230912051857.2284-2-quic_adisi@quicinc.com +Signed-off-by: Johannes Berg +--- + include/net/cfg80211.h | 24 ++++++++++++++++++++++++ + net/wireless/chan.c | 2 ++ + net/wireless/core.h | 17 ----------------- + 3 files changed, 26 insertions(+), 17 deletions(-) + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -1008,6 +1008,30 @@ int cfg80211_chandef_dfs_required(struct + enum nl80211_iftype iftype); + + /** ++ * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable and we ++ * can/need start CAC on such channel ++ * @wiphy: the wiphy to validate against ++ * @chandef: the channel definition to check ++ * ++ * Return: true if all channels available and at least ++ * one channel requires CAC (NL80211_DFS_USABLE) ++ */ ++bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy, ++ const struct cfg80211_chan_def *chandef); ++ ++/** ++ * cfg80211_chandef_dfs_cac_time - get the DFS CAC time (in ms) for given ++ * channel definition ++ * @wiphy: the wiphy to validate against ++ * @chandef: the channel definition to check ++ * ++ * Returns: DFS CAC time (in ms) which applies for this channel definition ++ */ ++unsigned int ++cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy, ++ const struct cfg80211_chan_def *chandef); ++ ++/** + * nl80211_send_chandef - sends the channel definition. + * @msg: the msg to send channel definition + * @chandef: the channel definition to check +--- a/net/wireless/chan.c ++++ b/net/wireless/chan.c +@@ -666,6 +666,7 @@ bool cfg80211_chandef_dfs_usable(struct + + return (r1 + r2 > 0); + } ++EXPORT_SYMBOL(cfg80211_chandef_dfs_usable); + + /* + * Checks if center frequency of chan falls with in the bandwidth +@@ -965,6 +966,7 @@ cfg80211_chandef_dfs_cac_time(struct wip + + return max(t1, t2); + } ++EXPORT_SYMBOL(cfg80211_chandef_dfs_cac_time); + + static bool cfg80211_secondary_chans_ok(struct wiphy *wiphy, + u32 center_freq, u32 bandwidth, +--- a/net/wireless/core.h ++++ b/net/wireless/core.h +@@ -469,29 +469,12 @@ int cfg80211_scan(struct cfg80211_regist + + extern struct work_struct cfg80211_disconnect_work; + +-/** +- * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable +- * @wiphy: the wiphy to validate against +- * @chandef: the channel definition to check +- * +- * Checks if chandef is usable and we can/need start CAC on such channel. +- * +- * Return: true if all channels available and at least +- * one channel requires CAC (NL80211_DFS_USABLE) +- */ +-bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy, +- const struct cfg80211_chan_def *chandef); +- + void cfg80211_set_dfs_state(struct wiphy *wiphy, + const struct cfg80211_chan_def *chandef, + enum nl80211_dfs_state dfs_state); + + void cfg80211_dfs_channels_update_work(struct work_struct *work); + +-unsigned int +-cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy, +- const struct cfg80211_chan_def *chandef); +- + void cfg80211_sched_dfs_chan_update(struct cfg80211_registered_device *rdev); + + int diff --git a/package/kernel/mac80211/patches/subsys/314-v6.3-wifi-mac80211-remove-mesh-forwarding-congestion-chec.patch b/package/kernel/mac80211/patches/subsys/314-v6.3-wifi-mac80211-remove-mesh-forwarding-congestion-chec.patch deleted file mode 100644 index 515176f0dec45f..00000000000000 --- a/package/kernel/mac80211/patches/subsys/314-v6.3-wifi-mac80211-remove-mesh-forwarding-congestion-chec.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: Felix Fietkau -Date: Fri, 2 Dec 2022 17:01:46 +0100 -Subject: [PATCH] wifi: mac80211: remove mesh forwarding congestion check - -Now that all drivers use iTXQ, it does not make sense to check to drop -tx forwarding packets when the driver has stopped the queues. -fq_codel will take care of dropping packets when the queues fill up - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/debugfs_netdev.c -+++ b/net/mac80211/debugfs_netdev.c -@@ -603,8 +603,6 @@ IEEE80211_IF_FILE(fwded_mcast, u.mesh.ms - IEEE80211_IF_FILE(fwded_unicast, u.mesh.mshstats.fwded_unicast, DEC); - IEEE80211_IF_FILE(fwded_frames, u.mesh.mshstats.fwded_frames, DEC); - IEEE80211_IF_FILE(dropped_frames_ttl, u.mesh.mshstats.dropped_frames_ttl, DEC); --IEEE80211_IF_FILE(dropped_frames_congestion, -- u.mesh.mshstats.dropped_frames_congestion, DEC); - IEEE80211_IF_FILE(dropped_frames_no_route, - u.mesh.mshstats.dropped_frames_no_route, DEC); - -@@ -740,7 +738,6 @@ static void add_mesh_stats(struct ieee80 - MESHSTATS_ADD(fwded_frames); - MESHSTATS_ADD(dropped_frames_ttl); - MESHSTATS_ADD(dropped_frames_no_route); -- MESHSTATS_ADD(dropped_frames_congestion); - #undef MESHSTATS_ADD - } - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -329,7 +329,6 @@ struct mesh_stats { - __u32 fwded_frames; /* Mesh total forwarded frames */ - __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/ - __u32 dropped_frames_no_route; /* Not transmitted, no route found */ -- __u32 dropped_frames_congestion;/* Not forwarded due to congestion */ - }; - - #define PREQ_Q_F_START 0x1 ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2926,11 +2926,6 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 - return RX_CONTINUE; - - ac = ieee802_1d_to_ac[skb->priority]; -- q = sdata->vif.hw_queue[ac]; -- if (ieee80211_queue_stopped(&local->hw, q)) { -- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion); -- return RX_DROP_MONITOR; -- } - skb_set_queue_mapping(skb, ac); - - if (!--mesh_hdr->ttl) { diff --git a/package/kernel/mac80211/patches/subsys/314-wifi-mac80211-fix-race-condition-on-enabling-fast-xm.patch b/package/kernel/mac80211/patches/subsys/314-wifi-mac80211-fix-race-condition-on-enabling-fast-xm.patch new file mode 100644 index 00000000000000..191eb67e8eac9e --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/314-wifi-mac80211-fix-race-condition-on-enabling-fast-xm.patch @@ -0,0 +1,34 @@ +From: Felix Fietkau +Date: Wed, 3 Jan 2024 15:10:18 +0100 +Subject: [PATCH] wifi: mac80211: fix race condition on enabling fast-xmit + +fast-xmit must only be enabled after the sta has been uploaded to the driver, +otherwise it could end up passing the not-yet-uploaded sta via drv_tx calls +to the driver, leading to potential crashes because of uninitialized drv_priv +data. +Add a missing sta->uploaded check and re-check fast xmit after inserting a sta. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -911,6 +911,7 @@ static int sta_info_insert_finish(struct + + if (ieee80211_vif_is_mesh(&sdata->vif)) + mesh_accept_plinks_update(sdata); ++ ieee80211_check_fast_xmit(sta); + + return 0; + out_remove: +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3033,7 +3033,7 @@ void ieee80211_check_fast_xmit(struct st + sdata->vif.type == NL80211_IFTYPE_STATION) + goto out; + +- if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED)) ++ if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED) || !sta->uploaded) + goto out; + + if (test_sta_flag(sta, WLAN_STA_PS_STA) || diff --git a/package/kernel/mac80211/patches/subsys/315-v6.3-wifi-mac80211-fix-receiving-A-MSDU-frames-on-mesh-in.patch b/package/kernel/mac80211/patches/subsys/315-v6.3-wifi-mac80211-fix-receiving-A-MSDU-frames-on-mesh-in.patch deleted file mode 100644 index 6aec9bc85fc32a..00000000000000 --- a/package/kernel/mac80211/patches/subsys/315-v6.3-wifi-mac80211-fix-receiving-A-MSDU-frames-on-mesh-in.patch +++ /dev/null @@ -1,753 +0,0 @@ -From: Felix Fietkau -Date: Tue, 6 Dec 2022 11:15:02 +0100 -Subject: [PATCH] wifi: mac80211: fix receiving A-MSDU frames on mesh - interfaces - -The current mac80211 mesh A-MSDU receive path fails to parse A-MSDU packets -on mesh interfaces, because it assumes that the Mesh Control field is always -directly after the 802.11 header. -802.11-2020 9.3.2.2.2 Figure 9-70 shows that the Mesh Control field is -actually part of the A-MSDU subframe header. -This makes more sense, since it allows packets for multiple different -destinations to be included in the same A-MSDU, as long as RA and TID are -still the same. -Another issue is the fact that the A-MSDU subframe length field was apparently -accidentally defined as little-endian in the standard. - -In order to fix this, the mesh forwarding path needs happen at a different -point in the receive path. - -ieee80211_data_to_8023_exthdr is changed to ignore the mesh control field -and leave it in after the ethernet header. This also affects the source/dest -MAC address fields, which now in the case of mesh point to the mesh SA/DA. - -ieee80211_amsdu_to_8023s is changed to deal with the endian difference and -to add the Mesh Control length to the subframe length, since it's not covered -by the MSDU length field. - -With these changes, the mac80211 will get the same packet structure for -converted regular data packets and unpacked A-MSDU subframes. - -The mesh forwarding checks are now only performed after the A-MSDU decap. -For locally received packets, the Mesh Control header is stripped away. -For forwarded packets, a new 802.11 header gets added. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c -+++ b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c -@@ -33,7 +33,7 @@ static int mwifiex_11n_dispatch_amsdu_pk - skb_trim(skb, le16_to_cpu(local_rx_pd->rx_pkt_length)); - - ieee80211_amsdu_to_8023s(skb, &list, priv->curr_addr, -- priv->wdev.iftype, 0, NULL, NULL); -+ priv->wdev.iftype, 0, NULL, NULL, false); - - while (!skb_queue_empty(&list)) { - struct rx_packet_hdr *rx_hdr; ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -6208,11 +6208,36 @@ static inline int ieee80211_data_to_8023 - * @extra_headroom: The hardware extra headroom for SKBs in the @list. - * @check_da: DA to check in the inner ethernet header, or NULL - * @check_sa: SA to check in the inner ethernet header, or NULL -+ * @mesh_control: A-MSDU subframe header includes the mesh control field - */ - void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, - const u8 *addr, enum nl80211_iftype iftype, - const unsigned int extra_headroom, -- const u8 *check_da, const u8 *check_sa); -+ const u8 *check_da, const u8 *check_sa, -+ bool mesh_control); -+ -+/** -+ * ieee80211_get_8023_tunnel_proto - get RFC1042 or bridge tunnel encap protocol -+ * -+ * Check for RFC1042 or bridge tunnel header and fetch the encapsulated -+ * protocol. -+ * -+ * @hdr: pointer to the MSDU payload -+ * @proto: destination pointer to store the protocol -+ * Return: true if encapsulation was found -+ */ -+bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto); -+ -+/** -+ * ieee80211_strip_8023_mesh_hdr - strip mesh header from converted 802.3 frames -+ * -+ * Strip the mesh header, which was left in by ieee80211_data_to_8023 as part -+ * of the MSDU data. Also move any source/destination addresses from the mesh -+ * header to the ethernet header (if present). -+ * -+ * @skb: The 802.3 frame with embedded mesh header -+ */ -+int ieee80211_strip_8023_mesh_hdr(struct sk_buff *skb); - - /** - * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2720,6 +2720,174 @@ ieee80211_deliver_skb(struct ieee80211_r - } - } - -+static ieee80211_rx_result -+ieee80211_rx_mesh_data(struct ieee80211_sub_if_data *sdata, struct sta_info *sta, -+ struct sk_buff *skb) -+{ -+#ifdef CPTCFG_MAC80211_MESH -+ struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; -+ struct ieee80211_local *local = sdata->local; -+ uint16_t fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA; -+ struct ieee80211_hdr hdr = { -+ .frame_control = cpu_to_le16(fc) -+ }; -+ struct ieee80211_hdr *fwd_hdr; -+ struct ieee80211s_hdr *mesh_hdr; -+ struct ieee80211_tx_info *info; -+ struct sk_buff *fwd_skb; -+ struct ethhdr *eth; -+ bool multicast; -+ int tailroom = 0; -+ int hdrlen, mesh_hdrlen; -+ u8 *qos; -+ -+ if (!ieee80211_vif_is_mesh(&sdata->vif)) -+ return RX_CONTINUE; -+ -+ if (!pskb_may_pull(skb, sizeof(*eth) + 6)) -+ return RX_DROP_MONITOR; -+ -+ mesh_hdr = (struct ieee80211s_hdr *)(skb->data + sizeof(*eth)); -+ mesh_hdrlen = ieee80211_get_mesh_hdrlen(mesh_hdr); -+ -+ if (!pskb_may_pull(skb, sizeof(*eth) + mesh_hdrlen)) -+ return RX_DROP_MONITOR; -+ -+ eth = (struct ethhdr *)skb->data; -+ multicast = is_multicast_ether_addr(eth->h_dest); -+ -+ mesh_hdr = (struct ieee80211s_hdr *)(eth + 1); -+ if (!mesh_hdr->ttl) -+ return RX_DROP_MONITOR; -+ -+ /* frame is in RMC, don't forward */ -+ if (is_multicast_ether_addr(eth->h_dest) && -+ mesh_rmc_check(sdata, eth->h_source, mesh_hdr)) -+ return RX_DROP_MONITOR; -+ -+ /* Frame has reached destination. Don't forward */ -+ if (ether_addr_equal(sdata->vif.addr, eth->h_dest)) -+ goto rx_accept; -+ -+ if (!ifmsh->mshcfg.dot11MeshForwarding) { -+ if (is_multicast_ether_addr(eth->h_dest)) -+ goto rx_accept; -+ -+ return RX_DROP_MONITOR; -+ } -+ -+ /* forward packet */ -+ if (sdata->crypto_tx_tailroom_needed_cnt) -+ tailroom = IEEE80211_ENCRYPT_TAILROOM; -+ -+ if (!--mesh_hdr->ttl) { -+ if (multicast) -+ goto rx_accept; -+ -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl); -+ return RX_DROP_MONITOR; -+ } -+ -+ if (mesh_hdr->flags & MESH_FLAGS_AE) { -+ struct mesh_path *mppath; -+ char *proxied_addr; -+ -+ if (multicast) -+ proxied_addr = mesh_hdr->eaddr1; -+ else if ((mesh_hdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) -+ /* has_a4 already checked in ieee80211_rx_mesh_check */ -+ proxied_addr = mesh_hdr->eaddr2; -+ else -+ return RX_DROP_MONITOR; -+ -+ rcu_read_lock(); -+ mppath = mpp_path_lookup(sdata, proxied_addr); -+ if (!mppath) { -+ mpp_path_add(sdata, proxied_addr, eth->h_source); -+ } else { -+ spin_lock_bh(&mppath->state_lock); -+ if (!ether_addr_equal(mppath->mpp, eth->h_source)) -+ memcpy(mppath->mpp, eth->h_source, ETH_ALEN); -+ mppath->exp_time = jiffies; -+ spin_unlock_bh(&mppath->state_lock); -+ } -+ rcu_read_unlock(); -+ } -+ -+ skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]); -+ -+ ieee80211_fill_mesh_addresses(&hdr, &hdr.frame_control, -+ eth->h_dest, eth->h_source); -+ hdrlen = ieee80211_hdrlen(hdr.frame_control); -+ if (multicast) { -+ int extra_head = sizeof(struct ieee80211_hdr) - sizeof(*eth); -+ -+ fwd_skb = skb_copy_expand(skb, local->tx_headroom + extra_head + -+ IEEE80211_ENCRYPT_HEADROOM, -+ tailroom, GFP_ATOMIC); -+ if (!fwd_skb) -+ goto rx_accept; -+ } else { -+ fwd_skb = skb; -+ skb = NULL; -+ -+ if (skb_cow_head(fwd_skb, hdrlen - sizeof(struct ethhdr))) -+ return RX_DROP_UNUSABLE; -+ } -+ -+ fwd_hdr = skb_push(fwd_skb, hdrlen - sizeof(struct ethhdr)); -+ memcpy(fwd_hdr, &hdr, hdrlen - 2); -+ qos = ieee80211_get_qos_ctl(fwd_hdr); -+ qos[0] = qos[1] = 0; -+ -+ skb_reset_mac_header(fwd_skb); -+ hdrlen += mesh_hdrlen; -+ if (ieee80211_get_8023_tunnel_proto(fwd_skb->data + hdrlen, -+ &fwd_skb->protocol)) -+ hdrlen += ETH_ALEN; -+ else -+ fwd_skb->protocol = htons(fwd_skb->len - hdrlen); -+ skb_set_network_header(fwd_skb, hdrlen); -+ -+ info = IEEE80211_SKB_CB(fwd_skb); -+ memset(info, 0, sizeof(*info)); -+ info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING; -+ info->control.vif = &sdata->vif; -+ info->control.jiffies = jiffies; -+ if (multicast) { -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_mcast); -+ memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); -+ /* update power mode indication when forwarding */ -+ ieee80211_mps_set_frame_flags(sdata, NULL, fwd_hdr); -+ } else if (!mesh_nexthop_lookup(sdata, fwd_skb)) { -+ /* mesh power mode flags updated in mesh_nexthop_lookup */ -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast); -+ } else { -+ /* unable to resolve next hop */ -+ if (sta) -+ mesh_path_error_tx(sdata, ifmsh->mshcfg.element_ttl, -+ hdr.addr3, 0, -+ WLAN_REASON_MESH_PATH_NOFORWARD, -+ sta->sta.addr); -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_no_route); -+ kfree_skb(fwd_skb); -+ goto rx_accept; -+ } -+ -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames); -+ fwd_skb->dev = sdata->dev; -+ ieee80211_add_pending_skb(local, fwd_skb); -+ -+rx_accept: -+ if (!skb) -+ return RX_QUEUED; -+ -+ ieee80211_strip_8023_mesh_hdr(skb); -+#endif -+ -+ return RX_CONTINUE; -+} -+ - static ieee80211_rx_result debug_noinline - __ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx, u8 data_offset) - { -@@ -2728,8 +2896,10 @@ __ieee80211_rx_h_amsdu(struct ieee80211_ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - __le16 fc = hdr->frame_control; - struct sk_buff_head frame_list; -+ static ieee80211_rx_result res; - struct ethhdr ethhdr; - const u8 *check_da = ethhdr.h_dest, *check_sa = ethhdr.h_source; -+ bool mesh = false; - - if (unlikely(ieee80211_has_a4(hdr->frame_control))) { - check_da = NULL; -@@ -2746,6 +2916,8 @@ __ieee80211_rx_h_amsdu(struct ieee80211_ - break; - case NL80211_IFTYPE_MESH_POINT: - check_sa = NULL; -+ check_da = NULL; -+ mesh = true; - break; - default: - break; -@@ -2763,17 +2935,29 @@ __ieee80211_rx_h_amsdu(struct ieee80211_ - ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr, - rx->sdata->vif.type, - rx->local->hw.extra_tx_headroom, -- check_da, check_sa); -+ check_da, check_sa, mesh); - - while (!skb_queue_empty(&frame_list)) { - rx->skb = __skb_dequeue(&frame_list); - -- if (!ieee80211_frame_allowed(rx, fc)) { -- dev_kfree_skb(rx->skb); -+ res = ieee80211_rx_mesh_data(rx->sdata, rx->sta, rx->skb); -+ switch (res) { -+ case RX_QUEUED: - continue; -+ case RX_CONTINUE: -+ break; -+ default: -+ goto free; - } - -+ if (!ieee80211_frame_allowed(rx, fc)) -+ goto free; -+ - ieee80211_deliver_skb(rx); -+ continue; -+ -+free: -+ dev_kfree_skb(rx->skb); - } - - return RX_QUEUED; -@@ -2806,6 +2990,8 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx - if (!rx->sdata->u.mgd.use_4addr) - return RX_DROP_UNUSABLE; - break; -+ case NL80211_IFTYPE_MESH_POINT: -+ break; - default: - return RX_DROP_UNUSABLE; - } -@@ -2834,155 +3020,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx - return __ieee80211_rx_h_amsdu(rx, 0); - } - --#ifdef CPTCFG_MAC80211_MESH --static ieee80211_rx_result --ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) --{ -- struct ieee80211_hdr *fwd_hdr, *hdr; -- struct ieee80211_tx_info *info; -- struct ieee80211s_hdr *mesh_hdr; -- struct sk_buff *skb = rx->skb, *fwd_skb; -- struct ieee80211_local *local = rx->local; -- struct ieee80211_sub_if_data *sdata = rx->sdata; -- struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; -- u16 ac, q, hdrlen; -- int tailroom = 0; -- -- hdr = (struct ieee80211_hdr *) skb->data; -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -- -- /* make sure fixed part of mesh header is there, also checks skb len */ -- if (!pskb_may_pull(rx->skb, hdrlen + 6)) -- return RX_DROP_MONITOR; -- -- mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); -- -- /* make sure full mesh header is there, also checks skb len */ -- if (!pskb_may_pull(rx->skb, -- hdrlen + ieee80211_get_mesh_hdrlen(mesh_hdr))) -- return RX_DROP_MONITOR; -- -- /* reload pointers */ -- hdr = (struct ieee80211_hdr *) skb->data; -- mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); -- -- if (ieee80211_drop_unencrypted(rx, hdr->frame_control)) { -- int offset = hdrlen + ieee80211_get_mesh_hdrlen(mesh_hdr) + -- sizeof(rfc1042_header); -- __be16 ethertype; -- -- if (!ether_addr_equal(hdr->addr1, rx->sdata->vif.addr) || -- skb_copy_bits(rx->skb, offset, ðertype, 2) != 0 || -- ethertype != rx->sdata->control_port_protocol) -- return RX_DROP_MONITOR; -- } -- -- /* frame is in RMC, don't forward */ -- if (ieee80211_is_data(hdr->frame_control) && -- is_multicast_ether_addr(hdr->addr1) && -- mesh_rmc_check(rx->sdata, hdr->addr3, mesh_hdr)) -- return RX_DROP_MONITOR; -- -- if (!ieee80211_is_data(hdr->frame_control)) -- return RX_CONTINUE; -- -- if (!mesh_hdr->ttl) -- return RX_DROP_MONITOR; -- -- if (mesh_hdr->flags & MESH_FLAGS_AE) { -- struct mesh_path *mppath; -- char *proxied_addr; -- char *mpp_addr; -- -- if (is_multicast_ether_addr(hdr->addr1)) { -- mpp_addr = hdr->addr3; -- proxied_addr = mesh_hdr->eaddr1; -- } else if ((mesh_hdr->flags & MESH_FLAGS_AE) == -- MESH_FLAGS_AE_A5_A6) { -- /* has_a4 already checked in ieee80211_rx_mesh_check */ -- mpp_addr = hdr->addr4; -- proxied_addr = mesh_hdr->eaddr2; -- } else { -- return RX_DROP_MONITOR; -- } -- -- rcu_read_lock(); -- mppath = mpp_path_lookup(sdata, proxied_addr); -- if (!mppath) { -- mpp_path_add(sdata, proxied_addr, mpp_addr); -- } else { -- spin_lock_bh(&mppath->state_lock); -- if (!ether_addr_equal(mppath->mpp, mpp_addr)) -- memcpy(mppath->mpp, mpp_addr, ETH_ALEN); -- mppath->exp_time = jiffies; -- spin_unlock_bh(&mppath->state_lock); -- } -- rcu_read_unlock(); -- } -- -- /* Frame has reached destination. Don't forward */ -- if (!is_multicast_ether_addr(hdr->addr1) && -- ether_addr_equal(sdata->vif.addr, hdr->addr3)) -- return RX_CONTINUE; -- -- ac = ieee802_1d_to_ac[skb->priority]; -- skb_set_queue_mapping(skb, ac); -- -- if (!--mesh_hdr->ttl) { -- if (!is_multicast_ether_addr(hdr->addr1)) -- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, -- dropped_frames_ttl); -- goto out; -- } -- -- if (!ifmsh->mshcfg.dot11MeshForwarding) -- goto out; -- -- if (sdata->crypto_tx_tailroom_needed_cnt) -- tailroom = IEEE80211_ENCRYPT_TAILROOM; -- -- fwd_skb = skb_copy_expand(skb, local->tx_headroom + -- IEEE80211_ENCRYPT_HEADROOM, -- tailroom, GFP_ATOMIC); -- if (!fwd_skb) -- goto out; -- -- fwd_skb->dev = sdata->dev; -- fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; -- fwd_hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_RETRY); -- info = IEEE80211_SKB_CB(fwd_skb); -- memset(info, 0, sizeof(*info)); -- info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING; -- info->control.vif = &rx->sdata->vif; -- info->control.jiffies = jiffies; -- if (is_multicast_ether_addr(fwd_hdr->addr1)) { -- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_mcast); -- memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); -- /* update power mode indication when forwarding */ -- ieee80211_mps_set_frame_flags(sdata, NULL, fwd_hdr); -- } else if (!mesh_nexthop_lookup(sdata, fwd_skb)) { -- /* mesh power mode flags updated in mesh_nexthop_lookup */ -- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast); -- } else { -- /* unable to resolve next hop */ -- mesh_path_error_tx(sdata, ifmsh->mshcfg.element_ttl, -- fwd_hdr->addr3, 0, -- WLAN_REASON_MESH_PATH_NOFORWARD, -- fwd_hdr->addr2); -- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_no_route); -- kfree_skb(fwd_skb); -- return RX_DROP_MONITOR; -- } -- -- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames); -- ieee80211_add_pending_skb(local, fwd_skb); -- out: -- if (is_multicast_ether_addr(hdr->addr1)) -- return RX_CONTINUE; -- return RX_DROP_MONITOR; --} --#endif -- - static ieee80211_rx_result debug_noinline - ieee80211_rx_h_data(struct ieee80211_rx_data *rx) - { -@@ -2991,6 +3028,7 @@ ieee80211_rx_h_data(struct ieee80211_rx_ - struct net_device *dev = sdata->dev; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; - __le16 fc = hdr->frame_control; -+ static ieee80211_rx_result res; - bool port_control; - int err; - -@@ -3017,6 +3055,10 @@ ieee80211_rx_h_data(struct ieee80211_rx_ - if (unlikely(err)) - return RX_DROP_UNUSABLE; - -+ res = ieee80211_rx_mesh_data(rx->sdata, rx->sta, rx->skb); -+ if (res != RX_CONTINUE) -+ return res; -+ - if (!ieee80211_frame_allowed(rx, fc)) - return RX_DROP_MONITOR; - -@@ -3987,10 +4029,6 @@ static void ieee80211_rx_handlers(struct - CALL_RXH(ieee80211_rx_h_defragment); - CALL_RXH(ieee80211_rx_h_michael_mic_verify); - /* must be after MMIC verify so header is counted in MPDU mic */ --#ifdef CPTCFG_MAC80211_MESH -- if (ieee80211_vif_is_mesh(&rx->sdata->vif)) -- CALL_RXH(ieee80211_rx_h_mesh_fwding); --#endif - CALL_RXH(ieee80211_rx_h_amsdu); - CALL_RXH(ieee80211_rx_h_data); - ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -542,7 +542,7 @@ unsigned int ieee80211_get_mesh_hdrlen(s - } - EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen); - --static bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto) -+bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto) - { - const __be16 *hdr_proto = hdr + ETH_ALEN; - -@@ -556,6 +556,49 @@ static bool ieee80211_get_8023_tunnel_pr - - return true; - } -+EXPORT_SYMBOL(ieee80211_get_8023_tunnel_proto); -+ -+int ieee80211_strip_8023_mesh_hdr(struct sk_buff *skb) -+{ -+ const void *mesh_addr; -+ struct { -+ struct ethhdr eth; -+ u8 flags; -+ } payload; -+ int hdrlen; -+ int ret; -+ -+ ret = skb_copy_bits(skb, 0, &payload, sizeof(payload)); -+ if (ret) -+ return ret; -+ -+ hdrlen = sizeof(payload.eth) + __ieee80211_get_mesh_hdrlen(payload.flags); -+ -+ if (likely(pskb_may_pull(skb, hdrlen + 8) && -+ ieee80211_get_8023_tunnel_proto(skb->data + hdrlen, -+ &payload.eth.h_proto))) -+ hdrlen += ETH_ALEN + 2; -+ else if (!pskb_may_pull(skb, hdrlen)) -+ return -EINVAL; -+ -+ mesh_addr = skb->data + sizeof(payload.eth) + ETH_ALEN; -+ switch (payload.flags & MESH_FLAGS_AE) { -+ case MESH_FLAGS_AE_A4: -+ memcpy(&payload.eth.h_source, mesh_addr, ETH_ALEN); -+ break; -+ case MESH_FLAGS_AE_A5_A6: -+ memcpy(&payload.eth.h_dest, mesh_addr, 2 * ETH_ALEN); -+ break; -+ default: -+ break; -+ } -+ -+ pskb_pull(skb, hdrlen - sizeof(payload.eth)); -+ memcpy(skb->data, &payload.eth, sizeof(payload.eth)); -+ -+ return 0; -+} -+EXPORT_SYMBOL(ieee80211_strip_8023_mesh_hdr); - - int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, - const u8 *addr, enum nl80211_iftype iftype, -@@ -568,7 +611,6 @@ int ieee80211_data_to_8023_exthdr(struct - } payload; - struct ethhdr tmp; - u16 hdrlen; -- u8 mesh_flags = 0; - - if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) - return -1; -@@ -589,12 +631,6 @@ int ieee80211_data_to_8023_exthdr(struct - memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN); - memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN); - -- if (iftype == NL80211_IFTYPE_MESH_POINT && -- skb_copy_bits(skb, hdrlen, &mesh_flags, 1) < 0) -- return -1; -- -- mesh_flags &= MESH_FLAGS_AE; -- - switch (hdr->frame_control & - cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) { - case cpu_to_le16(IEEE80211_FCTL_TODS): -@@ -608,17 +644,6 @@ int ieee80211_data_to_8023_exthdr(struct - iftype != NL80211_IFTYPE_AP_VLAN && - iftype != NL80211_IFTYPE_STATION)) - return -1; -- if (iftype == NL80211_IFTYPE_MESH_POINT) { -- if (mesh_flags == MESH_FLAGS_AE_A4) -- return -1; -- if (mesh_flags == MESH_FLAGS_AE_A5_A6 && -- skb_copy_bits(skb, hdrlen + -- offsetof(struct ieee80211s_hdr, eaddr1), -- tmp.h_dest, 2 * ETH_ALEN) < 0) -- return -1; -- -- hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags); -- } - break; - case cpu_to_le16(IEEE80211_FCTL_FROMDS): - if ((iftype != NL80211_IFTYPE_STATION && -@@ -627,16 +652,6 @@ int ieee80211_data_to_8023_exthdr(struct - (is_multicast_ether_addr(tmp.h_dest) && - ether_addr_equal(tmp.h_source, addr))) - return -1; -- if (iftype == NL80211_IFTYPE_MESH_POINT) { -- if (mesh_flags == MESH_FLAGS_AE_A5_A6) -- return -1; -- if (mesh_flags == MESH_FLAGS_AE_A4 && -- skb_copy_bits(skb, hdrlen + -- offsetof(struct ieee80211s_hdr, eaddr1), -- tmp.h_source, ETH_ALEN) < 0) -- return -1; -- hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags); -- } - break; - case cpu_to_le16(0): - if (iftype != NL80211_IFTYPE_ADHOC && -@@ -646,7 +661,7 @@ int ieee80211_data_to_8023_exthdr(struct - break; - } - -- if (likely(!is_amsdu && -+ if (likely(!is_amsdu && iftype != NL80211_IFTYPE_MESH_POINT && - skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)) == 0 && - ieee80211_get_8023_tunnel_proto(&payload, &tmp.h_proto))) { - /* remove RFC1042 or Bridge-Tunnel encapsulation */ -@@ -722,7 +737,8 @@ __ieee80211_amsdu_copy_frag(struct sk_bu - - static struct sk_buff * - __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen, -- int offset, int len, bool reuse_frag) -+ int offset, int len, bool reuse_frag, -+ int min_len) - { - struct sk_buff *frame; - int cur_len = len; -@@ -736,7 +752,7 @@ __ieee80211_amsdu_copy(struct sk_buff *s - * in the stack later. - */ - if (reuse_frag) -- cur_len = min_t(int, len, 32); -+ cur_len = min_t(int, len, min_len); - - /* - * Allocate and reserve two bytes more for payload -@@ -746,6 +762,7 @@ __ieee80211_amsdu_copy(struct sk_buff *s - if (!frame) - return NULL; - -+ frame->priority = skb->priority; - skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2); - skb_copy_bits(skb, offset, skb_put(frame, cur_len), cur_len); - -@@ -762,23 +779,37 @@ __ieee80211_amsdu_copy(struct sk_buff *s - void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, - const u8 *addr, enum nl80211_iftype iftype, - const unsigned int extra_headroom, -- const u8 *check_da, const u8 *check_sa) -+ const u8 *check_da, const u8 *check_sa, -+ bool mesh_control) - { - unsigned int hlen = ALIGN(extra_headroom, 4); - struct sk_buff *frame = NULL; - int offset = 0, remaining; -- struct ethhdr eth; -+ struct { -+ struct ethhdr eth; -+ uint8_t flags; -+ } hdr; - bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb); - bool reuse_skb = false; - bool last = false; -+ int copy_len = sizeof(hdr.eth); -+ -+ if (iftype == NL80211_IFTYPE_MESH_POINT) -+ copy_len = sizeof(hdr); - - while (!last) { - unsigned int subframe_len; -- int len; -+ int len, mesh_len = 0; - u8 padding; - -- skb_copy_bits(skb, offset, ð, sizeof(eth)); -- len = ntohs(eth.h_proto); -+ skb_copy_bits(skb, offset, &hdr, copy_len); -+ if (iftype == NL80211_IFTYPE_MESH_POINT) -+ mesh_len = __ieee80211_get_mesh_hdrlen(hdr.flags); -+ if (mesh_control) -+ len = le16_to_cpu(*(__le16 *)&hdr.eth.h_proto) + mesh_len; -+ else -+ len = ntohs(hdr.eth.h_proto); -+ - subframe_len = sizeof(struct ethhdr) + len; - padding = (4 - subframe_len) & 0x3; - -@@ -787,16 +818,16 @@ void ieee80211_amsdu_to_8023s(struct sk_ - if (subframe_len > remaining) - goto purge; - /* mitigate A-MSDU aggregation injection attacks */ -- if (ether_addr_equal(eth.h_dest, rfc1042_header)) -+ if (ether_addr_equal(hdr.eth.h_dest, rfc1042_header)) - goto purge; - - offset += sizeof(struct ethhdr); - last = remaining <= subframe_len + padding; - - /* FIXME: should we really accept multicast DA? */ -- if ((check_da && !is_multicast_ether_addr(eth.h_dest) && -- !ether_addr_equal(check_da, eth.h_dest)) || -- (check_sa && !ether_addr_equal(check_sa, eth.h_source))) { -+ if ((check_da && !is_multicast_ether_addr(hdr.eth.h_dest) && -+ !ether_addr_equal(check_da, hdr.eth.h_dest)) || -+ (check_sa && !ether_addr_equal(check_sa, hdr.eth.h_source))) { - offset += len + padding; - continue; - } -@@ -808,7 +839,7 @@ void ieee80211_amsdu_to_8023s(struct sk_ - reuse_skb = true; - } else { - frame = __ieee80211_amsdu_copy(skb, hlen, offset, len, -- reuse_frag); -+ reuse_frag, 32 + mesh_len); - if (!frame) - goto purge; - -@@ -819,10 +850,11 @@ void ieee80211_amsdu_to_8023s(struct sk_ - frame->dev = skb->dev; - frame->priority = skb->priority; - -- if (likely(ieee80211_get_8023_tunnel_proto(frame->data, ð.h_proto))) -+ if (likely(iftype != NL80211_IFTYPE_MESH_POINT && -+ ieee80211_get_8023_tunnel_proto(frame->data, &hdr.eth.h_proto))) - skb_pull(frame, ETH_ALEN + 2); - -- memcpy(skb_push(frame, sizeof(eth)), ð, sizeof(eth)); -+ memcpy(skb_push(frame, sizeof(hdr.eth)), &hdr.eth, sizeof(hdr.eth)); - __skb_queue_tail(list, frame); - } - diff --git a/package/kernel/mac80211/patches/subsys/316-v6.3-wifi-mac80211-add-a-workaround-for-receiving-non-sta.patch b/package/kernel/mac80211/patches/subsys/316-v6.3-wifi-mac80211-add-a-workaround-for-receiving-non-sta.patch deleted file mode 100644 index 6dc98ae16af127..00000000000000 --- a/package/kernel/mac80211/patches/subsys/316-v6.3-wifi-mac80211-add-a-workaround-for-receiving-non-sta.patch +++ /dev/null @@ -1,145 +0,0 @@ -From: Felix Fietkau -Date: Fri, 9 Dec 2022 21:15:04 +0100 -Subject: [PATCH] wifi: mac80211: add a workaround for receiving - non-standard mesh A-MSDU - -At least ath10k and ath11k supported hardware (maybe more) does not implement -mesh A-MSDU aggregation in a standard compliant way. -802.11-2020 9.3.2.2.2 declares that the Mesh Control field is part of the -A-MSDU header. As such, its length must not be included in the subframe -length field. -Hardware affected by this bug treats the mesh control field as part of the -MSDU data and sets the length accordingly. -In order to avoid packet loss, keep track of which stations are affected -by this and take it into account when converting A-MSDU to 802.3 + mesh control -packets. - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -6194,6 +6194,19 @@ static inline int ieee80211_data_to_8023 - } - - /** -+ * ieee80211_is_valid_amsdu - check if subframe lengths of an A-MSDU are valid -+ * -+ * This is used to detect non-standard A-MSDU frames, e.g. the ones generated -+ * by ath10k and ath11k, where the subframe length includes the length of the -+ * mesh control field. -+ * -+ * @skb: The input A-MSDU frame without any headers. -+ * @mesh_hdr: use standard compliant mesh A-MSDU subframe header -+ * Returns: true if subframe header lengths are valid for the @mesh_hdr mode -+ */ -+bool ieee80211_is_valid_amsdu(struct sk_buff *skb, bool mesh_hdr); -+ -+/** - * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame - * - * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames. ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2899,7 +2899,6 @@ __ieee80211_rx_h_amsdu(struct ieee80211_ - static ieee80211_rx_result res; - struct ethhdr ethhdr; - const u8 *check_da = ethhdr.h_dest, *check_sa = ethhdr.h_source; -- bool mesh = false; - - if (unlikely(ieee80211_has_a4(hdr->frame_control))) { - check_da = NULL; -@@ -2917,7 +2916,6 @@ __ieee80211_rx_h_amsdu(struct ieee80211_ - case NL80211_IFTYPE_MESH_POINT: - check_sa = NULL; - check_da = NULL; -- mesh = true; - break; - default: - break; -@@ -2932,10 +2930,21 @@ __ieee80211_rx_h_amsdu(struct ieee80211_ - data_offset, true)) - return RX_DROP_UNUSABLE; - -+ if (rx->sta && rx->sta->amsdu_mesh_control < 0) { -+ bool valid_std = ieee80211_is_valid_amsdu(skb, true); -+ bool valid_nonstd = ieee80211_is_valid_amsdu(skb, false); -+ -+ if (valid_std && !valid_nonstd) -+ rx->sta->amsdu_mesh_control = 1; -+ else if (valid_nonstd && !valid_std) -+ rx->sta->amsdu_mesh_control = 0; -+ } -+ - ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr, - rx->sdata->vif.type, - rx->local->hw.extra_tx_headroom, -- check_da, check_sa, mesh); -+ check_da, check_sa, -+ rx->sta->amsdu_mesh_control); - - while (!skb_queue_empty(&frame_list)) { - rx->skb = __skb_dequeue(&frame_list); ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -591,6 +591,9 @@ __sta_info_alloc(struct ieee80211_sub_if - - sta->sta_state = IEEE80211_STA_NONE; - -+ if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) -+ sta->amsdu_mesh_control = -1; -+ - /* Mark TID as unreserved */ - sta->reserved_tid = IEEE80211_TID_UNRESERVED; - ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -702,6 +702,7 @@ struct sta_info { - struct codel_params cparams; - - u8 reserved_tid; -+ s8 amsdu_mesh_control; - - struct cfg80211_chan_def tdls_chandef; - ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -776,6 +776,38 @@ __ieee80211_amsdu_copy(struct sk_buff *s - return frame; - } - -+bool ieee80211_is_valid_amsdu(struct sk_buff *skb, bool mesh_hdr) -+{ -+ int offset = 0, remaining, subframe_len, padding; -+ -+ for (offset = 0; offset < skb->len; offset += subframe_len + padding) { -+ struct { -+ __be16 len; -+ u8 mesh_flags; -+ } hdr; -+ u16 len; -+ -+ if (skb_copy_bits(skb, offset + 2 * ETH_ALEN, &hdr, sizeof(hdr)) < 0) -+ return false; -+ -+ if (mesh_hdr) -+ len = le16_to_cpu(*(__le16 *)&hdr.len) + -+ __ieee80211_get_mesh_hdrlen(hdr.mesh_flags); -+ else -+ len = ntohs(hdr.len); -+ -+ subframe_len = sizeof(struct ethhdr) + len; -+ padding = (4 - subframe_len) & 0x3; -+ remaining = skb->len - offset; -+ -+ if (subframe_len > remaining) -+ return false; -+ } -+ -+ return true; -+} -+EXPORT_SYMBOL(ieee80211_is_valid_amsdu); -+ - void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, - const u8 *addr, enum nl80211_iftype iftype, - const unsigned int extra_headroom, diff --git a/package/kernel/mac80211/patches/subsys/318-wifi-mac80211-fix-race-in-mesh-sequence-number-assig.patch b/package/kernel/mac80211/patches/subsys/318-wifi-mac80211-fix-race-in-mesh-sequence-number-assig.patch deleted file mode 100644 index 7d01ffdfff0a20..00000000000000 --- a/package/kernel/mac80211/patches/subsys/318-wifi-mac80211-fix-race-in-mesh-sequence-number-assig.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Felix Fietkau -Date: Wed, 15 Feb 2023 15:21:37 +0100 -Subject: [PATCH] wifi: mac80211: fix race in mesh sequence number - assignment - -Since the sequence number is shared across different tx queues, it needs -to be atomic in order to avoid accidental duplicate assignment - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -696,7 +696,7 @@ struct ieee80211_if_mesh { - struct mesh_stats mshstats; - struct mesh_config mshcfg; - atomic_t estab_plinks; -- u32 mesh_seqnum; -+ atomic_t mesh_seqnum; - bool accepting_plinks; - int num_gates; - struct beacon_data __rcu *beacon; ---- a/net/mac80211/mesh.c -+++ b/net/mac80211/mesh.c -@@ -752,10 +752,8 @@ unsigned int ieee80211_new_mesh_header(s - - meshhdr->ttl = sdata->u.mesh.mshcfg.dot11MeshTTL; - -- /* FIXME: racy -- TX on multiple queues can be concurrent */ -- put_unaligned(cpu_to_le32(sdata->u.mesh.mesh_seqnum), &meshhdr->seqnum); -- sdata->u.mesh.mesh_seqnum++; -- -+ put_unaligned_le32(atomic_inc_return(&sdata->u.mesh.mesh_seqnum), -+ &meshhdr->seqnum); - if (addr4or5 && !addr6) { - meshhdr->flags |= MESH_FLAGS_AE_A4; - memcpy(meshhdr->eaddr1, addr4or5, ETH_ALEN); diff --git a/package/kernel/mac80211/patches/subsys/319-wifi-mac80211-mesh-fast-xmit-support.patch b/package/kernel/mac80211/patches/subsys/319-wifi-mac80211-mesh-fast-xmit-support.patch deleted file mode 100644 index 968d2885f2a987..00000000000000 --- a/package/kernel/mac80211/patches/subsys/319-wifi-mac80211-mesh-fast-xmit-support.patch +++ /dev/null @@ -1,850 +0,0 @@ -From: Felix Fietkau -Date: Sun, 26 Feb 2023 13:53:08 +0100 -Subject: [PATCH] wifi: mac80211: mesh fast xmit support - -Previously, fast xmit only worked on interface types where initially a -sta lookup is performed, and a cached header can be attached to the sta, -requiring only some fields to be updated at runtime. - -This technique is not directly applicable for a mesh device type due -to the dynamic nature of the topology and protocol. There are more -addresses that need to be filled, and there is an extra header with a -dynamic length based on the addressing mode. - -Change the code to cache entries contain a copy of the mesh subframe header + -bridge tunnel header, as well as an embedded struct ieee80211_fast_tx, which -contains the information for building the 802.11 header. - -Add a mesh specific early fast xmit call, which looks up a cached entry and -adds only the mesh subframe header, before passing it over to the generic -fast xmit code. - -To ensure the changes in network are reflected in these cached headers, -flush affected cached entries on path changes, as well as other conditions -that currently trigger a fast xmit check in other modes (key changes etc.) - -This code is loosely based on a previous implementation by: -Sriram R - -Signed-off-by: Ryder Lee -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -37,6 +37,7 @@ - extern const struct cfg80211_ops mac80211_config_ops; - - struct ieee80211_local; -+struct ieee80211_mesh_fast_tx; - - /* Maximum number of broadcast/multicast frames to buffer when some of the - * associated stations are using power saving. */ -@@ -656,6 +657,19 @@ struct mesh_table { - atomic_t entries; /* Up to MAX_MESH_NEIGHBOURS */ - }; - -+/** -+ * struct mesh_tx_cache - mesh fast xmit header cache -+ * -+ * @rht: hash table containing struct ieee80211_mesh_fast_tx, using skb DA as key -+ * @walk_head: linked list containing all ieee80211_mesh_fast_tx objects -+ * @walk_lock: lock protecting walk_head and rht -+ */ -+struct mesh_tx_cache { -+ struct rhashtable rht; -+ struct hlist_head walk_head; -+ spinlock_t walk_lock; -+}; -+ - struct ieee80211_if_mesh { - struct timer_list housekeeping_timer; - struct timer_list mesh_path_timer; -@@ -734,6 +748,7 @@ struct ieee80211_if_mesh { - struct mesh_table mpp_paths; /* Store paths for MPP&MAP */ - int mesh_paths_generation; - int mpp_paths_generation; -+ struct mesh_tx_cache tx_cache; - }; - - #ifdef CPTCFG_MAC80211_MESH -@@ -2002,6 +2017,11 @@ int ieee80211_tx_control_port(struct wip - int link_id, u64 *cookie); - int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev, - const u8 *buf, size_t len); -+void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, -+ struct ieee80211_fast_tx *fast_tx, -+ struct sk_buff *skb, bool ampdu, -+ const u8 *da, const u8 *sa); - - /* HT */ - void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, ---- a/net/mac80211/mesh.c -+++ b/net/mac80211/mesh.c -@@ -10,6 +10,7 @@ - #include - #include "ieee80211_i.h" - #include "mesh.h" -+#include "wme.h" - #include "driver-ops.h" - - static int mesh_allocated; -@@ -698,6 +699,95 @@ ieee80211_mesh_update_bss_params(struct - __le32_to_cpu(he_oper->he_oper_params); - } - -+bool ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, u32 ctrl_flags) -+{ -+ struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; -+ struct ieee80211_mesh_fast_tx *entry; -+ struct ieee80211s_hdr *meshhdr; -+ u8 sa[ETH_ALEN] __aligned(2); -+ struct tid_ampdu_tx *tid_tx; -+ struct sta_info *sta; -+ bool copy_sa = false; -+ u16 ethertype; -+ u8 tid; -+ -+ if (ctrl_flags & IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP) -+ return false; -+ -+ if (ifmsh->mshcfg.dot11MeshNolearn) -+ return false; -+ -+ /* Add support for these cases later */ -+ if (ifmsh->ps_peers_light_sleep || ifmsh->ps_peers_deep_sleep) -+ return false; -+ -+ if (is_multicast_ether_addr(skb->data)) -+ return false; -+ -+ ethertype = (skb->data[12] << 8) | skb->data[13]; -+ if (ethertype < ETH_P_802_3_MIN) -+ return false; -+ -+ if (skb->sk && skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS) -+ return false; -+ -+ if (skb->ip_summed == CHECKSUM_PARTIAL) { -+ skb_set_transport_header(skb, skb_checksum_start_offset(skb)); -+ if (skb_checksum_help(skb)) -+ return false; -+ } -+ -+ entry = mesh_fast_tx_get(sdata, skb->data); -+ if (!entry) -+ return false; -+ -+ if (skb_headroom(skb) < entry->hdrlen + entry->fast_tx.hdr_len) -+ return false; -+ -+ sta = rcu_dereference(entry->mpath->next_hop); -+ if (!sta) -+ return false; -+ -+ tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -+ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); -+ if (tid_tx) { -+ if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) -+ return false; -+ if (tid_tx->timeout) -+ tid_tx->last_tx = jiffies; -+ } -+ -+ skb = skb_share_check(skb, GFP_ATOMIC); -+ if (!skb) -+ return true; -+ -+ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); -+ -+ meshhdr = (struct ieee80211s_hdr *)entry->hdr; -+ if ((meshhdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) { -+ /* preserve SA from eth header for 6-addr frames */ -+ ether_addr_copy(sa, skb->data + ETH_ALEN); -+ copy_sa = true; -+ } -+ -+ memcpy(skb_push(skb, entry->hdrlen - 2 * ETH_ALEN), entry->hdr, -+ entry->hdrlen); -+ -+ meshhdr = (struct ieee80211s_hdr *)skb->data; -+ put_unaligned_le32(atomic_inc_return(&sdata->u.mesh.mesh_seqnum), -+ &meshhdr->seqnum); -+ meshhdr->ttl = sdata->u.mesh.mshcfg.dot11MeshTTL; -+ if (copy_sa) -+ ether_addr_copy(meshhdr->eaddr2, sa); -+ -+ skb_push(skb, 2 * ETH_ALEN); -+ __ieee80211_xmit_fast(sdata, sta, &entry->fast_tx, skb, tid_tx, -+ entry->mpath->dst, sdata->vif.addr); -+ -+ return true; -+} -+ - /** - * ieee80211_fill_mesh_addresses - fill addresses of a locally originated mesh frame - * @hdr: 802.11 frame header -@@ -780,6 +870,8 @@ static void ieee80211_mesh_housekeeping( - changed = mesh_accept_plinks_update(sdata); - ieee80211_mbss_info_change_notify(sdata, changed); - -+ mesh_fast_tx_gc(sdata); -+ - mod_timer(&ifmsh->housekeeping_timer, - round_jiffies(jiffies + - IEEE80211_MESH_HOUSEKEEPING_INTERVAL)); ---- a/net/mac80211/mesh.h -+++ b/net/mac80211/mesh.h -@@ -122,11 +122,41 @@ struct mesh_path { - u8 rann_snd_addr[ETH_ALEN]; - u32 rann_metric; - unsigned long last_preq_to_root; -+ unsigned long fast_tx_check; - bool is_root; - bool is_gate; - u32 path_change_count; - }; - -+#define MESH_FAST_TX_CACHE_MAX_SIZE 512 -+#define MESH_FAST_TX_CACHE_THRESHOLD_SIZE 384 -+#define MESH_FAST_TX_CACHE_TIMEOUT 8000 /* msecs */ -+ -+/** -+ * struct ieee80211_mesh_fast_tx - cached mesh fast tx entry -+ * @rhash: rhashtable pointer -+ * @addr_key: The Ethernet DA which is the key for this entry -+ * @fast_tx: base fast_tx data -+ * @hdr: cached mesh and rfc1042 headers -+ * @hdrlen: length of mesh + rfc1042 -+ * @walk_list: list containing all the fast tx entries -+ * @mpath: mesh path corresponding to the Mesh DA -+ * @mppath: MPP entry corresponding to this DA -+ * @timestamp: Last used time of this entry -+ */ -+struct ieee80211_mesh_fast_tx { -+ struct rhash_head rhash; -+ u8 addr_key[ETH_ALEN] __aligned(2); -+ -+ struct ieee80211_fast_tx fast_tx; -+ u8 hdr[sizeof(struct ieee80211s_hdr) + sizeof(rfc1042_header)]; -+ u16 hdrlen; -+ -+ struct mesh_path *mpath, *mppath; -+ struct hlist_node walk_list; -+ unsigned long timestamp; -+}; -+ - /* Recent multicast cache */ - /* RMC_BUCKETS must be a power of 2, maximum 256 */ - #define RMC_BUCKETS 256 -@@ -298,6 +328,20 @@ void mesh_path_discard_frame(struct ieee - void mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata); - - bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt); -+struct ieee80211_mesh_fast_tx * -+mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, const u8 *addr); -+bool ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, u32 ctrl_flags); -+void mesh_fast_tx_cache(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, struct mesh_path *mpath); -+void mesh_fast_tx_gc(struct ieee80211_sub_if_data *sdata); -+void mesh_fast_tx_flush_addr(struct ieee80211_sub_if_data *sdata, -+ const u8 *addr); -+void mesh_fast_tx_flush_mpath(struct mesh_path *mpath); -+void mesh_fast_tx_flush_sta(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta); -+void mesh_path_refresh(struct ieee80211_sub_if_data *sdata, -+ struct mesh_path *mpath, const u8 *addr); - - #ifdef CPTCFG_MAC80211_MESH - static inline ---- a/net/mac80211/mesh_hwmp.c -+++ b/net/mac80211/mesh_hwmp.c -@@ -394,6 +394,7 @@ static u32 hwmp_route_info_get(struct ie - u32 orig_sn, orig_metric; - unsigned long orig_lifetime, exp_time; - u32 last_hop_metric, new_metric; -+ bool flush_mpath = false; - bool process = true; - u8 hopcount; - -@@ -491,8 +492,10 @@ static u32 hwmp_route_info_get(struct ie - } - - if (fresh_info) { -- if (rcu_access_pointer(mpath->next_hop) != sta) -+ if (rcu_access_pointer(mpath->next_hop) != sta) { - mpath->path_change_count++; -+ flush_mpath = true; -+ } - mesh_path_assign_nexthop(mpath, sta); - mpath->flags |= MESH_PATH_SN_VALID; - mpath->metric = new_metric; -@@ -502,6 +505,8 @@ static u32 hwmp_route_info_get(struct ie - mpath->hop_count = hopcount; - mesh_path_activate(mpath); - spin_unlock_bh(&mpath->state_lock); -+ if (flush_mpath) -+ mesh_fast_tx_flush_mpath(mpath); - ewma_mesh_fail_avg_init(&sta->mesh->fail_avg); - /* init it at a low value - 0 start is tricky */ - ewma_mesh_fail_avg_add(&sta->mesh->fail_avg, 1); -@@ -539,8 +544,10 @@ static u32 hwmp_route_info_get(struct ie - } - - if (fresh_info) { -- if (rcu_access_pointer(mpath->next_hop) != sta) -+ if (rcu_access_pointer(mpath->next_hop) != sta) { - mpath->path_change_count++; -+ flush_mpath = true; -+ } - mesh_path_assign_nexthop(mpath, sta); - mpath->metric = last_hop_metric; - mpath->exp_time = time_after(mpath->exp_time, exp_time) -@@ -548,6 +555,8 @@ static u32 hwmp_route_info_get(struct ie - mpath->hop_count = 1; - mesh_path_activate(mpath); - spin_unlock_bh(&mpath->state_lock); -+ if (flush_mpath) -+ mesh_fast_tx_flush_mpath(mpath); - ewma_mesh_fail_avg_init(&sta->mesh->fail_avg); - /* init it at a low value - 0 start is tricky */ - ewma_mesh_fail_avg_add(&sta->mesh->fail_avg, 1); -@@ -1215,6 +1224,20 @@ static int mesh_nexthop_lookup_nolearn(s - return 0; - } - -+void mesh_path_refresh(struct ieee80211_sub_if_data *sdata, -+ struct mesh_path *mpath, const u8 *addr) -+{ -+ if (mpath->flags & (MESH_PATH_REQ_QUEUED | MESH_PATH_FIXED | -+ MESH_PATH_RESOLVING)) -+ return; -+ -+ if (time_after(jiffies, -+ mpath->exp_time - -+ msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) && -+ (!addr || ether_addr_equal(sdata->vif.addr, addr))) -+ mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); -+} -+ - /** - * mesh_nexthop_lookup - put the appropriate next hop on a mesh frame. Calling - * this function is considered "using" the associated mpath, so preempt a path -@@ -1242,19 +1265,15 @@ int mesh_nexthop_lookup(struct ieee80211 - if (!mpath || !(mpath->flags & MESH_PATH_ACTIVE)) - return -ENOENT; - -- if (time_after(jiffies, -- mpath->exp_time - -- msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) && -- ether_addr_equal(sdata->vif.addr, hdr->addr4) && -- !(mpath->flags & MESH_PATH_RESOLVING) && -- !(mpath->flags & MESH_PATH_FIXED)) -- mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); -+ mesh_path_refresh(sdata, mpath, hdr->addr4); - - next_hop = rcu_dereference(mpath->next_hop); - if (next_hop) { - memcpy(hdr->addr1, next_hop->sta.addr, ETH_ALEN); - memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN); - ieee80211_mps_set_frame_flags(sdata, next_hop, hdr); -+ if (ieee80211_hw_check(&sdata->local->hw, SUPPORT_FAST_XMIT)) -+ mesh_fast_tx_cache(sdata, skb, mpath); - return 0; - } - ---- a/net/mac80211/mesh_pathtbl.c -+++ b/net/mac80211/mesh_pathtbl.c -@@ -14,6 +14,7 @@ - #include "wme.h" - #include "ieee80211_i.h" - #include "mesh.h" -+#include - - static void mesh_path_free_rcu(struct mesh_table *tbl, struct mesh_path *mpath); - -@@ -32,6 +33,41 @@ static const struct rhashtable_params me - .hashfn = mesh_table_hash, - }; - -+static const struct rhashtable_params fast_tx_rht_params = { -+ .nelem_hint = 10, -+ .automatic_shrinking = true, -+ .key_len = ETH_ALEN, -+ .key_offset = offsetof(struct ieee80211_mesh_fast_tx, addr_key), -+ .head_offset = offsetof(struct ieee80211_mesh_fast_tx, rhash), -+ .hashfn = mesh_table_hash, -+}; -+ -+static void __mesh_fast_tx_entry_free(void *ptr, void *tblptr) -+{ -+ struct ieee80211_mesh_fast_tx *entry = ptr; -+ -+ kfree_rcu(entry, fast_tx.rcu_head); -+} -+ -+static void mesh_fast_tx_deinit(struct ieee80211_sub_if_data *sdata) -+{ -+ struct mesh_tx_cache *cache; -+ -+ cache = &sdata->u.mesh.tx_cache; -+ rhashtable_free_and_destroy(&cache->rht, -+ __mesh_fast_tx_entry_free, NULL); -+} -+ -+static void mesh_fast_tx_init(struct ieee80211_sub_if_data *sdata) -+{ -+ struct mesh_tx_cache *cache; -+ -+ cache = &sdata->u.mesh.tx_cache; -+ rhashtable_init(&cache->rht, &fast_tx_rht_params); -+ INIT_HLIST_HEAD(&cache->walk_head); -+ spin_lock_init(&cache->walk_lock); -+} -+ - static inline bool mpath_expired(struct mesh_path *mpath) - { - return (mpath->flags & MESH_PATH_ACTIVE) && -@@ -381,6 +417,243 @@ struct mesh_path *mesh_path_new(struct i - return new_mpath; - } - -+static void mesh_fast_tx_entry_free(struct mesh_tx_cache *cache, -+ struct ieee80211_mesh_fast_tx *entry) -+{ -+ hlist_del_rcu(&entry->walk_list); -+ rhashtable_remove_fast(&cache->rht, &entry->rhash, fast_tx_rht_params); -+ kfree_rcu(entry, fast_tx.rcu_head); -+} -+ -+struct ieee80211_mesh_fast_tx * -+mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, const u8 *addr) -+{ -+ struct ieee80211_mesh_fast_tx *entry; -+ struct mesh_tx_cache *cache; -+ -+ cache = &sdata->u.mesh.tx_cache; -+ entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params); -+ if (!entry) -+ return NULL; -+ -+ if (!(entry->mpath->flags & MESH_PATH_ACTIVE) || -+ mpath_expired(entry->mpath)) { -+ spin_lock_bh(&cache->walk_lock); -+ entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params); -+ if (entry) -+ mesh_fast_tx_entry_free(cache, entry); -+ spin_unlock_bh(&cache->walk_lock); -+ return NULL; -+ } -+ -+ mesh_path_refresh(sdata, entry->mpath, NULL); -+ if (entry->mppath) -+ entry->mppath->exp_time = jiffies; -+ entry->timestamp = jiffies; -+ -+ return entry; -+} -+ -+void mesh_fast_tx_cache(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, struct mesh_path *mpath) -+{ -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -+ struct ieee80211_mesh_fast_tx *entry, *prev; -+ struct ieee80211_mesh_fast_tx build = {}; -+ struct ieee80211s_hdr *meshhdr; -+ struct mesh_tx_cache *cache; -+ struct ieee80211_key *key; -+ struct mesh_path *mppath; -+ struct sta_info *sta; -+ u8 *qc; -+ -+ if (sdata->noack_map || -+ !ieee80211_is_data_qos(hdr->frame_control)) -+ return; -+ -+ build.fast_tx.hdr_len = ieee80211_hdrlen(hdr->frame_control); -+ meshhdr = (struct ieee80211s_hdr *)(skb->data + build.fast_tx.hdr_len); -+ build.hdrlen = ieee80211_get_mesh_hdrlen(meshhdr); -+ -+ cache = &sdata->u.mesh.tx_cache; -+ if (atomic_read(&cache->rht.nelems) >= MESH_FAST_TX_CACHE_MAX_SIZE) -+ return; -+ -+ sta = rcu_dereference(mpath->next_hop); -+ if (!sta) -+ return; -+ -+ if ((meshhdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) { -+ /* This is required to keep the mppath alive */ -+ mppath = mpp_path_lookup(sdata, meshhdr->eaddr1); -+ if (!mppath) -+ return; -+ build.mppath = mppath; -+ } else if (ieee80211_has_a4(hdr->frame_control)) { -+ mppath = mpath; -+ } else { -+ return; -+ } -+ -+ /* rate limit, in case fast xmit can't be enabled */ -+ if (mppath->fast_tx_check == jiffies) -+ return; -+ -+ mppath->fast_tx_check = jiffies; -+ -+ /* -+ * Same use of the sta lock as in ieee80211_check_fast_xmit, in order -+ * to protect against concurrent sta key updates. -+ */ -+ spin_lock_bh(&sta->lock); -+ key = rcu_access_pointer(sta->ptk[sta->ptk_idx]); -+ if (!key) -+ key = rcu_access_pointer(sdata->default_unicast_key); -+ build.fast_tx.key = key; -+ -+ if (key) { -+ bool gen_iv, iv_spc; -+ -+ gen_iv = key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV; -+ iv_spc = key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE; -+ -+ if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) || -+ (key->flags & KEY_FLAG_TAINTED)) -+ goto unlock_sta; -+ -+ switch (key->conf.cipher) { -+ case WLAN_CIPHER_SUITE_CCMP: -+ case WLAN_CIPHER_SUITE_CCMP_256: -+ if (gen_iv) -+ build.fast_tx.pn_offs = build.fast_tx.hdr_len; -+ if (gen_iv || iv_spc) -+ build.fast_tx.hdr_len += IEEE80211_CCMP_HDR_LEN; -+ break; -+ case WLAN_CIPHER_SUITE_GCMP: -+ case WLAN_CIPHER_SUITE_GCMP_256: -+ if (gen_iv) -+ build.fast_tx.pn_offs = build.fast_tx.hdr_len; -+ if (gen_iv || iv_spc) -+ build.fast_tx.hdr_len += IEEE80211_GCMP_HDR_LEN; -+ break; -+ default: -+ goto unlock_sta; -+ } -+ } -+ -+ memcpy(build.addr_key, mppath->dst, ETH_ALEN); -+ build.timestamp = jiffies; -+ build.fast_tx.band = info->band; -+ build.fast_tx.da_offs = offsetof(struct ieee80211_hdr, addr3); -+ build.fast_tx.sa_offs = offsetof(struct ieee80211_hdr, addr4); -+ build.mpath = mpath; -+ memcpy(build.hdr, meshhdr, build.hdrlen); -+ memcpy(build.hdr + build.hdrlen, rfc1042_header, sizeof(rfc1042_header)); -+ build.hdrlen += sizeof(rfc1042_header); -+ memcpy(build.fast_tx.hdr, hdr, build.fast_tx.hdr_len); -+ -+ hdr = (struct ieee80211_hdr *)build.fast_tx.hdr; -+ if (build.fast_tx.key) -+ hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); -+ -+ qc = ieee80211_get_qos_ctl(hdr); -+ qc[1] |= IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT >> 8; -+ -+ entry = kmemdup(&build, sizeof(build), GFP_ATOMIC); -+ if (!entry) -+ goto unlock_sta; -+ -+ spin_lock(&cache->walk_lock); -+ prev = rhashtable_lookup_get_insert_fast(&cache->rht, -+ &entry->rhash, -+ fast_tx_rht_params); -+ if (unlikely(IS_ERR(prev))) { -+ kfree(entry); -+ goto unlock_cache; -+ } -+ -+ /* -+ * replace any previous entry in the hash table, in case we're -+ * replacing it with a different type (e.g. mpath -> mpp) -+ */ -+ if (unlikely(prev)) { -+ rhashtable_replace_fast(&cache->rht, &prev->rhash, -+ &entry->rhash, fast_tx_rht_params); -+ hlist_del_rcu(&prev->walk_list); -+ kfree_rcu(prev, fast_tx.rcu_head); -+ } -+ -+ hlist_add_head(&entry->walk_list, &cache->walk_head); -+ -+unlock_cache: -+ spin_unlock(&cache->walk_lock); -+unlock_sta: -+ spin_unlock_bh(&sta->lock); -+} -+ -+void mesh_fast_tx_gc(struct ieee80211_sub_if_data *sdata) -+{ -+ unsigned long timeout = msecs_to_jiffies(MESH_FAST_TX_CACHE_TIMEOUT); -+ struct mesh_tx_cache *cache; -+ struct ieee80211_mesh_fast_tx *entry; -+ struct hlist_node *n; -+ -+ cache = &sdata->u.mesh.tx_cache; -+ if (atomic_read(&cache->rht.nelems) < MESH_FAST_TX_CACHE_THRESHOLD_SIZE) -+ return; -+ -+ spin_lock_bh(&cache->walk_lock); -+ hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list) -+ if (!time_is_after_jiffies(entry->timestamp + timeout)) -+ mesh_fast_tx_entry_free(cache, entry); -+ spin_unlock_bh(&cache->walk_lock); -+} -+ -+void mesh_fast_tx_flush_mpath(struct mesh_path *mpath) -+{ -+ struct ieee80211_sub_if_data *sdata = mpath->sdata; -+ struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache; -+ struct ieee80211_mesh_fast_tx *entry; -+ struct hlist_node *n; -+ -+ cache = &sdata->u.mesh.tx_cache; -+ spin_lock_bh(&cache->walk_lock); -+ hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list) -+ if (entry->mpath == mpath) -+ mesh_fast_tx_entry_free(cache, entry); -+ spin_unlock_bh(&cache->walk_lock); -+} -+ -+void mesh_fast_tx_flush_sta(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta) -+{ -+ struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache; -+ struct ieee80211_mesh_fast_tx *entry; -+ struct hlist_node *n; -+ -+ cache = &sdata->u.mesh.tx_cache; -+ spin_lock_bh(&cache->walk_lock); -+ hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list) -+ if (rcu_access_pointer(entry->mpath->next_hop) == sta) -+ mesh_fast_tx_entry_free(cache, entry); -+ spin_unlock_bh(&cache->walk_lock); -+} -+ -+void mesh_fast_tx_flush_addr(struct ieee80211_sub_if_data *sdata, -+ const u8 *addr) -+{ -+ struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache; -+ struct ieee80211_mesh_fast_tx *entry; -+ -+ cache = &sdata->u.mesh.tx_cache; -+ spin_lock_bh(&cache->walk_lock); -+ entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params); -+ if (entry) -+ mesh_fast_tx_entry_free(cache, entry); -+ spin_unlock_bh(&cache->walk_lock); -+} -+ - /** - * mesh_path_add - allocate and add a new path to the mesh path table - * @dst: destination address of the path (ETH_ALEN length) -@@ -464,6 +737,8 @@ int mpp_path_add(struct ieee80211_sub_if - - if (ret) - kfree(new_mpath); -+ else -+ mesh_fast_tx_flush_addr(sdata, dst); - - sdata->u.mesh.mpp_paths_generation++; - return ret; -@@ -523,6 +798,10 @@ static void __mesh_path_del(struct mesh_ - { - hlist_del_rcu(&mpath->walk_list); - rhashtable_remove_fast(&tbl->rhead, &mpath->rhash, mesh_rht_params); -+ if (tbl == &mpath->sdata->u.mesh.mpp_paths) -+ mesh_fast_tx_flush_addr(mpath->sdata, mpath->dst); -+ else -+ mesh_fast_tx_flush_mpath(mpath); - mesh_path_free_rcu(tbl, mpath); - } - -@@ -747,6 +1026,7 @@ void mesh_path_fix_nexthop(struct mesh_p - mpath->exp_time = 0; - mpath->flags = MESH_PATH_FIXED | MESH_PATH_SN_VALID; - mesh_path_activate(mpath); -+ mesh_fast_tx_flush_mpath(mpath); - spin_unlock_bh(&mpath->state_lock); - ewma_mesh_fail_avg_init(&next_hop->mesh->fail_avg); - /* init it at a low value - 0 start is tricky */ -@@ -758,6 +1038,7 @@ void mesh_pathtbl_init(struct ieee80211_ - { - mesh_table_init(&sdata->u.mesh.mesh_paths); - mesh_table_init(&sdata->u.mesh.mpp_paths); -+ mesh_fast_tx_init(sdata); - } - - static -@@ -785,6 +1066,7 @@ void mesh_path_expire(struct ieee80211_s - - void mesh_pathtbl_unregister(struct ieee80211_sub_if_data *sdata) - { -+ mesh_fast_tx_deinit(sdata); - mesh_table_free(&sdata->u.mesh.mesh_paths); - mesh_table_free(&sdata->u.mesh.mpp_paths); - } ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2791,6 +2791,7 @@ ieee80211_rx_mesh_data(struct ieee80211_ - if (mesh_hdr->flags & MESH_FLAGS_AE) { - struct mesh_path *mppath; - char *proxied_addr; -+ bool update = false; - - if (multicast) - proxied_addr = mesh_hdr->eaddr1; -@@ -2806,11 +2807,18 @@ ieee80211_rx_mesh_data(struct ieee80211_ - mpp_path_add(sdata, proxied_addr, eth->h_source); - } else { - spin_lock_bh(&mppath->state_lock); -- if (!ether_addr_equal(mppath->mpp, eth->h_source)) -+ if (!ether_addr_equal(mppath->mpp, eth->h_source)) { - memcpy(mppath->mpp, eth->h_source, ETH_ALEN); -+ update = true; -+ } - mppath->exp_time = jiffies; - spin_unlock_bh(&mppath->state_lock); - } -+ -+ /* flush fast xmit cache if the address path changed */ -+ if (update) -+ mesh_fast_tx_flush_addr(sdata, proxied_addr); -+ - rcu_read_unlock(); - } - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3022,6 +3022,9 @@ void ieee80211_check_fast_xmit(struct st - if (!ieee80211_hw_check(&local->hw, SUPPORT_FAST_XMIT)) - return; - -+ if (ieee80211_vif_is_mesh(&sdata->vif)) -+ mesh_fast_tx_flush_sta(sdata, sta); -+ - /* Locking here protects both the pointer itself, and against concurrent - * invocations winning data access races to, e.g., the key pointer that - * is used. -@@ -3403,6 +3406,9 @@ static bool ieee80211_amsdu_aggregate(st - if (sdata->vif.offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED) - return false; - -+ if (ieee80211_vif_is_mesh(&sdata->vif)) -+ return false; -+ - if (skb_is_gso(skb)) - return false; - -@@ -3635,10 +3641,11 @@ free: - return NULL; - } - --static void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -- struct sta_info *sta, -- struct ieee80211_fast_tx *fast_tx, -- struct sk_buff *skb, u8 tid, bool ampdu) -+void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, -+ struct ieee80211_fast_tx *fast_tx, -+ struct sk_buff *skb, bool ampdu, -+ const u8 *da, const u8 *sa) - { - struct ieee80211_local *local = sdata->local; - struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; -@@ -3647,7 +3654,6 @@ static void __ieee80211_xmit_fast(struct - ieee80211_tx_result r; - int hw_headroom = sdata->local->hw.extra_tx_headroom; - int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); -- struct ethhdr eth; - - skb = skb_share_check(skb, GFP_ATOMIC); - if (unlikely(!skb)) -@@ -3667,11 +3673,10 @@ static void __ieee80211_xmit_fast(struct - ENCRYPT_NO))) - goto free; - -- memcpy(ð, skb->data, ETH_HLEN - 2); - hdr = skb_push(skb, extra_head); - memcpy(skb->data, fast_tx->hdr, fast_tx->hdr_len); -- memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN); -- memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN); -+ memcpy(skb->data + fast_tx->da_offs, da, ETH_ALEN); -+ memcpy(skb->data + fast_tx->sa_offs, sa, ETH_ALEN); - - info = IEEE80211_SKB_CB(skb); - memset(info, 0, sizeof(*info)); -@@ -3690,7 +3695,8 @@ static void __ieee80211_xmit_fast(struct - #endif - - if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { -- tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -+ - *ieee80211_get_qos_ctl(hdr) = tid; - } - -@@ -3733,6 +3739,7 @@ static bool ieee80211_xmit_fast(struct i - struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; - struct tid_ampdu_tx *tid_tx = NULL; - struct sk_buff *next; -+ struct ethhdr eth; - u8 tid = IEEE80211_NUM_TIDS; - - /* control port protocol needs a lot of special handling */ -@@ -3758,6 +3765,8 @@ static bool ieee80211_xmit_fast(struct i - } - } - -+ memcpy(ð, skb->data, ETH_HLEN - 2); -+ - /* after this point (skb is modified) we cannot return false */ - skb = ieee80211_tx_skb_fixup(skb, ieee80211_sdata_netdev_features(sdata)); - if (!skb) -@@ -3765,7 +3774,8 @@ static bool ieee80211_xmit_fast(struct i - - skb_list_walk_safe(skb, skb, next) { - skb_mark_not_on_list(skb); -- __ieee80211_xmit_fast(sdata, sta, fast_tx, skb, tid, tid_tx); -+ __ieee80211_xmit_fast(sdata, sta, fast_tx, skb, tid_tx, -+ eth.h_dest, eth.h_source); - } - - return true; -@@ -4252,8 +4262,15 @@ void __ieee80211_subif_start_xmit(struct - return; - } - -+ sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift); -+ - rcu_read_lock(); - -+ if (ieee80211_vif_is_mesh(&sdata->vif) && -+ ieee80211_hw_check(&local->hw, SUPPORT_FAST_XMIT) && -+ ieee80211_mesh_xmit_fast(sdata, skb, ctrl_flags)) -+ goto out; -+ - if (ieee80211_lookup_ra_sta(sdata, skb, &sta)) - goto out_free; - -@@ -4263,8 +4280,6 @@ void __ieee80211_subif_start_xmit(struct - skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); - ieee80211_aggr_check(sdata, sta, skb); - -- sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift); -- - if (sta) { - struct ieee80211_fast_tx *fast_tx; - diff --git a/package/kernel/mac80211/patches/subsys/340-cfg80211-allow-grace-period-for-DFS-available-after-.patch b/package/kernel/mac80211/patches/subsys/320-cfg80211-allow-grace-period-for-DFS-available-after-.patch similarity index 91% rename from package/kernel/mac80211/patches/subsys/340-cfg80211-allow-grace-period-for-DFS-available-after-.patch rename to package/kernel/mac80211/patches/subsys/320-cfg80211-allow-grace-period-for-DFS-available-after-.patch index ad2e2e24c9fb3d..28e2144f7f51ba 100644 --- a/package/kernel/mac80211/patches/subsys/340-cfg80211-allow-grace-period-for-DFS-available-after-.patch +++ b/package/kernel/mac80211/patches/subsys/320-cfg80211-allow-grace-period-for-DFS-available-after-.patch @@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau wdev->conn_owner_nlportid = 0; @@ -41,9 +44,6 @@ static int ___cfg80211_stop_ap(struct cf if (notify) - nl80211_send_ap_stopped(wdev); + nl80211_send_ap_stopped(wdev, link_id); - /* Should we apply the grace period during beaconing interface - * shutdown also? @@ -61,7 +61,7 @@ Signed-off-by: Felix Fietkau } } -@@ -873,6 +875,49 @@ static bool cfg80211_get_chans_dfs_avail +@@ -874,6 +876,49 @@ static bool cfg80211_get_chans_dfs_avail return true; } @@ -113,18 +113,18 @@ Signed-off-by: Felix Fietkau { --- a/net/wireless/core.h +++ b/net/wireless/core.h -@@ -477,6 +477,8 @@ void cfg80211_set_dfs_state(struct wiphy +@@ -474,6 +474,8 @@ void cfg80211_set_dfs_state(struct wiphy enum nl80211_dfs_state dfs_state); void cfg80211_dfs_channels_update_work(struct work_struct *work); +void cfg80211_update_last_available(struct wiphy *wiphy, + const struct cfg80211_chan_def *chandef); - unsigned int - cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy, + void cfg80211_sched_dfs_chan_update(struct cfg80211_registered_device *rdev); + --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c -@@ -891,6 +891,8 @@ void cfg80211_dfs_channels_update_work(s +@@ -915,6 +915,8 @@ void cfg80211_dfs_channels_update_work(s if (c->dfs_state == NL80211_DFS_UNAVAILABLE) { time_dfs_update = IEEE80211_DFS_MIN_NOP_TIME_MS; radar_event = NL80211_RADAR_NOP_FINISHED; @@ -133,7 +133,7 @@ Signed-off-by: Felix Fietkau } else { if (regulatory_pre_cac_allowed(wiphy) || cfg80211_any_wiphy_oper_chan(wiphy, c)) -@@ -898,11 +900,10 @@ void cfg80211_dfs_channels_update_work(s +@@ -922,11 +924,10 @@ void cfg80211_dfs_channels_update_work(s time_dfs_update = REG_PRE_CAC_EXPIRY_GRACE_MS; radar_event = NL80211_RADAR_PRE_CAC_EXPIRED; diff --git a/package/kernel/mac80211/patches/subsys/320-wifi-mac80211-use-mesh-header-cache-to-speed-up-mesh.patch b/package/kernel/mac80211/patches/subsys/320-wifi-mac80211-use-mesh-header-cache-to-speed-up-mesh.patch deleted file mode 100644 index 28b1ff110684ee..00000000000000 --- a/package/kernel/mac80211/patches/subsys/320-wifi-mac80211-use-mesh-header-cache-to-speed-up-mesh.patch +++ /dev/null @@ -1,132 +0,0 @@ -From: Felix Fietkau -Date: Thu, 16 Feb 2023 11:07:30 +0100 -Subject: [PATCH] wifi: mac80211: use mesh header cache to speed up mesh - forwarding - -Significantly reduces mesh forwarding path CPU usage and enables the -direct use of iTXQ. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2720,6 +2720,65 @@ ieee80211_deliver_skb(struct ieee80211_r - } - } - -+#ifdef CPTCFG_MAC80211_MESH -+static bool -+ieee80211_rx_mesh_fast_forward(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, int hdrlen) -+{ -+ struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; -+ struct ieee80211_mesh_fast_tx *entry = NULL; -+ struct ieee80211s_hdr *mesh_hdr; -+ struct tid_ampdu_tx *tid_tx; -+ struct sta_info *sta; -+ struct ethhdr eth; -+ u8 tid; -+ -+ mesh_hdr = (struct ieee80211s_hdr *)(skb->data + sizeof(eth)); -+ if ((mesh_hdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) -+ entry = mesh_fast_tx_get(sdata, mesh_hdr->eaddr1); -+ else if (!(mesh_hdr->flags & MESH_FLAGS_AE)) -+ entry = mesh_fast_tx_get(sdata, skb->data); -+ if (!entry) -+ return false; -+ -+ sta = rcu_dereference(entry->mpath->next_hop); -+ if (!sta) -+ return false; -+ -+ if (skb_linearize(skb)) -+ return false; -+ -+ tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -+ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); -+ if (tid_tx) { -+ if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) -+ return false; -+ -+ if (tid_tx->timeout) -+ tid_tx->last_tx = jiffies; -+ } -+ -+ ieee80211_aggr_check(sdata, sta, skb); -+ -+ if (ieee80211_get_8023_tunnel_proto(skb->data + hdrlen, -+ &skb->protocol)) -+ hdrlen += ETH_ALEN; -+ else -+ skb->protocol = htons(skb->len - hdrlen); -+ skb_set_network_header(skb, hdrlen + 2); -+ -+ skb->dev = sdata->dev; -+ memcpy(ð, skb->data, ETH_HLEN - 2); -+ skb_pull(skb, 2); -+ __ieee80211_xmit_fast(sdata, sta, &entry->fast_tx, skb, tid_tx, -+ eth.h_dest, eth.h_source); -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast); -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames); -+ -+ return true; -+} -+#endif -+ - static ieee80211_rx_result - ieee80211_rx_mesh_data(struct ieee80211_sub_if_data *sdata, struct sta_info *sta, - struct sk_buff *skb) -@@ -2824,6 +2883,10 @@ ieee80211_rx_mesh_data(struct ieee80211_ - - skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]); - -+ if (!multicast && -+ ieee80211_rx_mesh_fast_forward(sdata, skb, mesh_hdrlen)) -+ return RX_QUEUED; -+ - ieee80211_fill_mesh_addresses(&hdr, &hdr.frame_control, - eth->h_dest, eth->h_source); - hdrlen = ieee80211_hdrlen(hdr.frame_control); -@@ -2862,6 +2925,7 @@ ieee80211_rx_mesh_data(struct ieee80211_ - info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING; - info->control.vif = &sdata->vif; - info->control.jiffies = jiffies; -+ fwd_skb->dev = sdata->dev; - if (multicast) { - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_mcast); - memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); -@@ -2883,7 +2947,6 @@ ieee80211_rx_mesh_data(struct ieee80211_ - } - - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames); -- fwd_skb->dev = sdata->dev; - ieee80211_add_pending_skb(local, fwd_skb); - - rx_accept: ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -2022,6 +2022,8 @@ void __ieee80211_xmit_fast(struct ieee80 - struct ieee80211_fast_tx *fast_tx, - struct sk_buff *skb, bool ampdu, - const u8 *da, const u8 *sa); -+void ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, struct sk_buff *skb); - - /* HT */ - void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1191,10 +1191,8 @@ static bool ieee80211_tx_prep_agg(struct - return queued; - } - --static void --ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata, -- struct sta_info *sta, -- struct sk_buff *skb) -+void ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, struct sk_buff *skb) - { - struct rate_control_ref *ref = sdata->local->rate_ctrl; - u16 tid; diff --git a/package/kernel/mac80211/patches/subsys/321-mac80211-fix-mesh-forwarding.patch b/package/kernel/mac80211/patches/subsys/321-mac80211-fix-mesh-forwarding.patch deleted file mode 100644 index e2b268ae4c0e4f..00000000000000 --- a/package/kernel/mac80211/patches/subsys/321-mac80211-fix-mesh-forwarding.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Felix Fietkau -Date: Mon, 20 Feb 2023 12:50:50 +0100 -Subject: [PATCH] mac80211: fix mesh forwarding - -Linearize packets (needed for forwarding A-MSDU subframes). -Fix network header offset to fix flow dissector (and fair queueing). - -Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2904,6 +2904,9 @@ ieee80211_rx_mesh_data(struct ieee80211_ - - if (skb_cow_head(fwd_skb, hdrlen - sizeof(struct ethhdr))) - return RX_DROP_UNUSABLE; -+ -+ if (skb_linearize(fwd_skb)) -+ return RX_DROP_UNUSABLE; - } - - fwd_hdr = skb_push(fwd_skb, hdrlen - sizeof(struct ethhdr)); -@@ -2918,7 +2921,7 @@ ieee80211_rx_mesh_data(struct ieee80211_ - hdrlen += ETH_ALEN; - else - fwd_skb->protocol = htons(fwd_skb->len - hdrlen); -- skb_set_network_header(fwd_skb, hdrlen); -+ skb_set_network_header(fwd_skb, hdrlen + 2); - - info = IEEE80211_SKB_CB(fwd_skb); - memset(info, 0, sizeof(*info)); diff --git a/package/kernel/mac80211/patches/subsys/322-wifi-mac80211-fix-mesh-path-discovery-based-on-unica.patch b/package/kernel/mac80211/patches/subsys/322-wifi-mac80211-fix-mesh-path-discovery-based-on-unica.patch deleted file mode 100644 index 292a89ef9213fa..00000000000000 --- a/package/kernel/mac80211/patches/subsys/322-wifi-mac80211-fix-mesh-path-discovery-based-on-unica.patch +++ /dev/null @@ -1,52 +0,0 @@ -From: Felix Fietkau -Date: Sun, 26 Feb 2023 20:30:20 +0100 -Subject: [PATCH] wifi: mac80211: fix mesh path discovery based on unicast - packets - -If a packet has reached its intended destination, it was bumped to the code -that accepts it, without first checking if a mesh_path needs to be created -based on the discovered source. -Fix this by moving the destination address check further down - -Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2824,17 +2824,6 @@ ieee80211_rx_mesh_data(struct ieee80211_ - mesh_rmc_check(sdata, eth->h_source, mesh_hdr)) - return RX_DROP_MONITOR; - -- /* Frame has reached destination. Don't forward */ -- if (ether_addr_equal(sdata->vif.addr, eth->h_dest)) -- goto rx_accept; -- -- if (!ifmsh->mshcfg.dot11MeshForwarding) { -- if (is_multicast_ether_addr(eth->h_dest)) -- goto rx_accept; -- -- return RX_DROP_MONITOR; -- } -- - /* forward packet */ - if (sdata->crypto_tx_tailroom_needed_cnt) - tailroom = IEEE80211_ENCRYPT_TAILROOM; -@@ -2881,6 +2870,17 @@ ieee80211_rx_mesh_data(struct ieee80211_ - rcu_read_unlock(); - } - -+ /* Frame has reached destination. Don't forward */ -+ if (ether_addr_equal(sdata->vif.addr, eth->h_dest)) -+ goto rx_accept; -+ -+ if (!ifmsh->mshcfg.dot11MeshForwarding) { -+ if (is_multicast_ether_addr(eth->h_dest)) -+ goto rx_accept; -+ -+ return RX_DROP_MONITOR; -+ } -+ - skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]); - - if (!multicast && diff --git a/package/kernel/mac80211/patches/subsys/323-v6.3-wifi-mac80211-Add-VHT-MU-MIMO-related-flags-in-ieee8.patch b/package/kernel/mac80211/patches/subsys/323-v6.3-wifi-mac80211-Add-VHT-MU-MIMO-related-flags-in-ieee8.patch deleted file mode 100644 index e23dc4d226a0af..00000000000000 --- a/package/kernel/mac80211/patches/subsys/323-v6.3-wifi-mac80211-Add-VHT-MU-MIMO-related-flags-in-ieee8.patch +++ /dev/null @@ -1,68 +0,0 @@ -From: Muna Sinada -Date: Wed, 5 Oct 2022 14:54:45 -0700 -Subject: [PATCH] wifi: mac80211: Add VHT MU-MIMO related flags in - ieee80211_bss_conf - -Adding flags for SU Beamformer, SU Beamformee, MU Beamformer and -MU Beamformee for VHT. This is utilized to pass MU-MIMO -configurations from user space to driver in AP mode. - -Signed-off-by: Muna Sinada -Link: https://lore.kernel.org/r/1665006886-23874-1-git-send-email-quic_msinada@quicinc.com -[fixed indentation, removed redundant !!] -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -653,6 +653,14 @@ struct ieee80211_fils_discovery { - * write-protected by sdata_lock and local->mtx so holding either is fine - * for read access. - * @color_change_color: the bss color that will be used after the change. -+ * @vht_su_beamformer: in AP mode, does this BSS support operation as an VHT SU -+ * beamformer -+ * @vht_su_beamformee: in AP mode, does this BSS support operation as an VHT SU -+ * beamformee -+ * @vht_mu_beamformer: in AP mode, does this BSS support operation as an VHT MU -+ * beamformer -+ * @vht_mu_beamformee: in AP mode, does this BSS support operation as an VHT MU -+ * beamformee - */ - struct ieee80211_bss_conf { - const u8 *bssid; -@@ -726,6 +734,11 @@ struct ieee80211_bss_conf { - - bool color_change_active; - u8 color_change_color; -+ -+ bool vht_su_beamformer; -+ bool vht_su_beamformee; -+ bool vht_mu_beamformer; -+ bool vht_mu_beamformee; - }; - - /** ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1252,6 +1252,21 @@ static int ieee80211_start_ap(struct wip - prev_beacon_int = link_conf->beacon_int; - link_conf->beacon_int = params->beacon_interval; - -+ if (params->vht_cap) { -+ link_conf->vht_su_beamformer = -+ params->vht_cap->vht_cap_info & -+ cpu_to_le32(IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE); -+ link_conf->vht_su_beamformee = -+ params->vht_cap->vht_cap_info & -+ cpu_to_le32(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE); -+ link_conf->vht_mu_beamformer = -+ params->vht_cap->vht_cap_info & -+ cpu_to_le32(IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE); -+ link_conf->vht_mu_beamformee = -+ params->vht_cap->vht_cap_info & -+ cpu_to_le32(IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE); -+ } -+ - if (params->he_cap && params->he_oper) { - link_conf->he_support = true; - link_conf->htc_trig_based_pkt_ext = diff --git a/package/kernel/mac80211/patches/subsys/324-v6.3-wifi-mac80211-Add-HE-MU-MIMO-related-flags-in-ieee80.patch b/package/kernel/mac80211/patches/subsys/324-v6.3-wifi-mac80211-Add-HE-MU-MIMO-related-flags-in-ieee80.patch deleted file mode 100644 index f843dba1235cf0..00000000000000 --- a/package/kernel/mac80211/patches/subsys/324-v6.3-wifi-mac80211-Add-HE-MU-MIMO-related-flags-in-ieee80.patch +++ /dev/null @@ -1,68 +0,0 @@ -From: Muna Sinada -Date: Wed, 5 Oct 2022 14:54:46 -0700 -Subject: [PATCH] wifi: mac80211: Add HE MU-MIMO related flags in - ieee80211_bss_conf - -Adding flags for SU Beamformer, SU Beamformee, MU Beamformer and Full -Bandwidth UL MU-MIMO for HE. This is utilized to pass MU-MIMO -configurations from user space to driver in AP mode. - -Signed-off-by: Muna Sinada -Link: https://lore.kernel.org/r/1665006886-23874-2-git-send-email-quic_msinada@quicinc.com -[fixed indentation, removed redundant !!] -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -661,6 +661,15 @@ struct ieee80211_fils_discovery { - * beamformer - * @vht_mu_beamformee: in AP mode, does this BSS support operation as an VHT MU - * beamformee -+ * @he_su_beamformer: in AP-mode, does this BSS support operation as an HE SU -+ * beamformer -+ * @he_su_beamformee: in AP-mode, does this BSS support operation as an HE SU -+ * beamformee -+ * @he_mu_beamformer: in AP-mode, does this BSS support operation as an HE MU -+ * beamformer -+ * @he_full_ul_mumimo: does this BSS support the reception (AP) or transmission -+ * (non-AP STA) of an HE TB PPDU on an RU that spans the entire PPDU -+ * bandwidth - */ - struct ieee80211_bss_conf { - const u8 *bssid; -@@ -739,6 +748,10 @@ struct ieee80211_bss_conf { - bool vht_su_beamformee; - bool vht_mu_beamformer; - bool vht_mu_beamformee; -+ bool he_su_beamformer; -+ bool he_su_beamformee; -+ bool he_mu_beamformer; -+ bool he_full_ul_mumimo; - }; - - /** ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1281,6 +1281,21 @@ static int ieee80211_start_ap(struct wip - changed |= BSS_CHANGED_HE_BSS_COLOR; - } - -+ if (params->he_cap) { -+ link_conf->he_su_beamformer = -+ params->he_cap->phy_cap_info[3] & -+ IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER; -+ link_conf->he_su_beamformee = -+ params->he_cap->phy_cap_info[4] & -+ IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE; -+ link_conf->he_mu_beamformer = -+ params->he_cap->phy_cap_info[4] & -+ IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER; -+ link_conf->he_full_ul_mumimo = -+ params->he_cap->phy_cap_info[2] & -+ IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO; -+ } -+ - if (sdata->vif.type == NL80211_IFTYPE_AP && - params->mbssid_config.tx_wdev) { - err = ieee80211_set_ap_mbssid_options(sdata, diff --git a/package/kernel/mac80211/patches/subsys/325-wifi-mac80211-introduce-ieee80211_refresh_tx_agg_ses.patch b/package/kernel/mac80211/patches/subsys/325-wifi-mac80211-introduce-ieee80211_refresh_tx_agg_ses.patch deleted file mode 100644 index 1be5fcfbfa18e8..00000000000000 --- a/package/kernel/mac80211/patches/subsys/325-wifi-mac80211-introduce-ieee80211_refresh_tx_agg_ses.patch +++ /dev/null @@ -1,60 +0,0 @@ -From: Ryder Lee -Date: Sat, 18 Feb 2023 01:50:05 +0800 -Subject: [PATCH] wifi: mac80211: introduce - ieee80211_refresh_tx_agg_session_timer() - -This allows low level drivers to refresh the tx agg session timer, based on -querying stats from the firmware usually. Especially for some mt76 devices -support .net_fill_forward_path would bypass mac80211, which leads to tx BA -session timeout for certain clients. - -Signed-off-by: Ryder Lee ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -5964,6 +5964,18 @@ void ieee80211_queue_delayed_work(struct - unsigned long delay); - - /** -+ * ieee80211_refresh_tx_agg_session_timer - Refresh a tx agg session timer. -+ * @sta: the station for which to start a BA session -+ * @tid: the TID to BA on. -+ * -+ * This function allows low level driver to refresh tx agg session timer -+ * to maintain BA session, the session level will still be managed by the -+ * mac80211. -+ */ -+void ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *sta, -+ u16 tid); -+ -+/** - * ieee80211_start_tx_ba_session - Start a tx Block Ack session. - * @sta: the station for which to start a BA session - * @tid: the TID to BA on. ---- a/net/mac80211/agg-tx.c -+++ b/net/mac80211/agg-tx.c -@@ -554,6 +554,23 @@ void ieee80211_tx_ba_session_handle_star - ieee80211_send_addba_with_timeout(sta, tid_tx); - } - -+void ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *pubsta, -+ u16 tid) -+{ -+ struct sta_info *sta = container_of(pubsta, struct sta_info, sta); -+ struct tid_ampdu_tx *tid_tx; -+ -+ if (WARN_ON_ONCE(tid >= IEEE80211_NUM_TIDS)) -+ return; -+ -+ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); -+ if (!tid_tx) -+ return; -+ -+ tid_tx->last_tx = jiffies; -+} -+EXPORT_SYMBOL(ieee80211_refresh_tx_agg_session_timer); -+ - /* - * After accepting the AddBA Response we activated a timer, - * resetting it after each frame that we send. diff --git a/package/kernel/mac80211/patches/subsys/326-wifi-mac80211-add-mesh-fast-rx-support.patch b/package/kernel/mac80211/patches/subsys/326-wifi-mac80211-add-mesh-fast-rx-support.patch deleted file mode 100644 index 11f39c2d109dec..00000000000000 --- a/package/kernel/mac80211/patches/subsys/326-wifi-mac80211-add-mesh-fast-rx-support.patch +++ /dev/null @@ -1,77 +0,0 @@ -From: Felix Fietkau -Date: Thu, 2 Mar 2023 13:52:29 +0100 -Subject: [PATCH] wifi: mac80211: add mesh fast-rx support - -This helps bring down rx CPU usage by avoiding calls to the rx handlers in -the slow path. Supports forwarding and local rx, including A-MSDU. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -4564,6 +4564,12 @@ void ieee80211_check_fast_rx(struct sta_ - } - - break; -+ case NL80211_IFTYPE_MESH_POINT: -+ fastrx.expected_ds_bits = cpu_to_le16(IEEE80211_FCTL_FROMDS | -+ IEEE80211_FCTL_TODS); -+ fastrx.da_offs = offsetof(struct ieee80211_hdr, addr3); -+ fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr4); -+ break; - default: - goto clear; - } -@@ -4772,6 +4778,7 @@ static bool ieee80211_invoke_fast_rx(str - struct sk_buff *skb = rx->skb; - struct ieee80211_hdr *hdr = (void *)skb->data; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); -+ static ieee80211_rx_result res; - int orig_len = skb->len; - int hdrlen = ieee80211_hdrlen(hdr->frame_control); - int snap_offs = hdrlen; -@@ -4833,7 +4840,8 @@ static bool ieee80211_invoke_fast_rx(str - snap_offs += IEEE80211_CCMP_HDR_LEN; - } - -- if (!(status->rx_flags & IEEE80211_RX_AMSDU)) { -+ if (!ieee80211_vif_is_mesh(&rx->sdata->vif) && -+ !(status->rx_flags & IEEE80211_RX_AMSDU)) { - if (!pskb_may_pull(skb, snap_offs + sizeof(*payload))) - return false; - -@@ -4872,13 +4880,29 @@ static bool ieee80211_invoke_fast_rx(str - /* do the header conversion - first grab the addresses */ - ether_addr_copy(addrs.da, skb->data + fast_rx->da_offs); - ether_addr_copy(addrs.sa, skb->data + fast_rx->sa_offs); -- skb_postpull_rcsum(skb, skb->data + snap_offs, -- sizeof(rfc1042_header) + 2); -- /* remove the SNAP but leave the ethertype */ -- skb_pull(skb, snap_offs + sizeof(rfc1042_header)); -+ if (ieee80211_vif_is_mesh(&rx->sdata->vif)) { -+ skb_pull(skb, snap_offs - 2); -+ put_unaligned_be16(skb->len - 2, skb->data); -+ } else { -+ skb_postpull_rcsum(skb, skb->data + snap_offs, -+ sizeof(rfc1042_header) + 2); -+ -+ /* remove the SNAP but leave the ethertype */ -+ skb_pull(skb, snap_offs + sizeof(rfc1042_header)); -+ } - /* push the addresses in front */ - memcpy(skb_push(skb, sizeof(addrs)), &addrs, sizeof(addrs)); - -+ res = ieee80211_rx_mesh_data(rx->sdata, rx->sta, rx->skb); -+ switch (res) { -+ case RX_QUEUED: -+ return true; -+ case RX_CONTINUE: -+ break; -+ default: -+ goto drop; -+ } -+ - ieee80211_rx_8023(rx, fast_rx, orig_len); - - return true; diff --git a/package/kernel/mac80211/patches/subsys/327-wifi-mac80211-add-support-for-letting-drivers-regist.patch b/package/kernel/mac80211/patches/subsys/327-wifi-mac80211-add-support-for-letting-drivers-regist.patch deleted file mode 100644 index ac290b5360a182..00000000000000 --- a/package/kernel/mac80211/patches/subsys/327-wifi-mac80211-add-support-for-letting-drivers-regist.patch +++ /dev/null @@ -1,149 +0,0 @@ -From: Felix Fietkau -Date: Mon, 20 Mar 2023 14:28:08 +0100 -Subject: [PATCH] wifi: mac80211: add support for letting drivers register tc - offload support - -On newer MediaTek SoCs (e.g. MT7986), WLAN->WLAN or WLAN->Ethernet flows can -be offloaded by the SoC. In order to support that, the .ndo_setup_tc op is -needed. - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -4192,6 +4192,10 @@ struct ieee80211_prep_tx_info { - * Note that a sta can also be inserted or removed with valid links, - * i.e. passed to @sta_add/@sta_state with sta->valid_links not zero. - * In fact, cannot change from having valid_links and not having them. -+ * @net_setup_tc: Called from .ndo_setup_tc in order to prepare hardware -+ * flow offloading for flows originating from the vif. -+ * Note that the driver must not assume that the vif driver_data is valid -+ * at this point, since the callback can be called during netdev teardown. - */ - struct ieee80211_ops { - void (*tx)(struct ieee80211_hw *hw, -@@ -4547,6 +4551,11 @@ struct ieee80211_ops { - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - u16 old_links, u16 new_links); -+ int (*net_setup_tc)(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct net_device *dev, -+ enum tc_setup_type type, -+ void *type_data); - }; - - /** ---- a/net/mac80211/driver-ops.h -+++ b/net/mac80211/driver-ops.h -@@ -1470,6 +1470,23 @@ static inline int drv_net_fill_forward_p - return ret; - } - -+static inline int drv_net_setup_tc(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct net_device *dev, -+ enum tc_setup_type type, void *type_data) -+{ -+ int ret = -EOPNOTSUPP; -+ -+ sdata = get_bss_sdata(sdata); -+ trace_drv_net_setup_tc(local, sdata, type); -+ if (local->ops->net_setup_tc) -+ ret = local->ops->net_setup_tc(&local->hw, &sdata->vif, dev, -+ type, type_data); -+ trace_drv_return_int(local, ret); -+ -+ return ret; -+} -+ - int drv_change_vif_links(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - u16 old_links, u16 new_links, ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1939,7 +1939,8 @@ void ieee80211_color_collision_detection - /* interface handling */ - #define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \ - NETIF_F_HW_CSUM | NETIF_F_SG | \ -- NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE) -+ NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE | \ -+ NETIF_F_HW_TC) - #define MAC80211_SUPPORTED_FEATURES_RX (NETIF_F_RXCSUM) - #define MAC80211_SUPPORTED_FEATURES (MAC80211_SUPPORTED_FEATURES_TX | \ - MAC80211_SUPPORTED_FEATURES_RX) ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -813,6 +813,21 @@ ieee80211_get_stats64(struct net_device - dev_fetch_sw_netstats(stats, dev->tstats); - } - -+static int ieee80211_netdev_setup_tc(struct net_device *dev, -+ enum tc_setup_type type, void *type_data) -+{ -+ struct ieee80211_sub_if_data *sdata; -+ struct ieee80211_local *local; -+ -+ sdata = IEEE80211_DEV_TO_SUB_IF(dev); -+ local = sdata->local; -+ -+ if (!local->ops->net_setup_tc) -+ return -EOPNOTSUPP; -+ -+ return drv_net_setup_tc(local, sdata, dev, type, type_data); -+} -+ - static const struct net_device_ops ieee80211_dataif_ops = { - .ndo_open = ieee80211_open, - .ndo_stop = ieee80211_stop, -@@ -821,6 +836,7 @@ static const struct net_device_ops ieee8 - .ndo_set_rx_mode = ieee80211_set_multicast_list, - .ndo_set_mac_address = ieee80211_change_mac, - .ndo_get_stats64 = ieee80211_get_stats64, -+ .ndo_setup_tc = ieee80211_netdev_setup_tc, - }; - - static u16 ieee80211_monitor_select_queue(struct net_device *dev, -@@ -929,6 +945,7 @@ static const struct net_device_ops ieee8 - .ndo_set_mac_address = ieee80211_change_mac, - .ndo_get_stats64 = ieee80211_get_stats64, - .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path, -+ .ndo_setup_tc = ieee80211_netdev_setup_tc, - }; - - static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype) ---- a/net/mac80211/trace.h -+++ b/net/mac80211/trace.h -@@ -2478,6 +2478,31 @@ DEFINE_EVENT(sta_event, drv_net_fill_for - TP_ARGS(local, sdata, sta) - ); - -+TRACE_EVENT(drv_net_setup_tc, -+ TP_PROTO(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ u8 type), -+ -+ TP_ARGS(local, sdata, type), -+ -+ TP_STRUCT__entry( -+ LOCAL_ENTRY -+ VIF_ENTRY -+ __field(u8, type) -+ ), -+ -+ TP_fast_assign( -+ LOCAL_ASSIGN; -+ VIF_ASSIGN; -+ __entry->type = type; -+ ), -+ -+ TP_printk( -+ LOCAL_PR_FMT VIF_PR_FMT " type:%d\n", -+ LOCAL_PR_ARG, VIF_PR_ARG, __entry->type -+ ) -+); -+ - TRACE_EVENT(drv_change_vif_links, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, diff --git a/package/kernel/mac80211/patches/subsys/329-wifi-mac80211-fix-receiving-mesh-packets-in-forwardi.patch b/package/kernel/mac80211/patches/subsys/329-wifi-mac80211-fix-receiving-mesh-packets-in-forwardi.patch deleted file mode 100644 index 6882694da8e569..00000000000000 --- a/package/kernel/mac80211/patches/subsys/329-wifi-mac80211-fix-receiving-mesh-packets-in-forwardi.patch +++ /dev/null @@ -1,50 +0,0 @@ -From: Felix Fietkau -Date: Sun, 26 Mar 2023 17:11:34 +0200 -Subject: [PATCH] wifi: mac80211: fix receiving mesh packets in forwarding=0 - networks -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When forwarding is set to 0, frames are typically sent with ttl=1. -Move the ttl decrement check below the check for local receive in order to -fix packet drops. - -Reported-by: Thomas Hühn -Reported-by: Nick Hainke -Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2828,14 +2828,6 @@ ieee80211_rx_mesh_data(struct ieee80211_ - if (sdata->crypto_tx_tailroom_needed_cnt) - tailroom = IEEE80211_ENCRYPT_TAILROOM; - -- if (!--mesh_hdr->ttl) { -- if (multicast) -- goto rx_accept; -- -- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl); -- return RX_DROP_MONITOR; -- } -- - if (mesh_hdr->flags & MESH_FLAGS_AE) { - struct mesh_path *mppath; - char *proxied_addr; -@@ -2874,6 +2866,14 @@ ieee80211_rx_mesh_data(struct ieee80211_ - if (ether_addr_equal(sdata->vif.addr, eth->h_dest)) - goto rx_accept; - -+ if (!--mesh_hdr->ttl) { -+ if (multicast) -+ goto rx_accept; -+ -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl); -+ return RX_DROP_MONITOR; -+ } -+ - if (!ifmsh->mshcfg.dot11MeshForwarding) { - if (is_multicast_ether_addr(eth->h_dest)) - goto rx_accept; diff --git a/package/kernel/mac80211/patches/subsys/330-wifi-ieee80211-correctly-mark-FTM-frames-non-buffera.patch b/package/kernel/mac80211/patches/subsys/330-wifi-ieee80211-correctly-mark-FTM-frames-non-buffera.patch deleted file mode 100644 index 079dd2a86865a0..00000000000000 --- a/package/kernel/mac80211/patches/subsys/330-wifi-ieee80211-correctly-mark-FTM-frames-non-buffera.patch +++ /dev/null @@ -1,134 +0,0 @@ -From: Johannes Berg -Date: Wed, 29 Mar 2023 16:46:26 +0200 -Subject: [PATCH] wifi: ieee80211: correctly mark FTM frames non-bufferable - -The checks of whether or not a frame is bufferable were not -taking into account that some action frames aren't, such as -FTM. Check this, which requires some changes to the function -ieee80211_is_bufferable_mmpdu() since we need the whole skb -for the checks now. - -Signed-off-by: Johannes Berg -Reviewed-by: Greenman, Gregory -Reviewed-by: Peer, Ilan ---- - ---- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c -@@ -601,8 +601,9 @@ static void iwl_mvm_skb_prepare_status(s - - static int iwl_mvm_get_ctrl_vif_queue(struct iwl_mvm *mvm, - struct ieee80211_tx_info *info, -- struct ieee80211_hdr *hdr) -+ struct sk_buff *skb) - { -+ struct ieee80211_hdr *hdr = (void *)skb->data; - struct iwl_mvm_vif *mvmvif = - iwl_mvm_vif_from_mac80211(info->control.vif); - __le16 fc = hdr->frame_control; -@@ -621,7 +622,7 @@ static int iwl_mvm_get_ctrl_vif_queue(st - * reason 7 ("Class 3 frame received from nonassociated STA"). - */ - if (ieee80211_is_mgmt(fc) && -- (!ieee80211_is_bufferable_mmpdu(fc) || -+ (!ieee80211_is_bufferable_mmpdu(skb) || - ieee80211_is_deauth(fc) || ieee80211_is_disassoc(fc))) - return mvm->probe_queue; - -@@ -740,7 +741,7 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mv - else - sta_id = mvmvif->mcast_sta.sta_id; - -- queue = iwl_mvm_get_ctrl_vif_queue(mvm, &info, hdr); -+ queue = iwl_mvm_get_ctrl_vif_queue(mvm, &info, skb); - } else if (info.control.vif->type == NL80211_IFTYPE_MONITOR) { - queue = mvm->snif_queue; - sta_id = mvm->snif_sta.sta_id; ---- a/include/linux/ieee80211.h -+++ b/include/linux/ieee80211.h -@@ -772,20 +772,6 @@ static inline bool ieee80211_is_any_null - } - - /** -- * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU -- * @fc: frame control field in little-endian byteorder -- */ --static inline bool ieee80211_is_bufferable_mmpdu(__le16 fc) --{ -- /* IEEE 802.11-2012, definition of "bufferable management frame"; -- * note that this ignores the IBSS special case. */ -- return ieee80211_is_mgmt(fc) && -- (ieee80211_is_action(fc) || -- ieee80211_is_disassoc(fc) || -- ieee80211_is_deauth(fc)); --} -- --/** - * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set - * @seq_ctrl: frame sequence control bytes in little-endian byteorder - */ -@@ -4121,6 +4107,44 @@ static inline u8 *ieee80211_get_DA(struc - } - - /** -+ * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU -+ * @skb: the skb to check, starting with the 802.11 header -+ */ -+static inline bool ieee80211_is_bufferable_mmpdu(struct sk_buff *skb) -+{ -+ struct ieee80211_mgmt *mgmt = (void *)skb->data; -+ __le16 fc = mgmt->frame_control; -+ -+ /* -+ * IEEE 802.11 REVme D2.0 definition of bufferable MMPDU; -+ * note that this ignores the IBSS special case. -+ */ -+ if (!ieee80211_is_mgmt(fc)) -+ return false; -+ -+ if (ieee80211_is_disassoc(fc) || ieee80211_is_deauth(fc)) -+ return true; -+ -+ if (!ieee80211_is_action(fc)) -+ return false; -+ -+ if (skb->len < offsetofend(typeof(*mgmt), u.action.u.ftm.action_code)) -+ return true; -+ -+ /* action frame - additionally check for non-bufferable FTM */ -+ -+ if (mgmt->u.action.category != WLAN_CATEGORY_PUBLIC && -+ mgmt->u.action.category != WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION) -+ return true; -+ -+ if (mgmt->u.action.u.ftm.action_code == WLAN_PUB_ACTION_FTM_REQUEST || -+ mgmt->u.action.u.ftm.action_code == WLAN_PUBLIC_ACTION_FTM_RESPONSE) -+ return false; -+ -+ return true; -+} -+ -+/** - * _ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame - * @hdr: the frame (buffer must include at least the first octet of payload) - */ ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -488,7 +488,7 @@ ieee80211_tx_h_unicast_ps_buf(struct iee - int ac = skb_get_queue_mapping(tx->skb); - - if (ieee80211_is_mgmt(hdr->frame_control) && -- !ieee80211_is_bufferable_mmpdu(hdr->frame_control)) { -+ !ieee80211_is_bufferable_mmpdu(tx->skb)) { - info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER; - return TX_CONTINUE; - } -@@ -1326,7 +1326,7 @@ static struct txq_info *ieee80211_get_tx - if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) && - unlikely(!ieee80211_is_data_present(hdr->frame_control))) { - if ((!ieee80211_is_mgmt(hdr->frame_control) || -- ieee80211_is_bufferable_mmpdu(hdr->frame_control) || -+ ieee80211_is_bufferable_mmpdu(skb) || - vif->type == NL80211_IFTYPE_STATION) && - sta && sta->uploaded) { - /* diff --git a/package/kernel/mac80211/patches/subsys/331-wifi-mac80211-flush-queues-on-STA-removal.patch b/package/kernel/mac80211/patches/subsys/331-wifi-mac80211-flush-queues-on-STA-removal.patch deleted file mode 100644 index 00232ec1b9e9f6..00000000000000 --- a/package/kernel/mac80211/patches/subsys/331-wifi-mac80211-flush-queues-on-STA-removal.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: Johannes Berg -Date: Mon, 13 Mar 2023 11:42:12 +0100 -Subject: [PATCH] wifi: mac80211: flush queues on STA removal - -When we remove a station, we first make it unreachable, -then we (must) remove its keys, and then remove the -station itself. Depending on the hardware design, if -we have hardware crypto at all, frames still sitting -on hardware queues may then be transmitted without a -valid key, possibly unencrypted or with a fixed key. - -Fix this by flushing the queues when removing stations -so this cannot happen. - -Cc: stable@vger.kernel.org -Signed-off-by: Johannes Berg -Reviewed-by: Greenman, Gregory ---- - ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -1271,6 +1271,14 @@ static void __sta_info_destroy_part2(str - WARN_ON_ONCE(ret); - } - -+ /* Flush queues before removing keys, as that might remove them -+ * from hardware, and then depending on the offload method, any -+ * frames sitting on hardware queues might be sent out without -+ * any encryption at all. -+ */ -+ if (local->ops->set_key) -+ ieee80211_flush_queues(local, sta->sdata, false); -+ - /* now keys can no longer be reached */ - ieee80211_free_sta_keys(local, sta); - diff --git a/package/kernel/mac80211/patches/subsys/332-wifi-iwlwifi-mvm-support-flush-on-AP-interfaces.patch b/package/kernel/mac80211/patches/subsys/332-wifi-iwlwifi-mvm-support-flush-on-AP-interfaces.patch deleted file mode 100644 index 3c31dfeddc8eba..00000000000000 --- a/package/kernel/mac80211/patches/subsys/332-wifi-iwlwifi-mvm-support-flush-on-AP-interfaces.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Johannes Berg -Date: Mon, 13 Mar 2023 12:02:58 +0100 -Subject: [PATCH] wifi: iwlwifi: mvm: support flush on AP interfaces - -Support TX flush on AP interfaces so that we will do a -proper flush for frames on the queue before keys are -removed. - -Signed-off-by: Johannes Berg -Reviewed-by: Greenman, Gregory ---- - ---- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -@@ -4854,9 +4854,6 @@ static void iwl_mvm_mac_flush(struct iee - return; - } - -- if (vif->type != NL80211_IFTYPE_STATION) -- return; -- - /* Make sure we're done with the deferred traffic before flushing */ - flush_work(&mvm->add_stream_wk); - -@@ -4874,9 +4871,6 @@ static void iwl_mvm_mac_flush(struct iee - if (mvmsta->vif != vif) - continue; - -- /* make sure only TDLS peers or the AP are flushed */ -- WARN_ON(i != mvmvif->ap_sta_id && !sta->tdls); -- - if (drop) { - if (iwl_mvm_flush_sta(mvm, mvmsta, false)) - IWL_ERR(mvm, "flush request fail\n"); diff --git a/package/kernel/mac80211/patches/subsys/333-wifi-mac80211-add-flush_sta-method.patch b/package/kernel/mac80211/patches/subsys/333-wifi-mac80211-add-flush_sta-method.patch deleted file mode 100644 index 3bba0b7e66f61e..00000000000000 --- a/package/kernel/mac80211/patches/subsys/333-wifi-mac80211-add-flush_sta-method.patch +++ /dev/null @@ -1,91 +0,0 @@ -From: Johannes Berg -Date: Mon, 13 Mar 2023 11:53:51 +0100 -Subject: [PATCH] wifi: mac80211: add flush_sta method - -Some drivers like iwlwifi might have per-STA queues, so we -may want to flush/drop just those queues rather than all -when removing a station. Add a separate method for that. - -Signed-off-by: Johannes Berg -Reviewed-by: Greenman, Gregory ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -3918,6 +3918,10 @@ struct ieee80211_prep_tx_info { - * Note that vif can be NULL. - * The callback can sleep. - * -+ * @flush_sta: Flush or drop all pending frames from the hardware queue(s) for -+ * the given station, as it's about to be removed. -+ * The callback can sleep. -+ * - * @channel_switch: Drivers that need (or want) to offload the channel - * switch operation for CSAs received from the AP may implement this - * callback. They must then call ieee80211_chswitch_done() to indicate -@@ -4372,6 +4376,8 @@ struct ieee80211_ops { - #endif - void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - u32 queues, bool drop); -+ void (*flush_sta)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, -+ struct ieee80211_sta *sta); - void (*channel_switch)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_channel_switch *ch_switch); ---- a/net/mac80211/driver-ops.h -+++ b/net/mac80211/driver-ops.h -@@ -617,6 +617,21 @@ static inline void drv_flush(struct ieee - trace_drv_return_void(local); - } - -+static inline void drv_flush_sta(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta) -+{ -+ might_sleep(); -+ -+ if (sdata && !check_sdata_in_driver(sdata)) -+ return; -+ -+ trace_drv_flush_sta(local, sdata, &sta->sta); -+ if (local->ops->flush_sta) -+ local->ops->flush_sta(&local->hw, &sdata->vif, &sta->sta); -+ trace_drv_return_void(local); -+} -+ - static inline void drv_channel_switch(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct ieee80211_channel_switch *ch_switch) ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -1276,8 +1276,12 @@ static void __sta_info_destroy_part2(str - * frames sitting on hardware queues might be sent out without - * any encryption at all. - */ -- if (local->ops->set_key) -- ieee80211_flush_queues(local, sta->sdata, false); -+ if (local->ops->set_key) { -+ if (local->ops->flush_sta) -+ drv_flush_sta(local, sta->sdata, sta); -+ else -+ ieee80211_flush_queues(local, sta->sdata, false); -+ } - - /* now keys can no longer be reached */ - ieee80211_free_sta_keys(local, sta); ---- a/net/mac80211/trace.h -+++ b/net/mac80211/trace.h -@@ -1177,6 +1177,13 @@ TRACE_EVENT(drv_flush, - ) - ); - -+DEFINE_EVENT(sta_event, drv_flush_sta, -+ TP_PROTO(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct ieee80211_sta *sta), -+ TP_ARGS(local, sdata, sta) -+); -+ - TRACE_EVENT(drv_channel_switch, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, diff --git a/package/kernel/mac80211/patches/subsys/334-wifi-iwlwifi-mvm-support-new-flush_sta-method.patch b/package/kernel/mac80211/patches/subsys/334-wifi-iwlwifi-mvm-support-new-flush_sta-method.patch deleted file mode 100644 index 18f39d505feb7d..00000000000000 --- a/package/kernel/mac80211/patches/subsys/334-wifi-iwlwifi-mvm-support-new-flush_sta-method.patch +++ /dev/null @@ -1,53 +0,0 @@ -From: Johannes Berg -Date: Mon, 13 Mar 2023 12:05:35 +0100 -Subject: [PATCH] wifi: iwlwifi: mvm: support new flush_sta method - -For iwlwifi this is simple to implement, and on newer hardware -it's an improvement since we have per-station queues. - -Signed-off-by: Johannes Berg -Reviewed-by: Greenman, Gregory ---- - ---- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -@@ -4890,6 +4890,31 @@ static void iwl_mvm_mac_flush(struct iee - iwl_trans_wait_tx_queues_empty(mvm->trans, msk); - } - -+static void iwl_mvm_mac_flush_sta(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_sta *sta) -+{ -+ struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); -+ int i; -+ -+ mutex_lock(&mvm->mutex); -+ for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) { -+ struct iwl_mvm_sta *mvmsta; -+ struct ieee80211_sta *tmp; -+ -+ tmp = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], -+ lockdep_is_held(&mvm->mutex)); -+ if (tmp != sta) -+ continue; -+ -+ mvmsta = iwl_mvm_sta_from_mac80211(sta); -+ -+ if (iwl_mvm_flush_sta(mvm, mvmsta, false)) -+ IWL_ERR(mvm, "flush request fail\n"); -+ } -+ mutex_unlock(&mvm->mutex); -+} -+ - static int iwl_mvm_mac_get_survey(struct ieee80211_hw *hw, int idx, - struct survey_info *survey) - { -@@ -5417,6 +5442,7 @@ const struct ieee80211_ops iwl_mvm_hw_op - .mgd_complete_tx = iwl_mvm_mac_mgd_complete_tx, - .mgd_protect_tdls_discover = iwl_mvm_mac_mgd_protect_tdls_discover, - .flush = iwl_mvm_mac_flush, -+ .flush_sta = iwl_mvm_mac_flush_sta, - .sched_scan_start = iwl_mvm_mac_sched_scan_start, - .sched_scan_stop = iwl_mvm_mac_sched_scan_stop, - .set_key = iwl_mvm_mac_set_key, diff --git a/package/kernel/mac80211/patches/subsys/335-wifi-mac80211-add-LDPC-related-flags-in-ieee80211_bs.patch b/package/kernel/mac80211/patches/subsys/335-wifi-mac80211-add-LDPC-related-flags-in-ieee80211_bs.patch deleted file mode 100644 index 1b379b76ae9f9d..00000000000000 --- a/package/kernel/mac80211/patches/subsys/335-wifi-mac80211-add-LDPC-related-flags-in-ieee80211_bs.patch +++ /dev/null @@ -1,62 +0,0 @@ -From: Ryder Lee -Date: Sat, 18 Feb 2023 01:49:25 +0800 -Subject: [PATCH] wifi: mac80211: add LDPC related flags in ieee80211_bss_conf - -This is utilized to pass LDPC configurations from user space -(i.e. hostapd) to driver. - -Signed-off-by: Ryder Lee -Link: https://lore.kernel.org/r/1de696aaa34efd77a926eb657b8c0fda05aaa177.1676628065.git.ryder.lee@mediatek.com -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -653,6 +653,9 @@ struct ieee80211_fils_discovery { - * write-protected by sdata_lock and local->mtx so holding either is fine - * for read access. - * @color_change_color: the bss color that will be used after the change. -+ * @ht_ldpc: in AP mode, indicates interface has HT LDPC capability. -+ * @vht_ldpc: in AP mode, indicates interface has VHT LDPC capability. -+ * @he_ldpc: in AP mode, indicates interface has HE LDPC capability. - * @vht_su_beamformer: in AP mode, does this BSS support operation as an VHT SU - * beamformer - * @vht_su_beamformee: in AP mode, does this BSS support operation as an VHT SU -@@ -744,6 +747,9 @@ struct ieee80211_bss_conf { - bool color_change_active; - u8 color_change_color; - -+ bool ht_ldpc; -+ bool vht_ldpc; -+ bool he_ldpc; - bool vht_su_beamformer; - bool vht_su_beamformee; - bool vht_mu_beamformer; ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1252,7 +1252,15 @@ static int ieee80211_start_ap(struct wip - prev_beacon_int = link_conf->beacon_int; - link_conf->beacon_int = params->beacon_interval; - -+ if (params->ht_cap) -+ link_conf->ht_ldpc = -+ params->ht_cap->cap_info & -+ cpu_to_le16(IEEE80211_HT_CAP_LDPC_CODING); -+ - if (params->vht_cap) { -+ link_conf->vht_ldpc = -+ params->vht_cap->vht_cap_info & -+ cpu_to_le32(IEEE80211_VHT_CAP_RXLDPC); - link_conf->vht_su_beamformer = - params->vht_cap->vht_cap_info & - cpu_to_le32(IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE); -@@ -1282,6 +1290,9 @@ static int ieee80211_start_ap(struct wip - } - - if (params->he_cap) { -+ link_conf->he_ldpc = -+ params->he_cap->phy_cap_info[1] & -+ IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD; - link_conf->he_su_beamformer = - params->he_cap->phy_cap_info[3] & - IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER; diff --git a/package/kernel/mac80211/patches/subsys/336-v6.4-wifi-mac80211-generate-EMA-beacons-in-AP-mode.patch b/package/kernel/mac80211/patches/subsys/336-v6.4-wifi-mac80211-generate-EMA-beacons-in-AP-mode.patch deleted file mode 100644 index 088f468e37216e..00000000000000 --- a/package/kernel/mac80211/patches/subsys/336-v6.4-wifi-mac80211-generate-EMA-beacons-in-AP-mode.patch +++ /dev/null @@ -1,372 +0,0 @@ -From bd54f3c29077f23dad92ef82a78061b40be30c65 Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Mon, 5 Dec 2022 16:50:37 -0800 -Subject: [PATCH] wifi: mac80211: generate EMA beacons in AP mode - -Add APIs to generate an array of beacons for an EMA AP (enhanced -multiple BSSID advertisements), each including a single MBSSID element. -EMA profile periodicity equals the count of elements. - -- ieee80211_beacon_get_template_ema_list() - Generate and return all -EMA beacon templates. Drivers must call ieee80211_beacon_free_ema_list() -to free the memory. No change in the prototype for the existing API, -ieee80211_beacon_get_template(), which should be used for non-EMA AP. - -- ieee80211_beacon_get_template_ema_index() - Generate a beacon which -includes the multiple BSSID element at the given index. Drivers can use -this function in a loop until NULL is returned which indicates end of -available MBSSID elements. - -- ieee80211_beacon_free_ema_list() - free the memory allocated for the -list of EMA beacon templates. - -Modify existing functions ieee80211_beacon_get_ap(), -ieee80211_get_mbssid_beacon_len() and ieee80211_beacon_add_mbssid() -to accept a new parameter for EMA index. - -Signed-off-by: Aloka Dixit -Co-developed-by: John Crispin -Signed-off-by: John Crispin -Link: https://lore.kernel.org/r/20221206005040.3177-2-quic_alokad@quicinc.com -Signed-off-by: Johannes Berg ---- - include/net/mac80211.h | 68 +++++++++++++++++++ - net/mac80211/cfg.c | 11 +-- - net/mac80211/ieee80211_i.h | 10 ++- - net/mac80211/tx.c | 134 ++++++++++++++++++++++++++++++++++--- - 4 files changed, 205 insertions(+), 18 deletions(-) - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -5252,6 +5252,74 @@ ieee80211_beacon_get_template(struct iee - unsigned int link_id); - - /** -+ * ieee80211_beacon_get_template_ema_index - EMA beacon template generation -+ * @hw: pointer obtained from ieee80211_alloc_hw(). -+ * @vif: &struct ieee80211_vif pointer from the add_interface callback. -+ * @offs: &struct ieee80211_mutable_offsets pointer to struct that will -+ * receive the offsets that may be updated by the driver. -+ * @link_id: the link id to which the beacon belongs (or 0 for a non-MLD AP). -+ * @ema_index: index of the beacon in the EMA set. -+ * -+ * This function follows the same rules as ieee80211_beacon_get_template() -+ * but returns a beacon template which includes multiple BSSID element at the -+ * requested index. -+ * -+ * Return: The beacon template. %NULL indicates the end of EMA templates. -+ */ -+struct sk_buff * -+ieee80211_beacon_get_template_ema_index(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_mutable_offsets *offs, -+ unsigned int link_id, u8 ema_index); -+ -+/** -+ * struct ieee80211_ema_beacons - List of EMA beacons -+ * @cnt: count of EMA beacons. -+ * -+ * @bcn: array of EMA beacons. -+ * @bcn.skb: the skb containing this specific beacon -+ * @bcn.offs: &struct ieee80211_mutable_offsets pointer to struct that will -+ * receive the offsets that may be updated by the driver. -+ */ -+struct ieee80211_ema_beacons { -+ u8 cnt; -+ struct { -+ struct sk_buff *skb; -+ struct ieee80211_mutable_offsets offs; -+ } bcn[]; -+}; -+ -+/** -+ * ieee80211_beacon_get_template_ema_list - EMA beacon template generation -+ * @hw: pointer obtained from ieee80211_alloc_hw(). -+ * @vif: &struct ieee80211_vif pointer from the add_interface callback. -+ * @link_id: the link id to which the beacon belongs (or 0 for a non-MLD AP) -+ * -+ * This function follows the same rules as ieee80211_beacon_get_template() -+ * but allocates and returns a pointer to list of all beacon templates required -+ * to cover all profiles in the multiple BSSID set. Each template includes only -+ * one multiple BSSID element. -+ * -+ * Driver must call ieee80211_beacon_free_ema_list() to free the memory. -+ * -+ * Return: EMA beacon templates of type struct ieee80211_ema_beacons *. -+ * %NULL on error. -+ */ -+struct ieee80211_ema_beacons * -+ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ unsigned int link_id); -+ -+/** -+ * ieee80211_beacon_free_ema_list - free an EMA beacon template list -+ * @ema_beacons: list of EMA beacons of type &struct ieee80211_ema_beacons pointers. -+ * -+ * This function will free a list previously acquired by calling -+ * ieee80211_beacon_get_template_ema_list() -+ */ -+void ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *ema_beacons); -+ -+/** - * ieee80211_beacon_get_tim - beacon generation function - * @hw: pointer obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1122,11 +1122,11 @@ static int ieee80211_assign_beacon(struc - if (params->mbssid_ies) { - mbssid = params->mbssid_ies; - size += struct_size(new->mbssid_ies, elem, mbssid->cnt); -- size += ieee80211_get_mbssid_beacon_len(mbssid); -+ size += ieee80211_get_mbssid_beacon_len(mbssid, mbssid->cnt); - } else if (old && old->mbssid_ies) { - mbssid = old->mbssid_ies; - size += struct_size(new->mbssid_ies, elem, mbssid->cnt); -- size += ieee80211_get_mbssid_beacon_len(mbssid); -+ size += ieee80211_get_mbssid_beacon_len(mbssid, mbssid->cnt); - } - - new = kzalloc(size, GFP_KERNEL); -@@ -3384,8 +3384,11 @@ cfg80211_beacon_dup(struct cfg80211_beac - - len = beacon->head_len + beacon->tail_len + beacon->beacon_ies_len + - beacon->proberesp_ies_len + beacon->assocresp_ies_len + -- beacon->probe_resp_len + beacon->lci_len + beacon->civicloc_len + -- ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies); -+ beacon->probe_resp_len + beacon->lci_len + beacon->civicloc_len; -+ -+ if (beacon->mbssid_ies) -+ len += ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies, -+ beacon->mbssid_ies->cnt); - - new_beacon = kzalloc(sizeof(*new_beacon) + len, GFP_KERNEL); - if (!new_beacon) ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1182,13 +1182,17 @@ ieee80211_vif_get_shift(struct ieee80211 - } - - static inline int --ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems) -+ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems, u8 i) - { -- int i, len = 0; -+ int len = 0; - -- if (!elems) -+ if (!elems || !elems->cnt || i > elems->cnt) - return 0; - -+ if (i < elems->cnt) -+ return elems->elem[i].len; -+ -+ /* i == elems->cnt, calculate total length of all MBSSID elements */ - for (i = 0; i < elems->cnt; i++) - len += elems->elem[i].len; - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -5205,13 +5205,20 @@ ieee80211_beacon_get_finish(struct ieee8 - } - - static void --ieee80211_beacon_add_mbssid(struct sk_buff *skb, struct beacon_data *beacon) -+ieee80211_beacon_add_mbssid(struct sk_buff *skb, struct beacon_data *beacon, -+ u8 i) - { -- int i; -+ if (!beacon->mbssid_ies || !beacon->mbssid_ies->cnt || -+ i > beacon->mbssid_ies->cnt) -+ return; - -- if (!beacon->mbssid_ies) -+ if (i < beacon->mbssid_ies->cnt) { -+ skb_put_data(skb, beacon->mbssid_ies->elem[i].data, -+ beacon->mbssid_ies->elem[i].len); - return; -+ } - -+ /* i == beacon->mbssid_ies->cnt, include all MBSSID elements */ - for (i = 0; i < beacon->mbssid_ies->cnt; i++) - skb_put_data(skb, beacon->mbssid_ies->elem[i].data, - beacon->mbssid_ies->elem[i].len); -@@ -5224,7 +5231,8 @@ ieee80211_beacon_get_ap(struct ieee80211 - struct ieee80211_mutable_offsets *offs, - bool is_template, - struct beacon_data *beacon, -- struct ieee80211_chanctx_conf *chanctx_conf) -+ struct ieee80211_chanctx_conf *chanctx_conf, -+ u8 ema_index) - { - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); -@@ -5243,7 +5251,9 @@ ieee80211_beacon_get_ap(struct ieee80211 - /* headroom, head length, - * tail length, maximum TIM length and multiple BSSID length - */ -- mbssid_len = ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies); -+ mbssid_len = ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies, -+ ema_index); -+ - skb = dev_alloc_skb(local->tx_headroom + beacon->head_len + - beacon->tail_len + 256 + - local->hw.extra_beacon_tailroom + mbssid_len); -@@ -5261,7 +5271,7 @@ ieee80211_beacon_get_ap(struct ieee80211 - offs->cntdwn_counter_offs[0] = beacon->cntdwn_counter_offsets[0]; - - if (mbssid_len) { -- ieee80211_beacon_add_mbssid(skb, beacon); -+ ieee80211_beacon_add_mbssid(skb, beacon, ema_index); - offs->mbssid_off = skb->len - mbssid_len; - } - -@@ -5280,12 +5290,51 @@ ieee80211_beacon_get_ap(struct ieee80211 - return skb; - } - -+static struct ieee80211_ema_beacons * -+ieee80211_beacon_get_ap_ema_list(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_link_data *link, -+ struct ieee80211_mutable_offsets *offs, -+ bool is_template, struct beacon_data *beacon, -+ struct ieee80211_chanctx_conf *chanctx_conf) -+{ -+ struct ieee80211_ema_beacons *ema = NULL; -+ -+ if (!beacon->mbssid_ies || !beacon->mbssid_ies->cnt) -+ return NULL; -+ -+ ema = kzalloc(struct_size(ema, bcn, beacon->mbssid_ies->cnt), -+ GFP_ATOMIC); -+ if (!ema) -+ return NULL; -+ -+ for (ema->cnt = 0; ema->cnt < beacon->mbssid_ies->cnt; ema->cnt++) { -+ ema->bcn[ema->cnt].skb = -+ ieee80211_beacon_get_ap(hw, vif, link, -+ &ema->bcn[ema->cnt].offs, -+ is_template, beacon, -+ chanctx_conf, ema->cnt); -+ if (!ema->bcn[ema->cnt].skb) -+ break; -+ } -+ -+ if (ema->cnt == beacon->mbssid_ies->cnt) -+ return ema; -+ -+ ieee80211_beacon_free_ema_list(ema); -+ return NULL; -+} -+ -+#define IEEE80211_INCLUDE_ALL_MBSSID_ELEMS -1 -+ - static struct sk_buff * - __ieee80211_beacon_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_mutable_offsets *offs, - bool is_template, -- unsigned int link_id) -+ unsigned int link_id, -+ int ema_index, -+ struct ieee80211_ema_beacons **ema_beacons) - { - struct ieee80211_local *local = hw_to_local(hw); - struct beacon_data *beacon = NULL; -@@ -5314,8 +5363,29 @@ __ieee80211_beacon_get(struct ieee80211_ - if (!beacon) - goto out; - -- skb = ieee80211_beacon_get_ap(hw, vif, link, offs, is_template, -- beacon, chanctx_conf); -+ if (ema_beacons) { -+ *ema_beacons = -+ ieee80211_beacon_get_ap_ema_list(hw, vif, link, -+ offs, -+ is_template, -+ beacon, -+ chanctx_conf); -+ } else { -+ if (beacon->mbssid_ies && beacon->mbssid_ies->cnt) { -+ if (ema_index >= beacon->mbssid_ies->cnt) -+ goto out; /* End of MBSSID elements */ -+ -+ if (ema_index <= IEEE80211_INCLUDE_ALL_MBSSID_ELEMS) -+ ema_index = beacon->mbssid_ies->cnt; -+ } else { -+ ema_index = 0; -+ } -+ -+ skb = ieee80211_beacon_get_ap(hw, vif, link, offs, -+ is_template, beacon, -+ chanctx_conf, -+ ema_index); -+ } - } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - struct ieee80211_hdr *hdr; -@@ -5403,10 +5473,50 @@ ieee80211_beacon_get_template(struct iee - struct ieee80211_mutable_offsets *offs, - unsigned int link_id) - { -- return __ieee80211_beacon_get(hw, vif, offs, true, link_id); -+ return __ieee80211_beacon_get(hw, vif, offs, true, link_id, -+ IEEE80211_INCLUDE_ALL_MBSSID_ELEMS, NULL); - } - EXPORT_SYMBOL(ieee80211_beacon_get_template); - -+struct sk_buff * -+ieee80211_beacon_get_template_ema_index(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_mutable_offsets *offs, -+ unsigned int link_id, u8 ema_index) -+{ -+ return __ieee80211_beacon_get(hw, vif, offs, true, link_id, ema_index, -+ NULL); -+} -+EXPORT_SYMBOL(ieee80211_beacon_get_template_ema_index); -+ -+void ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *ema_beacons) -+{ -+ u8 i; -+ -+ if (!ema_beacons) -+ return; -+ -+ for (i = 0; i < ema_beacons->cnt; i++) -+ kfree_skb(ema_beacons->bcn[i].skb); -+ -+ kfree(ema_beacons); -+} -+EXPORT_SYMBOL(ieee80211_beacon_free_ema_list); -+ -+struct ieee80211_ema_beacons * -+ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ unsigned int link_id) -+{ -+ struct ieee80211_ema_beacons *ema_beacons = NULL; -+ -+ WARN_ON(__ieee80211_beacon_get(hw, vif, NULL, false, link_id, 0, -+ &ema_beacons)); -+ -+ return ema_beacons; -+} -+EXPORT_SYMBOL(ieee80211_beacon_get_template_ema_list); -+ - struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - u16 *tim_offset, u16 *tim_length, -@@ -5414,7 +5524,9 @@ struct sk_buff *ieee80211_beacon_get_tim - { - struct ieee80211_mutable_offsets offs = {}; - struct sk_buff *bcn = __ieee80211_beacon_get(hw, vif, &offs, false, -- link_id); -+ link_id, -+ IEEE80211_INCLUDE_ALL_MBSSID_ELEMS, -+ NULL); - struct sk_buff *copy; - int shift; - diff --git a/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch index c38fa13f03daa0..ad24dfda5a7775 100644 --- a/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch +++ b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch @@ -16,7 +16,7 @@ and we should ignore this. --- a/net/wireless/core.c +++ b/net/wireless/core.c -@@ -614,21 +614,6 @@ static int wiphy_verify_combinations(str +@@ -649,21 +649,6 @@ static int wiphy_verify_combinations(str c->limits[j].max > 1)) return -EINVAL; diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch deleted file mode 100644 index 58a590682a3502..00000000000000 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ /dev/null @@ -1,162 +0,0 @@ ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -4084,6 +4084,7 @@ struct mgmt_frame_regs { - * (as advertised by the nl80211 feature flag.) - * @get_tx_power: store the current TX power into the dbm variable; - * return 0 if successful -+ * @set_antenna_gain: set antenna gain to reduce maximum tx power if necessary - * - * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting - * functions to adjust rfkill hw state -@@ -4434,6 +4435,7 @@ struct cfg80211_ops { - enum nl80211_tx_power_setting type, int mbm); - int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, - int *dbm); -+ int (*set_antenna_gain)(struct wiphy *wiphy, int dbi); - - void (*rfkill_poll)(struct wiphy *wiphy); - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -1677,6 +1677,7 @@ enum ieee80211_smps_mode { - * - * @power_level: requested transmit power (in dBm), backward compatibility - * value only that is set to the minimum of all interfaces -+ * @max_antenna_gain: maximum antenna gain adjusted by user config (in dBi) - * - * @chandef: the channel definition to tune to - * @radar_enabled: whether radar detection is enabled -@@ -1697,6 +1698,7 @@ enum ieee80211_smps_mode { - struct ieee80211_conf { - u32 flags; - int power_level, dynamic_ps_timeout; -+ int max_antenna_gain; - - u16 listen_interval; - u8 ps_dtim_period; ---- a/include/uapi/linux/nl80211.h -+++ b/include/uapi/linux/nl80211.h -@@ -2749,6 +2749,9 @@ enum nl80211_commands { - * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the ack RX - * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates - * the incoming frame RX timestamp. -+ * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce -+ * transmit power to stay within regulatory limits. u32, dBi. -+ * - * @NUM_NL80211_ATTR: total number of nl80211_attrs available - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -3277,6 +3280,8 @@ enum nl80211_attrs { - NL80211_ATTR_TX_HW_TIMESTAMP, - NL80211_ATTR_RX_HW_TIMESTAMP, - -+ NL80211_ATTR_WIPHY_ANTENNA_GAIN, -+ - /* add attributes here, update the policy in nl80211.c */ - - __NL80211_ATTR_AFTER_LAST, ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -3046,6 +3046,19 @@ static int ieee80211_get_tx_power(struct - return 0; - } - -+static int ieee80211_set_antenna_gain(struct wiphy *wiphy, int dbi) -+{ -+ struct ieee80211_local *local = wiphy_priv(wiphy); -+ -+ if (dbi < 0) -+ return -EINVAL; -+ -+ local->user_antenna_gain = dbi; -+ ieee80211_hw_config(local, 0); -+ -+ return 0; -+} -+ - static void ieee80211_rfkill_poll(struct wiphy *wiphy) - { - struct ieee80211_local *local = wiphy_priv(wiphy); -@@ -4956,6 +4969,7 @@ const struct cfg80211_ops mac80211_confi - .set_wiphy_params = ieee80211_set_wiphy_params, - .set_tx_power = ieee80211_set_tx_power, - .get_tx_power = ieee80211_get_tx_power, -+ .set_antenna_gain = ieee80211_set_antenna_gain, - .rfkill_poll = ieee80211_rfkill_poll, - CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) - CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump) ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1542,6 +1542,7 @@ struct ieee80211_local { - int dynamic_ps_forced_timeout; - - int user_power_level; /* in dBm, for all interfaces */ -+ int user_antenna_gain; /* in dBi */ - - enum ieee80211_smps_mode smps_mode; - ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -96,7 +96,7 @@ static u32 ieee80211_hw_conf_chan(struct - struct ieee80211_sub_if_data *sdata; - struct cfg80211_chan_def chandef = {}; - u32 changed = 0; -- int power; -+ int power, max_power; - u32 offchannel_flag; - - offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; -@@ -157,6 +157,12 @@ static u32 ieee80211_hw_conf_chan(struct - } - rcu_read_unlock(); - -+ max_power = chandef.chan->max_reg_power; -+ if (local->user_antenna_gain > 0) { -+ max_power -= local->user_antenna_gain; -+ power = min(power, max_power); -+ } -+ - if (local->hw.conf.power_level != power) { - changed |= IEEE80211_CONF_CHANGE_POWER; - local->hw.conf.power_level = power; -@@ -762,6 +768,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ - IEEE80211_RADIOTAP_MCS_HAVE_BW; - local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI | - IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH; -+ local->user_antenna_gain = 0; - local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES; - local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN; - local->hw.max_mtu = IEEE80211_MAX_DATA_LEN; ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -799,6 +799,7 @@ static const struct nla_policy nl80211_p - [NL80211_ATTR_MLD_ADDR] = NLA_POLICY_EXACT_LEN(ETH_ALEN), - [NL80211_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG }, - [NL80211_ATTR_MAX_NUM_AKM_SUITES] = { .type = NLA_REJECT }, -+ [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 }, - }; - - /* policy for the key attributes */ -@@ -3511,6 +3512,22 @@ static int nl80211_set_wiphy(struct sk_b - if (result) - goto out; - } -+ -+ if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_GAIN]) { -+ int idx, dbi = 0; -+ -+ if (!rdev->ops->set_antenna_gain) { -+ result = -EOPNOTSUPP; -+ goto out; -+ } -+ -+ idx = NL80211_ATTR_WIPHY_ANTENNA_GAIN; -+ dbi = nla_get_u32(info->attrs[idx]); -+ -+ result = rdev->ops->set_antenna_gain(&rdev->wiphy, dbi); -+ if (result) -+ goto out; -+ } - - if (info->attrs[NL80211_ATTR_WIPHY_TX_POWER_SETTING]) { - struct wireless_dev *txp_wdev = wdev; diff --git a/package/kernel/mac80211/patches/subsys/780-avoid-crashing-missing-band.patch b/package/kernel/mac80211/patches/subsys/780-avoid-crashing-missing-band.patch new file mode 100644 index 00000000000000..2bc11efd0047c7 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/780-avoid-crashing-missing-band.patch @@ -0,0 +1,34 @@ +From: David Bauer +Date: Thu, 30 Nov 2023 07:32:52 +0100 +Subject: [PATCH] mac80211: avoid crashing on invalid band info + +Frequent crashes have been observed on MT7916 based platforms. While the +root of these crashes are currently unknown, they happen when decoding +rate information of connected STAs in AP mode. The rate-information is +associated with a band which is not available on the PHY. + +Check for this condition in order to avoid crashing the whole system. +This patch should be removed once the roout cause has been found and +fixed. + +Link: https://github.com/freifunk-gluon/gluon/issues/2980 + +Signed-off-by: David Bauer +--- + +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -2422,6 +2422,13 @@ static void sta_stats_decode_rate(struct + + sband = local->hw.wiphy->bands[band]; + ++ if (!sband) { ++ wiphy_warn(local->hw.wiphy, ++ "Invalid band %d\n", ++ band); ++ break; ++ } ++ + if (WARN_ON_ONCE(!sband->bitrates)) + break; + diff --git a/package/kernel/mac80211/realtek.mk b/package/kernel/mac80211/realtek.mk index 9c143583265e11..04057b3106996c 100644 --- a/package/kernel/mac80211/realtek.mk +++ b/package/kernel/mac80211/realtek.mk @@ -1,7 +1,9 @@ PKG_DRIVERS += \ rtlwifi rtlwifi-pci rtlwifi-btcoexist rtlwifi-usb rtl8192c-common \ rtl8192ce rtl8192se rtl8192de rtl8192cu rtl8723bs rtl8821ae \ - rtl8xxxu rtw88 + rtl8xxxu rtw88 rtw88-pci rtw88-usb rtw88-8821c rtw88-8822b rtw88-8822c \ + rtw88-8723d rtw88-8821ce rtw88-8821cu rtw88-8822be rtw88-8822bu \ + rtw88-8822ce rtw88-8822cu rtw88-8723de config-$(call config_package,rtlwifi) += RTL_CARDS RTLWIFI config-$(call config_package,rtlwifi-pci) += RTLWIFI_PCI @@ -21,8 +23,20 @@ config-y += RTL8XXXU_UNTESTED config-$(call config_package,rtl8723bs) += RTL8723BS config-y += STAGING -config-$(call config_package,rtw88) += RTW88 RTW88_CORE RTW88_PCI -config-y += RTW88_8822BE RTW88_8822CE RTW88_8723DE +config-$(call config_package,rtw88) += RTW88 RTW88_CORE +config-$(call config_package,rtw88-pci) += RTW88_PCI +config-$(call config_package,rtw88-usb) += RTW88_USB +config-$(call config_package,rtw88-8821c) += RTW88_8821C +config-$(call config_package,rtw88-8821ce) += RTW88_8821CE +config-$(call config_package,rtw88-8821cu) += RTW88_8821CU +config-$(call config_package,rtw88-8822b) += RTW88_8822B +config-$(call config_package,rtw88-8822be) += RTW88_8822BE +config-$(call config_package,rtw88-8822bu) += RTW88_8822BU +config-$(call config_package,rtw88-8822c) += RTW88_8822C +config-$(call config_package,rtw88-8822ce) += RTW88_8822CE +config-$(call config_package,rtw88-8822cu) += RTW88_8822CU +config-$(call config_package,rtw88-8723d) += RTW88_8723D +config-$(call config_package,rtw88-8723de) += RTW88_8723DE config-$(CONFIG_PACKAGE_RTW88_DEBUG) += RTW88_DEBUG config-$(CONFIG_PACKAGE_RTW88_DEBUGFS) += RTW88_DEBUGFS @@ -168,18 +182,121 @@ endef define KernelPackage/rtw88 $(call KernelPackage/mac80211/Default) - TITLE:=Realtek RTL8822BE/RTL8822CE/RTL8723DE - DEPENDS+= @(PCI_SUPPORT) +kmod-mac80211 +@DRIVER_11AC_SUPPORT - FILES:=\ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822be.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822b.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822ce.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822c.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8723de.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8723d.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_core.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_pci.ko - AUTOLOAD:=$(call AutoProbe,rtw88_8822be rtw88_8822ce rtw88_8723de) + TITLE:=Realtek RTW88 common part + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_core.ko + AUTOLOAD:=$(call AutoProbe,rtw88_core) + HIDDEN:=1 +endef + +define KernelPackage/rtw88-pci + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTW88 PCI chips support + DEPENDS+= @PCI_SUPPORT +kmod-rtw88 + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_pci.ko + AUTOLOAD:=$(call AutoProbe,rtw88_pci) + HIDDEN:=1 +endef + +define KernelPackage/rtw88-usb + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTW88 USB chips support + DEPENDS+= @USB_SUPPORT +kmod-rtw88 +kmod-usb-core + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_usb.ko + AUTOLOAD:=$(call AutoProbe,rtw88_usb) + HIDDEN:=1 +endef + +define KernelPackage/rtw88-8821c + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8821C family support + DEPENDS+= +kmod-rtw88 +rtl8821ce-firmware +@DRIVER_11AC_SUPPORT + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8821c.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8821c) + HIDDEN:=1 +endef + +define KernelPackage/rtw88-8822b + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8822B family support + DEPENDS+= +kmod-rtw88 +rtl8822be-firmware +@DRIVER_11AC_SUPPORT + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822b.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8822b) + HIDDEN:=1 +endef + +define KernelPackage/rtw88-8822c + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8822C family support + DEPENDS+= +kmod-rtw88 +rtl8822ce-firmware +@DRIVER_11AC_SUPPORT + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822c.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8822c) + HIDDEN:=1 +endef + +define KernelPackage/rtw88-8723d + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8723D family support + DEPENDS+= +kmod-rtw88 +rtl8723de-firmware + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8723d.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8723d) + HIDDEN:=1 +endef + +define KernelPackage/rtw88-8821ce + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8821CE support + DEPENDS+= +kmod-rtw88-pci +kmod-rtw88-8821c + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8821ce.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8821ce) +endef + +define KernelPackage/rtw88-8821cu + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8821CU support + DEPENDS+= +kmod-rtw88-usb +kmod-rtw88-8821c + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8821cu.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8821cu) +endef + +define KernelPackage/rtw88-8822be + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8822BE support + DEPENDS+= +kmod-rtw88-pci +kmod-rtw88-8822b + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822be.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8822be) +endef + +define KernelPackage/rtw88-8822bu + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8822BU support + DEPENDS+= +kmod-rtw88-usb +kmod-rtw88-8822b + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822bu.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8822bu) +endef + +define KernelPackage/rtw88-8822ce + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8822CE support + DEPENDS+= +kmod-rtw88-pci +kmod-rtw88-8822c + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822ce.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8822ce) +endef + +define KernelPackage/rtw88-8822cu + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8822CU support + DEPENDS+= +kmod-rtw88-usb +kmod-rtw88-8822c + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8822cu.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8822cu) +endef + +define KernelPackage/rtw88-8723de + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8723DE support + DEPENDS+= +kmod-rtw88-pci +kmod-rtw88-8723d + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8723de.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8723) endef define KernelPackage/rtl8723bs diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 78f01c119fbfda..1fea3bd0e91617 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2023-08-14 -PKG_SOURCE_VERSION:=b14c2351ddb8601c322576d84029e463d456caef -PKG_MIRROR_HASH:=62b5e157ad525424b6857e77ed373e8d39d03af71b057f8b309d8b293d6eac5f +PKG_SOURCE_DATE:=2024-01-18 +PKG_SOURCE_VERSION:=f77188160441d5f77f08dd517632ae3f60c653b0 +PKG_MIRROR_HASH:=133a5e44624fe1933c893ee0b8ac75a847753f3490c26518c2ed9798f9ef53e0 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 @@ -262,6 +262,11 @@ define KernelPackage/mt7921-firmware TITLE:=MediaTek MT7921 firmware endef +define KernelPackage/mt7922-firmware + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7922 firmware +endef + define KernelPackage/mt792x-common $(KernelPackage/mt76-default) TITLE:=MediaTek MT792x wireless driver common code @@ -310,6 +315,38 @@ define KernelPackage/mt7921e AUTOLOAD:=$(call AutoProbe,mt7921e) endef +define KernelPackage/mt7996e + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7996E wireless driver + DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac +kmod-hwmon-core + FILES:= $(PKG_BUILD_DIR)/mt7996/mt7996e.ko + AUTOLOAD:=$(call AutoProbe,mt7996e) +endef + +define KernelPackage/mt7925-common + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7925 wireless driver common code + HIDDEN:=1 + DEPENDS+=+kmod-mt792x-common +@DRIVER_11AX_SUPPORT +kmod-hwmon-core + FILES:= $(PKG_BUILD_DIR)/mt7925/mt7925-common.ko +endef + +define KernelPackage/mt7925u + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7925U wireless driver + DEPENDS+=+kmod-mt792x-usb +kmod-mt7925-common + FILES:= $(PKG_BUILD_DIR)/mt7925/mt7925u.ko + AUTOLOAD:=$(call AutoProbe,mt7921u) +endef + +define KernelPackage/mt7925e + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7925e wireless driver + DEPENDS+=@PCI_SUPPORT +kmod-mt7925-common + FILES:= $(PKG_BUILD_DIR)/mt7925/mt7925e.ko + AUTOLOAD:=$(call AutoProbe,mt7921e) +endef + define Package/mt76-test SECTION:=devel CATEGORY:=Development @@ -418,6 +455,18 @@ endif ifdef CONFIG_PACKAGE_kmod-mt7921e PKG_MAKE_FLAGS += CONFIG_MT7921E=m endif +ifdef CONFIG_PACKAGE_kmod-mt7996e + PKG_MAKE_FLAGS += CONFIG_MT7996E=m +endif +ifdef CONFIG_PACKAGE_kmod-mt7925-common + PKG_MAKE_FLAGS += CONFIG_MT7925_COMMON=m +endif +ifdef CONFIG_PACKAGE_kmod-mt7925u + PKG_MAKE_FLAGS += CONFIG_MT7925U=m +endif +ifdef CONFIG_PACKAGE_kmod-mt7925e + PKG_MAKE_FLAGS += CONFIG_MT7925E=m +endif define Build/Compile +$(KERNEL_MAKE) $(PKG_JOBS) \ @@ -542,8 +591,6 @@ define KernelPackage/mt7986-firmware/install $(PKG_BUILD_DIR)/firmware/mt7986_wm.bin \ $(PKG_BUILD_DIR)/firmware/mt7986_rom_patch_mt7975.bin \ $(PKG_BUILD_DIR)/firmware/mt7986_rom_patch.bin \ - $(PKG_BUILD_DIR)/firmware/mt7986_eeprom_mt7975_dual.bin \ - $(PKG_BUILD_DIR)/firmware/mt7986_eeprom_mt7976_dual.bin \ $(1)/lib/firmware/mediatek endef @@ -555,6 +602,14 @@ define KernelPackage/mt7921-firmware/install $(1)/lib/firmware/mediatek endef +define KernelPackage/mt7922-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/mediatek + cp \ + $(PKG_BUILD_DIR)/firmware/WIFI_MT7922_patch_mcu_1_1_hdr.bin \ + $(PKG_BUILD_DIR)/firmware/WIFI_RAM_CODE_MT7922_1.bin \ + $(1)/lib/firmware/mediatek +endef + define Package/mt76-test/install mkdir -p $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/mt76-test $(1)/usr/sbin @@ -588,11 +643,16 @@ $(eval $(call KernelPackage,mt7916-firmware)) $(eval $(call KernelPackage,mt7981-firmware)) $(eval $(call KernelPackage,mt7986-firmware)) $(eval $(call KernelPackage,mt7921-firmware)) +$(eval $(call KernelPackage,mt7922-firmware)) $(eval $(call KernelPackage,mt792x-common)) $(eval $(call KernelPackage,mt792x-usb)) $(eval $(call KernelPackage,mt7921-common)) +$(eval $(call KernelPackage,mt7925-common)) $(eval $(call KernelPackage,mt7921u)) $(eval $(call KernelPackage,mt7921s)) $(eval $(call KernelPackage,mt7921e)) +$(eval $(call KernelPackage,mt7925u)) +$(eval $(call KernelPackage,mt7925e)) +$(eval $(call KernelPackage,mt7996e)) $(eval $(call KernelPackage,mt76)) $(eval $(call BuildPackage,mt76-test)) diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile index 130ed01fdc21ee..2e6cd3a31e5299 100644 --- a/package/kernel/mwlwifi/Makefile +++ b/package/kernel/mwlwifi/Makefile @@ -15,9 +15,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/kaloz/mwlwifi PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2023-04-29 -PKG_SOURCE_VERSION:=6a436714d2ea0d0adf39fc4d7d45e6a17fcc9371 -PKG_MIRROR_HASH:=dcc320a8f859b732ff65c7ded0b5199a625bfba05a775a6bed15ed3c10cb2748 +PKG_SOURCE_DATE:=2023-11-29 +PKG_SOURCE_VERSION:=ebf3167445f108346dcff9a31a708534c0bd7cc5 +PKG_MIRROR_HASH:=1d39ad25f4ad1fafff03a70341c2dabde8db4075f56163d40f8ae8aef2e2bb2d PKG_MAINTAINER:=Imre Kaloz PKG_BUILD_PARALLEL:=1 diff --git a/package/kernel/mwlwifi/patches/001-Fix-compilation-warning-with-64-bit-system.patch b/package/kernel/mwlwifi/patches/001-Fix-compilation-warning-with-64-bit-system.patch index 8e71918cf3f828..ee64e050473a3a 100644 --- a/package/kernel/mwlwifi/patches/001-Fix-compilation-warning-with-64-bit-system.patch +++ b/package/kernel/mwlwifi/patches/001-Fix-compilation-warning-with-64-bit-system.patch @@ -111,17 +111,15 @@ cc1: all warnings being treated as errors Signed-off-by: Christian Marangi --- - debugfs.c | 2 +- - hif/fwcmd.c | 2 +- - hif/pcie/pcie.c | 4 ++-- - hif/pcie/tx_ndp.c | 2 +- + debugfs.c | 2 +- + hif/fwcmd.c | 2 +- + hif/pcie/8964/tx_ndp.c | 2 +- + hif/pcie/pcie.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) -diff --git a/debugfs.c b/debugfs.c -index 39b09fd..42efd28 100644 --- a/debugfs.c +++ b/debugfs.c -@@ -1332,7 +1332,7 @@ done: +@@ -1342,7 +1342,7 @@ done: priv->reg_value); else len += scnprintf(p + len, size - len, @@ -130,11 +128,9 @@ index 39b09fd..42efd28 100644 ret, priv->reg_type, priv->reg_offset, priv->reg_value); -diff --git a/hif/fwcmd.c b/hif/fwcmd.c -index 376b58f..582c8d2 100644 --- a/hif/fwcmd.c +++ b/hif/fwcmd.c -@@ -3604,7 +3604,7 @@ int mwl_fwcmd_get_fw_core_dump(struct ieee80211_hw *hw, +@@ -3623,7 +3623,7 @@ int mwl_fwcmd_get_fw_core_dump(struct ie core_dump->size_kb = pcmd->cmd_data.coredump.size_kb; core_dump->flags = pcmd->cmd_data.coredump.flags; memcpy(buff, @@ -143,11 +139,20 @@ index 376b58f..582c8d2 100644 sizeof(struct hostcmd_cmd_get_fw_core_dump) - sizeof(struct hostcmd_cmd_get_fw_core_dump_)), MAX_CORE_DUMP_BUFFER); -diff --git a/hif/pcie/pcie.c b/hif/pcie/pcie.c -index 24453b6..5b6c633 100644 +--- a/hif/pcie/8964/tx_ndp.c ++++ b/hif/pcie/8964/tx_ndp.c +@@ -336,7 +336,7 @@ int pcie_tx_init_ndp(struct ieee80211_hw + + if (sizeof(struct pcie_tx_ctrl_ndp) > + sizeof(tx_info->driver_data)) { +- wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n", ++ wiphy_err(hw->wiphy, "driver data is not enough: %zu (%zu)\n", + sizeof(struct pcie_tx_ctrl_ndp), + sizeof(tx_info->driver_data)); + return -ENOMEM; --- a/hif/pcie/pcie.c +++ b/hif/pcie/pcie.c -@@ -1320,8 +1320,8 @@ static void pcie_bf_mimo_ctrl_decode(struct mwl_priv *priv, +@@ -1466,8 +1466,8 @@ static void pcie_bf_mimo_ctrl_decode(struct mwl_priv *priv, &fp_data->f_pos); filp_close(fp_data, current->files); } else { @@ -158,19 +163,3 @@ index 24453b6..5b6c633 100644 } #if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) -diff --git a/hif/pcie/tx_ndp.c b/hif/pcie/tx_ndp.c -index 6758cde..3140a2e 100644 ---- a/hif/pcie/tx_ndp.c -+++ b/hif/pcie/tx_ndp.c -@@ -335,7 +335,7 @@ int pcie_tx_init_ndp(struct ieee80211_hw *hw) - - if (sizeof(struct pcie_tx_ctrl_ndp) > - sizeof(tx_info->status.status_driver_data)) { -- wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n", -+ wiphy_err(hw->wiphy, "driver data is not enough: %zu (%zu)\n", - sizeof(struct pcie_tx_ctrl_ndp), - sizeof(tx_info->status.status_driver_data)); - return -ENOMEM; --- -2.39.2 - diff --git a/package/kernel/mwlwifi/patches/004-mwlwifi-fix-PCIe-DT-node-null-pointer-dereference.patch b/package/kernel/mwlwifi/patches/004-mwlwifi-fix-PCIe-DT-node-null-pointer-dereference.patch index 3d9ec4dcfb3ac2..f37d2f8171a8df 100644 --- a/package/kernel/mwlwifi/patches/004-mwlwifi-fix-PCIe-DT-node-null-pointer-dereference.patch +++ b/package/kernel/mwlwifi/patches/004-mwlwifi-fix-PCIe-DT-node-null-pointer-dereference.patch @@ -19,7 +19,7 @@ Signed-off-by: Robert Marko --- a/hif/pcie/pcie.c +++ b/hif/pcie/pcie.c -@@ -573,7 +573,8 @@ static struct device_node *pcie_get_devi +@@ -685,7 +685,8 @@ static struct device_node *pcie_get_devi struct device_node *dev_node; dev_node = pci_bus_to_OF_node(pcie_priv->pdev->bus); diff --git a/package/kernel/mwlwifi/patches/005-mac80211_update.patch b/package/kernel/mwlwifi/patches/005-mac80211_update.patch index c11cf8c9469d43..92a8f2f70fd9c1 100644 --- a/package/kernel/mwlwifi/patches/005-mac80211_update.patch +++ b/package/kernel/mwlwifi/patches/005-mac80211_update.patch @@ -1,6 +1,6 @@ --- a/core.c +++ b/core.c -@@ -706,7 +706,7 @@ static void mwl_chnl_switch_event(struct +@@ -718,7 +718,7 @@ static void mwl_chnl_switch_event(struct vif = container_of((void *)mwl_vif, struct ieee80211_vif, drv_priv); @@ -11,7 +11,7 @@ spin_unlock_bh(&priv->vif_lock); --- a/debugfs.c +++ b/debugfs.c -@@ -455,9 +455,9 @@ static ssize_t mwl_debugfs_vif_read(stru +@@ -498,9 +498,9 @@ static ssize_t mwl_debugfs_vif_read(stru switch (vif->type) { case NL80211_IFTYPE_AP: len += scnprintf(p + len, size - len, "type: ap\n"); @@ -24,7 +24,7 @@ len += scnprintf(p + len, size - len, "ssid: %s\n", ssid); len += scnprintf(p + len, size - len, -@@ -479,8 +479,8 @@ static ssize_t mwl_debugfs_vif_read(stru +@@ -522,8 +522,8 @@ static ssize_t mwl_debugfs_vif_read(stru "type: unknown\n"); break; } @@ -35,62 +35,58 @@ len += scnprintf(p + len, size - len, "channel: %d: width: %d\n", chan_def->chan->hw_value, -@@ -564,28 +564,28 @@ static ssize_t mwl_debugfs_sta_read(stru - "amsdu cap: 0x%02x\n", - sta_info->amsdu_ctrl.cap); - } -- if (sta->ht_cap.ht_supported) { -+ if (sta->deflink.ht_cap.ht_supported) { - len += scnprintf(p + len, size - len, - "ht_cap: 0x%04x, ampdu: %02x, %02x\n", -- sta->ht_cap.cap, -- sta->ht_cap.ampdu_factor, -- sta->ht_cap.ampdu_density); -+ sta->deflink.ht_cap.cap, -+ sta->deflink.ht_cap.ampdu_factor, -+ sta->deflink.ht_cap.ampdu_density); - len += scnprintf(p + len, size - len, - "rx_mask: 0x%02x, %02x, %02x, %02x\n", -- sta->ht_cap.mcs.rx_mask[0], -- sta->ht_cap.mcs.rx_mask[1], -- sta->ht_cap.mcs.rx_mask[2], -- sta->ht_cap.mcs.rx_mask[3]); -+ sta->deflink.ht_cap.mcs.rx_mask[0], -+ sta->deflink.ht_cap.mcs.rx_mask[1], -+ sta->deflink.ht_cap.mcs.rx_mask[2], -+ sta->deflink.ht_cap.mcs.rx_mask[3]); - } -- if (sta->vht_cap.vht_supported) { -+ if (sta->deflink.vht_cap.vht_supported) { - len += scnprintf(p + len, size - len, - "vht_cap: 0x%08x, mcs: %02x, %02x\n", -- sta->vht_cap.cap, -- sta->vht_cap.vht_mcs.rx_mcs_map, -- sta->vht_cap.vht_mcs.tx_mcs_map); -+ sta->deflink.vht_cap.cap, -+ sta->deflink.vht_cap.vht_mcs.rx_mcs_map, -+ sta->deflink.vht_cap.vht_mcs.tx_mcs_map); - } - len += scnprintf(p + len, size - len, "rx_bw: %d, rx_nss: %d\n", -- sta->bandwidth, sta->rx_nss); -+ sta->deflink.bandwidth, sta->deflink.rx_nss); - len += scnprintf(p + len, size - len, - "tdls: %d, tdls_init: %d\n", - sta->tdls, sta->tdls_initiator); +@@ -596,18 +596,18 @@ static ssize_t mwl_debugfs_sta_read(stru + sta_info->wds ? "true" : "false", + sta_info->ba_hist.enable ? "enable" : "disable", + sta_info->is_amsdu_allowed ? sta_info->amsdu_ctrl.cap : 0 , +- sta->ht_cap.ht_supported ? sta->ht_cap.cap : 0, +- sta->ht_cap.ht_supported ? sta->ht_cap.ampdu_factor : 0, +- sta->ht_cap.ht_supported ? sta->ht_cap.ampdu_density : 0, +- sta->ht_cap.ht_supported ? sta->ht_cap.mcs.rx_mask[0] : 0, +- sta->ht_cap.ht_supported ? sta->ht_cap.mcs.rx_mask[1] : 0, +- sta->ht_cap.ht_supported ? sta->ht_cap.mcs.rx_mask[2] : 0, +- sta->ht_cap.ht_supported ? sta->ht_cap.mcs.rx_mask[3] : 0, +- sta->vht_cap.vht_supported ? sta->vht_cap.cap : 0, +- sta->vht_cap.vht_supported ? sta->vht_cap.vht_mcs.rx_mcs_map : 0, +- sta->vht_cap.vht_supported ? sta->vht_cap.vht_mcs.tx_mcs_map : 0, +- sta->bandwidth, +- sta->rx_nss, ++ sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.cap : 0, ++ sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.ampdu_factor : 0, ++ sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.ampdu_density : 0, ++ sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.mcs.rx_mask[0] : 0, ++ sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.mcs.rx_mask[1] : 0, ++ sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.mcs.rx_mask[2] : 0, ++ sta->deflink.ht_cap.ht_supported ? sta->deflink.ht_cap.mcs.rx_mask[3] : 0, ++ sta->deflink.vht_cap.vht_supported ? sta->deflink.vht_cap.cap : 0, ++ sta->deflink.vht_cap.vht_supported ? sta->deflink.vht_cap.vht_mcs.rx_mcs_map : 0, ++ sta->deflink.vht_cap.vht_supported ? sta->deflink.vht_cap.vht_mcs.tx_mcs_map : 0, ++ sta->deflink.bandwidth, ++ sta->deflink.rx_nss, + sta->tdls, + sta->tdls_initiator, + sta->wme, --- a/hif/fwcmd.c +++ b/hif/fwcmd.c -@@ -634,8 +634,9 @@ einval: +@@ -633,11 +633,15 @@ einval: + } static int mwl_fwcmd_set_ap_beacon(struct mwl_priv *priv, - struct mwl_vif *mwl_vif, +- struct mwl_vif *mwl_vif, - struct ieee80211_bss_conf *bss_conf) + struct ieee80211_vif *vif) { -+ struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; struct hostcmd_cmd_ap_beacon *pcmd; struct ds_params *phy_ds_param_set; ++ struct mwl_vif *mwl_vif; ++ struct ieee80211_bss_conf *bss_conf; ++ ++ mwl_vif = mwl_dev_get_vif(vif); ++ bss_conf = &vif->bss_conf; -@@ -664,7 +665,7 @@ static int mwl_fwcmd_set_ap_beacon(struc + /* wmm structure of start command is defined less one byte, + * due to following field country is not used, add byte one +@@ -664,7 +668,7 @@ static int mwl_fwcmd_set_ap_beacon(struc pcmd->cmd_hdr.macid = mwl_vif->macid; ether_addr_copy(pcmd->start_cmd.sta_mac_addr, mwl_vif->bssid); @@ -99,16 +95,16 @@ if (priv->chip_type == MWL8997) ether_addr_copy(pcmd->start_cmd.bssid, mwl_vif->bssid); pcmd->start_cmd.bss_type = 1; -@@ -2091,7 +2092,7 @@ int mwl_fwcmd_set_beacon(struct ieee8021 +@@ -2090,7 +2094,7 @@ int mwl_fwcmd_set_beacon(struct ieee8021 if (mwl_fwcmd_set_wsc_ie(hw, b_inf->ie_wsc_len, b_inf->ie_wsc_ptr)) goto err; - if (mwl_fwcmd_set_ap_beacon(priv, mwl_vif, &vif->bss_conf)) -+ if (mwl_fwcmd_set_ap_beacon(priv, mwl_vif, vif)) ++ if (mwl_fwcmd_set_ap_beacon(priv, vif)) goto err; if (b_inf->cap_info & WLAN_CAPABILITY_SPECTRUM_MGMT) -@@ -2153,38 +2154,38 @@ int mwl_fwcmd_set_new_stn_add(struct iee +@@ -2152,38 +2156,38 @@ int mwl_fwcmd_set_new_stn_add(struct iee ether_addr_copy(pcmd->mac_addr, sta->addr); if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ) @@ -161,7 +157,7 @@ } pcmd->is_qos_sta = sta->wme; -@@ -2240,38 +2241,38 @@ int mwl_fwcmd_set_new_stn_add_sc4(struct +@@ -2239,38 +2243,38 @@ int mwl_fwcmd_set_new_stn_add_sc4(struct ether_addr_copy(pcmd->mac_addr, sta->addr); if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ) @@ -214,7 +210,7 @@ } pcmd->is_qos_sta = sta->wme; -@@ -2788,9 +2789,9 @@ int mwl_fwcmd_create_ba(struct ieee80211 +@@ -2787,9 +2791,9 @@ int mwl_fwcmd_create_ba(struct ieee80211 pcmd->ba_info.create_params.flags = cpu_to_le32(ba_flags); pcmd->ba_info.create_params.queue_id = stream->idx; pcmd->ba_info.create_params.param_info = @@ -226,7 +222,7 @@ IEEE80211_HT_AMPDU_PARM_DENSITY); if (direction == BA_FLAG_DIRECTION_UP) { pcmd->ba_info.create_params.reset_seq_no = 0; -@@ -2800,9 +2801,9 @@ int mwl_fwcmd_create_ba(struct ieee80211 +@@ -2799,9 +2803,9 @@ int mwl_fwcmd_create_ba(struct ieee80211 pcmd->ba_info.create_params.current_seq = cpu_to_le16(0); } if (priv->chip_type == MWL8964 && @@ -238,9 +234,51 @@ IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK) >> IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT); } +--- a/hif/pcie/8864/tx.c ++++ b/hif/pcie/8864/tx.c +@@ -743,7 +743,7 @@ void pcie_8864_tx_xmit(struct ieee80211_ + index = SYSADPT_TX_WMM_QUEUES - index - 1; + txpriority = index; + +- if (sta && sta->ht_cap.ht_supported && ++ if (sta && sta->deflink.ht_cap.ht_supported && + !(xmitcontrol & EAGLE_TXD_XMITCTRL_USE_MC_RATE) && + ieee80211_is_data_qos(wh->frame_control)) { + tid = qos & 0xf; +--- a/hif/pcie/8964/tx_ndp.c ++++ b/hif/pcie/8964/tx_ndp.c +@@ -607,7 +607,7 @@ void pcie_tx_xmit_ndp(struct ieee80211_h + pcie_tx_encapsulate_frame(priv, skb, k_conf); + } else { + tid = qos & 0x7; +- if (sta && sta->ht_cap.ht_supported && !eapol_frame && ++ if (sta && sta->deflink.ht_cap.ht_supported && !eapol_frame && + qos != 0xFFFF) { + pcie_tx_count_packet(sta, tid); + spin_lock_bh(&priv->stream_lock); +--- a/hif/pcie/8997/tx.c ++++ b/hif/pcie/8997/tx.c +@@ -81,7 +81,7 @@ static int pcie_txbd_ring_create(struct + wiphy_info(priv->hw->wiphy, + "TX ring: - base: %p, pbase: 0x%x, len: %d\n", + pcie_priv->txbd_ring_vbase, +- pcie_priv->txbd_ring_pbase, ++ (u32)pcie_priv->txbd_ring_pbase, + pcie_priv->txbd_ring_size); + + for (num = 0; num < PCIE_MAX_TXRX_BD; num++) { +@@ -694,7 +694,7 @@ void pcie_8997_tx_xmit(struct ieee80211_ + index = SYSADPT_TX_WMM_QUEUES - index - 1; + txpriority = index; + +- if (sta && sta->ht_cap.ht_supported && ++ if (sta && sta->deflink.ht_cap.ht_supported && + !(xmitcontrol & EAGLE_TXD_XMITCTRL_USE_MC_RATE) && + ieee80211_is_data_qos(wh->frame_control)) { + tid = qos & 0xf; --- a/mac80211.c +++ b/mac80211.c -@@ -371,15 +371,15 @@ static void mwl_mac80211_bss_info_change +@@ -368,15 +368,15 @@ static void mwl_mac80211_bss_info_change } } @@ -259,7 +297,7 @@ { struct mwl_priv *priv = hw->priv; struct mwl_vif *mwl_vif; -@@ -429,8 +429,8 @@ static void mwl_mac80211_bss_info_change +@@ -426,8 +426,8 @@ static void mwl_mac80211_bss_info_change if (changed & (BSS_CHANGED_BEACON_INT | BSS_CHANGED_BEACON)) { struct sk_buff *skb; @@ -270,7 +308,7 @@ (!info->hidden_ssid)) { if (mwl_vif->broadcast_ssid != true) { mwl_fwcmd_broadcast_ssid_enable(hw, vif, true); -@@ -444,7 +444,7 @@ static void mwl_mac80211_bss_info_change +@@ -441,7 +441,7 @@ static void mwl_mac80211_bss_info_change } if (!mwl_vif->set_beacon) { @@ -279,7 +317,7 @@ if (skb) { mwl_fwcmd_set_beacon(hw, vif, skb->data, skb->len); -@@ -461,7 +461,7 @@ static void mwl_mac80211_bss_info_change +@@ -458,7 +458,7 @@ static void mwl_mac80211_bss_info_change static void mwl_mac80211_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *info, @@ -288,7 +326,7 @@ { switch (vif->type) { case NL80211_IFTYPE_AP: -@@ -584,10 +584,10 @@ static int mwl_mac80211_sta_add(struct i +@@ -583,10 +583,10 @@ static int mwl_mac80211_sta_add(struct i if (vif->type == NL80211_IFTYPE_MESH_POINT) sta_info->is_mesh_node = true; @@ -296,12 +334,12 @@ + if (sta->deflink.ht_cap.ht_supported) { sta_info->is_ampdu_allowed = true; sta_info->is_amsdu_allowed = false; -- if (sta->ht_cap.cap & IEEE80211_HT_CAP_MAX_AMSDU) -+ if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_MAX_AMSDU) +- if (sta->ht_cap.cap & IEEE80211_HT_CAP_MAX_AMSDU) { ++ if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_MAX_AMSDU) { sta_info->amsdu_ctrl.cap = MWL_AMSDU_SIZE_8K; - else - sta_info->amsdu_ctrl.cap = MWL_AMSDU_SIZE_4K; -@@ -669,7 +669,7 @@ static int mwl_mac80211_sta_remove(struc + sta_info->amsdu_ctrl.amsdu_allow_size = SYSADPT_AMSDU_8K_MAX_SIZE; + } +@@ -670,7 +670,7 @@ static int mwl_mac80211_sta_remove(struc static int mwl_mac80211_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, @@ -310,7 +348,7 @@ const struct ieee80211_tx_queue_params *params) { struct mwl_priv *priv = hw->priv; -@@ -928,4 +928,5 @@ const struct ieee80211_ops mwl_mac80211_ +@@ -934,4 +934,5 @@ const struct ieee80211_ops mwl_mac80211_ .pre_channel_switch = mwl_mac80211_chnl_switch, .sw_scan_start = mwl_mac80211_sw_scan_start, .sw_scan_complete = mwl_mac80211_sw_scan_complete, @@ -360,34 +398,3 @@ switch (format) { case TX_RATE_FORMAT_LEGACY: ---- a/hif/pcie/tx.c -+++ b/hif/pcie/tx.c -@@ -153,7 +153,7 @@ static int pcie_txbd_ring_create(struct - wiphy_info(priv->hw->wiphy, - "TX ring: - base: %p, pbase: 0x%x, len: %d\n", - pcie_priv->txbd_ring_vbase, -- pcie_priv->txbd_ring_pbase, -+ (u32)pcie_priv->txbd_ring_pbase, - pcie_priv->txbd_ring_size); - - for (num = 0; num < PCIE_MAX_TXRX_BD; num++) { -@@ -1091,7 +1091,7 @@ void pcie_tx_xmit(struct ieee80211_hw *h - index = SYSADPT_TX_WMM_QUEUES - index - 1; - txpriority = index; - -- if (sta && sta->ht_cap.ht_supported && !eapol_frame && -+ if (sta && sta->deflink.ht_cap.ht_supported && !eapol_frame && - ieee80211_is_data_qos(wh->frame_control)) { - tid = qos & 0xf; - pcie_tx_count_packet(sta, tid); ---- a/hif/pcie/tx_ndp.c -+++ b/hif/pcie/tx_ndp.c -@@ -602,7 +602,7 @@ void pcie_tx_xmit_ndp(struct ieee80211_h - pcie_tx_encapsulate_frame(priv, skb, k_conf, NULL); - } else { - tid = qos & 0x7; -- if (sta && sta->ht_cap.ht_supported && !eapol_frame && -+ if (sta && sta->deflink.ht_cap.ht_supported && !eapol_frame && - qos != 0xFFFF) { - pcie_tx_count_packet(sta, tid); - spin_lock_bh(&priv->stream_lock); diff --git a/package/kernel/qca-nss-dp/Makefile b/package/kernel/qca-nss-dp/Makefile index e9d9706141f0cf..f9e992f246af2f 100644 --- a/package/kernel/qca-nss-dp/Makefile +++ b/package/kernel/qca-nss-dp/Makefile @@ -1,13 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qca-nss-dp -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-dp.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2022-04-30 -PKG_SOURCE_VERSION:=72e9ec4187414461cbcf6ccff100e8b5ebe5f40b -PKG_MIRROR_HASH:=805f16e59c75511132922f97740ebf6bf953845b0bbfd2089c4615456893bb37 +PKG_SOURCE_DATE:=2023-06-06 +PKG_SOURCE_VERSION:=fa67464466f69f00967cc373d1bdd6025f57eb89 +PKG_MIRROR_HASH:=51bf524382a5cb542c2c80d12a91f87b9736de3ac3c1d4a351c97b3502d68574 PKG_BUILD_PARALLEL:=1 PKG_FLAGS:=nonshared @@ -19,7 +19,7 @@ define KernelPackage/qca-nss-dp SECTION:=kernel CATEGORY:=Kernel modules SUBMENU:=Network Devices - DEPENDS:=@TARGET_ipq807x +kmod-qca-ssdk + DEPENDS:=@TARGET_qualcommax +kmod-qca-ssdk TITLE:=Qualcom NSS dataplane ethernet driver FILES:=$(PKG_BUILD_DIR)/qca-nss-dp.ko AUTOLOAD:=$(call AutoLoad,31,qca-nss-dp,1) @@ -39,18 +39,15 @@ EXTRA_CFLAGS+= \ NSS_DP_HAL_DIR:=$(PKG_BUILD_DIR)/hal define Build/Configure - $(LN) $(NSS_DP_HAL_DIR)/soc_ops/$(CONFIG_TARGET_BOARD)/nss_$(CONFIG_TARGET_BOARD).h \ + $(LN) $(NSS_DP_HAL_DIR)/soc_ops/$(CONFIG_TARGET_SUBTARGET)/nss_$(CONFIG_TARGET_SUBTARGET).h \ $(PKG_BUILD_DIR)/exports/nss_dp_arch.h endef define Build/Compile - +$(MAKE) -C "$(LINUX_DIR)" \ - CROSS_COMPILE="$(TARGET_CROSS)" \ - ARCH="$(LINUX_KARCH)" \ + +$(KERNEL_MAKE) $(PKG_JOBS) \ + -C "$(LINUX_DIR)" \ M="$(PKG_BUILD_DIR)" \ - EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC="$(CONFIG_TARGET_BOARD)" \ - $(KERNEL_MAKE_FLAGS) \ - $(PKG_JOBS) \ + EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC="$(CONFIG_TARGET_SUBTARGET)" \ modules endef diff --git a/package/kernel/qca-nss-dp/patches/0001-nss-dp-Drop-_nocache-variants-of-ioremap.patch b/package/kernel/qca-nss-dp/patches/0001-nss-dp-Drop-_nocache-variants-of-ioremap.patch new file mode 100644 index 00000000000000..c998874d4e62c1 --- /dev/null +++ b/package/kernel/qca-nss-dp/patches/0001-nss-dp-Drop-_nocache-variants-of-ioremap.patch @@ -0,0 +1,48 @@ +From 946381fd6fdabedf2b5a1d8647a49e3da8f1894e Mon Sep 17 00:00:00 2001 +From: Baruch Siach +Date: Fri, 23 Jun 2023 11:28:02 +0200 +Subject: [PATCH 1/8] nss-dp: Drop _nocache variants of ioremap() + +ioremap_nocache was made equivelant to ioremap and was dropped. + +Signed-off-by: Baruch Siach +Signed-off-by: Robert Marko +--- + hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 2 +- + hal/gmac_ops/syn/gmac/syn_if.c | 2 +- + hal/soc_ops/ipq50xx/nss_ipq50xx.c | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c ++++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c +@@ -279,7 +279,7 @@ int edma_init(void) + /* + * Remap register resource + */ +- edma_hw.reg_base = ioremap_nocache((edma_hw.reg_resource)->start, ++ edma_hw.reg_base = ioremap((edma_hw.reg_resource)->start, + resource_size(edma_hw.reg_resource)); + if (!edma_hw.reg_base) { + pr_warn("Unable to remap EDMA register memory.\n"); +--- a/hal/gmac_ops/syn/gmac/syn_if.c ++++ b/hal/gmac_ops/syn/gmac/syn_if.c +@@ -806,7 +806,7 @@ static void *syn_init(struct nss_gmac_ha + * Populate the mac base addresses + */ + shd->nghd.mac_base = +- devm_ioremap_nocache(&dp_priv->pdev->dev, res->start, ++ devm_ioremap(&dp_priv->pdev->dev, res->start, + resource_size(res)); + if (!shd->nghd.mac_base) { + netdev_dbg(ndev, "ioremap fail.\n"); +--- a/hal/soc_ops/ipq50xx/nss_ipq50xx.c ++++ b/hal/soc_ops/ipq50xx/nss_ipq50xx.c +@@ -89,7 +89,7 @@ static void nss_dp_hal_tcsr_set(void) + pr_err("%s: SCM TCSR write error: %d\n", __func__, err); + } + } else { +- tcsr_addr = ioremap_nocache((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET), ++ tcsr_addr = ioremap((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET), + TCSR_GMAC_AXI_CACHE_OVERRIDE_REG_SIZE); + if (!tcsr_addr) { + pr_err("%s: ioremap failed\n", __func__); diff --git a/package/kernel/qca-nss-dp/patches/0001-edma_tx_rx-support-newer-kernels-time-stamping-API.patch b/package/kernel/qca-nss-dp/patches/0002-edma_tx_rx-support-newer-kernels-time-stamping-API.patch similarity index 80% rename from package/kernel/qca-nss-dp/patches/0001-edma_tx_rx-support-newer-kernels-time-stamping-API.patch rename to package/kernel/qca-nss-dp/patches/0002-edma_tx_rx-support-newer-kernels-time-stamping-API.patch index 1fed4ba8ab96fa..d091311b9752e0 100644 --- a/package/kernel/qca-nss-dp/patches/0001-edma_tx_rx-support-newer-kernels-time-stamping-API.patch +++ b/package/kernel/qca-nss-dp/patches/0002-edma_tx_rx-support-newer-kernels-time-stamping-API.patch @@ -1,9 +1,12 @@ -From 40979666b4371012405715ffa61ab5760fcdc6b3 Mon Sep 17 00:00:00 2001 -Message-Id: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il> +From 3357c64b3fc63fe003d5ef02ba7f6abca64d80bf Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Mon, 3 May 2021 20:07:36 +0300 -Subject: [PATCH 1/3] edma_tx_rx: support newer kernels time stamping API +Subject: [PATCH 2/8] edma_tx_rx: support newer kernels time stamping API +Timestamping API has changed in kernel 5.6, so update the implementation +for newer kernels. + +Signed-off-by: Baruch Siach --- hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 11 +++++++++++ 1 file changed, 11 insertions(+) @@ -37,7 +40,7 @@ Subject: [PATCH 1/3] edma_tx_rx: support newer kernels time stamping API ndev->phydev->drv->txtstamp(ndev->phydev, skb, 0); +#else + if (ndev && phy_has_txtstamp(ndev->phydev)) -+ phy_rxtstamp(ndev->phydev, skb, 0); ++ phy_txtstamp(ndev->phydev, skb, 0); +#endif } EXPORT_SYMBOL(nss_phy_tstamp_tx_buf); diff --git a/package/kernel/qca-nss-dp/patches/0002-nss_dp_main-make-phy-mode-code-compatible-with-newer.patch b/package/kernel/qca-nss-dp/patches/0002-nss_dp_main-make-phy-mode-code-compatible-with-newer.patch deleted file mode 100644 index 04adad86f6b4e4..00000000000000 --- a/package/kernel/qca-nss-dp/patches/0002-nss_dp_main-make-phy-mode-code-compatible-with-newer.patch +++ /dev/null @@ -1,48 +0,0 @@ -From cef7873a2d77df13ee702d902ed4e06b2248904b Mon Sep 17 00:00:00 2001 -Message-Id: -In-Reply-To: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il> -References: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il> -From: Baruch Siach -Date: Mon, 3 May 2021 20:17:22 +0300 -Subject: [PATCH 2/3] nss_dp_main: make phy mode code compatible with newer - kernels - ---- - include/nss_dp_dev.h | 4 ++-- - nss_dp_main.c | 4 ++++ - 2 files changed, 6 insertions(+), 2 deletions(-) - ---- a/include/nss_dp_dev.h -+++ b/include/nss_dp_dev.h -@@ -22,7 +22,7 @@ - #include - #include - #include --#include -+#include - #include - - #include "nss_dp_api_if.h" -@@ -99,7 +99,7 @@ struct nss_dp_dev { - /* Phy related stuff */ - struct phy_device *phydev; /* Phy device */ - struct mii_bus *miibus; /* MII bus */ -- uint32_t phy_mii_type; /* RGMII/SGMII/QSGMII */ -+ phy_interface_t phy_mii_type; /* RGMII/SGMII/QSGMII */ - uint32_t phy_mdio_addr; /* Mdio address */ - bool link_poll; /* Link polling enable? */ - uint32_t forced_speed; /* Forced speed? */ ---- a/nss_dp_main.c -+++ b/nss_dp_main.c -@@ -584,7 +584,11 @@ static int32_t nss_dp_of_get_pdata(struc - hal_pdata->netdev = netdev; - hal_pdata->macid = dp_priv->macid; - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)) - dp_priv->phy_mii_type = of_get_phy_mode(np); -+#else -+ of_get_phy_mode(np, &dp_priv->phy_mii_type); -+#endif - dp_priv->link_poll = of_property_read_bool(np, "qcom,link-poll"); - if (of_property_read_u32(np, "qcom,phy-mdio-addr", - &dp_priv->phy_mdio_addr) && dp_priv->link_poll) { diff --git a/package/kernel/qca-nss-dp/patches/0003-Drop-_nocache-variants-of-ioremap.patch b/package/kernel/qca-nss-dp/patches/0003-Drop-_nocache-variants-of-ioremap.patch deleted file mode 100644 index 18bd85c8c36597..00000000000000 --- a/package/kernel/qca-nss-dp/patches/0003-Drop-_nocache-variants-of-ioremap.patch +++ /dev/null @@ -1,48 +0,0 @@ -From c8c52512ff48bee578901c381a42f027e79eadf9 Mon Sep 17 00:00:00 2001 -Message-Id: -In-Reply-To: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il> -References: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il> -From: Baruch Siach -Date: Mon, 3 May 2021 20:20:29 +0300 -Subject: [PATCH 3/3] Drop _nocache variants of ioremap() - -Recent kernels removed them. ---- - hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 2 +- - hal/gmac_ops/qcom/qcom_if.c | 2 +- - hal/gmac_ops/syn/xgmac/syn_if.c | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - ---- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -@@ -279,7 +279,7 @@ int edma_init(void) - /* - * Remap register resource - */ -- edma_hw.reg_base = ioremap_nocache((edma_hw.reg_resource)->start, -+ edma_hw.reg_base = ioremap((edma_hw.reg_resource)->start, - resource_size(edma_hw.reg_resource)); - if (!edma_hw.reg_base) { - pr_warn("Unable to remap EDMA register memory.\n"); ---- a/hal/gmac_ops/qcom/qcom_if.c -+++ b/hal/gmac_ops/qcom/qcom_if.c -@@ -418,7 +418,7 @@ static void *qcom_init(struct nss_gmac_h - qhd->nghd.mac_id = gmacpdata->macid; - - /* Populate the mac base addresses */ -- qhd->nghd.mac_base = devm_ioremap_nocache(&dp_priv->pdev->dev, -+ qhd->nghd.mac_base = devm_ioremap(&dp_priv->pdev->dev, - res->start, resource_size(res)); - if (!qhd->nghd.mac_base) { - netdev_dbg(ndev, "ioremap fail.\n"); ---- a/hal/gmac_ops/syn/xgmac/syn_if.c -+++ b/hal/gmac_ops/syn/xgmac/syn_if.c -@@ -432,7 +432,7 @@ static void *syn_init(struct nss_gmac_ha - - /* Populate the mac base addresses */ - shd->nghd.mac_base = -- devm_ioremap_nocache(&dp_priv->pdev->dev, res->start, -+ devm_ioremap(&dp_priv->pdev->dev, res->start, - resource_size(res)); - if (!shd->nghd.mac_base) { - netdev_dbg(ndev, "ioremap fail.\n"); diff --git a/package/kernel/qca-nss-dp/patches/0004-EDMA-Fix-NAPI-packet-counting.patch b/package/kernel/qca-nss-dp/patches/0003-EDMA-Fix-NAPI-packet-counting.patch similarity index 88% rename from package/kernel/qca-nss-dp/patches/0004-EDMA-Fix-NAPI-packet-counting.patch rename to package/kernel/qca-nss-dp/patches/0003-EDMA-Fix-NAPI-packet-counting.patch index f7653729a00a28..a2268010d4c1bd 100644 --- a/package/kernel/qca-nss-dp/patches/0004-EDMA-Fix-NAPI-packet-counting.patch +++ b/package/kernel/qca-nss-dp/patches/0003-EDMA-Fix-NAPI-packet-counting.patch @@ -1,7 +1,7 @@ -From d74920e2a7c413ef40eed72f9cf287cf6fbd5fb8 Mon Sep 17 00:00:00 2001 +From c36420c219bf0e03842a11f69193c802eb42030a Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Thu, 20 May 2021 14:56:46 +0200 -Subject: [PATCH 1/2] EDMA: Fix NAPI packet counting +Subject: [PATCH 3/8] EDMA: Fix NAPI packet counting There is a bug in the NAPI packet counting that will cause NAPI over budget warnings. diff --git a/package/kernel/qca-nss-dp/patches/0005-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch b/package/kernel/qca-nss-dp/patches/0004-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch similarity index 87% rename from package/kernel/qca-nss-dp/patches/0005-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch rename to package/kernel/qca-nss-dp/patches/0004-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch index 9c22fa7904496d..84fb02a92a553c 100644 --- a/package/kernel/qca-nss-dp/patches/0005-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch +++ b/package/kernel/qca-nss-dp/patches/0004-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch @@ -1,7 +1,7 @@ -From 44a30d94abcbb10aacc21db29be212518a6b1bf7 Mon Sep 17 00:00:00 2001 +From 158032d3d4e5089afa2aa38c27c6e222ac427820 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Thu, 20 May 2021 14:57:46 +0200 -Subject: [PATCH] EDMA: Use NAPI_POLL_WEIGHT as NAPI weight +Subject: [PATCH 4/8] EDMA: Use NAPI_POLL_WEIGHT as NAPI weight Currently a weight of 100 is used by the EDMA, according to upstream max of 64 should be used and that is used for @@ -20,7 +20,7 @@ Signed-off-by: Robert Marko --- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c +++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -@@ -837,7 +837,7 @@ static int edma_register_netdevice(struc +@@ -845,7 +845,7 @@ static int edma_register_netdevice(struc */ if (!edma_hw.napi_added) { netif_napi_add(netdev, &edma_hw.napi, edma_napi, diff --git a/package/kernel/qca-nss-dp/patches/0005-nss-dp-adapt-to-netif_napi_add-changes.patch b/package/kernel/qca-nss-dp/patches/0005-nss-dp-adapt-to-netif_napi_add-changes.patch new file mode 100644 index 00000000000000..d5b0f624783e01 --- /dev/null +++ b/package/kernel/qca-nss-dp/patches/0005-nss-dp-adapt-to-netif_napi_add-changes.patch @@ -0,0 +1,46 @@ +From e46c4d526d77916c00fff4fff3237b9c9d0d774d Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Fri, 23 Jun 2023 12:04:11 +0200 +Subject: [PATCH 5/8] nss-dp: adapt to netif_napi_add() changes + +netif_napi_add() removed the weight argument and just uses the default +NAPI_POLL_WEIGHT in background, so for those requiring custom weight use +netif_napi_add_weight() instead. + +Signed-off-by: Robert Marko +--- + hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 4 ++++ + hal/dp_ops/syn_gmac_dp/syn_dp.c | 5 +++++ + 2 files changed, 9 insertions(+) + +--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c ++++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c +@@ -844,8 +844,12 @@ static int edma_register_netdevice(struc + * NAPI add + */ + if (!edma_hw.napi_added) { ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)) + netif_napi_add(netdev, &edma_hw.napi, edma_napi, + NAPI_POLL_WEIGHT); ++#else ++ netif_napi_add(netdev, &edma_hw.napi, edma_napi); ++#endif + /* + * Register the interrupt handlers and enable interrupts + */ +--- a/hal/dp_ops/syn_gmac_dp/syn_dp.c ++++ b/hal/dp_ops/syn_gmac_dp/syn_dp.c +@@ -189,8 +189,13 @@ static int syn_dp_if_init(struct nss_dp_ + } + + if (!dev_info->napi_added) { ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)) + netif_napi_add(netdev, &rx_info->napi_rx, syn_dp_napi_poll_rx, SYN_DP_NAPI_BUDGET_RX); + netif_napi_add(netdev, &tx_info->napi_tx, syn_dp_napi_poll_tx, SYN_DP_NAPI_BUDGET_TX); ++#else ++ netif_napi_add_weight(netdev, &rx_info->napi_rx, syn_dp_napi_poll_rx, SYN_DP_NAPI_BUDGET_RX); ++ netif_napi_add_weight(netdev, &tx_info->napi_tx, syn_dp_napi_poll_tx, SYN_DP_NAPI_BUDGET_TX); ++#endif + + /* + * Requesting irq. Set IRQ_DISABLE_UNLAZY flag, this flag diff --git a/package/kernel/qca-nss-dp/patches/0006-NSS-DP-fix-of_get_mac_address.patch b/package/kernel/qca-nss-dp/patches/0006-NSS-DP-fix-of_get_mac_address.patch deleted file mode 100644 index 1d7b49129fb0af..00000000000000 --- a/package/kernel/qca-nss-dp/patches/0006-NSS-DP-fix-of_get_mac_address.patch +++ /dev/null @@ -1,46 +0,0 @@ -From cadeb62a42296563141d6954eec58e34ef86778d Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Fri, 13 Aug 2021 20:12:08 +0200 -Subject: [PATCH] NSS-DP: fix of_get_mac_address() - -Recently OpenWrt backported the updated of_get_mac_address() -function which returns and error code instead. - -So, patch the SSDK to use it and fix the compilation error. - -Signed-off-by: Robert Marko ---- - nss_dp_main.c | 13 ++++--------- - 1 file changed, 4 insertions(+), 9 deletions(-) - ---- a/nss_dp_main.c -+++ b/nss_dp_main.c -@@ -555,9 +555,10 @@ static int32_t nss_dp_of_get_pdata(struc - struct net_device *netdev, - struct nss_gmac_hal_platform_data *hal_pdata) - { -- uint8_t *maddr; -+ u8 maddr[ETH_ALEN]; - struct nss_dp_dev *dp_priv; - struct resource memres_devtree = {0}; -+ int ret; - - dp_priv = netdev_priv(netdev); - -@@ -600,14 +601,8 @@ static int32_t nss_dp_of_get_pdata(struc - of_property_read_u32(np, "qcom,forced-speed", &dp_priv->forced_speed); - of_property_read_u32(np, "qcom,forced-duplex", &dp_priv->forced_duplex); - -- maddr = (uint8_t *)of_get_mac_address(np); --#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 4, 0)) -- if (IS_ERR((void *)maddr)) { -- maddr = NULL; -- } --#endif -- -- if (maddr && is_valid_ether_addr(maddr)) { -+ ret = of_get_mac_address(np, maddr); -+ if (!ret && is_valid_ether_addr(maddr)) { - ether_addr_copy(netdev->dev_addr, maddr); - } else { - random_ether_addr(netdev->dev_addr); diff --git a/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch b/package/kernel/qca-nss-dp/patches/0006-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch similarity index 71% rename from package/kernel/qca-nss-dp/patches/0013-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch rename to package/kernel/qca-nss-dp/patches/0006-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch index 276c87adfc52af..0432b82dda3f5c 100644 --- a/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch +++ b/package/kernel/qca-nss-dp/patches/0006-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch @@ -1,8 +1,8 @@ -From 8293a26ca56ee2e9a88e4efb5dcc7f647803cd8c Mon Sep 17 00:00:00 2001 +From 5b05b1d7a2d2001d9711856608f61abaf7b9a9a5 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc -Date: Sun, 5 Jun 2022 21:45:09 -0500 -Subject: [PATCH] nss_dp_main: Use a 'phy-handle' property to connect to the - PHY +Date: Fri, 23 Jun 2023 13:34:56 +0200 +Subject: [PATCH 6/8] nss_dp_main: Use a 'phy-handle' property to connect to + the PHY The original method of connecting a PHY to the ethernet controller requires the "qcom,link-poll", and "qcom,phy-mdio-addr" devicetree @@ -18,21 +18,22 @@ as they are no longer used: * "qcom,forced-duplex" Signed-off-by: Alexandru Gagniuc +Signed-off-by: Robert Marko --- include/nss_dp_dev.h | 5 +-- - nss_dp_main.c | 91 +++++--------------------------------------- - 2 files changed, 10 insertions(+), 86 deletions(-) + nss_dp_main.c | 91 +++++++------------------------------------- + 2 files changed, 14 insertions(+), 82 deletions(-) --- a/include/nss_dp_dev.h +++ b/include/nss_dp_dev.h -@@ -100,13 +100,10 @@ struct nss_dp_dev { +@@ -202,13 +202,10 @@ struct nss_dp_dev { unsigned long drv_flags; /* Driver specific feature flags */ /* Phy related stuff */ -+ struct device_node *phy_node; ++ struct device_node *phy_node; /* Phy device OF node */ struct phy_device *phydev; /* Phy device */ struct mii_bus *miibus; /* MII bus */ - phy_interface_t phy_mii_type; /* RGMII/SGMII/QSGMII */ + uint32_t phy_mii_type; /* RGMII/SGMII/QSGMII */ - uint32_t phy_mdio_addr; /* Mdio address */ - bool link_poll; /* Link polling enable? */ - uint32_t forced_speed; /* Forced speed? */ @@ -42,7 +43,7 @@ Signed-off-by: Alexandru Gagniuc --- a/nss_dp_main.c +++ b/nss_dp_main.c -@@ -399,7 +399,7 @@ static int nss_dp_open(struct net_device +@@ -418,7 +418,7 @@ static int nss_dp_open(struct net_device netif_start_queue(netdev); @@ -51,19 +52,23 @@ Signed-off-by: Alexandru Gagniuc /* Notify data plane link is up */ if (dp_priv->data_plane_ops->link_state(dp_priv->dpc, 1)) { netdev_dbg(netdev, "Data plane set link failed\n"); -@@ -576,6 +576,8 @@ static int32_t nss_dp_of_get_pdata(struc +@@ -615,6 +615,12 @@ static int32_t nss_dp_of_get_pdata(struc return -EFAULT; } + dp_priv->phy_node = of_parse_phandle(np, "phy-handle", 0); ++ if (!dp_priv->phy_node) { ++ pr_err("%s: error parsing phy-handle\n", np->name); ++ return -EFAULT; ++ } + if (of_property_read_u32(np, "qcom,mactype", &hal_pdata->mactype)) { pr_err("%s: error reading mactype\n", np->name); return -EFAULT; -@@ -594,16 +596,6 @@ static int32_t nss_dp_of_get_pdata(struc - #else - of_get_phy_mode(np, &dp_priv->phy_mii_type); +@@ -635,18 +641,6 @@ static int32_t nss_dp_of_get_pdata(struc + return -EFAULT; #endif + - dp_priv->link_poll = of_property_read_bool(np, "qcom,link-poll"); - if (of_property_read_u32(np, "qcom,phy-mdio-addr", - &dp_priv->phy_mdio_addr) && dp_priv->link_poll) { @@ -74,10 +79,12 @@ Signed-off-by: Alexandru Gagniuc - - of_property_read_u32(np, "qcom,forced-speed", &dp_priv->forced_speed); - of_property_read_u32(np, "qcom,forced-duplex", &dp_priv->forced_duplex); - - ret = of_get_mac_address(np, maddr); - if (!ret && is_valid_ether_addr(maddr)) { -@@ -636,50 +628,6 @@ static int32_t nss_dp_of_get_pdata(struc +- +- + #if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)) + maddr = (uint8_t *)of_get_mac_address(np); + #if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 4, 0)) +@@ -695,56 +689,6 @@ static int32_t nss_dp_of_get_pdata(struc return 0; } @@ -88,7 +95,9 @@ Signed-off-by: Alexandru Gagniuc -{ - struct device_node *mdio_node; - struct platform_device *mdio_plat; +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(6,1,0)) - struct ipq40xx_mdio_data *mdio_data; +-#endif - - /* - * Find mii_bus using "mdio-bus" handle. @@ -115,6 +124,9 @@ Signed-off-by: Alexandru Gagniuc - return NULL; - } - +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0)) +- return dev_get_drvdata(&mdio_plat->dev); +-#else - mdio_data = dev_get_drvdata(&mdio_plat->dev); - if (!mdio_data) { - dev_err(&pdev->dev, "cannot get mii bus reference from device data\n"); @@ -123,12 +135,13 @@ Signed-off-by: Alexandru Gagniuc - } - - return mdio_data->mii_bus; +-#endif -} - #ifdef CONFIG_NET_SWITCHDEV /* * nss_dp_is_phy_dev() -@@ -738,7 +686,6 @@ static int32_t nss_dp_probe(struct platf +@@ -803,7 +747,6 @@ static int32_t nss_dp_probe(struct platf struct device_node *np = pdev->dev.of_node; struct nss_gmac_hal_platform_data gmac_hal_pdata; int32_t ret = 0; @@ -136,7 +149,7 @@ Signed-off-by: Alexandru Gagniuc #if defined(NSS_DP_PPE_SUPPORT) uint32_t vsi_id; fal_port_t port_id; -@@ -813,37 +760,17 @@ static int32_t nss_dp_probe(struct platf +@@ -880,22 +823,14 @@ static int32_t nss_dp_probe(struct platf dp_priv->drv_flags |= NSS_DP_PRIV_FLAG(INIT_DONE); @@ -151,33 +164,17 @@ Signed-off-by: Alexandru Gagniuc - + if (dp_priv->phy_node) { SET_NETDEV_DEV(netdev, &pdev->dev); -- + - dp_priv->phydev = phy_connect(netdev, phy_id, - &nss_dp_adjust_link, - dp_priv->phy_mii_type); - if (IS_ERR(dp_priv->phydev)) { - netdev_dbg(netdev, "failed to connect to phy device\n"); + dp_priv->phydev = of_phy_connect(netdev, dp_priv->phy_node, -+ &nss_dp_adjust_link, 0, -+ dp_priv->phy_mii_type); ++ &nss_dp_adjust_link, 0, ++ dp_priv->phy_mii_type); + if (!(dp_priv->phydev)) { -+ dev_err(&pdev->dev, "Could not attach to PHY\n"); ++ netdev_err(netdev, "failed to connect to phy device\n"); goto phy_setup_fail; } - --#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)) -- dp_priv->phydev->advertising |= -- (ADVERTISED_Pause | ADVERTISED_Asym_Pause); -- dp_priv->phydev->supported |= -- (SUPPORTED_Pause | SUPPORTED_Asym_Pause); --#else -- linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, dp_priv->phydev->advertising); -- linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, dp_priv->phydev->advertising); -- -- linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, dp_priv->phydev->supported); -- linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, dp_priv->phydev->supported); --#endif -+ phy_attached_info(dp_priv->phydev); } - - #if defined(NSS_DP_PPE_SUPPORT) diff --git a/package/kernel/qca-nss-dp/patches/0007-NSS-DP-implement-ethernet-IOCTL-s.patch b/package/kernel/qca-nss-dp/patches/0007-NSS-DP-implement-ethernet-IOCTL-s.patch deleted file mode 100644 index 824f18634be0e0..00000000000000 --- a/package/kernel/qca-nss-dp/patches/0007-NSS-DP-implement-ethernet-IOCTL-s.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 5da62ba19f554bf437752a44360fb5ae9f1a7f5e Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Tue, 8 Mar 2022 10:48:32 +0100 -Subject: [PATCH] NSS-DP: implement ethernet IOCTL-s - -Since kernel 5.15 ethernet/PHY related IOCTL-s have been split from the -generic IOCTL netdev op. -So, implement the new op instead of the generic one which is considered -for private IOCTL-s only now for 5.15+. - -Signed-off-by: Robert Marko ---- - nss_dp_main.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/nss_dp_main.c -+++ b/nss_dp_main.c -@@ -532,7 +532,11 @@ static const struct net_device_ops nss_d - .ndo_set_mac_address = nss_dp_set_mac_address, - .ndo_validate_addr = eth_validate_addr, - .ndo_change_mtu = nss_dp_change_mtu, -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)) - .ndo_do_ioctl = nss_dp_do_ioctl, -+#else -+ .ndo_eth_ioctl = nss_dp_do_ioctl, -+#endif - - #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)) - .ndo_bridge_setlink = switchdev_port_bridge_setlink, diff --git a/package/kernel/qca-nss-dp/patches/0014-nss-dp-edma-v1-use-NAPI-GRO-by-default.patch b/package/kernel/qca-nss-dp/patches/0007-nss-dp-edma-v1-use-NAPI-GRO-by-default.patch similarity index 76% rename from package/kernel/qca-nss-dp/patches/0014-nss-dp-edma-v1-use-NAPI-GRO-by-default.patch rename to package/kernel/qca-nss-dp/patches/0007-nss-dp-edma-v1-use-NAPI-GRO-by-default.patch index 3683b4ec4c9dba..6fbe75dc1c4956 100644 --- a/package/kernel/qca-nss-dp/patches/0014-nss-dp-edma-v1-use-NAPI-GRO-by-default.patch +++ b/package/kernel/qca-nss-dp/patches/0007-nss-dp-edma-v1-use-NAPI-GRO-by-default.patch @@ -1,7 +1,7 @@ -From ae4fe8fb79b68f4cf4a887434ab6a8a9a1c65bfc Mon Sep 17 00:00:00 2001 +From c2df713569fe3bb671d1444c7bf758681081053c Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Thu, 23 Jun 2022 14:18:50 +0200 -Subject: [PATCH] nss-dp: edma-v1: use NAPI GRO by default +Subject: [PATCH 7/8] nss-dp: edma-v1: use NAPI GRO by default Utilize napi_gro_receive instead of plain netif_receive_skb on EDMA v1. @@ -18,11 +18,9 @@ Signed-off-by: Robert Marko hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 8 ++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) -diff --git a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -index 1d748db..e81c461 100644 --- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c +++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -@@ -589,10 +589,12 @@ drop: +@@ -597,10 +597,12 @@ drop: */ static void edma_if_set_features(struct nss_dp_data_plane_ctx *dpc) { @@ -39,11 +37,9 @@ index 1d748db..e81c461 100644 } /* TODO - check if this is needed */ -diff --git a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c -index 5780a30..a002a79 100644 --- a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c +++ b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c -@@ -410,8 +410,12 @@ static uint32_t edma_clean_rx(struct edma_hw *ehw, +@@ -410,8 +410,12 @@ static uint32_t edma_clean_rx(struct edm if (unlikely(EDMA_RXPH_SERVICE_CODE_GET(rxph) == NSS_PTP_EVENT_SERVICE_CODE)) nss_phy_tstamp_rx_buf(ndev, skb); @@ -58,6 +54,3 @@ index 5780a30..a002a79 100644 next_rx_desc: /* --- -2.38.1 - diff --git a/package/kernel/qca-nss-dp/patches/0015-nss-dp-allow-setting-netdev-name-from-DTS.patch b/package/kernel/qca-nss-dp/patches/0008-nss-dp-allow-setting-netdev-name-from-DTS.patch similarity index 82% rename from package/kernel/qca-nss-dp/patches/0015-nss-dp-allow-setting-netdev-name-from-DTS.patch rename to package/kernel/qca-nss-dp/patches/0008-nss-dp-allow-setting-netdev-name-from-DTS.patch index b1aebc268f77e8..e90bf32ced7707 100644 --- a/package/kernel/qca-nss-dp/patches/0015-nss-dp-allow-setting-netdev-name-from-DTS.patch +++ b/package/kernel/qca-nss-dp/patches/0008-nss-dp-allow-setting-netdev-name-from-DTS.patch @@ -1,7 +1,7 @@ -From 358b93e40d0c6b6d381fe0e9d2a63c45a10321b3 Mon Sep 17 00:00:00 2001 +From 53b044f7a21d5cd65ada90a228910e6efbad00fa Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sun, 4 Dec 2022 18:41:36 +0100 -Subject: [PATCH] nss-dp: allow setting netdev name from DTS +Subject: [PATCH 8/8] nss-dp: allow setting netdev name from DTS Allow reading the desired netdev name from DTS like DSA allows and then set it as the netdev name during registration. @@ -13,11 +13,9 @@ Signed-off-by: Robert Marko nss_dp_main.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) -diff --git a/nss_dp_main.c b/nss_dp_main.c -index 18e1088..19e14fb 100644 --- a/nss_dp_main.c +++ b/nss_dp_main.c -@@ -685,18 +685,29 @@ static int32_t nss_dp_probe(struct platform_device *pdev) +@@ -746,18 +746,29 @@ static int32_t nss_dp_probe(struct platf struct nss_dp_dev *dp_priv; struct device_node *np = pdev->dev.of_node; struct nss_gmac_hal_platform_data gmac_hal_pdata; @@ -50,6 +48,3 @@ index 18e1088..19e14fb 100644 return -ENOMEM; } --- -2.38.1 - diff --git a/package/kernel/qca-nss-dp/patches/0008-switchdev-remove-the-transaction-structure.patch b/package/kernel/qca-nss-dp/patches/0008-switchdev-remove-the-transaction-structure.patch deleted file mode 100644 index 220be961ab4a3d..00000000000000 --- a/package/kernel/qca-nss-dp/patches/0008-switchdev-remove-the-transaction-structure.patch +++ /dev/null @@ -1,48 +0,0 @@ -From c9afdcdd2642485a6476906be9da2e811090fc7a Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Fri, 18 Mar 2022 18:06:03 +0100 -Subject: [PATCH] switchdev: remove the transaction structure - -Since 5.12 there is no transaction structure anymore, so drop it for -5.12 and newer. - -Signed-off-by: Robert Marko ---- - nss_dp_switchdev.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/nss_dp_switchdev.c -+++ b/nss_dp_switchdev.c -@@ -279,13 +279,19 @@ void nss_dp_switchdev_setup(struct net_d - * Sets attributes - */ - static int nss_dp_port_attr_set(struct net_device *dev, -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)) - const struct switchdev_attr *attr, - struct switchdev_trans *trans) -+#else -+ const struct switchdev_attr *attr) -+#endif - { - struct nss_dp_dev *dp_priv = (struct nss_dp_dev *)netdev_priv(dev); - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)) - if (switchdev_trans_ph_prepare(trans)) - return 0; -+#endif - - switch (attr->id) { - case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS: -@@ -309,8 +315,12 @@ static int nss_dp_switchdev_port_attr_se - { - int err; - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)) - err = nss_dp_port_attr_set(netdev, port_attr_info->attr, - port_attr_info->trans); -+#else -+ err = nss_dp_port_attr_set(netdev, port_attr_info->attr); -+#endif - - port_attr_info->handled = true; - return notifier_from_errno(err); diff --git a/package/kernel/qca-nss-dp/patches/0010-switchdev-fix-FDB-roaming.patch b/package/kernel/qca-nss-dp/patches/0009-nss-dp-switchdev-fix-FDB-roaming.patch similarity index 65% rename from package/kernel/qca-nss-dp/patches/0010-switchdev-fix-FDB-roaming.patch rename to package/kernel/qca-nss-dp/patches/0009-nss-dp-switchdev-fix-FDB-roaming.patch index 19395ac42c49a7..ec10bdc2d98b52 100644 --- a/package/kernel/qca-nss-dp/patches/0010-switchdev-fix-FDB-roaming.patch +++ b/package/kernel/qca-nss-dp/patches/0009-nss-dp-switchdev-fix-FDB-roaming.patch @@ -1,7 +1,7 @@ -From d16102cad769f430144ca8094d928762b445e9b0 Mon Sep 17 00:00:00 2001 +From 25ca3308edb67aa0c6c70b83edf0e22b8ae7533f Mon Sep 17 00:00:00 2001 From: Robert Marko -Date: Fri, 18 Mar 2022 22:02:01 +0100 -Subject: [PATCH] switchdev: fix FDB roaming +Date: Thu, 29 Jun 2023 13:52:58 +0200 +Subject: [PATCH] nss-dp: switchdev: fix FDB roaming Try and solve the roaming issue by trying to replicate what NSS bridge module is doing, but by utilizing switchdev FDB notifiers instead of @@ -17,12 +17,12 @@ notification provided MAC adress existing FDB entry gets removed. Signed-off-by: Robert Marko --- - nss_dp_switchdev.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 61 insertions(+) + nss_dp_switchdev.c | 73 +++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 72 insertions(+), 1 deletion(-) --- a/nss_dp_switchdev.c +++ b/nss_dp_switchdev.c -@@ -24,6 +24,8 @@ +@@ -29,6 +29,8 @@ #include "nss_dp_dev.h" #include "fal/fal_stp.h" #include "fal/fal_ctrlpkt.h" @@ -31,10 +31,18 @@ Signed-off-by: Robert Marko #define NSS_DP_SWITCH_ID 0 #define NSS_DP_SW_ETHTYPE_PID 0 /* PPE ethtype profile ID for slow protocols */ -@@ -348,10 +350,64 @@ static int nss_dp_switchdev_event(struct - return NOTIFY_DONE; - } +@@ -521,7 +523,76 @@ static struct notifier_block *nss_dp_sw_ + #else + +-static struct notifier_block *nss_dp_sw_ev_nb; ++/* ++ * nss_dp_switchdev_fdb_del_event ++ * ++ * Used for EDMA v1 to remove old MAC in order to preventing having ++ * duplicate MAC entries in FDB thus and avoid roaming issues. ++ */ ++ +static int nss_dp_switchdev_fdb_del_event(struct net_device *netdev, + struct switchdev_notifier_fdb_info *fdb_info) +{ @@ -65,8 +73,14 @@ Signed-off-by: Robert Marko + return notifier_from_errno(rv); +} + -+static int nss_dp_fdb_switchdev_event(struct notifier_block *nb, -+ unsigned long event, void *ptr) ++/* ++ * nss_dp_switchdev_event_nb ++ * ++ * Non blocking switchdev event for netdevice. ++ * Used for EDMA v1 to remove old MAC and avoid roaming issues. ++ */ ++static int nss_dp_switchdev_event_nb(struct notifier_block *unused, ++ unsigned long event, void *ptr) +{ + struct net_device *dev = switchdev_notifier_info_to_dev(ptr); + @@ -80,31 +94,18 @@ Signed-off-by: Robert Marko + switch (event) { + case SWITCHDEV_FDB_DEL_TO_DEVICE: + return nss_dp_switchdev_fdb_del_event(dev, ptr); ++ default: ++ netdev_dbg(dev, "Switchdev event %lu is not supported\n", event); + } + + return NOTIFY_DONE; +} + - static struct notifier_block nss_dp_switchdev_notifier = { - .notifier_call = nss_dp_switchdev_event, - }; - -+static struct notifier_block nss_dp_switchdev_fdb_notifier = { -+ .notifier_call = nss_dp_fdb_switchdev_event, ++static struct notifier_block nss_dp_switchdev_notifier_nb = { ++ .notifier_call = nss_dp_switchdev_event_nb, +}; + - static bool switch_init_done; ++static struct notifier_block *nss_dp_sw_ev_nb = &nss_dp_switchdev_notifier_nb; /* -@@ -366,6 +422,11 @@ void nss_dp_switchdev_setup(struct net_d - return; - } - -+ err = register_switchdev_notifier(&nss_dp_switchdev_fdb_notifier); -+ if (err) { -+ netdev_dbg(dev, "%px:Failed to register switchdev FDB notifier\n", dev); -+ } -+ - err = register_switchdev_blocking_notifier(&nss_dp_switchdev_notifier); - if (err) { - netdev_dbg(dev, "%px:Failed to register switchdev notifier\n", dev); + * nss_dp_bridge_attr_set() diff --git a/package/kernel/qca-nss-dp/patches/0009-switchdev-use-new-switchdev-flags.patch b/package/kernel/qca-nss-dp/patches/0009-switchdev-use-new-switchdev-flags.patch deleted file mode 100644 index ecc84c1741c433..00000000000000 --- a/package/kernel/qca-nss-dp/patches/0009-switchdev-use-new-switchdev-flags.patch +++ /dev/null @@ -1,51 +0,0 @@ -From f95868d54301c0f54e968ec9d978c9caa02ee425 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Fri, 18 Mar 2022 18:24:18 +0100 -Subject: [PATCH] switchdev: use new switchdev flags - -Since kernel 5.12 switched utilizes a new way of setting the flags by -using a dedicated structure with flags and mask. - -So fix using kernels 5.12 and later. - -Signed-off-by: Robert Marko ---- - include/nss_dp_dev.h | 7 +++++++ - nss_dp_switchdev.c | 2 +- - 2 files changed, 8 insertions(+), 1 deletion(-) - ---- a/include/nss_dp_dev.h -+++ b/include/nss_dp_dev.h -@@ -24,6 +24,9 @@ - #include - #include - #include -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)) -+#include -+#endif - - #include "nss_dp_api_if.h" - #include "nss_dp_hal_if.h" -@@ -126,7 +129,11 @@ struct nss_dp_dev { - /* switchdev related attributes */ - #ifdef CONFIG_NET_SWITCHDEV - u8 stp_state; /* STP state of this physical port */ -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)) - unsigned long brport_flags; /* bridge port flags */ -+#else -+ struct switchdev_brport_flags brport_flags; /* bridge port flags */ -+#endif - #endif - uint32_t rx_page_mode; /* page mode for Rx processing */ - uint32_t rx_jumbo_mru; /* Jumbo mru value for Rx processing */ ---- a/nss_dp_switchdev.c -+++ b/nss_dp_switchdev.c -@@ -296,7 +296,7 @@ static int nss_dp_port_attr_set(struct n - switch (attr->id) { - case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS: - dp_priv->brport_flags = attr->u.brport_flags; -- netdev_dbg(dev, "set brport_flags %lu\n", attr->u.brport_flags); -+ netdev_dbg(dev, "set brport_flags %lu\n", attr->u.brport_flags.val); - return 0; - case SWITCHDEV_ATTR_ID_PORT_STP_STATE: - return nss_dp_stp_state_set(dp_priv, attr->u.stp_state); diff --git a/package/kernel/qca-nss-dp/patches/0011-treewide-fix-confusing-printing-of-registered-netdev.patch b/package/kernel/qca-nss-dp/patches/0011-treewide-fix-confusing-printing-of-registered-netdev.patch deleted file mode 100644 index 726ca304df704f..00000000000000 --- a/package/kernel/qca-nss-dp/patches/0011-treewide-fix-confusing-printing-of-registered-netdev.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 7e4ae2d6285095794d73d2f2ce61404f61d4e633 Mon Sep 17 00:00:00 2001 -From: Ansuel Smith -Date: Tue, 17 May 2022 15:55:36 +0200 -Subject: [PATCH 11/11] treewide: fix confusing printing of registered netdev - -Net core implementation changed and now printing the netdev name cause -confusing printing if done before register_netdev. Move the old printing -to dbg and add an additional info log right after register_netdev to -give the user some info on correct nss-dp probe. - -Signed-off-by: Ansuel Smith ---- - hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 4 ++-- - nss_dp_main.c | 3 +++ - 2 files changed, 5 insertions(+), 2 deletions(-) - ---- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -@@ -822,8 +822,8 @@ static int edma_register_netdevice(struc - return -EINVAL; - } - -- netdev_info(netdev, "nss_dp_edma: Registering netdev %s(qcom-id:%d) with EDMA\n", -- netdev->name, macid); -+ netdev_dbg(netdev, "nss_dp_edma: Registering netdev %s(qcom-id:%d) with EDMA\n", -+ netdev->name, macid); - - /* - * We expect 'macid' to correspond to ports numbers on ---- a/nss_dp_main.c -+++ b/nss_dp_main.c -@@ -875,6 +875,9 @@ static int32_t nss_dp_probe(struct platf - goto phy_setup_fail; - } - -+ netdev_info(netdev, "Registered netdev %s(qcom-id:%d)\n", -+ netdev->name, port_id); -+ - dp_global_ctx.nss_dp[dp_priv->macid - 1] = dp_priv; - dp_global_ctx.slowproto_acl_bm = 0; - diff --git a/package/kernel/qca-nss-dp/patches/0012-gmac-syn-xgmac-silence-debug-log-on-probe.patch b/package/kernel/qca-nss-dp/patches/0012-gmac-syn-xgmac-silence-debug-log-on-probe.patch deleted file mode 100644 index 3c1c8ab83b5834..00000000000000 --- a/package/kernel/qca-nss-dp/patches/0012-gmac-syn-xgmac-silence-debug-log-on-probe.patch +++ /dev/null @@ -1,23 +0,0 @@ -From fee52ef165e9fab2fca15492677082fd8e9e891f Mon Sep 17 00:00:00 2001 -From: Ansuel Smith -Date: Thu, 19 May 2022 23:40:24 +0200 -Subject: [PATCH 12/12] gmac: syn: xgmac: silence debug log on probe - -Silence debug log set as info in xgmac port probe. - -Signed-off-by: Ansuel Smith ---- - hal/gmac_ops/syn/xgmac/syn_if.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/hal/gmac_ops/syn/xgmac/syn_if.c -+++ b/hal/gmac_ops/syn/xgmac/syn_if.c -@@ -445,7 +445,7 @@ static void *syn_init(struct nss_gmac_ha - - spin_lock_init(&shd->nghd.slock); - -- netdev_info(ndev, "ioremap OK.Size 0x%x Ndev base 0x%lx macbase 0x%px\n", -+ netdev_dbg(ndev, "ioremap OK.Size 0x%x Ndev base 0x%lx macbase 0x%px\n", - gmacpdata->reg_len, - ndev->base_addr, - shd->nghd.mac_base); diff --git a/package/kernel/qca-ssdk/Makefile b/package/kernel/qca-ssdk/Makefile index a27e032b8126e3..d8c8d6cb167c1d 100644 --- a/package/kernel/qca-ssdk/Makefile +++ b/package/kernel/qca-ssdk/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qca-ssdk -PKG_RELEASE:=2 +PKG_RELEASE:=4 PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/qca-ssdk.git PKG_SOURCE_PROTO:=git @@ -20,7 +20,7 @@ define KernelPackage/qca-ssdk CATEGORY:=Kernel modules SUBMENU:=Network Devices TITLE:=Qualcom SSDK switch driver - DEPENDS:=@(TARGET_ipq807x) + DEPENDS:=@(TARGET_qualcommax) FILES:=$(PKG_BUILD_DIR)/build/bin/qca-ssdk.ko AUTOLOAD:=$(call AutoLoad,30,qca-ssdk) endef @@ -31,17 +31,11 @@ endef GCC_VERSION=$(shell echo "$(CONFIG_GCC_VERSION)" | sed 's/[^0-9.]*\([0-9.]*\).*/\1/') -ifdef CONFIG_TOOLCHAIN_BIN_PATH -TOOLCHAIN_BIN_PATH=$(CONFIG_TOOLCHAIN_BIN_PATH) -else -TOOLCHAIN_BIN_PATH=$(TOOLCHAIN_DIR)/bin -endif - LNX_CONFIG_OPTS = LNX_MAKEOPTS='$(KERNEL_MAKEOPTS)' MODULE_TYPE=KSLIB modules MAKE_FLAGS+= \ TARGET_NAME=$(CONFIG_TARGET_NAME) \ - TOOL_PATH=$(TOOLCHAIN_BIN_PATH) \ + TOOL_PATH=$(firstword $(TOOLCHAIN_BIN_DIRS)) \ SYS_PATH=$(LINUX_DIR) \ TOOLPREFIX=$(TARGET_CROSS) \ KVER=$(LINUX_VERSION) \ @@ -49,10 +43,13 @@ MAKE_FLAGS+= \ TARGET_SUFFIX=$(CONFIG_TARGET_SUFFIX) \ GCC_VERSION=$(GCC_VERSION) \ EXTRA_CFLAGS=-fno-stack-protector -I$(STAGING_DIR)/usr/include \ + SoC=$(CONFIG_TARGET_SUBTARGET) \ + PTP_FEATURE=disable SWCONFIG_FEATURE=disable \ + ISISC_ENABLE=disable IN_QCA803X_PHY=FALSE \ $(LNX_CONFIG_OPTS) -ifeq ($(CONFIG_TARGET_BOARD), "ipq807x") - MAKE_FLAGS+= CHIP_TYPE=HPPE PTP_FEATURE=disable SWCONFIG_FEATURE=disable +ifeq ($(CONFIG_TARGET_SUBTARGET), "ipq807x") + MAKE_FLAGS+= CHIP_TYPE=HPPE endif define Build/InstallDev @@ -75,6 +72,9 @@ define Build/InstallDev if [ -f $(PKG_BUILD_DIR)/include/init/ssdk_init.h ]; then \ $(CP) -rf $(PKG_BUILD_DIR)/include/init/ssdk_init.h $(1)/usr/include/qca-ssdk/init/; \ fi + if [ -f $(PKG_BUILD_DIR)/include/init/ssdk_netlink.h ]; then \ + $(CP) -rf $(PKG_BUILD_DIR)/include/init/ssdk_netlink.h $(1)/usr/include/qca-ssdk/init/; \ + fi $(CP) -rf $(PKG_BUILD_DIR)/include/fal $(1)/usr/include/qca-ssdk $(CP) -rf $(PKG_BUILD_DIR)/include/common/*.h $(1)/usr/include/qca-ssdk $(CP) -rf $(PKG_BUILD_DIR)/include/sal/os/linux/*.h $(1)/usr/include/qca-ssdk diff --git a/package/kernel/qca-ssdk/patches/0007-qca807x-add-a-LED-quirk-for-Xiaomi-AX9000.patch b/package/kernel/qca-ssdk/patches/0001-qca807x-add-a-LED-quirk-for-Xiaomi-AX9000.patch similarity index 100% rename from package/kernel/qca-ssdk/patches/0007-qca807x-add-a-LED-quirk-for-Xiaomi-AX9000.patch rename to package/kernel/qca-ssdk/patches/0001-qca807x-add-a-LED-quirk-for-Xiaomi-AX9000.patch diff --git a/package/kernel/qca-ssdk/patches/0002-SSDK-replace-ioremap_nocache-with-ioremap.patch b/package/kernel/qca-ssdk/patches/0002-SSDK-replace-ioremap_nocache-with-ioremap.patch deleted file mode 100644 index 5589c8e22986b8..00000000000000 --- a/package/kernel/qca-ssdk/patches/0002-SSDK-replace-ioremap_nocache-with-ioremap.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 845a89b05aae807fb837f8e8f27f95c89de6023f Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Wed, 12 May 2021 13:45:45 +0200 -Subject: [PATCH 02/11] SSDK: replace ioremap_nocache with ioremap - -ioremap_nocache was dropped upstream, simply use the -generic variety. - -Signed-off-by: Robert Marko ---- - src/init/ssdk_clk.c | 10 +++++----- - src/init/ssdk_init.c | 2 +- - src/init/ssdk_plat.c | 6 +++--- - 3 files changed, 9 insertions(+), 9 deletions(-) - ---- a/src/init/ssdk_clk.c -+++ b/src/init/ssdk_clk.c -@@ -721,7 +721,7 @@ ssdk_mp_tcsr_get(a_uint32_t tcsr_offset, - { - void __iomem *tcsr_base = NULL; - -- tcsr_base = ioremap_nocache(TCSR_ETH_ADDR, TCSR_ETH_SIZE); -+ tcsr_base = ioremap(TCSR_ETH_ADDR, TCSR_ETH_SIZE); - if (!tcsr_base) - { - SSDK_ERROR("Failed to map tcsr eth address!\n"); -@@ -738,7 +738,7 @@ ssdk_mp_tcsr_set(a_uint32_t tcsr_offset, - { - void __iomem *tcsr_base = NULL; - -- tcsr_base = ioremap_nocache(TCSR_ETH_ADDR, TCSR_ETH_SIZE); -+ tcsr_base = ioremap(TCSR_ETH_ADDR, TCSR_ETH_SIZE); - if (!tcsr_base) - { - SSDK_ERROR("Failed to map tcsr eth address!\n"); -@@ -786,7 +786,7 @@ ssdk_mp_cmnblk_stable_check(void) - a_uint32_t reg_val; - int i, loops = 20; - -- pll_lock = ioremap_nocache(CMN_PLL_LOCKED_ADDR, CMN_PLL_LOCKED_SIZE); -+ pll_lock = ioremap(CMN_PLL_LOCKED_ADDR, CMN_PLL_LOCKED_SIZE); - if (!pll_lock) { - SSDK_ERROR("Failed to map CMN PLL LOCK register!\n"); - return A_FALSE; -@@ -843,7 +843,7 @@ static void ssdk_cmnblk_pll_src_set(enum - void __iomem *cmn_pll_src_base = NULL; - a_uint32_t reg_val; - -- cmn_pll_src_base = ioremap_nocache(CMN_BLK_PLL_SRC_ADDR, CMN_BLK_SIZE); -+ cmn_pll_src_base = ioremap(CMN_BLK_PLL_SRC_ADDR, CMN_BLK_SIZE); - if (!cmn_pll_src_base) { - SSDK_ERROR("Failed to map cmn pll source address!\n"); - return; -@@ -869,7 +869,7 @@ static void ssdk_cmnblk_init(enum cmnblk - return; - } - -- gcc_pll_base = ioremap_nocache(CMN_BLK_ADDR, CMN_BLK_SIZE); -+ gcc_pll_base = ioremap(CMN_BLK_ADDR, CMN_BLK_SIZE); - if (!gcc_pll_base) { - SSDK_ERROR("Failed to map gcc pll address!\n"); - return; ---- a/src/init/ssdk_init.c -+++ b/src/init/ssdk_init.c -@@ -3134,7 +3134,7 @@ static int ssdk_dess_mac_mode_init(a_uin - (a_uint8_t *)®_value, 4); - mdelay(10); - /*softreset psgmii, fixme*/ -- gcc_addr = ioremap_nocache(0x1812000, 0x200); -+ gcc_addr = ioremap(0x1812000, 0x200); - if (!gcc_addr) { - SSDK_ERROR("gcc map fail!\n"); - return 0; ---- a/src/init/ssdk_plat.c -+++ b/src/init/ssdk_plat.c -@@ -1708,7 +1708,7 @@ ssdk_plat_init(ssdk_init_cfg *cfg, a_uin - reg_mode = ssdk_uniphy_reg_access_mode_get(dev_id); - if(reg_mode == HSL_REG_LOCAL_BUS) { - ssdk_uniphy_reg_map_info_get(dev_id, &map); -- qca_phy_priv_global[dev_id]->uniphy_hw_addr = ioremap_nocache(map.base_addr, -+ qca_phy_priv_global[dev_id]->uniphy_hw_addr = ioremap(map.base_addr, - map.size); - if (!qca_phy_priv_global[dev_id]->uniphy_hw_addr) { - SSDK_ERROR("%s ioremap fail.", __func__); -@@ -1723,7 +1723,7 @@ ssdk_plat_init(ssdk_init_cfg *cfg, a_uin - reg_mode = ssdk_switch_reg_access_mode_get(dev_id); - if (reg_mode == HSL_REG_LOCAL_BUS) { - ssdk_switch_reg_map_info_get(dev_id, &map); -- qca_phy_priv_global[dev_id]->hw_addr = ioremap_nocache(map.base_addr, -+ qca_phy_priv_global[dev_id]->hw_addr = ioremap(map.base_addr, - map.size); - if (!qca_phy_priv_global[dev_id]->hw_addr) { - SSDK_ERROR("%s ioremap fail.", __func__); -@@ -1764,7 +1764,7 @@ ssdk_plat_init(ssdk_init_cfg *cfg, a_uin - return -1; - } - -- qca_phy_priv_global[dev_id]->psgmii_hw_addr = ioremap_nocache(map.base_addr, -+ qca_phy_priv_global[dev_id]->psgmii_hw_addr = ioremap(map.base_addr, - map.size); - if (!qca_phy_priv_global[dev_id]->psgmii_hw_addr) { - SSDK_ERROR("%s ioremap fail.", __func__); diff --git a/package/kernel/qca-ssdk/patches/0008-qca807x-add-a-LED-quirk-for-Xiaomi-AX3600.patch b/package/kernel/qca-ssdk/patches/0002-qca807x-add-a-LED-quirk-for-Xiaomi-AX3600.patch similarity index 100% rename from package/kernel/qca-ssdk/patches/0008-qca807x-add-a-LED-quirk-for-Xiaomi-AX3600.patch rename to package/kernel/qca-ssdk/patches/0002-qca807x-add-a-LED-quirk-for-Xiaomi-AX3600.patch diff --git a/package/kernel/qca-ssdk/patches/0003-SSDK-platform-use-of_mdio_find_bus-to-get-MDIO-bus.patch b/package/kernel/qca-ssdk/patches/0003-SSDK-platform-use-of_mdio_find_bus-to-get-MDIO-bus.patch deleted file mode 100644 index f9535fb38743a0..00000000000000 --- a/package/kernel/qca-ssdk/patches/0003-SSDK-platform-use-of_mdio_find_bus-to-get-MDIO-bus.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 85f988dbc15559a5a2fee606e6ef400aa39fe444 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Wed, 12 May 2021 17:15:46 +0200 -Subject: [PATCH 03/11] SSDK: platform: use of_mdio_find_bus() to get MDIO bus - -Kernel has a generic of_mdio_find_bus() which can get the appropriate -MDIO bus based on the DT node. -So, drop the getting MDIO from platform data, which no longer works -in 5.4 and later and use of_mdio_find_bus(). - -Signed-off-by: Baruch Siach -Signed-off-by: Robert Marko ---- - src/init/ssdk_plat.c | 8 +------- - 1 file changed, 1 insertion(+), 7 deletions(-) - ---- a/src/init/ssdk_plat.c -+++ b/src/init/ssdk_plat.c -@@ -753,7 +753,6 @@ static int miibus_get(a_uint32_t dev_id) - struct device_node *mdio_node = NULL; - struct device_node *switch_node = NULL; - struct platform_device *mdio_plat = NULL; -- struct qca_mdio_data *mdio_data = NULL; - struct qca_phy_priv *priv; - hsl_reg_mode reg_mode = HSL_REG_LOCAL_BUS; - priv = qca_phy_priv_global[dev_id]; -@@ -788,12 +787,7 @@ static int miibus_get(a_uint32_t dev_id) - - if(reg_mode == HSL_REG_LOCAL_BUS) - { -- mdio_data = dev_get_drvdata(&mdio_plat->dev); -- if (!mdio_data) { -- SSDK_ERROR("cannot get mdio_data reference from device data\n"); -- return 1; -- } -- priv->miibus = mdio_data->mii_bus; -+ priv->miibus = of_mdio_find_bus(mdio_node); - } - else - priv->miibus = dev_get_drvdata(&mdio_plat->dev); diff --git a/package/kernel/qca-ssdk/patches/0004-SSDK-dts-fix-of_get_mac_address.patch b/package/kernel/qca-ssdk/patches/0004-SSDK-dts-fix-of_get_mac_address.patch deleted file mode 100644 index 1dd948643f2028..00000000000000 --- a/package/kernel/qca-ssdk/patches/0004-SSDK-dts-fix-of_get_mac_address.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 079c20aa182c6b623d49e1f375e022dedac7373c Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Fri, 13 Aug 2021 20:03:21 +0200 -Subject: [PATCH 04/11] SSDK: dts: fix of_get_mac_address() - -Recently OpenWrt backported the updated of_get_mac_address() -function which returns and error code instead. - -So, patch the SSDK to use it and fix the compilation error. - -Signed-off-by: Robert Marko ---- - src/init/ssdk_dts.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - ---- a/src/init/ssdk_dts.c -+++ b/src/init/ssdk_dts.c -@@ -921,8 +921,9 @@ static void ssdk_dt_parse_intf_mac(void) - { - struct device_node *dp_node = NULL; - a_uint32_t dp = 0; -- a_uint8_t *maddr = NULL; -+ u8 maddr[ETH_ALEN]; - char dp_name[8] = {0}; -+ int ret; - - for (dp = 1; dp <= SSDK_MAX_NR_ETH; dp++) { - snprintf(dp_name, sizeof(dp_name), "dp%d", dp); -@@ -930,11 +931,11 @@ static void ssdk_dt_parse_intf_mac(void) - if (!dp_node) { - continue; - } -- maddr = (a_uint8_t *)of_get_mac_address(dp_node); -+ ret = of_get_mac_address(dp_node, maddr); - #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)) - if (maddr && is_valid_ether_addr(maddr)) { - #else -- if (!IS_ERR(maddr) && is_valid_ether_addr(maddr)) { -+ if (!ret && is_valid_ether_addr(maddr)) { - #endif - ssdk_dt_global.num_intf_mac++; - ether_addr_copy(ssdk_dt_global.intf_mac[dp-1].uc, maddr); diff --git a/package/kernel/qca-ssdk/patches/0005-SSDK-config-add-kernel-5.15.patch b/package/kernel/qca-ssdk/patches/0005-SSDK-config-add-kernel-5.15.patch deleted file mode 100644 index 7b19f5d12cb5b5..00000000000000 --- a/package/kernel/qca-ssdk/patches/0005-SSDK-config-add-kernel-5.15.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0c509f8d8e5a6a03933a112d4487fd1c005442d6 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Fri, 24 Dec 2021 19:39:02 +0100 -Subject: [PATCH 05/11] SSDK: config: add kernel 5.15 - -This is purely to identify it and be able to set -flags correctly. - -Signed-off-by: Robert Marko ---- - config | 6 +++++- - make/linux_opt.mk | 4 ++-- - 2 files changed, 7 insertions(+), 3 deletions(-) - ---- a/config -+++ b/config -@@ -24,6 +24,10 @@ ifeq ($(KVER),$(filter 5.4%,$(KVER))) - OS_VER=5_4 - endif - -+ifeq ($(KVER),$(filter 5.15%,$(KVER))) -+OS_VER=5_15 -+endif -+ - ifeq ($(KVER), 3.4.0) - OS_VER=3_4 - endif -@@ -132,7 +136,7 @@ ifeq ($(ARCH), arm) - endif - - ifeq ($(ARCH), arm64) -- ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4%,$(KVER))) -+ ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4% 5.15%,$(KVER))) - CPU_CFLAG= -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -Werror -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large - endif - endif ---- a/make/linux_opt.mk -+++ b/make/linux_opt.mk -@@ -437,7 +437,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) - KASAN_SHADOW_SCALE_SHIFT := 3 - endif - -- ifeq (5_4, $(OS_VER)) -+ ifeq (5_4 5_15, $(OS_VER)) - ifeq ($(ARCH), arm64) - KASAN_OPTION += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT) - endif -@@ -468,7 +468,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) - - endif - -- ifeq ($(OS_VER),$(filter 4_4 5_4, $(OS_VER))) -+ ifeq ($(OS_VER),$(filter 4_4 5_4 5_15, $(OS_VER))) - MODULE_CFLAG += -DKVER34 - MODULE_CFLAG += -DKVER32 - MODULE_CFLAG += -DLNX26_22 diff --git a/package/kernel/qca-ssdk/patches/0006-qca8081-convert-to-5.11-IRQ-model.patch b/package/kernel/qca-ssdk/patches/0006-qca8081-convert-to-5.11-IRQ-model.patch deleted file mode 100644 index 4eb7483d2bc593..00000000000000 --- a/package/kernel/qca-ssdk/patches/0006-qca8081-convert-to-5.11-IRQ-model.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 9278b2794d984f5a8ec2350b9607a35aea2cc106 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Fri, 24 Dec 2021 20:02:32 +0100 -Subject: [PATCH 06/11] qca8081: convert to 5.11 IRQ model - -Kernel 5.11 introduced new IRQ handling model for PHY-s, -so provide those if 5.11 or later is used. - -Signed-off-by: Robert Marko ---- - src/hsl/phy/qca808x.c | 46 +++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 46 insertions(+) - ---- a/src/hsl/phy/qca808x.c -+++ b/src/hsl/phy/qca808x.c -@@ -247,6 +247,7 @@ static int qca808x_config_intr(struct ph - return err; - } - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)) - static int qca808x_ack_interrupt(struct phy_device *phydev) - { - int err; -@@ -266,6 +267,47 @@ static int qca808x_ack_interrupt(struct - - return (err < 0) ? err : 0; - } -+#endif -+ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 11, 0)) -+static irqreturn_t qca808x_handle_interrupt(struct phy_device *phydev) -+{ -+ a_uint16_t irq_status, int_enabled; -+ a_uint32_t dev_id = 0, phy_id = 0; -+ qca808x_priv *priv = phydev->priv; -+ const struct qca808x_phy_info *pdata = priv->phy_info; -+ -+ if (!pdata) { -+ return SW_FAIL; -+ } -+ -+ dev_id = pdata->dev_id; -+ phy_id = pdata->phy_addr; -+ -+ irq_status = qca808x_phy_reg_read(dev_id, phy_id, -+ QCA808X_PHY_INTR_STATUS); -+ if (irq_status < 0) { -+ phy_error(phydev); -+ return IRQ_NONE; -+ } -+ -+ /* Read the current enabled interrupts */ -+ int_enabled = qca808x_phy_reg_read(dev_id, phy_id, -+ QCA808X_PHY_INTR_MASK); -+ if (int_enabled < 0) { -+ phy_error(phydev); -+ return IRQ_NONE; -+ } -+ -+ /* See if this was one of our enabled interrupts */ -+ if (!(irq_status & int_enabled)) -+ return IRQ_NONE; -+ -+ phy_trigger_machine(phydev); -+ -+ return IRQ_HANDLED; -+} -+#endif - - /* switch linux negtiation capability to fal avariable */ - #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)) -@@ -638,7 +680,11 @@ struct phy_driver qca808x_phy_driver = { - .config_intr = qca808x_config_intr, - .config_aneg = qca808x_config_aneg, - .aneg_done = qca808x_aneg_done, -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)) - .ack_interrupt = qca808x_ack_interrupt, -+#else -+ .handle_interrupt = qca808x_handle_interrupt, -+#endif - .read_status = qca808x_read_status, - .suspend = qca808x_suspend, - .resume = qca808x_resume, diff --git a/package/kernel/qca-ssdk/patches/0009-include-fix-compilation-error-for-parse_uci_option.patch b/package/kernel/qca-ssdk/patches/0009-include-fix-compilation-error-for-parse_uci_option.patch deleted file mode 100644 index 1cdb47b2c14054..00000000000000 --- a/package/kernel/qca-ssdk/patches/0009-include-fix-compilation-error-for-parse_uci_option.patch +++ /dev/null @@ -1,22 +0,0 @@ -From be352dd54d163c005611906ac6b87692c9b8a1e6 Mon Sep 17 00:00:00 2001 -From: Ansuel Smith -Date: Sat, 7 May 2022 19:03:55 +0200 -Subject: [PATCH 09/11] include: fix compilation error for parse_uci_option - -Fix missing include for parse_uci_option - -Signed-off-by: Ansuel Smith ---- - include/ref/ref_uci.h | 1 + - 1 file changed, 1 insertion(+) - ---- a/include/ref/ref_uci.h -+++ b/include/ref/ref_uci.h -@@ -22,6 +22,7 @@ - extern "C" { - #endif /* __cplusplus */ - -+#include - - #if defined(IN_SWCONFIG) - int diff --git a/package/kernel/qca-ssdk/patches/0010-QSDK-config-Avoid-Werror-heroics.patch b/package/kernel/qca-ssdk/patches/0010-QSDK-config-Avoid-Werror-heroics.patch deleted file mode 100644 index 8eff0a9958ee80..00000000000000 --- a/package/kernel/qca-ssdk/patches/0010-QSDK-config-Avoid-Werror-heroics.patch +++ /dev/null @@ -1,30 +0,0 @@ -From ecd1e0c57fdf7f8916fa20f085e08bb4b6ba0396 Mon Sep 17 00:00:00 2001 -From: Alexandru Gagniuc -Date: Fri, 23 Sep 2022 08:21:13 -0500 -Subject: [PATCH 10/11] QSDK: config: Avoid -Werror heroics - -Trying to compile the QSDK with warnings as errors is a very brave -endeavor. It's also stupid as it doesn't work on ipq60xx: - - isisc_acl_prv.h:99: error: "FIELD_GET" redefined [-Werror] - 99 | #define FIELD_GET(reg, field, val) \ - | - -Instead of dealing with the braindead code, just disable Werror. - -Signed-off-by: Alexandru Gagniuc ---- - config | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/config -+++ b/config -@@ -137,7 +137,7 @@ endif - - ifeq ($(ARCH), arm64) - ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4% 5.15%,$(KVER))) -- CPU_CFLAG= -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -Werror -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large -+ CPU_CFLAG= -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large - endif - endif - diff --git a/package/kernel/qca-ssdk/patches/0011-Revert-qca-ssdk-remove-bridge-fdb-entry-for-the-auth.patch b/package/kernel/qca-ssdk/patches/0011-Revert-qca-ssdk-remove-bridge-fdb-entry-for-the-auth.patch deleted file mode 100644 index 14db66876acdd4..00000000000000 --- a/package/kernel/qca-ssdk/patches/0011-Revert-qca-ssdk-remove-bridge-fdb-entry-for-the-auth.patch +++ /dev/null @@ -1,48 +0,0 @@ -From c06e6edfb740d0ba0b804fa16d6222e257349089 Mon Sep 17 00:00:00 2001 -From: Alexandru Gagniuc -Date: Fri, 23 Sep 2022 08:30:03 -0500 -Subject: [PATCH 11/11] Revert "qca-ssdk: remove bridge fdb entry for the - authentication failed mac" - -This change causes an undefined reference to "br_fdb_delete_by_netdev". -This reverts commit 144f02b982c8c707aaf84b57d8c277d03d877236. - -Signed-off-by: Alexandru Gagniuc ---- - src/ref/ref_acl.c | 11 ----------- - 1 file changed, 11 deletions(-) - ---- a/src/ref/ref_acl.c -+++ b/src/ref/ref_acl.c -@@ -23,7 +23,6 @@ - #include "ssdk_init.h" - #include "ssdk_plat.h" - #include --#include - - /* entry 0-1 is for global deny all and accept eapol rule - entry 2-9 is for phy port1 specific mac accept rule -@@ -128,7 +127,6 @@ _ref_acl_mac_entry_create_rule(a_uint32_ - { - sw_error_t rv = SW_OK; - fal_acl_rule_t rule = {0}; -- struct net_device *eth_dev = NULL; - a_uint32_t port_id = ssdk_ifname_to_port(dev_id, entry->ifname); - SSDK_DEBUG("port_id %d entry_idx %d\n", port_id, entry_idx); - -@@ -224,15 +222,6 @@ _ref_acl_mac_entry_create_rule(a_uint32_ - ref_acl_mac_entry[dev_id][entry_idx].port_map = BIT(port_id); - ref_acl_mac_entry[dev_id][entry_idx].acl_policy = 1; - } -- else if (!is_deny_all_mac(entry->src_mac.uc) && !entry->acl_policy) -- { -- eth_dev = dev_get_by_name(&init_net, entry->ifname); -- if (eth_dev) -- { -- br_fdb_delete_by_netdev(eth_dev, entry->src_mac.uc, 0); -- dev_put(eth_dev); -- } -- } - return rv; - } - diff --git a/package/kernel/qca-ssdk/patches/0012-qca-ssdk-Support-Linux-Style-Makefile-for-SSDK.patch b/package/kernel/qca-ssdk/patches/0012-qca-ssdk-Support-Linux-Style-Makefile-for-SSDK.patch deleted file mode 100644 index 91b7d570d8a1d4..00000000000000 --- a/package/kernel/qca-ssdk/patches/0012-qca-ssdk-Support-Linux-Style-Makefile-for-SSDK.patch +++ /dev/null @@ -1,286 +0,0 @@ -From edd3d4347cc73a99c7cf59aceeb1e8ad4d4dd303 Mon Sep 17 00:00:00 2001 -From: crao -Date: Tue, 15 Nov 2022 18:50:01 +0800 -Subject: [PATCH] [qca-ssdk]: Support Linux-Style Makefile for SSDK - -Change-Id: I8c4399433b6422ef6192f70bf08b0d3023cc94b6 -Signed-off-by: crao ---- - Makefile | 15 +++++++++++++ - Makefile.modules | 16 ++++++++++++++ - make/defs.mk | 1 + - make/linux_opt.mk | 54 ++++++++++++++++++++++++++++------------------- - make/target.mk | 12 +++++++++++ - src/api/Makefile | 2 +- - 6 files changed, 77 insertions(+), 23 deletions(-) - mode change 100755 => 100644 Makefile - create mode 100644 Makefile.modules - mode change 100755 => 100644 make/defs.mk - mode change 100755 => 100644 make/linux_opt.mk - mode change 100755 => 100644 make/target.mk - mode change 100755 => 100644 src/api/Makefile - ---- a/Makefile -+++ b/Makefile -@@ -12,6 +12,9 @@ include ./make/$(OS)_opt.mk - SUB_DIR=$(patsubst %/, %, $(dir $(wildcard src/*/Makefile))) - SUB_LIB=$(subst src/, , $(SUB_DIR)) - -+#################################################################### -+# SSDK-Style Makefile -+#################################################################### - all: $(BIN_DIR) kslib - mkdir -p ./temp/;cd ./temp;cp ../build/bin/ssdk_ks_km.a ./;ar -x ssdk_ks_km.a; cp ../ko_Makefile ./Makefile; - make -C $(SYS_PATH) M=$(PRJ_PATH)/temp/ CROSS_COMPILE=$(TOOLPREFIX) modules -@@ -20,6 +23,18 @@ all: $(BIN_DIR) kslib - rm -Rf ./temp/*.o ./temp/*.ko ./temp/*.a - @echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished." - -+#################################################################### -+# LNX Modules-Style Makefile -+#################################################################### -+modules: $(BIN_DIR) kslib_c -+ cp Makefile.modules ./Makefile; -+ make -C $(SYS_PATH) M=$(PRJ_PATH)/ $(LNX_MAKEOPTS) modules -+ cp *.ko build/bin; -+ @echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished." -+ -+kslib_c: -+ $(foreach i, $(SUB_LIB), $(MAKE) MODULE_TYPE=KSLIB -C src/$i src_list_loop || exit 1;) -+ - kslib:kslib_o - $(AR) -r $(BIN_DIR)/$(KS_MOD)_$(RUNMODE).a $(wildcard $(BLD_DIR)/KSLIB/*.o) - ---- /dev/null -+++ b/Makefile.modules -@@ -0,0 +1,16 @@ -+#################################################################### -+# Add All Local Flags -+#################################################################### -+ccflags-y += $(LNX_LOCAL_CFLAGS) -Wno-error -+ -+#################################################################### -+# Build Object List -+#################################################################### -+SRC_LIST := $(shell cat $(PRJ_PATH)/src_list.dep) -+OBJ_LIST := $(patsubst %.c,%.o,$(SRC_LIST)) -+ -+#################################################################### -+# Linux Kernel Module -+#################################################################### -+obj-m := qca-ssdk.o -+qca-ssdk-objs := $(OBJ_LIST) ---- a/make/defs.mk -+++ b/make/defs.mk -@@ -7,6 +7,7 @@ ifeq (,$(findstring $(LIB), $(COMPONENTS - endif - - SRC_FILE=$(addprefix $(PRJ_PATH)/$(LOC_DIR)/, $(SRC_LIST)) -+LOC_SRC_FILE=$(addprefix $(LOC_DIR)/, $(SRC_LIST)) - - OBJ_LIST=$(SRC_LIST:.c=.o) - OBJ_FILE=$(addprefix $(DST_DIR)/, $(OBJ_LIST)) ---- a/make/linux_opt.mk -+++ b/make/linux_opt.mk -@@ -295,7 +295,7 @@ ifeq (TRUE, $(DEBUG_ON)) - MODULE_CFLAG += -g - endif - --MODULE_CFLAG += $(OPT_FLAG) -Wall -DVERSION=\"$(VERSION)\" -DBUILD_DATE=\"$(BUILD_DATE)\" -DOS=\"$(OS)\" -D"KBUILD_STR(s)=\#s" -D"KBUILD_MODNAME=KBUILD_STR(qca-ssdk)" -+MODULE_CFLAG += $(OPT_FLAG) -Wall -DVERSION=\"$(VERSION)\" -DBUILD_DATE=\"$(BUILD_DATE)\" -DOS=\"$(OS)\" -D"KBUILD_STR(s)=\#s" - - MODULE_INC += -I$(PRJ_PATH)/include \ - -I$(PRJ_PATH)/include/common \ -@@ -450,7 +450,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) - MODULE_CFLAG += -DKVER34 - MODULE_CFLAG += -DKVER32 - MODULE_CFLAG += -DLNX26_22 -- MODULE_INC += -I$(SYS_PATH) \ -+ SYS_INC += -I$(SYS_PATH) \ - -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \ - -I$(SYS_PATH)/include \ - -I$(SYS_PATH)/source/include \ -@@ -473,7 +473,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) - MODULE_CFLAG += -DKVER32 - MODULE_CFLAG += -DLNX26_22 - ifeq ($(ARCH), arm64) -- MODULE_INC += -I$(SYS_PATH) \ -+ SYS_INC += -I$(SYS_PATH) \ - -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \ - -I$(SYS_PATH)/include \ - -I$(SYS_PATH)/source \ -@@ -492,13 +492,13 @@ ifeq (KSLIB, $(MODULE_TYPE)) - -I$(SYS_PATH)/source/include/uapi - - ifneq ($(wildcard $(SYS_PATH)/include/linux/kconfig.h),) -- MODULE_INC += -include $(SYS_PATH)/include/linux/kconfig.h -+ SYS_INC += -include $(SYS_PATH)/include/linux/kconfig.h - else -- MODULE_INC += -include $(KERNEL_SRC)/include/linux/kconfig.h -+ SYS_INC += -include $(KERNEL_SRC)/include/linux/kconfig.h - endif - - else ifeq ($(ARCH), arm) -- MODULE_INC += -I$(SYS_PATH) \ -+ SYS_INC += -I$(SYS_PATH) \ - -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \ - -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/7.5.0/include/ \ - -I$(TOOL_PATH)/../../lib/armv7a-vfp-neon-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/4.8.4/include/ \ -@@ -522,13 +522,13 @@ ifeq (KSLIB, $(MODULE_TYPE)) - -I$(TOOL_PATH)/../../lib/arm-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/9.3.0/include/ - - ifneq ($(wildcard $(SYS_PATH)/include/linux/kconfig.h),) -- MODULE_INC += -include $(SYS_PATH)/include/linux/kconfig.h -+ SYS_INC += -include $(SYS_PATH)/include/linux/kconfig.h - else -- MODULE_INC += -include $(KERNEL_SRC)/include/linux/kconfig.h -+ SYS_INC += -include $(KERNEL_SRC)/include/linux/kconfig.h - endif - - else -- MODULE_INC += -I$(SYS_PATH) \ -+ SYS_INC += -I$(SYS_PATH) \ - -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \ - -I$(SYS_PATH)/include \ - -I$(SYS_PATH)/source \ -@@ -564,7 +564,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) - MODULE_CFLAG += -DLNX26_22 - ifeq ($(ARCH), arm64) - KCONF_FILE = $(SYS_PATH)/source/include/linux/kconfig.h -- MODULE_INC += -I$(SYS_PATH) \ -+ SYS_INC += -I$(SYS_PATH) \ - -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \ - -I$(SYS_PATH)/include \ - -I$(SYS_PATH)/source/include \ -@@ -581,7 +581,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) - -I$(SYS_PATH)/source/arch/arm64/include/asm/mach \ - -include $(KCONF_FILE) - else ifeq ($(ARCH), arm) -- MODULE_INC += -I$(SYS_PATH) \ -+ SYS_INC += -I$(SYS_PATH) \ - -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \ - -I$(TOOL_PATH)/../../lib/armv7a-vfp-neon-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/4.8.4/include/ \ - -I$(SYS_PATH)/include \ -@@ -604,7 +604,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) - MODULE_CFLAG += -DKVER34 - MODULE_CFLAG += -DKVER32 - MODULE_CFLAG += -DLNX26_22 -- MODULE_INC += -I$(SYS_PATH) \ -+ SYS_INC += -I$(SYS_PATH) \ - -I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \ - -I$(TOOL_PATH)/../../lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/5.3.0/include/ \ - -I$(TOOL_PATH)/../../lib/armv7a-vfp-neon-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/4.8.4/include/ \ -@@ -627,10 +627,10 @@ ifeq (KSLIB, $(MODULE_TYPE)) - -I$(EXT_PATH) \ - -I$(SYS_PATH)/source/arch/arm/include/asm/mach - ifneq ($(wildcard $(SYS_PATH)/include/linux/kconfig.h),) -- MODULE_INC += \ -+ SYS_INC += \ - -include $(SYS_PATH)/include/linux/kconfig.h - else -- MODULE_INC += \ -+ SYS_INC += \ - -include $(SYS_PATH)/source/include/linux/kconfig.h - endif - -@@ -641,7 +641,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) - MODULE_CFLAG += -DKVER32 - MODULE_CFLAG += -DLNX26_22 - MODULE_CFLAG += -Werror -- MODULE_INC += -I$(SYS_PATH) \ -+ SYS_INC += -I$(SYS_PATH) \ - -I$(SYS_PATH)/include \ - -I$(SYS_PATH)/source/include \ - -I$(SYS_PATH)/source/arch/arm/mach-msm/include \ -@@ -657,7 +657,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) - MODULE_CFLAG += -DKVER32 - MODULE_CFLAG += -DLNX26_22 - ifeq (mips, $(CPU)) -- MODULE_INC += -I$(SYS_PATH) \ -+ SYS_INC += -I$(SYS_PATH) \ - -I$(SYS_PATH)/include \ - -I$(SYS_PATH)/arch/mips/include \ - -I$(SYS_PATH)/arch/mips/include/asm/mach-ar7240 \ -@@ -678,7 +678,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) - -O2 -fno-pic -pipe -mabi=32 -march=mips32r2 -DMODULE -mlong-calls -DEXPORT_SYMTAB - endif - else -- MODULE_INC += -I$(SYS_PATH) \ -+ SYS_INC += -I$(SYS_PATH) \ - -I$(SYS_PATH)/include \ - -I$(SYS_PATH)/arch/arm/include \ - -I$(SYS_PATH)/arch/arm/include/asm \ -@@ -695,7 +695,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) - MODULE_CFLAG += -DKVER26 - MODULE_CFLAG += -DLNX26_22 - ifeq (mips, $(CPU)) -- MODULE_INC += -I$(SYS_PATH) \ -+ SYS_INC += -I$(SYS_PATH) \ - -I$(SYS_PATH)/include \ - -I$(SYS_PATH)/arch/mips/include \ - -I$(SYS_PATH)/arch/mips/include/asm/mach-ar7240 \ -@@ -708,7 +708,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) - -O2 -fno-pic -pipe -mabi=32 -march=mips32r2 -DMODULE -mlong-calls -DEXPORT_SYMTAB - endif - else -- MODULE_INC += -I$(SYS_PATH) \ -+ SYS_INC += -I$(SYS_PATH) \ - -I$(SYS_PATH)/include \ - -I$(SYS_PATH)/arch/arm/include \ - -I$(SYS_PATH)/arch/arm/include/asm \ -@@ -721,8 +721,7 @@ ifeq (KSLIB, $(MODULE_TYPE)) - - endif - -- MODULE_CFLAG += -D__KERNEL__ -DKERNEL_MODULE $(CPU_CFLAG) -- -+ MODULE_CFLAG += -D__KERNEL__ -DKERNEL_MODULE - - endif - -@@ -748,4 +747,15 @@ ifneq (TRUE, $(KERNEL_MODE)) - endif - endif - --LOCAL_CFLAGS += $(MODULE_INC) $(MODULE_CFLAG) $(EXTRA_CFLAGS) -+LOCAL_CFLAGS += $(MODULE_INC) $(SYS_INC) $(MODULE_CFLAG) $(EXTRA_CFLAGS) -+ -+#################################################################### -+# cflags for SSDK-Style Makefile -+#################################################################### -+LOCAL_CFLAGS += $(CPU_CFLAG) -D"KBUILD_MODNAME=KBUILD_STR(qca-ssdk)" -+ -+#################################################################### -+# cflags for LNX Modules-Style Makefile -+#################################################################### -+LNX_LOCAL_CFLAGS += $(MODULE_INC) $(MODULE_CFLAG) ${EXTRA_INC} -+export LNX_LOCAL_CFLAGS ---- a/make/target.mk -+++ b/make/target.mk -@@ -3,6 +3,18 @@ include $(PRJ_PATH)/make/$(OS)_opt.mk - - include $(PRJ_PATH)/make/tools.mk - -+#################################################################### -+# LNX Modules-Style Makefile -+#################################################################### -+src_list_loop: src_list -+ $(foreach i, $(SUB_DIR), $(MAKE) -C $(i) src_list_loop || exit 1;) -+ -+src_list: -+ echo -n "$(LOC_SRC_FILE) " >> $(PRJ_PATH)/src_list.dep -+ -+#################################################################### -+# SSDK-Style Makefile -+#################################################################### - obj: $(OBJ_LIST) - $(OBJ_LOOP) - ---- a/src/api/Makefile -+++ b/src/api/Makefile -@@ -1,4 +1,4 @@ --LOC_DIR=src/sal -+LOC_DIR=src/api - LIB=API - - include $(PRJ_PATH)/make/config.mk diff --git a/package/kernel/qca-ssdk/patches/0013-qca-ssdk-fix-compilation-issue-in-Linux-Style-Makefi.patch b/package/kernel/qca-ssdk/patches/0013-qca-ssdk-fix-compilation-issue-in-Linux-Style-Makefi.patch deleted file mode 100644 index 792cd9e31b59f9..00000000000000 --- a/package/kernel/qca-ssdk/patches/0013-qca-ssdk-fix-compilation-issue-in-Linux-Style-Makefi.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 3026f89b06049df01d5fe19c5fccc972637aa344 Mon Sep 17 00:00:00 2001 -From: crao -Date: Tue, 7 Mar 2023 17:15:07 +0800 -Subject: [PATCH] [qca-ssdk]: fix compilation issue in Linux-Style Makefile - -Change-Id: If38251fc0a2bf4abc666d30f4812c0d9507310dc -Signed-off-by: crao ---- - Makefile | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - mode change 100644 => 100755 Makefile - ---- a/Makefile -+++ b/Makefile -@@ -27,9 +27,9 @@ all: $(BIN_DIR) kslib - # LNX Modules-Style Makefile - #################################################################### - modules: $(BIN_DIR) kslib_c -- cp Makefile.modules ./Makefile; -- make -C $(SYS_PATH) M=$(PRJ_PATH)/ $(LNX_MAKEOPTS) modules -- cp *.ko build/bin; -+ mkdir -p ./temp/;cp * ./temp -a;cd ./temp;cp ../Makefile.modules ./Makefile; -+ make -C $(SYS_PATH) M=$(PRJ_PATH)/temp $(LNX_MAKEOPTS) modules -+ cp temp/*.ko build/bin; - @echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished." - - kslib_c: diff --git a/package/kernel/qca-ssdk/patches/0014-qca-ssdk-fix-compilation-issue-in-Miami-yocto.patch b/package/kernel/qca-ssdk/patches/0014-qca-ssdk-fix-compilation-issue-in-Miami-yocto.patch deleted file mode 100644 index 53c0c341316ac0..00000000000000 --- a/package/kernel/qca-ssdk/patches/0014-qca-ssdk-fix-compilation-issue-in-Miami-yocto.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 6e4efd68e6e560a1994bc273fe6f7a72139f3957 Mon Sep 17 00:00:00 2001 -From: crao -Date: Wed, 15 Mar 2023 11:19:39 +0800 -Subject: [PATCH] [qca-ssdk]: fix compilation issue in Miami yocto - -Change-Id: I8526b9e43667d72ae9afa4ef8a13167088d194ba -Signed-off-by: crao ---- - Makefile | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/Makefile -+++ b/Makefile -@@ -29,7 +29,9 @@ all: $(BIN_DIR) kslib - modules: $(BIN_DIR) kslib_c - mkdir -p ./temp/;cp * ./temp -a;cd ./temp;cp ../Makefile.modules ./Makefile; - make -C $(SYS_PATH) M=$(PRJ_PATH)/temp $(LNX_MAKEOPTS) modules -+ cp $(PRJ_PATH)/temp/Module.symvers $(PRJ_PATH)/Module.symvers; - cp temp/*.ko build/bin; -+ rm -Rf ./temp/*.o ./temp/*.ko ./temp/*.a - @echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished." - - kslib_c: diff --git a/package/kernel/qca-ssdk/patches/100-malibu-phy-add-support-for-manual-define-of-first-ph.patch b/package/kernel/qca-ssdk/patches/100-malibu-phy-add-support-for-manual-define-of-first-ph.patch new file mode 100644 index 00000000000000..6aaa579c09e33a --- /dev/null +++ b/package/kernel/qca-ssdk/patches/100-malibu-phy-add-support-for-manual-define-of-first-ph.patch @@ -0,0 +1,131 @@ +From a651d10fbd880098d7b98dee27dfd1eb15146fb2 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sun, 12 Nov 2023 18:40:22 +0100 +Subject: [PATCH] malibu-phy: add support for manual define of first phy addr + +The usage of first_phy_addr is EXTREMELY FRAGILE and results +in dangerous results if the OEM (or anyone that by chance try to +implement things in a logical manner) deviates from the default values +from the "magical template". + +To be in more details. With QSDK 12.4, some tweaks were done to improve +autoneg and now on every call of port status, the phydev is tried to +add. This resulted in the call and log spam of an error with ports that +are actually not present on the system with qsdk reporting phydev is +NULL. This itself is not an error and printing the error is correct. + +What is actually an error from ages is setting generic bitmap reporting +presence of port that are actually not present. This is very common on +OEM where the switch_lan_bmp is always a variant of 0x1e (that on bitmap +results in PORT1 PORT2 PORT3 PORT4 present) or 0x3e (PORT1 PORT2 PORT3 +PORT4 PORT5). Reality is that many device are used as AP with one LAN +port or one WAN port. (or even exotic configuration with PORT1 not +present and PORT2 PORT3 PORT4 present (Xiaomi 3600) + +With this finding one can say... ok nice, then lets update the DT and +set the correct bitmap... + +Again world is a bad place and reality is that this cause wonderful +regression in some case of by extreme luck the first ever connected +port working and the rest of the switch dead. + +The problem has been bisected to all the device that doesn't have the +PORT1 declared in any of the bitmap. + +With this prefaction in mind, on to the REAL problem. + +malibu_phy_hw_init FOR SOME REASON, set a global variable first_phy_addr +to the first detected PHY addr that coincidentally is always PORT1. +PORT1 addr is 0x0. The entire code in malibu_phy use this variable to +derive the phy addrs in some function. + +Declaring a bitmap where the PORT1 is missing (or worse PORT4 the only +one connected) result in first_phy_addr set to 1 or whatever phy addr is +detected first setting wrong value all over the init stage. + +To fix this, introduce a new binding malibu_first_phy_addr to manually +declare the first phy that the malibu PHY driver should use and permit +to detach it from port bmp detection. The legacy detection is kept for +compatibility reason. + +Signed-off-by: Christian Marangi +--- + include/init/ssdk_dts.h | 1 + + include/init/ssdk_init.h | 2 ++ + src/hsl/phy/malibu_phy.c | 5 +++++ + src/init/ssdk_dts.c | 15 +++++++++++++++ + 4 files changed, 23 insertions(+) + +--- a/include/init/ssdk_dts.h ++++ b/include/init/ssdk_dts.h +@@ -146,6 +146,7 @@ a_uint32_t ssdk_wan_bmp_get(a_uint32_t d + sw_error_t ssdk_lan_bmp_set(a_uint32_t dev_id, a_uint32_t lan_bmp); + sw_error_t ssdk_wan_bmp_set(a_uint32_t dev_id, a_uint32_t wan_bmp); + a_uint32_t ssdk_inner_bmp_get(a_uint32_t dev_id); ++a_uint32_t ssdk_malibu_first_phy_addr_get(a_uint32_t dev_id); + hsl_reg_mode ssdk_switch_reg_access_mode_get(a_uint32_t dev_id); + void ssdk_switch_reg_map_info_get(a_uint32_t dev_id, ssdk_reg_map_info *info); + a_uint32_t ssdk_switch_pcie_base_get(a_uint32_t dev_id); +--- a/include/init/ssdk_init.h ++++ b/include/init/ssdk_init.h +@@ -194,6 +194,7 @@ enum ssdk_port_wrapper_cfg { + a_uint32_t lan_bmp; + a_uint32_t wan_bmp; + a_uint32_t inner_bmp; ++ a_uint32_t malibu_first_phy_addr; + } ssdk_port_cfg; + + typedef struct +@@ -384,6 +385,7 @@ ssdk_hsl_access_mode_set(a_uint32_t dev_ + + a_uint32_t ssdk_dt_global_get_mac_mode(a_uint32_t dev_id, a_uint32_t index); + a_uint32_t ssdk_dt_global_set_mac_mode(a_uint32_t dev_id, a_uint32_t index, a_uint32_t mode); ++a_uint32_t ssdk_malibu_first_phy_addr_get(a_uint32_t dev_id); + + a_uint32_t + qca_hppe_port_mac_type_get(a_uint32_t dev_id, a_uint32_t port_id); +--- a/src/hsl/phy/malibu_phy.c ++++ b/src/hsl/phy/malibu_phy.c +@@ -1945,6 +1945,11 @@ static int malibu_phy_api_ops_init(void) + int malibu_phy_init(a_uint32_t dev_id, a_uint32_t port_bmp) + { + static a_uint32_t phy_ops_flag = 0; ++ a_uint32_t malibu_first_phy_addr; ++ ++ malibu_first_phy_addr = ssdk_malibu_first_phy_addr_get(dev_id); ++ if (malibu_first_phy_addr != MAX_PHY_ADDR) ++ first_phy_addr = malibu_first_phy_addr; + + if(phy_ops_flag == 0) { + malibu_phy_api_ops_init(); +--- a/src/init/ssdk_dts.c ++++ b/src/init/ssdk_dts.c +@@ -186,6 +186,13 @@ a_uint32_t ssdk_inner_bmp_get(a_uint32_t + return cfg->port_cfg.inner_bmp; + } + ++a_uint32_t ssdk_malibu_first_phy_addr_get(a_uint32_t dev_id) ++{ ++ ssdk_dt_cfg* cfg = ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]; ++ ++ return cfg->port_cfg.malibu_first_phy_addr; ++} ++ + hsl_reg_mode ssdk_switch_reg_access_mode_get(a_uint32_t dev_id) + { + ssdk_dt_cfg* cfg = ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]; +@@ -1039,6 +1046,14 @@ static void ssdk_dt_parse_port_bmp(a_uin + cfg->port_cfg.inner_bmp; + } + ++ /* Permit to manually declare start phy addr for malibu PHY. If not found set to legacy detection. */ ++ if (!of_property_read_u32(switch_node, "malibu_first_phy_addr", &cfg->port_cfg.malibu_first_phy_addr)) { ++ ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]->port_cfg.malibu_first_phy_addr = ++ cfg->port_cfg.malibu_first_phy_addr; ++ } else { ++ ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]->port_cfg.malibu_first_phy_addr = MAX_PHY_ADDR; ++ } ++ + ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]->port_cfg.cpu_bmp = cfg->port_cfg.cpu_bmp; + ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]->port_cfg.lan_bmp = cfg->port_cfg.lan_bmp; + ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]->port_cfg.wan_bmp = cfg->port_cfg.wan_bmp; diff --git a/package/kernel/rtl8812au-ct/Makefile b/package/kernel/rtl8812au-ct/Makefile index be1acabf28778f..b0440a68589bc5 100644 --- a/package/kernel/rtl8812au-ct/Makefile +++ b/package/kernel/rtl8812au-ct/Makefile @@ -7,10 +7,10 @@ PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/greearb/rtl8812AU_8821AU_linux.git -PKG_MIRROR_HASH:=31e658df3e4d4c18c396259c2e0bef2bfc44a4aa870931f031a31e948be98af4 +PKG_MIRROR_HASH:=748f5c58aa3f391222c0c43db35b9ff4c30c9c987ca052a5a3cdf36193e5821b PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2021-11-07 -PKG_SOURCE_VERSION:=39df55967b7de9f6c9600017b724303f95a8b9e2 +PKG_SOURCE_DATE:=2022-10-26 +PKG_SOURCE_VERSION:=9b2b203a217e1320602a0eb07c338a1bfca0f5a6 PKG_MAINTAINER:=Ben Greear PKG_BUILD_PARALLEL:=1 diff --git a/package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch b/package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch index 67ebb82b387860..f84adebe0ad2cc 100644 --- a/package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch +++ b/package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch @@ -1,6 +1,6 @@ --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c -@@ -5177,6 +5177,15 @@ exit: +@@ -5196,6 +5196,15 @@ exit: return ret; } @@ -16,7 +16,7 @@ #if defined(CONFIG_TDLS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) static int cfg80211_rtw_tdls_mgmt(struct wiphy *wiphy, struct net_device *ndev, -@@ -5990,7 +5999,10 @@ static struct cfg80211_ops rtw_cfg80211_ +@@ -6009,7 +6018,10 @@ static struct cfg80211_ops rtw_cfg80211_ .cancel_remain_on_channel = cfg80211_rtw_cancel_remain_on_channel, #endif diff --git a/package/kernel/rtl8812au-ct/patches/007-treewide-fix-always-TRUE-condition-warning.patch b/package/kernel/rtl8812au-ct/patches/007-treewide-fix-always-TRUE-condition-warning.patch new file mode 100644 index 00000000000000..c645c1e8e39e7e --- /dev/null +++ b/package/kernel/rtl8812au-ct/patches/007-treewide-fix-always-TRUE-condition-warning.patch @@ -0,0 +1,72 @@ +From dc4024894c9deefc56f8dd6b2d2822b277f268a5 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sun, 30 Jul 2023 11:18:48 +0200 +Subject: [PATCH 2/5] treewide: fix always TRUE condition warning + +Fix always TRUE condition warning an drop redundant check. + +Signed-off-by: Christian Marangi +--- + core/rtw_sta_mgt.c | 3 +-- + hal/OUTSRC/phydm_debug.c | 16 ++++++---------- + os_dep/linux/ioctl_cfg80211.c | 3 +-- + 3 files changed, 8 insertions(+), 14 deletions(-) + +--- a/core/rtw_sta_mgt.c ++++ b/core/rtw_sta_mgt.c +@@ -207,8 +207,7 @@ void rtw_mfree_stainfo(struct sta_info * + { + _func_enter_; + +- if(&psta->lock != NULL) +- _rtw_spinlock_free(&psta->lock); ++ _rtw_spinlock_free(&psta->lock); + + _rtw_free_sta_xmit_priv_lock(&psta->sta_xmitpriv); + _rtw_free_sta_recv_priv_lock(&psta->sta_recvpriv); +--- a/hal/OUTSRC/phydm_debug.c ++++ b/hal/OUTSRC/phydm_debug.c +@@ -870,12 +870,10 @@ phydm_cmd_parser( + case PHYDM_RA: + + for(i=0; i<5; i++) { +- if(input[i+1]) { +- PHYDM_SSCANF(input[i+1], DCMD_DECIMAL, &var1[i]); ++ PHYDM_SSCANF(input[i+1], DCMD_DECIMAL, &var1[i]); + +- PHYDM_SNPRINTF((output+used, out_len-used, "new SET, RA_var[%d]= (( %d ))\n", i , var1[i])); +- input_idx++; +- } ++ PHYDM_SNPRINTF((output+used, out_len-used, "new SET, RA_var[%d]= (( %d ))\n", i , var1[i])); ++ input_idx++; + } + + if(input_idx>=1) { +@@ -891,12 +889,10 @@ phydm_cmd_parser( + case PHYDM_PATHDIV: + + for(i=0; i<5; i++) { +- if(input[i+1]) { +- PHYDM_SSCANF(input[i+1], DCMD_HEX, &var1[i]); ++ PHYDM_SSCANF(input[i+1], DCMD_HEX, &var1[i]); + +- PHYDM_SNPRINTF((output+used, out_len-used, "new SET, PATHDIV_var[%d]= (( %d ))\n", i , var1[i])); +- input_idx++; +- } ++ PHYDM_SNPRINTF((output+used, out_len-used, "new SET, PATHDIV_var[%d]= (( %d ))\n", i , var1[i])); ++ input_idx++; + } + + if(input_idx>=1) { +--- a/os_dep/linux/ioctl_cfg80211.c ++++ b/os_dep/linux/ioctl_cfg80211.c +@@ -2185,8 +2185,7 @@ static int cfg80211_rtw_scan(struct wiph + + #ifdef CONFIG_P2P + if( pwdinfo->driver_interface == DRIVER_CFG80211 ) { +- if(ssids->ssid != NULL +- && _rtw_memcmp(ssids->ssid, "DIRECT-", 7) ++ if(_rtw_memcmp(ssids->ssid, "DIRECT-", 7) + && rtw_get_p2p_ie((u8 *)request->ie, request->ie_len, NULL, NULL) + ) { + if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { diff --git a/package/kernel/rtl8812au-ct/patches/099-cut-linkid-linux-version-code-conditionals.patch b/package/kernel/rtl8812au-ct/patches/099-cut-linkid-linux-version-code-conditionals.patch new file mode 100644 index 00000000000000..bb644a9ace46c3 --- /dev/null +++ b/package/kernel/rtl8812au-ct/patches/099-cut-linkid-linux-version-code-conditionals.patch @@ -0,0 +1,86 @@ +From 30fc9d96fa2ce16209306237e677d3d3cbb12685 Mon Sep 17 00:00:00 2001 +From: John Thomson +Date: Sun, 28 May 2023 13:26:46 +1000 +Subject: [PATCH] Revert "fix kernel 6.1 80211 link_id" + +This reverts commit a027da58e8d8e95827f97222ca321cd0b2d377dd. +--- + os_dep/linux/ioctl_cfg80211.c | 29 +++++------------------------ + 1 file changed, 5 insertions(+), 24 deletions(-) + +--- a/os_dep/linux/ioctl_cfg80211.c ++++ b/os_dep/linux/ioctl_cfg80211.c +@@ -797,14 +797,9 @@ check_bss: + #endif + + DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter)); +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +- roam_info.links[0].channel = notify_channel; +- roam_info.links[0].bssid = cur_network->network.MacAddress; +-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + roam_info.channel = notify_channel; + roam_info.bssid = cur_network->network.MacAddress; +-#endif +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + roam_info.req_ie = pmlmepriv->assoc_req + sizeof(struct rtw_ieee80211_hdr_3addr) + 2; + roam_info.req_ie_len = pmlmepriv->assoc_req_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 2; + roam_info.resp_ie = pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6; +@@ -1393,9 +1388,7 @@ exit: + } + + static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +- int link_id, u8 key_index, bool pairwise, const u8 *mac_addr, +-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + u8 key_index, bool pairwise, const u8 *mac_addr, + #else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + u8 key_index, const u8 *mac_addr, +@@ -1535,9 +1528,7 @@ addkey_end: + } + + static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev, +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +- int link_id, u8 key_index, bool pairwise, const u8 *mac_addr, +-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + u8 key_index, bool pairwise, const u8 *mac_addr, + #else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + u8 key_index, const u8 *mac_addr, +@@ -1570,9 +1561,7 @@ static int cfg80211_rtw_get_key(struct w + } + + static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +- int link_id, u8 key_index, bool pairwise, const u8 *mac_addr) +-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + u8 key_index, bool pairwise, const u8 *mac_addr) + #else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + u8 key_index, const u8 *mac_addr) +@@ -1592,11 +1581,7 @@ static int cfg80211_rtw_del_key(struct w + } + + static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, +- struct net_device *ndev, +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +- int link_id, +-#endif +- u8 key_index ++ struct net_device *ndev, u8 key_index + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + , bool unicast, bool multicast + #endif +@@ -4033,11 +4018,7 @@ static int cfg80211_rtw_change_beacon(st + return ret; + } + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0)) +-static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, unsigned int link_id) +-#else + static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev) +-#endif + { + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + return 0; diff --git a/package/kernel/rtl8812au-ct/patches/100-api_update.patch b/package/kernel/rtl8812au-ct/patches/100-api_update.patch index 2c081256ed7b9b..e7ca4b05f3446b 100644 --- a/package/kernel/rtl8812au-ct/patches/100-api_update.patch +++ b/package/kernel/rtl8812au-ct/patches/100-api_update.patch @@ -44,7 +44,7 @@ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) , bool unicast, bool multicast #endif -@@ -4019,7 +4022,8 @@ static int cfg80211_rtw_change_beacon(st +@@ -4018,7 +4021,8 @@ static int cfg80211_rtw_change_beacon(st return ret; } diff --git a/package/kernel/ubnt-ledbar/src/leds-ubnt-ledbar.c b/package/kernel/ubnt-ledbar/src/leds-ubnt-ledbar.c index 555340c5e87fd2..ee9d34601c6fec 100644 --- a/package/kernel/ubnt-ledbar/src/leds-ubnt-ledbar.c +++ b/package/kernel/ubnt-ledbar/src/leds-ubnt-ledbar.c @@ -9,6 +9,7 @@ #include #include #include +#include /** * Driver for the Ubiquiti RGB LED controller (LEDBAR). @@ -218,13 +219,19 @@ static int ubnt_ledbar_probe(struct i2c_client *client, return ubnt_ledbar_apply_state(ledbar); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) static int ubnt_ledbar_remove(struct i2c_client *client) +#else +static void ubnt_ledbar_remove(struct i2c_client *client) +#endif { struct ubnt_ledbar *ledbar = i2c_get_clientdata(client); mutex_destroy(&ledbar->lock); +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) return 0; +#endif } static const struct i2c_device_id ubnt_ledbar_id[] = { diff --git a/package/kernel/ubootenv-nvram/Makefile b/package/kernel/ubootenv-nvram/Makefile new file mode 100644 index 00000000000000..0574ea61d7d6c9 --- /dev/null +++ b/package/kernel/ubootenv-nvram/Makefile @@ -0,0 +1,30 @@ +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=ubootenv-nvram +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/ubootenv-nvram + SUBMENU:=Other modules + TITLE:=NVRAM environment for uboot-envtools + FILES:=$(PKG_BUILD_DIR)/ubootenv-nvram.ko + AUTOLOAD:=$(call AutoLoad,30,ubootenv-nvram,1) + KCONFIG:= +endef + +define KernelPackage/ubootenv-nvram/description + Support vendor modified U-Boot storing the environment + in RAM. This driver exports the environment memory + region as a misc device named "ubootenv", pretending + it is a NOR mtd device to let existing userspace tools + work without modifications. +endef + +define Build/Compile + $(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" modules +endef + +$(eval $(call KernelPackage,ubootenv-nvram)) diff --git a/package/kernel/ubootenv-nvram/src/Makefile b/package/kernel/ubootenv-nvram/src/Makefile new file mode 100644 index 00000000000000..469cb801f3b350 --- /dev/null +++ b/package/kernel/ubootenv-nvram/src/Makefile @@ -0,0 +1 @@ +obj-m += ubootenv-nvram.o diff --git a/package/kernel/ubootenv-nvram/src/ubootenv-nvram.c b/package/kernel/ubootenv-nvram/src/ubootenv-nvram.c new file mode 100644 index 00000000000000..f6244142167b0b --- /dev/null +++ b/package/kernel/ubootenv-nvram/src/ubootenv-nvram.c @@ -0,0 +1,158 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2022 Bjørn Mork + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define NAME "ubootenv" + +struct ubootenv_drvdata { + void *env; + struct reserved_mem *rmem; + struct miscdevice misc; +}; + +static inline struct ubootenv_drvdata *to_ubootenv_drvdata(struct file *file) +{ + return container_of(file->private_data, struct ubootenv_drvdata, misc); +} + +static ssize_t ubootenv_write(struct file *file, const char __user *buffer, size_t count, + loff_t *ppos) +{ + struct ubootenv_drvdata *data = to_ubootenv_drvdata(file); + + if (!data->env) + return -EIO; + return simple_write_to_buffer(data->env, data->rmem->size, ppos, buffer, count); +} + +static ssize_t ubootenv_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) +{ + struct ubootenv_drvdata *data = to_ubootenv_drvdata(file); + + if (!data->env) + return 0; + return simple_read_from_buffer(buffer, count, ppos, data->env, data->rmem->size); +} + +static loff_t ubootenv_llseek(struct file *file, loff_t off, int whence) +{ + struct ubootenv_drvdata *data = to_ubootenv_drvdata(file); + + return fixed_size_llseek(file, off, whence, data->rmem->size); +} + +/* Faking the minimal mtd ioctl subset required by the fw_env.c */ +static long ubootenv_ioctl(struct file *file, u_int cmd, u_long arg) +{ + struct ubootenv_drvdata *data = to_ubootenv_drvdata(file); + void __user *argp = (void __user *)arg; + struct mtd_info_user info = { + .type = MTD_NORFLASH, + .size = data->rmem->size, + }; + + switch (cmd) { + case MEMISLOCKED: + case MEMERASE: + break; + case MEMGETINFO: + if (copy_to_user(argp, &info, sizeof(struct mtd_info_user))) + return -EFAULT; + break; + default: + return -ENOTTY; + } + return 0; +} + +static const struct file_operations ubootenv_fops = { + .owner = THIS_MODULE, + .read = ubootenv_read, + .write = ubootenv_write, + .llseek = ubootenv_llseek, + .unlocked_ioctl = ubootenv_ioctl, +}; + +/* We can only map a single reserved-memory range */ +static struct ubootenv_drvdata drvdata = { + .misc = { + .fops = &ubootenv_fops, + .minor = MISC_DYNAMIC_MINOR, + .name = NAME, + }, +}; + +const struct of_device_id of_ubootenv_match[] = { + { .compatible = "ubootenv" }, + {}, +}; +MODULE_DEVICE_TABLE(of, of_ubootenv_match); + +static int ubootenv_probe(struct platform_device *pdev) +{ + struct ubootenv_drvdata *data = &drvdata; + struct device *dev = &pdev->dev; + struct device_node *np; + + /* enforce single instance */ + if (data->env) + return -EINVAL; + + np = of_parse_phandle(dev->of_node, "memory-region", 0); + if (!np) + return -ENODEV; + + data->rmem = of_reserved_mem_lookup(np); + of_node_put(np); + if (!data->rmem) + return -ENODEV; + + if (!data->rmem->size || (data->rmem->size > ULONG_MAX)) + return -EINVAL; + + if (!PAGE_ALIGNED(data->rmem->base) || !PAGE_ALIGNED(data->rmem->size)) + return -EINVAL; + + data->env = devm_memremap(&pdev->dev, data->rmem->base, data->rmem->size, MEMREMAP_WB); + platform_set_drvdata(pdev, data); + + data->misc.parent = &pdev->dev; + return misc_register(&data->misc); +} + +static int ubootenv_remove(struct platform_device *pdev) +{ + struct ubootenv_drvdata *data = platform_get_drvdata(pdev); + + data->env = NULL; + misc_deregister(&data->misc); + return 0; +} + +static struct platform_driver ubootenv_driver = { + .probe = ubootenv_probe, + .remove = ubootenv_remove, + .driver = { + .name = NAME, + .owner = THIS_MODULE, + .of_match_table = of_ubootenv_match, + }, +}; + +module_platform_driver(ubootenv_driver); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Bjørn Mork "); +MODULE_DESCRIPTION("Access u-boot environment in RAM");