ath11k: fix WDS when encap offload is enabled

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2022-03-01 16:02:11 +01:00
parent 4b07afe59f
commit d84982f161
3 changed files with 110 additions and 21 deletions

View File

@@ -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 <sqlite3.h>
#endif /* CONFIG_SQLITE */
+#include <syslog.h>
+
#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;

View File

@@ -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;

View File

@@ -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) {