From d84982f161b9cd34459645f08d4729931ffd3035 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 1 Mar 2022 16:02:11 +0100 Subject: [PATCH] ath11k: fix WDS when encap offload is enabled Signed-off-by: John Crispin --- .../hostapd/patches/770-wds-hack.patch | 36 +++++++++ .../patches/pending/214-fix-wds.patch | 74 +++++++++++++++++++ .../patches/pending/214-no-encap.patch | 21 ------ 3 files changed, 110 insertions(+), 21 deletions(-) create mode 100644 feeds/wifi-ax/hostapd/patches/770-wds-hack.patch create mode 100644 feeds/wifi-ax/mac80211/patches/pending/214-fix-wds.patch delete mode 100644 feeds/wifi-ax/mac80211/patches/pending/214-no-encap.patch diff --git a/feeds/wifi-ax/hostapd/patches/770-wds-hack.patch b/feeds/wifi-ax/hostapd/patches/770-wds-hack.patch new file mode 100644 index 000000000..c9df6a616 --- /dev/null +++ b/feeds/wifi-ax/hostapd/patches/770-wds-hack.patch @@ -0,0 +1,36 @@ +Index: hostapd-2021-02-20-59e9794c/src/ap/hostapd.c +=================================================================== +--- hostapd-2021-02-20-59e9794c.orig/src/ap/hostapd.c ++++ hostapd-2021-02-20-59e9794c/src/ap/hostapd.c +@@ -11,6 +11,8 @@ + #include + #endif /* CONFIG_SQLITE */ + ++#include ++ + #include "utils/common.h" + #include "utils/eloop.h" + #include "common/ieee802_11_defs.h" +@@ -1316,6 +1318,22 @@ static int hostapd_setup_bss(struct host + os_memcpy(hapd->own_addr, if_addr, ETH_ALEN); + } + ++ if (conf->wds_sta) { ++ char path[128]; ++ FILE *fp; ++ ++ sprintf(path, "/sys/kernel/debug/ieee80211/%s/netdev:%s/disable_offload", hostapd_drv_get_radio_name(hapd), conf->iface); ++ ++ fp = fopen(path, "w"); ++ if (fp) { ++ syslog(0, "WDS: disable encap - %s\n", path); ++ fprintf(fp, "1"); ++ fclose(fp); ++ } else { ++ syslog(0, "WDS: failed to disable encap - %s\n", path); ++ } ++ } ++ + if (conf->wmm_enabled < 0) + conf->wmm_enabled = hapd->iconf->ieee80211n | hapd->iconf->ieee80211ax; + diff --git a/feeds/wifi-ax/mac80211/patches/pending/214-fix-wds.patch b/feeds/wifi-ax/mac80211/patches/pending/214-fix-wds.patch new file mode 100644 index 000000000..338dce054 --- /dev/null +++ b/feeds/wifi-ax/mac80211/patches/pending/214-fix-wds.patch @@ -0,0 +1,74 @@ +--- a/net/mac80211/debugfs_netdev.c ++++ b/net/mac80211/debugfs_netdev.c +@@ -300,6 +300,32 @@ static ssize_t ieee80211_if_parse_smps(s + } + IEEE80211_IF_FILE_RW(smps); + ++static ssize_t ieee80211_if_fmt_disable_offload(const struct ieee80211_sub_if_data *sdata, ++ char *buf, int buflen) ++{ ++ return snprintf(buf, buflen, "%u\n", sdata->disable_offload); ++} ++ ++static ssize_t ieee80211_if_parse_disable_offload(struct ieee80211_sub_if_data *sdata, ++ const char *buf, int buflen) ++{ ++ int ret; ++ u8 val; ++ ++ ret = kstrtou8(buf, 0, &val); ++ if (ret) ++ return ret; ++ ++ if (!val) ++ return -EINVAL; ++ ++ sdata->disable_offload = val; ++ ieee80211_recalc_offload(sdata->local); ++ ++ return buflen; ++} ++IEEE80211_IF_FILE_RW(disable_offload); ++ + int ieee80211_if_fmt_bmiss_threshold(const struct ieee80211_sub_if_data *sdata, + char *buf, int buflen) + { +@@ -680,6 +706,7 @@ static void add_common_files(struct ieee + DEBUGFS_ADD(rc_rateidx_mcs_mask_5ghz); + DEBUGFS_ADD(rc_rateidx_vht_mcs_mask_2ghz); + DEBUGFS_ADD(rc_rateidx_vht_mcs_mask_5ghz); ++ DEBUGFS_ADD_MODE(disable_offload, 0600); + DEBUGFS_ADD(hw_queues); + + if (sdata->local->ops->wake_tx_queue && +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -942,6 +942,7 @@ struct ieee80211_sub_if_data { + bool control_port_no_encrypt; + bool control_port_no_preauth; + bool control_port_over_nl80211; ++ bool disable_offload; + int encrypt_headroom; + + atomic_t num_tx_queued; +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -909,6 +909,9 @@ static bool ieee80211_set_sdata_offload_ + flags &= ~IEEE80211_OFFLOAD_DECAP_ENABLED; + } + ++ if (sdata->disable_offload) ++ flags = 0; ++ + if (sdata->vif.offload_flags == flags) + return false; + +@@ -939,6 +942,8 @@ static void ieee80211_set_vif_encap_ops( + if (sdata->wdev.use_4addr && + !(bss->vif.offload_flags & IEEE80211_OFFLOAD_ENCAP_4ADDR)) + enabled = false; ++ if (bss->disable_offload) ++ enabled = false; + + sdata->dev->netdev_ops = enabled ? &ieee80211_dataif_8023_ops : + &ieee80211_dataif_ops; diff --git a/feeds/wifi-ax/mac80211/patches/pending/214-no-encap.patch b/feeds/wifi-ax/mac80211/patches/pending/214-no-encap.patch deleted file mode 100644 index 83259cae8..000000000 --- a/feeds/wifi-ax/mac80211/patches/pending/214-no-encap.patch +++ /dev/null @@ -1,21 +0,0 @@ -Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/mac.c -=================================================================== ---- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/mac.c -+++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/mac.c -@@ -6590,6 +6590,7 @@ static int ath11k_mac_op_update_vif_offl - u32 param_id, param_value; - int ret; - -+ return 0; - if (ab->nss.enabled && vif->type == NL80211_IFTYPE_AP_VLAN) - return 0; - -@@ -6835,6 +6836,8 @@ static int ath11k_mac_op_add_interface(s - else - param_value = ATH11K_HW_TXRX_NATIVE_WIFI; - -+ param_value = ATH11K_HW_TXRX_NATIVE_WIFI; -+ - ret = ath11k_nss_vdev_set_cmd(arvif, NSS_WIFI_VDEV_ENCAP_TYPE_CMD, param_value); - - if(ret) {