wifi-ax: revert all ath11.5 changes

Fixes: WIFI-7570
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2022-06-02 09:17:24 +02:00
parent 8b9047952d
commit 386eca1f65
25 changed files with 1803 additions and 1149 deletions

View File

@@ -32,7 +32,6 @@ ALLWIFIBOARDS:= \
cybertan-eww622-a1 \
edgecore-eap101 \
gl-ax1800 \
gl-axt1800 \
sercomm-wallaby \
edgecore-eap102 \
edgecore-eap104 \
@@ -87,16 +86,6 @@ $(call Package/ath11k-wifi-default)
TITLE:=gl-ax1800 bdf
endef
define Package/ath11k-wifi-gl-axt1800
$(call Package/ath11k-wifi-default)
TITLE:=gl-axt1800 bdf
endef
define Package/ath11k-wifi-motorola-q14
$(call Package/ath11k-wifi-default)
TITLE:=motorola q14 bdf
endef
define ath11k-wifi-install-one-to
$(INSTALL_DIR) $(2)/lib/firmware/$(3)/
$(INSTALL_DATA) $(1) $(2)/lib/firmware/$(3)/board.bin
@@ -184,18 +173,6 @@ define Package/ath11k-wifi-gl-ax1800/install
$(INSTALL_DATA) ./board-gl-ax1800.bin.IPQ6018 $(1)/lib/firmware/ath11k/IPQ6018/hw1.0/board-2.bin
endef
define Package/ath11k-wifi-gl-axt1800/install
$(INSTALL_DIR) $(1)/lib/firmware/ath11k/IPQ6018/hw1.0/
$(INSTALL_DATA) ./board-gl-axt1800.bin.IPQ6018 $(1)/lib/firmware/ath11k/IPQ6018/hw1.0/board-2.bin
endef
define Package/ath11k-wifi-motorola-q14/install
$(INSTALL_DIR) $(1)/lib/firmware/ath11k/IPQ5018/hw1.0/
$(INSTALL_DIR) $(1)/lib/firmware/ath11k/qcn6122/hw1.0/
$(INSTALL_DATA) ./board-motorol-q14.bin.IPQ5018 $(1)/lib/firmware/ath11k/IPQ5018/hw1.0/board.bin
$(INSTALL_DATA) ./board-2-motorol-q14.bin.QCN6122 $(1)/lib/firmware/ath11k/qcn6122/hw1.0/board-2.bin
endef
$(eval $(call generate-ath11k-wifi-package,cig-wf188,Cigtech WF188))
$(eval $(call generate-ath11k-wifi-package,cig-wf188n,Cigtech WF188n))
$(eval $(call generate-ath11k-wifi-package,cig-wf194c,Cigtech WF194c))
@@ -219,4 +196,3 @@ $(eval $(call BuildPackage,ath11k-wifi-qcom-ipq8074))
$(eval $(call BuildPackage,ath11k-wifi-qcom-ipq6018))
$(eval $(call BuildPackage,ath11k-wifi-qcom-qcn9000))
$(eval $(call BuildPackage,ath11k-wifi-cig-wf196_6g))
$(eval $(call BuildPackage,ath11k-wifi-motorola-q14))

View File

@@ -0,0 +1,88 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2007-2019 B.A.T.M.A.N. contributors:
#
# Marek Lindner, Simon Wunderlich
#
# B.A.T.M.A.N meshing protocol
#
config BATMAN_ADV_BATMAN_V
bool "B.A.T.M.A.N. V protocol"
depends on PACKAGE_kmod-batman-adv
default y
help
This option enables the B.A.T.M.A.N. V protocol, the successor
of the currently used B.A.T.M.A.N. IV protocol. The main
changes include splitting of the OGM protocol into a neighbor
discovery protocol (Echo Location Protocol, ELP) and a new OGM
Protocol OGMv2 for flooding protocol information through the
network, as well as a throughput based metric.
B.A.T.M.A.N. V is currently considered experimental and not
compatible to B.A.T.M.A.N. IV networks.
config BATMAN_ADV_BLA
bool "Bridge Loop Avoidance"
depends on PACKAGE_kmod-batman-adv
select PACKAGE_kmod-lib-crc16
default y
help
This option enables BLA (Bridge Loop Avoidance), a mechanism
to avoid Ethernet frames looping when mesh nodes are connected
to both the same LAN and the same mesh. If you will never use
more than one mesh node in the same LAN, you can safely remove
this feature and save some space.
config BATMAN_ADV_DAT
bool "Distributed ARP Table"
depends on PACKAGE_kmod-batman-adv
default y
help
This option enables DAT (Distributed ARP Table), a DHT based
mechanism that increases ARP reliability on sparse wireless
mesh networks. If you think that your network does not need
this option you can safely remove it and save some space.
config BATMAN_ADV_NC
bool "Network Coding"
depends on PACKAGE_kmod-batman-adv
help
This option enables network coding, a mechanism that aims to
increase the overall network throughput by fusing multiple
packets in one transmission.
Note that interfaces controlled by batman-adv must be manually
configured to have promiscuous mode enabled in order to make
network coding work.
If you think that your network does not need this feature you
can safely disable it and save some space.
config BATMAN_ADV_MCAST
bool "Multicast optimisation"
depends on PACKAGE_kmod-batman-adv
default y
help
This option enables the multicast optimisation which aims to
reduce the air overhead while improving the reliability of
multicast messages.
config BATMAN_ADV_DEBUG
bool "B.A.T.M.A.N. debugging"
depends on PACKAGE_kmod-batman-adv
help
This is an option for use by developers; most people should
say N here. This enables compilation of support for
outputting debugging information to the debugfs log or tracing
buffer. The output is controlled via the batadv netdev specific
log_level setting.
config BATMAN_ADV_TRACING
bool "B.A.T.M.A.N. tracing support"
depends on PACKAGE_kmod-batman-adv
select KERNEL_FTRACE
select KERNEL_ENABLE_DEFAULT_TRACERS
help
This is an option for use by developers; most people should
say N here. Select this option to gather traces like the debug
messages using the generic tracing infrastructure of the kernel.
BATMAN_ADV_DEBUG must also be selected to get trace events for
batadv_dbg.

View File

@@ -0,0 +1,91 @@
# SPDX-License-Identifier: GPL-2.0-only
include $(TOPDIR)/rules.mk
PKG_NAME:=batman-adv
PKG_VERSION:=2021.1
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
PKG_HASH:=bf77843d8dead75342d673ce7021e4ad037447ce18c64056ae1e3202039934d0
PKG_EXTMOD_SUBDIRS:=net/batman-adv
PKG_MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
PKG_LICENSE:=GPL-2.0-only MIT
PKG_LICENSE_FILES:=LICENSES/preferred/GPL-2.0 LICENSES/preferred/MIT
STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
define KernelPackage/batman-adv
SUBMENU:=Network Support
TITLE:=B.A.T.M.A.N. Adv
URL:=https://www.open-mesh.org/
DEPENDS:=+BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-lib-crc32c +kmod-cfg80211 +batctl
FILES:=$(PKG_BUILD_DIR)/net/batman-adv/batman-adv.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoProbe,batman-adv)
endef
define KernelPackage/batman-adv/description
B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is
a routing protocol for multi-hop ad-hoc mesh networks. The
networks may be wired or wireless. See
https://www.open-mesh.org/ for more information and user space
tools. This package builds version $(PKG_VERSION) of the kernel
module.
endef
define KernelPackage/batman-adv/config
source "$(SOURCE)/Config.in"
endef
define Package/kmod-batman-adv/conffiles
/etc/config/batman-adv
endef
PKG_EXTRA_KCONFIG:= \
CONFIG_BATMAN_ADV=m \
CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_BATMAN_ADV_DEBUG),y,n) \
CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_BATMAN_ADV_BLA),y,n) \
CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_BATMAN_ADV_DAT),y,n) \
CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_BATMAN_ADV_MCAST),y,n) \
CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_BATMAN_ADV_NC),y,n) \
CONFIG_BATMAN_ADV_BATMAN_V=$(if $(CONFIG_BATMAN_ADV_BATMAN_V),y,n) \
CONFIG_BATMAN_ADV_TRACING=$(if $(CONFIG_BATMAN_ADV_TRACING),y,n) \
PKG_EXTRA_CFLAGS:= \
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \
NOSTDINC_FLAGS = \
$(KERNEL_NOSTDINC_FLAGS) \
-I$(PKG_BUILD_DIR)/net/batman-adv \
-I$(STAGING_DIR)/usr/include/mac80211-backport \
-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
-I$(STAGING_DIR)/usr/include/mac80211 \
-I$(STAGING_DIR)/usr/include/mac80211/uapi \
-I$(PKG_BUILD_DIR)/include/ \
-include backport/autoconf.h \
-include backport/backport.h \
-include $(PKG_BUILD_DIR)/compat-hacks.h \
-include $(PKG_BUILD_DIR)/compat-qca.h \
-DBATADV_SOURCE_VERSION=\\\"$(PKG_VERSION)-openwrt-$(PKG_RELEASE)\\\"
define Build/Compile
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
$(KERNEL_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)/net/batman-adv" \
$(PKG_EXTRA_KCONFIG) \
EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS)" \
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
modules
endef
define KernelPackage/batman-adv/install
$(CP) ./files/. $(1)/
endef
$(eval $(call KernelPackage,batman-adv))

View File

@@ -0,0 +1,97 @@
#!/bin/sh
# This UCI-Defaults script will split the batadv proto network interfaces
# in batadv_hardif and batadv proto. The configuration options from
# /etc/config/batman-adv will be moved to the latter.
. /lib/functions.sh
proto_batadv_to_batadv_hardif() {
local section="$1"
local proto
local mesh
local routing_algo
config_get proto "${section}" proto
config_get mesh "${section}" mesh
config_get routing_algo "${section}" routing_algo
if [ -z "$mesh" -o "${proto}" != "batadv" ]; then
continue
fi
uci set network."${section}".proto="batadv_hardif"
uci rename network."${section}".mesh="master"
uci delete network."${section}".routing_algo
# create new section or adjust existing one
uci set network."${mesh}"=interface
uci set network."${mesh}".proto=batadv
[ -n "${routing_algo}" ] && uci set network."${mesh}".routing_algo="${routing_algo}"
}
mv_batadv_config_section() {
local section="$1"
local aggregated_ogms
local ap_isolation
local bonding
local bridge_loop_avoidance
local distributed_arp_table
local fragmentation
local gw_bandwidth
local gw_mode
local gw_sel_class
local hop_penalty
local isolation_mark
local log_level
local multicast_mode
local network_coding
local orig_interval
config_get aggregated_ogms "${section}" aggregated_ogms
config_get ap_isolation "${section}" ap_isolation
config_get bonding "${section}" bonding
config_get bridge_loop_avoidance "${section}" bridge_loop_avoidance
config_get distributed_arp_table "${section}" distributed_arp_table
config_get fragmentation "${section}" fragmentation
config_get gw_bandwidth "${section}" gw_bandwidth
config_get gw_mode "${section}" gw_mode
config_get gw_sel_class "${section}" gw_sel_class
config_get hop_penalty "${section}" hop_penalty
config_get isolation_mark "${section}" isolation_mark
config_get log_level "${section}" log_level
config_get multicast_mode "${section}" multicast_mode
config_get network_coding "${section}" network_coding
config_get orig_interval "${section}" orig_interval
# update section in case it exists
[ -n "${aggregated_ogms}" ] && uci set network."${section}".aggregated_ogms="${aggregated_ogms}"
[ -n "${ap_isolation}" ] && uci set network."${section}".ap_isolation="${ap_isolation}"
[ -n "${bonding}" ] && uci set network."${section}".bonding="${bonding}"
[ -n "${bridge_loop_avoidance}" ] && uci set network."${section}".bridge_loop_avoidance="${bridge_loop_avoidance}"
[ -n "${distributed_arp_table}" ] && uci set network."${section}".distributed_arp_table="${distributed_arp_table}"
[ -n "${fragmentation}" ] && uci set network."${section}".fragmentation="${fragmentation}"
[ -n "${gw_bandwidth}" ] && uci set network."${section}".gw_bandwidth="${gw_bandwidth}"
[ -n "${gw_mode}" ] && uci set network."${section}".gw_mode="${gw_mode}"
[ -n "${gw_sel_class}" ] && uci set network."${section}".gw_sel_class="${gw_sel_class}"
[ -n "${hop_penalty}" ] && uci set network."${section}".hop_penalty="${hop_penalty}"
[ -n "${isolation_mark}" ] && uci set network."${section}".isolation_mark="${isolation_mark}"
[ -n "${log_level}" ] && uci set network."${section}".log_level="${log_level}"
[ -n "${multicast_mode}" ] && uci set network."${section}".multicast_mode="${multicast_mode}"
[ -n "${network_coding}" ] && uci set network."${section}".network_coding="${network_coding}"
[ -n "${orig_interval}" ] && uci set network."${section}".orig_interval="${orig_interval}"
}
if [ -f /etc/config/batman-adv ]; then
config_load network
config_foreach proto_batadv_to_batadv_hardif 'interface'
uci commit network
config_load batman-adv
config_foreach mv_batadv_config_section 'mesh'
uci commit network
rm -f /etc/config/batman-adv
fi
exit 0

View File

@@ -0,0 +1,123 @@
#!/bin/sh
[ -n "$INCLUDE_ONLY" ] || {
. /lib/functions.sh
. ../netifd-proto.sh
init_proto "$@"
}
proto_batadv_init_config() {
no_device=1
available=1
proto_config_add_boolean 'aggregated_ogms:bool'
proto_config_add_boolean 'ap_isolation:bool'
proto_config_add_boolean 'bonding:bool'
proto_config_add_boolean 'bridge_loop_avoidance:bool'
proto_config_add_boolean 'distributed_arp_table:bool'
proto_config_add_boolean 'fragmentation:bool'
proto_config_add_string 'gw_bandwidth'
proto_config_add_string 'gw_mode'
proto_config_add_int 'gw_sel_class'
proto_config_add_int 'hop_penalty'
proto_config_add_string 'isolation_mark'
proto_config_add_string 'log_level'
proto_config_add_int 'multicast_fanout'
proto_config_add_boolean 'multicast_mode:bool'
proto_config_add_boolean 'network_coding:bool'
proto_config_add_int 'orig_interval'
proto_config_add_string 'routing_algo'
}
proto_batadv_setup() {
local config="$1"
local iface="$config"
local aggregated_ogms
local ap_isolation
local bonding
local bridge_loop_avoidance
local distributed_arp_table
local fragmentation
local gw_bandwidth
local gw_mode
local gw_sel_class
local hop_penalty
local isolation_mark
local log_level
local multicast_fanout
local multicast_mode
local network_coding
local orig_interval
local routing_algo
json_get_vars aggregated_ogms
json_get_vars ap_isolation
json_get_vars bonding
json_get_vars bridge_loop_avoidance
json_get_vars distributed_arp_table
json_get_vars fragmentation
json_get_vars gw_bandwidth
json_get_vars gw_mode
json_get_vars gw_sel_class
json_get_vars hop_penalty
json_get_vars isolation_mark
json_get_vars log_level
json_get_vars multicast_fanout
json_get_vars multicast_mode
json_get_vars network_coding
json_get_vars orig_interval
json_get_vars routing_algo
set_default routing_algo 'BATMAN_IV'
batctl routing_algo "$routing_algo"
batctl meshif "$iface" interface create
[ -n "$aggregated_ogms" ] && batctl meshif "$iface" aggregation "$aggregated_ogms"
[ -n "$ap_isolation" ] && batctl meshif "$iface" ap_isolation "$ap_isolation"
[ -n "$bonding" ] && batctl meshif "$iface" bonding "$bonding"
[ -n "$bridge_loop_avoidance" ] && batctl meshif "$iface" bridge_loop_avoidance "$bridge_loop_avoidance" 2>&-
[ -n "$distributed_arp_table" ] && batctl meshif "$iface" distributed_arp_table "$distributed_arp_table" 2>&-
[ -n "$fragmentation" ] && batctl meshif "$iface" fragmentation "$fragmentation"
case "$gw_mode" in
server)
if [ -n "$gw_bandwidth" ]; then
batctl meshif "$iface" gw_mode "server" "$gw_bandwidth"
else
batctl meshif "$iface" gw_mode "server"
fi
;;
client)
if [ -n "$gw_sel_class" ]; then
batctl meshif "$iface" gw_mode "client" "$gw_sel_class"
else
batctl meshif "$iface" gw_mode "client"
fi
;;
*)
batctl meshif "$iface" gw_mode "off"
;;
esac
[ -n "$hop_penalty" ] && batctl meshif "$iface" hop_penalty "$hop_penalty"
[ -n "$isolation_mark" ] && batctl meshif "$iface" isolation_mark "$isolation_mark"
[ -n "$multicast_fanout" ] && batctl meshif "$iface" multicast_fanout "$multicast_fanout"
[ -n "$multicast_mode" ] && batctl meshif "$iface" multicast_mode "$multicast_mode" 2>&-
[ -n "$network_coding" ] && batctl meshif "$iface" network_coding "$network_coding" 2>&-
[ -n "$log_level" ] && batctl meshif "$iface" loglevel "$log_level" 2>&-
[ -n "$orig_interval" ] && batctl meshif "$iface" orig_interval "$orig_interval"
proto_init_update "$iface" 1
proto_send_update "$config"
}
proto_batadv_teardown() {
local config="$1"
local iface="$config"
batctl meshif "$iface" interface destroy
}
add_protocol batadv

View File

@@ -0,0 +1,53 @@
#!/bin/sh
[ -n "$INCLUDE_ONLY" ] || {
. /lib/functions.sh
. ../netifd-proto.sh
init_proto "$@"
}
proto_batadv_hardif_init_config() {
proto_config_add_int 'elp_interval'
proto_config_add_int 'hop_penalty'
proto_config_add_string "master"
proto_config_add_string 'throughput_override'
}
proto_batadv_hardif_setup() {
local config="$1"
local iface="$2"
local elp_interval
local hop_penalty
local master
local throughput_override
json_get_vars elp_interval
json_get_vars hop_penalty
json_get_vars master
json_get_vars throughput_override
( proto_add_host_dependency "$config" '' "$master" )
batctl meshif "$master" interface -M add "$iface"
[ -n "$elp_interval" ] && batctl hardif "$iface" elp_interval "$elp_interval"
[ -n "$hop_penalty" ] && batctl hardif "$iface" hop_penalty "$hop_penalty"
[ -n "$throughput_override" ] && batctl hardif "$iface" throughput_override "$throughput_override"
proto_init_update "$iface" 1
proto_send_update "$config"
}
proto_batadv_hardif_teardown() {
local config="$1"
local iface="$2"
local master
json_get_vars master
batctl meshif "$master" interface -M del "$iface" || true
}
add_protocol batadv_hardif

View File

@@ -0,0 +1,25 @@
#!/bin/sh
. /lib/functions.sh
. ../netifd-proto.sh
init_proto "$@"
proto_batadv_vlan_init_config() {
proto_config_add_boolean 'ap_isolation:bool'
}
proto_batadv_vlan_setup() {
local config="$1"
local iface="$2"
# batadv_vlan options
local ap_isolation
json_get_vars ap_isolation
[ -n "$ap_isolation" ] && batctl vlan "$iface" ap_isolation "$ap_isolation"
proto_init_update "$iface" 1
proto_send_update "$config"
}
add_protocol batadv_vlan

View File

@@ -0,0 +1,128 @@
From: Sven Eckelmann <sven@narfation.org>
Date: Sat, 24 Oct 2020 22:51:23 +0200
Subject: Revert "batman-adv: genetlink: move to smaller ops wherever possible"
The netlink genl_ops interface was splitted into two parts for Linux 5.10.
The batman-adv code changed to the new one because it doesn't use the more
complex policy handling of genl_ops. But the backports-5.8-1 version in
OpenWrt doesn't yet support the new genl_small_ops.
This patch must be dropped directly when OpenWrt switches to backports-5.10
or newer - otherwise it will not work as expected.
This reverts commit 725b4ef5be840cfcd0ca33b9393c14dee40c10f7.
--- a/compat-include/net/genetlink.h
+++ b/compat-include/net/genetlink.h
@@ -31,17 +31,15 @@ void batadv_genl_dump_check_consistent(s
#endif /* LINUX_VERSION_IS_LESS(4, 15, 0) */
-#if LINUX_VERSION_IS_LESS(5, 10, 0)
-
#if LINUX_VERSION_IS_LESS(5, 2, 0)
+
enum genl_validate_flags {
GENL_DONT_VALIDATE_STRICT = BIT(0),
GENL_DONT_VALIDATE_DUMP = BIT(1),
GENL_DONT_VALIDATE_DUMP_STRICT = BIT(2),
};
-#endif /* LINUX_VERSION_IS_LESS(5, 2, 0) */
-struct batadv_genl_small_ops {
+struct batadv_genl_ops {
int (*doit)(struct sk_buff *skb,
struct genl_info *info);
int (*dumpit)(struct sk_buff *skb,
@@ -70,9 +68,9 @@ struct batadv_genl_family {
struct genl_info *info);
void (*post_doit)(const struct genl_ops *ops, struct sk_buff *skb,
struct genl_info *info);
- const struct batadv_genl_small_ops *small_ops;
+ const struct batadv_genl_ops *ops;
const struct genl_multicast_group *mcgrps;
- unsigned int n_small_ops;
+ unsigned int n_ops;
unsigned int n_mcgrps;
struct module *module;
@@ -96,32 +94,24 @@ static inline int batadv_genl_register_f
family->family.pre_doit = family->pre_doit;
family->family.post_doit = family->post_doit;
family->family.mcgrps = family->mcgrps;
- family->family.n_ops = family->n_small_ops;
+ family->family.n_ops = family->n_ops;
family->family.n_mcgrps = family->n_mcgrps;
family->family.module = family->module;
- ops = kzalloc(sizeof(*ops) * family->n_small_ops, GFP_KERNEL);
+ ops = kzalloc(sizeof(*ops) * family->n_ops, GFP_KERNEL);
if (!ops)
return -ENOMEM;
for (i = 0; i < family->family.n_ops; i++) {
- ops[i].doit = family->small_ops[i].doit;
- ops[i].dumpit = family->small_ops[i].dumpit;
- ops[i].done = family->small_ops[i].done;
- ops[i].cmd = family->small_ops[i].cmd;
- ops[i].internal_flags = family->small_ops[i].internal_flags;
- ops[i].flags = family->small_ops[i].flags;
-#if LINUX_VERSION_IS_GEQ(5, 2, 0)
- ops[i].validate = family->small_ops[i].validate;
-#else
+ ops[i].doit = family->ops[i].doit;
+ ops[i].dumpit = family->ops[i].dumpit;
+ ops[i].done = family->ops[i].done;
+ ops[i].cmd = family->ops[i].cmd;
+ ops[i].internal_flags = family->ops[i].internal_flags;
+ ops[i].flags = family->ops[i].flags;
ops[i].policy = family->policy;
-#endif
}
-#if LINUX_VERSION_IS_GEQ(5, 2, 0)
- family->family.policy = family->policy;
-#endif
-
family->family.ops = ops;
family->copy_ops = ops;
@@ -136,7 +126,7 @@ typedef struct genl_ops batadv_genl_ops_
#define batadv_post_doit(__x, __y, __z) \
batadv_post_doit(const batadv_genl_ops_old *ops, __y, __z)
-#define genl_small_ops batadv_genl_small_ops
+#define genl_ops batadv_genl_ops
#define genl_family batadv_genl_family
#define genl_register_family(family) \
@@ -160,6 +150,6 @@ batadv_genl_unregister_family(struct bat
genlmsg_multicast_netns(&(_family)->family, _net, _skb, _portid, \
_group, _flags)
-#endif /* LINUX_VERSION_IS_LESS(5, 10, 0) */
+#endif /* LINUX_VERSION_IS_LESS(5, 2, 0) */
#endif /* _NET_BATMAN_ADV_COMPAT_NET_GENETLINK_H_ */
--- a/net/batman-adv/netlink.c
+++ b/net/batman-adv/netlink.c
@@ -1351,7 +1351,7 @@ static void batadv_post_doit(const struc
}
}
-static const struct genl_small_ops batadv_netlink_ops[] = {
+static const struct genl_ops batadv_netlink_ops[] = {
{
.cmd = BATADV_CMD_GET_MESH,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
@@ -1485,8 +1485,8 @@ struct genl_family batadv_netlink_family
.pre_doit = batadv_pre_doit,
.post_doit = batadv_post_doit,
.module = THIS_MODULE,
- .small_ops = batadv_netlink_ops,
- .n_small_ops = ARRAY_SIZE(batadv_netlink_ops),
+ .ops = batadv_netlink_ops,
+ .n_ops = ARRAY_SIZE(batadv_netlink_ops),
.mcgrps = batadv_netlink_mcgrps,
.n_mcgrps = ARRAY_SIZE(batadv_netlink_mcgrps),
};

View File

@@ -0,0 +1,116 @@
From: Sven Eckelmann <sven@narfation.org>
Date: Thu, 28 Jan 2021 21:06:51 +0100
Subject: Revert "batman-adv: Add new include for min/max helpers"
The OpenWrt kernel sources and backports sources are currently missing this
header.
This reverts commit 1810de05310d5c5e9140f870ac21052f38bc06b8.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
--- a/compat-include/linux/minmax.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright (C) B.A.T.M.A.N. contributors:
- *
- * Marek Lindner, Simon Wunderlich
- *
- * This file contains macros for maintaining compatibility with older versions
- * of the Linux kernel.
- */
-
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_MINMAX_H_
-#define _NET_BATMAN_ADV_COMPAT_LINUX_MINMAX_H_
-
-#include <linux/version.h>
-#if LINUX_VERSION_IS_GEQ(5, 10, 0)
-#include_next <linux/minmax.h>
-#else
-#include <linux/kernel.h>
-#endif
-
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_MINMAX_H_ */
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -15,7 +15,6 @@
#include <linux/jiffies.h>
#include <linux/kref.h>
#include <linux/list.h>
-#include <linux/minmax.h>
#include <linux/netdevice.h>
#include <linux/netlink.h>
#include <linux/rculist.h>
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -18,7 +18,6 @@
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/kref.h>
-#include <linux/minmax.h>
#include <linux/netdevice.h>
#include <linux/nl80211.h>
#include <linux/prandom.h>
--- a/net/batman-adv/bat_v_ogm.c
+++ b/net/batman-adv/bat_v_ogm.c
@@ -18,7 +18,6 @@
#include <linux/kref.h>
#include <linux/list.h>
#include <linux/lockdep.h>
-#include <linux/minmax.h>
#include <linux/mutex.h>
#include <linux/netdevice.h>
#include <linux/prandom.h>
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -14,8 +14,8 @@
#include <linux/gfp.h>
#include <linux/if_ether.h>
#include <linux/jiffies.h>
+#include <linux/kernel.h>
#include <linux/lockdep.h>
-#include <linux/minmax.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/slab.h>
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -18,7 +18,6 @@
#include <linux/kref.h>
#include <linux/limits.h>
#include <linux/list.h>
-#include <linux/minmax.h>
#include <linux/mutex.h>
#include <linux/netdevice.h>
#include <linux/printk.h>
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -23,7 +23,6 @@
#include <linux/kobject.h>
#include <linux/kref.h>
#include <linux/list.h>
-#include <linux/minmax.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/printk.h>
--- a/net/batman-adv/netlink.c
+++ b/net/batman-adv/netlink.c
@@ -23,7 +23,6 @@
#include <linux/kernel.h>
#include <linux/limits.h>
#include <linux/list.h>
-#include <linux/minmax.h>
#include <linux/netdevice.h>
#include <linux/netlink.h>
#include <linux/printk.h>
--- a/net/batman-adv/tp_meter.c
+++ b/net/batman-adv/tp_meter.c
@@ -23,7 +23,6 @@
#include <linux/kthread.h>
#include <linux/limits.h>
#include <linux/list.h>
-#include <linux/minmax.h>
#include <linux/netdevice.h>
#include <linux/param.h>
#include <linux/printk.h>

View File

@@ -0,0 +1,34 @@
From: Sven Eckelmann <sven@narfation.org>
Date: Fri, 14 May 2021 19:34:35 +0200
Subject: batman-adv: Fix build of multicast code against Linux < 5.13
Fixes: 007b4c4b031f ("batman-adv: convert ifmcaddr6 to RCU")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -454,9 +454,14 @@ batadv_mcast_mla_softif_get_ipv6(struct
return 0;
}
+#if LINUX_VERSION_IS_LESS(5, 13, 0)
+ read_lock_bh(&in6_dev->lock);
+ for (pmc6 = in6_dev->mc_list; pmc6; pmc6 = pmc6->next) {
+#else
for (pmc6 = rcu_dereference(in6_dev->mc_list);
pmc6;
pmc6 = rcu_dereference(pmc6->next)) {
+#endif
if (IPV6_ADDR_MC_SCOPE(&pmc6->mca_addr) <
IPV6_ADDR_SCOPE_LINKLOCAL)
continue;
@@ -485,6 +490,9 @@ batadv_mcast_mla_softif_get_ipv6(struct
hlist_add_head(&new->list, mcast_list);
ret++;
}
+#if LINUX_VERSION_IS_LESS(5, 13, 0)
+ read_unlock_bh(&in6_dev->lock);
+#endif
rcu_read_unlock();
return ret;

View File

@@ -0,0 +1,111 @@
From: Sven Eckelmann <sven@narfation.org>
Date: Mon, 10 May 2021 15:05:42 +0200
Subject: batman-adv: Always send iface index+name in genlmsg
The batman-adv netlink messages often contain the interface index and
interface name in the same message. This makes it easy for the receiver to
operate on the incoming data when it either needs to print something or
needs to operate on the interface index.
But one of the attributes was missing for:
* neighbor table dumps
* originator table dumps
* gateway list dumps
* query of hardif information
* query of vid information
The userspace therefore had to implement special workarounds using
SIOCGIFNAME or SIOCGIFINDEX depending on what was actually provided.
Providing both information simplifies the userspace code massively without
adding a lot of extra overhead in the kernel portion.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/77c7d62618259f22f36427eaa62668e6e1c43090
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -1849,6 +1849,8 @@ batadv_iv_ogm_orig_dump_subentry(struct
orig_node->orig) ||
nla_put(msg, BATADV_ATTR_NEIGH_ADDRESS, ETH_ALEN,
neigh_node->addr) ||
+ nla_put_string(msg, BATADV_ATTR_HARD_IFNAME,
+ neigh_node->if_incoming->net_dev->name) ||
nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX,
neigh_node->if_incoming->net_dev->ifindex) ||
nla_put_u8(msg, BATADV_ATTR_TQ, tq_avg) ||
@@ -2078,6 +2080,8 @@ batadv_iv_ogm_neigh_dump_neigh(struct sk
if (nla_put(msg, BATADV_ATTR_NEIGH_ADDRESS, ETH_ALEN,
hardif_neigh->addr) ||
+ nla_put_string(msg, BATADV_ATTR_HARD_IFNAME,
+ hardif_neigh->if_incoming->net_dev->name) ||
nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX,
hardif_neigh->if_incoming->net_dev->ifindex) ||
nla_put_u32(msg, BATADV_ATTR_LAST_SEEN_MSECS,
@@ -2459,6 +2463,8 @@ static int batadv_iv_gw_dump_entry(struc
router->addr) ||
nla_put_string(msg, BATADV_ATTR_HARD_IFNAME,
router->if_incoming->net_dev->name) ||
+ nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX,
+ router->if_incoming->net_dev->ifindex) ||
nla_put_u32(msg, BATADV_ATTR_BANDWIDTH_DOWN,
gw_node->bandwidth_down) ||
nla_put_u32(msg, BATADV_ATTR_BANDWIDTH_UP,
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -145,6 +145,8 @@ batadv_v_neigh_dump_neigh(struct sk_buff
if (nla_put(msg, BATADV_ATTR_NEIGH_ADDRESS, ETH_ALEN,
hardif_neigh->addr) ||
+ nla_put_string(msg, BATADV_ATTR_HARD_IFNAME,
+ hardif_neigh->if_incoming->net_dev->name) ||
nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX,
hardif_neigh->if_incoming->net_dev->ifindex) ||
nla_put_u32(msg, BATADV_ATTR_LAST_SEEN_MSECS,
@@ -297,6 +299,8 @@ batadv_v_orig_dump_subentry(struct sk_bu
if (nla_put(msg, BATADV_ATTR_ORIG_ADDRESS, ETH_ALEN, orig_node->orig) ||
nla_put(msg, BATADV_ATTR_NEIGH_ADDRESS, ETH_ALEN,
neigh_node->addr) ||
+ nla_put_string(msg, BATADV_ATTR_HARD_IFNAME,
+ neigh_node->if_incoming->net_dev->name) ||
nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX,
neigh_node->if_incoming->net_dev->ifindex) ||
nla_put_u32(msg, BATADV_ATTR_THROUGHPUT, throughput) ||
@@ -737,6 +741,12 @@ static int batadv_v_gw_dump_entry(struct
genlmsg_cancel(msg, hdr);
goto out;
}
+
+ if (nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX,
+ router->if_incoming->net_dev->ifindex)) {
+ genlmsg_cancel(msg, hdr);
+ goto out;
+ }
if (nla_put_u32(msg, BATADV_ATTR_BANDWIDTH_DOWN,
gw_node->bandwidth_down)) {
--- a/net/batman-adv/netlink.c
+++ b/net/batman-adv/netlink.c
@@ -813,6 +813,10 @@ static int batadv_netlink_hardif_fill(st
bat_priv->soft_iface->ifindex))
goto nla_put_failure;
+ if (nla_put_string(msg, BATADV_ATTR_MESH_IFNAME,
+ bat_priv->soft_iface->name))
+ goto nla_put_failure;
+
if (nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX,
net_dev->ifindex) ||
nla_put_string(msg, BATADV_ATTR_HARD_IFNAME,
@@ -1044,6 +1048,10 @@ static int batadv_netlink_vlan_fill(stru
bat_priv->soft_iface->ifindex))
goto nla_put_failure;
+ if (nla_put_string(msg, BATADV_ATTR_MESH_IFNAME,
+ bat_priv->soft_iface->name))
+ goto nla_put_failure;
+
if (nla_put_u32(msg, BATADV_ATTR_VLANID, vlan->vid & VLAN_VID_MASK))
goto nla_put_failure;

View File

@@ -0,0 +1,31 @@
From: Sven Eckelmann <sven@narfation.org>
Date: Tue, 18 May 2021 21:00:27 +0200
Subject: batman-adv: Avoid WARN_ON timing related checks
The soft/batadv interface for a queued OGM can be changed during the time
the OGM was queued for transmission and when the OGM is actually
transmitted by the worker.
But WARN_ON must be used to denote kernel bugs and not to print simple
warnings. A warning can simply be printed using pr_warn.
Reported-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Reported-by: syzbot+c0b807de416427ff3dd1@syzkaller.appspotmail.com
Fixes: 29b9256e6631 ("batman-adv: consider outgoing interface in OGM sending")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/5061f9c502d7101912089d8f4a7866e0a926a49a
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -409,8 +409,10 @@ static void batadv_iv_ogm_emit(struct ba
if (WARN_ON(!forw_packet->if_outgoing))
return;
- if (WARN_ON(forw_packet->if_outgoing->soft_iface != soft_iface))
+ if (forw_packet->if_outgoing->soft_iface != soft_iface) {
+ pr_warn("%s: soft interface switch for queued OGM\n", __func__);
return;
+ }
if (forw_packet->if_incoming->if_status != BATADV_IF_ACTIVE)
return;

View File

@@ -0,0 +1,162 @@
From: Pavel Skripkin <paskripkin@gmail.com>
Date: Sun, 24 Oct 2021 16:13:56 +0300
Subject: batman-adv: fix error handling
Syzbot reported ODEBUG warning in batadv_nc_mesh_free(). The problem was
in wrong error handling in batadv_mesh_init().
Before this patch batadv_mesh_init() was calling batadv_mesh_free() in case
of any batadv_*_init() calls failure. This approach may work well, when
there is some kind of indicator, which can tell which parts of batadv are
initialized; but there isn't any.
All written above lead to cleaning up uninitialized fields. Even if we hide
ODEBUG warning by initializing bat_priv->nc.work, syzbot was able to hit
GPF in batadv_nc_purge_paths(), because hash pointer in still NULL. [1]
To fix these bugs we can unwind batadv_*_init() calls one by one.
It is good approach for 2 reasons: 1) It fixes bugs on error handling
path 2) It improves the performance, since we won't call unneeded
batadv_*_free() functions.
So, this patch makes all batadv_*_init() clean up all allocated memory
before returning with an error to no call correspoing batadv_*_free()
and open-codes batadv_mesh_free() with proper order to avoid touching
uninitialized fields.
Link: https://lore.kernel.org/netdev/000000000000c87fbd05cef6bcb0@google.com/ [1]
Reported-and-tested-by: syzbot+28b0702ada0bf7381f58@syzkaller.appspotmail.com
Fixes: 21e838760727 ("[batman-adv] fix various race conditions during startup & shutdown")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/0631e0825c8129cd3896926da62a09ac00bf13a0
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -1556,10 +1556,14 @@ int batadv_bla_init(struct batadv_priv *
return 0;
bat_priv->bla.claim_hash = batadv_hash_new(128);
- bat_priv->bla.backbone_hash = batadv_hash_new(32);
+ if (!bat_priv->bla.claim_hash)
+ return -ENOMEM;
- if (!bat_priv->bla.claim_hash || !bat_priv->bla.backbone_hash)
+ bat_priv->bla.backbone_hash = batadv_hash_new(32);
+ if (!bat_priv->bla.backbone_hash) {
+ batadv_hash_destroy(bat_priv->bla.claim_hash);
return -ENOMEM;
+ }
batadv_hash_set_lock_class(bat_priv->bla.claim_hash,
&batadv_claim_hash_lock_class_key);
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -189,29 +189,41 @@ int batadv_mesh_init(struct net_device *
bat_priv->gw.generation = 0;
- ret = batadv_v_mesh_init(bat_priv);
- if (ret < 0)
- goto err;
-
ret = batadv_originator_init(bat_priv);
- if (ret < 0)
- goto err;
+ if (ret < 0) {
+ atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING);
+ goto err_orig;
+ }
ret = batadv_tt_init(bat_priv);
- if (ret < 0)
- goto err;
+ if (ret < 0) {
+ atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING);
+ goto err_tt;
+ }
+
+ ret = batadv_v_mesh_init(bat_priv);
+ if (ret < 0) {
+ atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING);
+ goto err_v;
+ }
ret = batadv_bla_init(bat_priv);
- if (ret < 0)
- goto err;
+ if (ret < 0) {
+ atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING);
+ goto err_bla;
+ }
ret = batadv_dat_init(bat_priv);
- if (ret < 0)
- goto err;
+ if (ret < 0) {
+ atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING);
+ goto err_dat;
+ }
ret = batadv_nc_mesh_init(bat_priv);
- if (ret < 0)
- goto err;
+ if (ret < 0) {
+ atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING);
+ goto err_nc;
+ }
batadv_gw_init(bat_priv);
batadv_mcast_init(bat_priv);
@@ -221,8 +233,20 @@ int batadv_mesh_init(struct net_device *
return 0;
-err:
- batadv_mesh_free(soft_iface);
+err_nc:
+ batadv_dat_free(bat_priv);
+err_dat:
+ batadv_bla_free(bat_priv);
+err_bla:
+ batadv_v_mesh_free(bat_priv);
+err_v:
+ batadv_tt_free(bat_priv);
+err_tt:
+ batadv_originator_free(bat_priv);
+err_orig:
+ batadv_purge_outstanding_packets(bat_priv, NULL);
+ atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE);
+
return ret;
}
--- a/net/batman-adv/network-coding.c
+++ b/net/batman-adv/network-coding.c
@@ -152,8 +152,10 @@ int batadv_nc_mesh_init(struct batadv_pr
&batadv_nc_coding_hash_lock_class_key);
bat_priv->nc.decoding_hash = batadv_hash_new(128);
- if (!bat_priv->nc.decoding_hash)
+ if (!bat_priv->nc.decoding_hash) {
+ batadv_hash_destroy(bat_priv->nc.coding_hash);
goto err;
+ }
batadv_hash_set_lock_class(bat_priv->nc.decoding_hash,
&batadv_nc_decoding_hash_lock_class_key);
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -4193,8 +4193,10 @@ int batadv_tt_init(struct batadv_priv *b
return ret;
ret = batadv_tt_global_init(bat_priv);
- if (ret < 0)
+ if (ret < 0) {
+ batadv_tt_local_table_free(bat_priv);
return ret;
+ }
batadv_tvlv_handler_register(bat_priv, batadv_tt_tvlv_ogm_handler_v1,
batadv_tt_tvlv_unicast_handler_v1,

View File

@@ -0,0 +1,182 @@
From: Linus Lüssing <linus.luessing@c0d3.blue>
Date: Mon, 1 Nov 2021 21:46:17 +0100
Subject: batman-adv: allow netlink usage in unprivileged containers
Currently, creating a batman-adv interface in an unprivileged LXD
container and attaching secondary interfaces to it with "ip" or "batctl"
works fine. However all batctl debug and configuration commands
fail:
root@container:~# batctl originators
Error received: Operation not permitted
root@container:~# batctl orig_interval
1000
root@container:~# batctl orig_interval 2000
root@container:~# batctl orig_interval
1000
To fix this change the generic netlink permissions from GENL_ADMIN_PERM
to GENL_UNS_ADMIN_PERM. This way a batman-adv interface is fully
maintainable as root from within a user namespace, from an unprivileged
container.
All except one batman-adv netlink setting are per interface and do not
leak information or change settings from the host system and are
therefore save to retrieve or modify as root from within an unprivileged
container.
"batctl routing_algo" / BATADV_CMD_GET_ROUTING_ALGOS is the only
exception: It provides the batman-adv kernel module wide default routing
algorithm. However it is read-only from netlink and an unprivileged
container is still not allowed to modify
/sys/module/batman_adv/parameters/routing_algo. Instead it is advised to
use the newly introduced "batctl if create routing_algo RA_NAME" /
IFLA_BATADV_ALGO_NAME to set the routing algorithm on interface
creation, which already works fine in an unprivileged container.
Cc: Tycho Andersen <tycho@tycho.pizza>
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/055fa41b73ca8dae1c1ed41777e32a8f02e80c82
--- /dev/null
+++ b/compat-include/uapi/linux/genetlink.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (C) B.A.T.M.A.N. contributors:
+ *
+ * Marek Lindner, Simon Wunderlich
+ *
+ * This file contains macros for maintaining compatibility with older versions
+ * of the Linux kernel.
+ */
+
+#ifndef _NET_BATMAN_ADV_COMPAT_UAPI_LINUX_GENETLINK_H_
+#define _NET_BATMAN_ADV_COMPAT_UAPI_LINUX_GENETLINK_H_
+
+#include <linux/version.h>
+#include_next <uapi/linux/genetlink.h>
+
+#if LINUX_VERSION_IS_LESS(4, 6, 0)
+
+#define GENL_UNS_ADMIN_PERM GENL_ADMIN_PERM
+
+#endif /* LINUX_VERSION_IS_LESS(4, 6, 0) */
+
+#endif /* _NET_BATMAN_ADV_COMPAT_UAPI_LINUX_GENETLINK_H_ */
--- a/net/batman-adv/netlink.c
+++ b/net/batman-adv/netlink.c
@@ -1369,21 +1369,21 @@ static const struct genl_ops batadv_netl
{
.cmd = BATADV_CMD_TP_METER,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
+ .flags = GENL_UNS_ADMIN_PERM,
.doit = batadv_netlink_tp_meter_start,
.internal_flags = BATADV_FLAG_NEED_MESH,
},
{
.cmd = BATADV_CMD_TP_METER_CANCEL,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
+ .flags = GENL_UNS_ADMIN_PERM,
.doit = batadv_netlink_tp_meter_cancel,
.internal_flags = BATADV_FLAG_NEED_MESH,
},
{
.cmd = BATADV_CMD_GET_ROUTING_ALGOS,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
+ .flags = GENL_UNS_ADMIN_PERM,
.dumpit = batadv_algo_dump,
},
{
@@ -1398,68 +1398,68 @@ static const struct genl_ops batadv_netl
{
.cmd = BATADV_CMD_GET_TRANSTABLE_LOCAL,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
+ .flags = GENL_UNS_ADMIN_PERM,
.dumpit = batadv_tt_local_dump,
},
{
.cmd = BATADV_CMD_GET_TRANSTABLE_GLOBAL,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
+ .flags = GENL_UNS_ADMIN_PERM,
.dumpit = batadv_tt_global_dump,
},
{
.cmd = BATADV_CMD_GET_ORIGINATORS,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
+ .flags = GENL_UNS_ADMIN_PERM,
.dumpit = batadv_orig_dump,
},
{
.cmd = BATADV_CMD_GET_NEIGHBORS,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
+ .flags = GENL_UNS_ADMIN_PERM,
.dumpit = batadv_hardif_neigh_dump,
},
{
.cmd = BATADV_CMD_GET_GATEWAYS,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
+ .flags = GENL_UNS_ADMIN_PERM,
.dumpit = batadv_gw_dump,
},
{
.cmd = BATADV_CMD_GET_BLA_CLAIM,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
+ .flags = GENL_UNS_ADMIN_PERM,
.dumpit = batadv_bla_claim_dump,
},
{
.cmd = BATADV_CMD_GET_BLA_BACKBONE,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
+ .flags = GENL_UNS_ADMIN_PERM,
.dumpit = batadv_bla_backbone_dump,
},
{
.cmd = BATADV_CMD_GET_DAT_CACHE,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
+ .flags = GENL_UNS_ADMIN_PERM,
.dumpit = batadv_dat_cache_dump,
},
{
.cmd = BATADV_CMD_GET_MCAST_FLAGS,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
+ .flags = GENL_UNS_ADMIN_PERM,
.dumpit = batadv_mcast_flags_dump,
},
{
.cmd = BATADV_CMD_SET_MESH,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
+ .flags = GENL_UNS_ADMIN_PERM,
.doit = batadv_netlink_set_mesh,
.internal_flags = BATADV_FLAG_NEED_MESH,
},
{
.cmd = BATADV_CMD_SET_HARDIF,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
+ .flags = GENL_UNS_ADMIN_PERM,
.doit = batadv_netlink_set_hardif,
.internal_flags = BATADV_FLAG_NEED_MESH |
BATADV_FLAG_NEED_HARDIF,
@@ -1475,7 +1475,7 @@ static const struct genl_ops batadv_netl
{
.cmd = BATADV_CMD_SET_VLAN,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .flags = GENL_ADMIN_PERM,
+ .flags = GENL_UNS_ADMIN_PERM,
.doit = batadv_netlink_set_vlan,
.internal_flags = BATADV_FLAG_NEED_MESH |
BATADV_FLAG_NEED_VLAN,

View File

@@ -0,0 +1,165 @@
From: Linus Lüssing <linus.luessing@c0d3.blue>
Date: Sat, 1 Jan 2022 06:27:13 +0100
Subject: batman-adv: mcast: don't send link-local multicast to mcast routers
The addition of routable multicast TX handling introduced a
bug/regression for packets with a link-local multicast destination:
These packets would be sent to all batman-adv nodes with a multicast
router and to all batman-adv nodes with an old version without multicast
router detection.
This even disregards the batman-adv multicast fanout setting, which can
potentially lead to an unwanted, high number of unicast transmissions or
even congestion.
Fixing this by avoiding to send link-local multicast packets to nodes in
the multicast router list.
Fixes: 3a8df00cd969 ("batman-adv: mcast: apply optimizations for routable packets, too")
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/ee013870947b9175847aa46a0686ca01dd480af4
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -1380,6 +1380,7 @@ batadv_mcast_forw_rtr_node_get(struct ba
* @bat_priv: the bat priv with all the soft interface information
* @skb: The multicast packet to check
* @orig: an originator to be set to forward the skb to
+ * @is_routable: stores whether the destination is routable
*
* Return: the forwarding mode as enum batadv_forw_mode and in case of
* BATADV_FORW_SINGLE set the orig to the single originator the skb
@@ -1387,17 +1388,16 @@ batadv_mcast_forw_rtr_node_get(struct ba
*/
enum batadv_forw_mode
batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
- struct batadv_orig_node **orig)
+ struct batadv_orig_node **orig, int *is_routable)
{
int ret, tt_count, ip_count, unsnoop_count, total_count;
bool is_unsnoopable = false;
unsigned int mcast_fanout;
struct ethhdr *ethhdr;
- int is_routable = 0;
int rtr_count = 0;
ret = batadv_mcast_forw_mode_check(bat_priv, skb, &is_unsnoopable,
- &is_routable);
+ is_routable);
if (ret == -ENOMEM)
return BATADV_FORW_NONE;
else if (ret < 0)
@@ -1410,7 +1410,7 @@ batadv_mcast_forw_mode(struct batadv_pri
ip_count = batadv_mcast_forw_want_all_ip_count(bat_priv, ethhdr);
unsnoop_count = !is_unsnoopable ? 0 :
atomic_read(&bat_priv->mcast.num_want_all_unsnoopables);
- rtr_count = batadv_mcast_forw_rtr_count(bat_priv, is_routable);
+ rtr_count = batadv_mcast_forw_rtr_count(bat_priv, *is_routable);
total_count = tt_count + ip_count + unsnoop_count + rtr_count;
@@ -1730,6 +1730,7 @@ batadv_mcast_forw_want_rtr(struct batadv
* @bat_priv: the bat priv with all the soft interface information
* @skb: the multicast packet to transmit
* @vid: the vlan identifier
+ * @is_routable: stores whether the destination is routable
*
* Sends copies of a frame with multicast destination to any node that signaled
* interest in it, that is either via the translation table or the according
@@ -1742,7 +1743,7 @@ batadv_mcast_forw_want_rtr(struct batadv
* is neither IPv4 nor IPv6. NET_XMIT_SUCCESS otherwise.
*/
int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
- unsigned short vid)
+ unsigned short vid, int is_routable)
{
int ret;
@@ -1758,12 +1759,16 @@ int batadv_mcast_forw_send(struct batadv
return ret;
}
+ if (!is_routable)
+ goto skip_mc_router;
+
ret = batadv_mcast_forw_want_rtr(bat_priv, skb, vid);
if (ret != NET_XMIT_SUCCESS) {
kfree_skb(skb);
return ret;
}
+skip_mc_router:
consume_skb(skb);
return ret;
}
--- a/net/batman-adv/multicast.h
+++ b/net/batman-adv/multicast.h
@@ -43,7 +43,8 @@ enum batadv_forw_mode {
enum batadv_forw_mode
batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
- struct batadv_orig_node **mcast_single_orig);
+ struct batadv_orig_node **mcast_single_orig,
+ int *is_routable);
int batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
struct sk_buff *skb,
@@ -51,7 +52,7 @@ int batadv_mcast_forw_send_orig(struct b
struct batadv_orig_node *orig_node);
int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
- unsigned short vid);
+ unsigned short vid, int is_routable);
void batadv_mcast_init(struct batadv_priv *bat_priv);
@@ -68,7 +69,8 @@ void batadv_mcast_purge_orig(struct bata
static inline enum batadv_forw_mode
batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
- struct batadv_orig_node **mcast_single_orig)
+ struct batadv_orig_node **mcast_single_orig,
+ int *is_routable)
{
return BATADV_FORW_ALL;
}
@@ -85,7 +87,7 @@ batadv_mcast_forw_send_orig(struct batad
static inline int
batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
- unsigned short vid)
+ unsigned short vid, int is_routable)
{
kfree_skb(skb);
return NET_XMIT_DROP;
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -198,6 +198,7 @@ static netdev_tx_t batadv_interface_tx(s
int gw_mode;
enum batadv_forw_mode forw_mode = BATADV_FORW_SINGLE;
struct batadv_orig_node *mcast_single_orig = NULL;
+ int mcast_is_routable = 0;
int network_offset = ETH_HLEN;
__be16 proto;
@@ -300,7 +301,8 @@ static netdev_tx_t batadv_interface_tx(s
send:
if (do_bcast && !is_broadcast_ether_addr(ethhdr->h_dest)) {
forw_mode = batadv_mcast_forw_mode(bat_priv, skb,
- &mcast_single_orig);
+ &mcast_single_orig,
+ &mcast_is_routable);
if (forw_mode == BATADV_FORW_NONE)
goto dropped;
@@ -365,7 +367,8 @@ send:
ret = batadv_mcast_forw_send_orig(bat_priv, skb, vid,
mcast_single_orig);
} else if (forw_mode == BATADV_FORW_SOME) {
- ret = batadv_mcast_forw_send(bat_priv, skb, vid);
+ ret = batadv_mcast_forw_send(bat_priv, skb, vid,
+ mcast_is_routable);
} else {
if (batadv_dat_snoop_outgoing_arp_request(bat_priv,
skb))

View File

@@ -0,0 +1,56 @@
From: Sven Eckelmann <sven@narfation.org>
Date: Tue, 18 May 2021 19:47:14 +0200
Subject: Revert "batman-adv: Migrate to linux/prandom.h"
This reverts commit fe773e9e389a763f38539de3d4782b628676ac99.
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 680def809838097a9949de1dc9861923911f3d04..97000fe0ae2cebd9dc2fdf02c30faa1caa36a6c8 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -27,7 +27,6 @@
#include <linux/netdevice.h>
#include <linux/netlink.h>
#include <linux/pkt_sched.h>
-#include <linux/prandom.h>
#include <linux/printk.h>
#include <linux/random.h>
#include <linux/rculist.h>
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index 4d8e3fdb4427a431cab903bc8a20edb816079fd7..3b3c890870ee6941c337ce820f661f216a819161 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -20,7 +20,6 @@
#include <linux/kref.h>
#include <linux/netdevice.h>
#include <linux/nl80211.h>
-#include <linux/prandom.h>
#include <linux/random.h>
#include <linux/rculist.h>
#include <linux/rcupdate.h>
diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c
index 89ba88322c9c11acc49a9dcd9877ad8767fe713b..cb0bce3774898884b399dd0eb5ba4e03364a2fdd 100644
--- a/net/batman-adv/bat_v_ogm.c
+++ b/net/batman-adv/bat_v_ogm.c
@@ -20,7 +20,6 @@
#include <linux/lockdep.h>
#include <linux/mutex.h>
#include <linux/netdevice.h>
-#include <linux/prandom.h>
#include <linux/random.h>
#include <linux/rculist.h>
#include <linux/rcupdate.h>
diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c
index 4bb76b434d0711dd67b8521e05c64772b4c48434..aceb1b2bb04db385f40deb94dd78901312150a17 100644
--- a/net/batman-adv/network-coding.c
+++ b/net/batman-adv/network-coding.c
@@ -25,8 +25,8 @@
#include <linux/lockdep.h>
#include <linux/net.h>
#include <linux/netdevice.h>
-#include <linux/prandom.h>
#include <linux/printk.h>
+#include <linux/random.h>
#include <linux/rculist.h>
#include <linux/rcupdate.h>
#include <linux/skbuff.h>

View File

@@ -0,0 +1,125 @@
/* Please avoid adding hacks here - instead add it to mac80211/backports.git */
#undef CONFIG_MODULE_STRIPPED
#include <linux/version.h> /* LINUX_VERSION_CODE */
#include <linux/types.h>
#if LINUX_VERSION_IS_LESS(5, 10, 0)
#include <linux/if_bridge.h>
struct batadv_br_ip {
union {
__be32 ip4;
#if IS_ENABLED(CONFIG_IPV6)
struct in6_addr ip6;
#endif
} dst;
__be16 proto;
__u16 vid;
};
struct batadv_br_ip_list {
struct list_head list;
struct batadv_br_ip addr;
};
#if 0
/* "static" dropped to force compiler to evaluate it as part of multicast.c
* might need to be added again and then called in some kind of dummy
* compat.c in case this header is included in multiple files.
*/
inline void __batadv_br_ip_list_check(void)
{
BUILD_BUG_ON(sizeof(struct batadv_br_ip_list) != sizeof(struct br_ip_list));
BUILD_BUG_ON(offsetof(struct batadv_br_ip_list, list) != offsetof(struct br_ip_list, list));
BUILD_BUG_ON(offsetof(struct batadv_br_ip_list, addr) != offsetof(struct br_ip_list, addr));
BUILD_BUG_ON(sizeof(struct batadv_br_ip) != sizeof(struct br_ip));
BUILD_BUG_ON(offsetof(struct batadv_br_ip, dst.ip4) != offsetof(struct br_ip, u.ip4));
BUILD_BUG_ON(offsetof(struct batadv_br_ip, dst.ip6) != offsetof(struct br_ip, u.ip6));
BUILD_BUG_ON(offsetof(struct batadv_br_ip, proto) != offsetof(struct br_ip, proto));
BUILD_BUG_ON(offsetof(struct batadv_br_ip, vid) != offsetof(struct br_ip, vid));
}
#endif
#define br_ip batadv_br_ip
#define br_ip_list batadv_br_ip_list
#endif /* LINUX_VERSION_IS_LESS(5, 10, 0) */
/* <DECLARE_EWMA> */
#include <linux/version.h>
#include_next <linux/average.h>
#include <linux/bug.h>
#ifdef DECLARE_EWMA
#undef DECLARE_EWMA
#endif /* DECLARE_EWMA */
/*
* Exponentially weighted moving average (EWMA)
*
* This implements a fixed-precision EWMA algorithm, with both the
* precision and fall-off coefficient determined at compile-time
* and built into the generated helper funtions.
*
* The first argument to the macro is the name that will be used
* for the struct and helper functions.
*
* The second argument, the precision, expresses how many bits are
* used for the fractional part of the fixed-precision values.
*
* The third argument, the weight reciprocal, determines how the
* new values will be weighed vs. the old state, new values will
* get weight 1/weight_rcp and old values 1-1/weight_rcp. Note
* that this parameter must be a power of two for efficiency.
*/
#define DECLARE_EWMA(name, _precision, _weight_rcp) \
struct ewma_##name { \
unsigned long internal; \
}; \
static inline void ewma_##name##_init(struct ewma_##name *e) \
{ \
BUILD_BUG_ON(!__builtin_constant_p(_precision)); \
BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \
/* \
* Even if you want to feed it just 0/1 you should have \
* some bits for the non-fractional part... \
*/ \
BUILD_BUG_ON((_precision) > 30); \
BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \
e->internal = 0; \
} \
static inline unsigned long \
ewma_##name##_read(struct ewma_##name *e) \
{ \
BUILD_BUG_ON(!__builtin_constant_p(_precision)); \
BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \
BUILD_BUG_ON((_precision) > 30); \
BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \
return e->internal >> (_precision); \
} \
static inline void ewma_##name##_add(struct ewma_##name *e, \
unsigned long val) \
{ \
unsigned long internal = READ_ONCE(e->internal); \
unsigned long weight_rcp = ilog2(_weight_rcp); \
unsigned long precision = _precision; \
\
BUILD_BUG_ON(!__builtin_constant_p(_precision)); \
BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \
BUILD_BUG_ON((_precision) > 30); \
BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \
\
WRITE_ONCE(e->internal, internal ? \
(((internal << weight_rcp) - internal) + \
(val << precision)) >> weight_rcp : \
(val << precision)); \
}
/* </DECLARE_EWMA> */

View File

@@ -0,0 +1,216 @@
#include <linux/version.h> /* LINUX_VERSION_CODE */
#include <linux/types.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
#define dev_get_iflink(_net_dev) ((_net_dev)->iflink)
#endif /* < KERNEL_VERSION(4, 1, 0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
#include <linux/netdevice.h>
#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info, extack) ({\
BUILD_BUG_ON(upper_priv != NULL); \
BUILD_BUG_ON(upper_info != NULL); \
BUILD_BUG_ON(extack != NULL); \
netdev_master_upper_dev_link(dev, upper_dev); \
})
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
#include <linux/netdevice.h>
#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info, extack) ({\
BUILD_BUG_ON(extack != NULL); \
netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info); \
})
#endif /* < KERNEL_VERSION(4, 5, 0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
/* wild hack for batadv_getlink_net only */
#define get_link_net get_xstats_size || 1 ? fallback_net : (struct net*)netdev->rtnl_link_ops->get_xstats_size
#endif /* < KERNEL_VERSION(4, 0, 0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
struct sk_buff *skb_checksum_trimmed(struct sk_buff *skb,
unsigned int transport_len,
__sum16(*skb_chkf)(struct sk_buff *skb));
int ip_mc_check_igmp(struct sk_buff *skb);
int ipv6_mc_check_mld(struct sk_buff *skb);
#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
#include_next <linux/igmp.h>
#include_next <net/addrconf.h>
static inline int batadv_ip_mc_check_igmp1(struct sk_buff *skb)
{
return ip_mc_check_igmp(skb, NULL);
}
static inline int batadv_ip_mc_check_igmp2(struct sk_buff *skb,
struct sk_buff **skb_trimmed)
{
return ip_mc_check_igmp(skb, skb_trimmed);
}
#define ip_mc_check_igmp_get(_1, _2, ip_mc_check_igmp_name, ...) ip_mc_check_igmp_name
#define ip_mc_check_igmp(...) \
ip_mc_check_igmp_get(__VA_ARGS__, batadv_ip_mc_check_igmp2, batadv_ip_mc_check_igmp1)(__VA_ARGS__)
#endif /* < KERNEL_VERSION(4, 2, 0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
#define IFF_NO_QUEUE 0; dev->tx_queue_len = 0
static inline bool hlist_fake(struct hlist_node *h)
{
return h->pprev == &h->next;
}
#endif /* < KERNEL_VERSION(4, 3, 0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
#include <linux/ethtool.h>
#define ethtool_link_ksettings batadv_ethtool_link_ksettings
struct batadv_ethtool_link_ksettings {
struct {
__u32 speed;
__u8 duplex;
__u8 autoneg;
} base;
};
#define __ethtool_get_link_ksettings(__dev, __link_settings) \
batadv_ethtool_get_link_ksettings(__dev, __link_settings)
static inline int
batadv_ethtool_get_link_ksettings(struct net_device *dev,
struct ethtool_link_ksettings *link_ksettings)
{
struct ethtool_cmd cmd;
int ret;
memset(&cmd, 0, sizeof(cmd));
ret = __ethtool_get_settings(dev, &cmd);
if (ret != 0)
return ret;
link_ksettings->base.duplex = cmd.duplex;
link_ksettings->base.speed = ethtool_cmd_speed(&cmd);
link_ksettings->base.autoneg = cmd.autoneg;
return 0;
}
#endif /* < KERNEL_VERSION(4, 6, 0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
#include_next <linux/cache.h>
/* hack for netlink.c which marked the family ops as ro */
#ifdef __ro_after_init
#undef __ro_after_init
#endif
#define __ro_after_init
#endif /* < KERNEL_VERSION(4, 10, 0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 9)
#include <linux/netdevice.h>
/* work around missing attribute needs_free_netdev and priv_destructor in
* net_device
*/
#define ether_setup(dev) \
void batadv_softif_free2(struct net_device *dev) \
{ \
batadv_softif_free(dev); \
free_netdev(dev); \
} \
void (*t1)(struct net_device *dev) __attribute__((unused)); \
bool t2 __attribute__((unused)); \
ether_setup(dev)
#define needs_free_netdev destructor = batadv_softif_free2; t2
#define priv_destructor destructor = batadv_softif_free2; t1
#endif /* < KERNEL_VERSION(4, 11, 9) */
#if LINUX_VERSION_IS_LESS(4, 13, 0)
#define batadv_softif_validate(__tb, __data, __extack) \
batadv_softif_validate(__tb, __data)
#define batadv_softif_newlink(__src_net, __dev, __tb, __data, __extack) \
batadv_softif_newlink(__src_net, __dev, __tb, __data)
#endif /* LINUX_VERSION_IS_LESS(4, 13, 0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
#define batadv_softif_slave_add(__dev, __slave_dev, __extack) \
batadv_softif_slave_add(__dev, __slave_dev)
#endif /* < KERNEL_VERSION(4, 15, 0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
#ifndef sizeof_field
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
#endif
#endif /* < KERNEL_VERSION(4, 16, 0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
static inline int batadv_access_ok(int type, const void __user *p,
unsigned long size)
{
return access_ok(type, p, size);
}
#ifdef access_ok
#undef access_ok
#endif
#define access_ok_get(_1, _2, _3 , access_ok_name, ...) access_ok_name
#define access_ok(...) \
access_ok_get(__VA_ARGS__, access_ok3, access_ok2)(__VA_ARGS__)
#define access_ok2(addr, size) batadv_access_ok(VERIFY_WRITE, (addr), (size))
#define access_ok3(type, addr, size) batadv_access_ok((type), (addr), (size))
#endif /* < KERNEL_VERSION(5, 0, 0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
#ifndef fallthrough
#if __GNUC__ > 7 && !defined(__CHECKER__)
# define fallthrough __attribute__((__fallthrough__))
#else
# define fallthrough do {} while (0) /* fallthrough */
#endif
#endif
#endif /* < KERNEL_VERSION(5, 4, 0) */

View File

@@ -1,13 +0,0 @@
Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/nss.c
===================================================================
--- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/nss.c
+++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/nss.c
@@ -15,6 +15,8 @@
#include "wmi.h"
#include "../../../../../net/mac80211/sta_info.h"
+#include <linux/of.h>
+
enum nss_wifi_mesh_mpp_learning_mode mpp_mode = NSS_WIFI_MESH_MPP_LEARNING_MODE_INDEPENDENT_NSS;
LIST_HEAD(mesh_vaps);

View File

@@ -1,382 +0,0 @@
From aa2f204ed12b5543aa5f1dfb2b1bb6b458a9dba5 Mon Sep 17 00:00:00 2001
From: Tamizh Chelvam <tamizhr@codeaurora.org>
Date: Thu, 27 May 2021 17:24:24 +0530
Subject: [PATCH 2/2] ath1k: Fix kernel API related compilation error
Signed-off-by: Tamizh Chelvam <tamizhr@codeaurora.org>
---
drivers/net/wireless/ath/ath11k/ahb.c | 53 +++++++-----------------------
drivers/net/wireless/ath/ath11k/ce.c | 7 ++++
drivers/net/wireless/ath/ath11k/core.h | 5 ++-
drivers/net/wireless/ath/ath11k/coredump.c | 4 +++
drivers/net/wireless/ath/ath11k/debugfs.c | 1 +
drivers/net/wireless/ath/ath11k/pci.c | 50 ++++------------------------
drivers/net/wireless/ath/ath11k/pci.h | 2 --
drivers/net/wireless/ath/ath11k/pktlog.c | 8 +++++
drivers/net/wireless/ath/ath11k/qmi.c | 14 ++++----
9 files changed, 46 insertions(+), 98 deletions(-)
--- a/drivers/net/wireless/ath/ath11k/ahb.c
+++ b/drivers/net/wireless/ath/ath11k/ahb.c
@@ -14,7 +14,6 @@
#include "qmi.h"
#include "pci.h"
#include <linux/remoteproc.h>
-#include <soc/qcom/qgic2m.h>
static const struct of_device_id ath11k_ahb_of_match[] = {
/* TODO: Should we change the compatible string to something similar
@@ -610,55 +609,21 @@ static int ath11k_ahb_ext_irq_config(str
static void ath11k_internal_pci_free_irq(struct ath11k_base *ab)
{
ath11k_pci_free_irq(ab);
- qgic2_disable_msi(ab->ipci.qgicm_id);
-}
-
-struct qgic2_msi *ath11k_qgic2_enable_msi(struct ath11k_base *ab, int qgicm_id)
-{
- struct qgic2_msi *qgic2_msi;
-
- ab->ipci.msi_cfg = &ath11k_msi_config[ATH11K_MSI_CONFIG_QCN6122];
- qgic2_msi = qgic2_enable_msi(qgicm_id,
- ab->ipci.msi_cfg->total_vectors);
- if (IS_ERR(qgic2_msi)) {
- ath11k_err(ab, "qgic2_enable_msi fails %ld\n", PTR_ERR(qgic2_msi));
- return NULL;
- }
-
- return qgic2_msi;
}
static int ath11k_config_irq_internal_pci(struct ath11k_base *ab)
{
int ret;
- if (ab->userpd_id == QCN6122_USERPD_0) {
- ab->ipci.qgicm_id = APCS_QGIC2M_0;
- } else if (ab->userpd_id == QCN6122_USERPD_1) {
- ab->ipci.qgicm_id = APCS_QGIC2M_1;
- } else {
+ if (ab->userpd_id != QCN6122_USERPD_0 &&
+ ab->userpd_id != QCN6122_USERPD_1) {
ath11k_warn(ab, "ath11k userpd invalid %d\n", ab->userpd_id);
return -ENODEV;
}
- ab->ipci.qgic2_msi =
- ath11k_qgic2_enable_msi(ab, ab->ipci.qgicm_id);
- if (!ab->ipci.qgic2_msi) {
- ath11k_err(ab, "qgic2_msi fails: dev %d\n", ab->hw_rev);
- return -ENODEV;
- }
- ab->ipci.qgic_enabled = 1;
- wake_up(&ab->ipci.qgic_msi_waitq);
+ ab->ipci.gic_enabled = 1;
+ wake_up(&ab->ipci.gic_msi_waitq);
- /* qcn6122 is seen as ahb based device by driver but internallly it is pci
- * Hence configuring pci irq for qcn6122
- */
- ret = ath11k_pci_config_qgic_msi_irq(ab);
- if (ret) {
- ath11k_err(ab, "internal pci msi configuration failed: dev %d\n",
- ab->hw_rev);
- qgic2_disable_msi(ab->ipci.qgicm_id);
- }
return ret;
}
@@ -772,18 +737,20 @@ static const struct ath11k_hif_ops ath11
.config_static_window = ath11k_pci_config_static_window,
.free_irq = ath11k_internal_pci_free_irq,
.config_irq = ath11k_config_irq_internal_pci,
- .get_msi_irq = ath11k_pci_get_qgic_msi_irq,
};
static int ath11k_core_get_rproc(struct ath11k_base *ab)
{
struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab);
struct device *dev = ab->dev;
+#if LINUX_VERSION_IS_LESS(5,4,0)
+ bool multi_pd_arch;
const char *name;
+#endif
struct rproc *prproc;
phandle rproc_phandle;
- bool multi_pd_arch;
+#if LINUX_VERSION_IS_LESS(5,4,0)
multi_pd_arch = of_property_read_bool(dev->of_node, "qcom,multipd_arch");
if (multi_pd_arch) {
if (of_property_read_string(dev->of_node, "qcom,userpd-subsys-name", &name))
@@ -795,6 +762,7 @@ static int ath11k_core_get_rproc(struct
return -EINVAL;
}
} else {
+#endif
if (of_property_read_u32(dev->of_node, "qcom,rproc", &rproc_phandle)) {
ath11k_err(ab, "failed to get q6_rproc handle\n");
return -ENOENT;
@@ -805,7 +773,9 @@ static int ath11k_core_get_rproc(struct
ath11k_err(ab, "failed to get rproc\n");
return -EINVAL;
}
+#if LINUX_VERSION_IS_LESS(5,4,0)
}
+#endif
ab_ahb->tgt_rproc = prproc;
--- a/drivers/net/wireless/ath/ath11k/ce.c
+++ b/drivers/net/wireless/ath/ath11k/ce.c
@@ -1107,10 +1107,17 @@ void ce_update_tasklet_time_duration_sta
{
s64 sched_us, exec_us;
+#if LINUX_VERSION_IS_LESS(5,4,0)
sched_us = (ce_pipe->tasklet_ts.exec_entry_ts.tv64 -
ce_pipe->tasklet_ts.sched_entry_ts.tv64);
exec_us = (ce_pipe->tasklet_ts.exec_complete_ts.tv64 -
ce_pipe->tasklet_ts.exec_entry_ts.tv64);
+#elif LINUX_VERSION_IS_GEQ(5,4,0)
+ sched_us = (ce_pipe->tasklet_ts.exec_entry_ts -
+ ce_pipe->tasklet_ts.sched_entry_ts);
+ exec_us = (ce_pipe->tasklet_ts.exec_complete_ts -
+ ce_pipe->tasklet_ts.exec_entry_ts);
+#endif
sched_us = div_s64(sched_us, CE_TIME_DURATION_USEC * NSEC_PER_USEC);
if (sched_us > CE_TIME_DURATION_USEC_500) {
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -848,10 +848,9 @@ struct ath11k_num_vdevs_peers {
struct ath11k_internal_pci {
int qgicm_id;
- bool qgic_enabled;
- struct qgic2_msi *qgic2_msi;
const struct ath11k_msi_config *msi_cfg;
- wait_queue_head_t qgic_msi_waitq;
+ bool gic_enabled;
+ wait_queue_head_t gic_msi_waitq;
};
struct ath11k_memory_stats {
--- a/drivers/net/wireless/ath/ath11k/coredump.c
+++ b/drivers/net/wireless/ath/ath11k/coredump.c
@@ -174,7 +174,11 @@ void ath11k_coredump_download_rddm(struc
struct ath11k_dump_segment *segment, *seg_info;
int i, rem_seg_cnt = 0, len, num_seg, seg_sz, qdss_seg_cnt = 1;
+#if LINUX_VERSION_IS_LESS(5,4,0)
mhi_download_rddm_img(mhi_ctrl, false);
+#elif LINUX_VERSION_IS_GEQ(5,4,0)
+ mhi_download_rddm_image(mhi_ctrl, false);
+#endif
rddm_img = mhi_ctrl->rddm_image;
fw_img = mhi_ctrl->fbc_image;
--- a/drivers/net/wireless/ath/ath11k/debugfs.c
+++ b/drivers/net/wireless/ath/ath11k/debugfs.c
@@ -2,6 +2,7 @@
/*
* Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
*/
+#include <linux/of.h>
#include "debugfs.h"
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -14,7 +14,6 @@
#include "debug.h"
#include "qmi.h"
#include <linux/of.h>
-#include <soc/qcom/qgic2m.h>
#define ATH11K_PCI_BAR_NUM 0
@@ -438,23 +437,6 @@ static void ath11k_pci_sw_reset(struct a
#define MAX_MSI_IRQS 32
-int ath11k_pci_get_qgic_msi_irq(struct ath11k_base *ab, unsigned int vector)
-{
- struct qgic2_msi *qgic2_msi = ab->ipci.qgic2_msi;
-
- if (!qgic2_msi) {
- ath11k_err(ab, "qgic2_msi is NULL\n");
- return -EINVAL;
- }
-
- if (vector >= MAX_MSI_IRQS) {
- ath11k_err(ab, "irq vector greater than MAX MSI IRQ\n");
- return -EINVAL;
- }
- return qgic2_msi->msi[vector];
-}
-EXPORT_SYMBOL(ath11k_pci_get_qgic_msi_irq);
-
int ath11k_pci_get_msi_irq(struct ath11k_base *ab, unsigned int vector)
{
struct device *dev = ab->dev;
@@ -483,13 +465,7 @@ void ath11k_pci_get_msi_address(struct a
void ath11k_pci_get_qgic_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo,
u32 *msi_addr_hi)
{
- struct qgic2_msi *qgic2_msi = ab->ipci.qgic2_msi;
-
- if (!qgic2_msi) {
- ath11k_err(ab, "qgic2_msi is NULL\n");
- return;
- }
- *msi_addr_lo = qgic2_msi->msi_gicm_addr;
+ *msi_addr_lo = 0;
*msi_addr_hi = 0;
}
EXPORT_SYMBOL(ath11k_pci_get_qgic_msi_address);
@@ -557,13 +533,7 @@ int ath11k_get_user_qgic_msi_assignment(
int *num_vectors, u32 *user_base_data,
u32 *base_vector)
{
- struct qgic2_msi *qgic2_msi = ab->ipci.qgic2_msi;
- struct ath11k_msi_config *msi_cfg = ab->ipci.msi_cfg;
-
- return ath11k_pci_get_user_msi_assignment(ab, msi_cfg,
- qgic2_msi->msi_gicm_base, user_name,
- num_vectors, user_base_data,
- base_vector);
+ return 0;
}
EXPORT_SYMBOL(ath11k_get_user_qgic_msi_assignment);
@@ -974,7 +944,11 @@ static int ath11k_pci_enable_msi(struct
num_vectors = pci_alloc_irq_vectors(ab_pci->pdev,
msi_config->total_vectors,
msi_config->total_vectors,
+#if LINUX_VERSION_IS_LESS(5,4,0)
PCI_IRQ_NOMSIX);
+#elif LINUX_VERSION_IS_GEQ(5,4,0)
+ PCI_IRQ_LEGACY|PCI_IRQ_MSI);
+#endif
if (num_vectors != msi_config->total_vectors) {
ath11k_err(ab, "failed to get %d MSI vectors, only %d available",
msi_config->total_vectors, num_vectors);
@@ -1313,18 +1287,6 @@ static const struct ath11k_hif_ops ath11
.get_msi_irq = ath11k_pci_get_msi_irq,
};
-int ath11k_pci_config_qgic_msi_irq(struct ath11k_base *ab)
-{
- int ret = 0;
- struct qgic2_msi *qgic2_msi = ab->ipci.qgic2_msi;
- struct ath11k_msi_config *msi_cfg = ab->ipci.msi_cfg;
-
- ret = ath11k_config_msi_irq(ab, msi_cfg,
- qgic2_msi->msi_gicm_base);
- return ret;
-}
-EXPORT_SYMBOL(ath11k_pci_config_qgic_msi_irq);
-
static int ath11k_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *pci_dev)
{
--- a/drivers/net/wireless/ath/ath11k/pci.h
+++ b/drivers/net/wireless/ath/ath11k/pci.h
@@ -169,7 +169,6 @@ int ath11k_pci_get_user_msi_assignment(s
int ath11k_pci_get_msi_irq(struct ath11k_base *ab, unsigned int vector);
void ath11k_pci_write32(struct ath11k_base *ab, u32 offset, u32 value);
u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offset);
-int ath11k_pci_config_qgic_msi_irq(struct ath11k_base *ab);
int ath11k_pci_start(struct ath11k_base *ab);
void ath11k_pci_stop(struct ath11k_base *ab);
void ath11k_pci_ext_irq_enable(struct ath11k_base *ab);
@@ -187,7 +186,6 @@ void ath11k_pci_get_ce_msi_idx(struct at
u32 *msi_idx);
void ath11k_pci_config_static_window(struct ath11k_base *ab);
void ath11k_pci_free_irq(struct ath11k_base *ab);
-int ath11k_pci_get_qgic_msi_irq(struct ath11k_base *ab, unsigned int vector);
int ath11k_ipci_start(struct ath11k_base *ab);
void ath11k_ipci_write32(struct ath11k_base *ab, u32 offset, u32 value);
u32 ath11k_ipci_read32(struct ath11k_base *ab, u32 offset);
--- a/drivers/net/wireless/ath/ath11k/pktlog.c
+++ b/drivers/net/wireless/ath/ath11k/pktlog.c
@@ -157,7 +157,11 @@ static char *ath_pktlog_getbuf(struct at
static int pktlog_pgfault(struct vm_area_struct *vma, struct vm_fault *vmf)
{
+#if LINUX_VERSION_IS_LESS(5,4,0)
unsigned long address = (unsigned long)vmf->virtual_address;
+#elif LINUX_VERSION_IS_GEQ(5,4,0)
+ unsigned long address = vmf->address;
+#endif
if (address == 0UL)
return VM_FAULT_NOPAGE;
@@ -167,7 +171,11 @@ static int pktlog_pgfault(struct vm_are
get_page(virt_to_page(address));
vmf->page = virt_to_page(address);
+#if LINUX_VERSION_IS_LESS(5,4,0)
return VM_FAULT_MINOR;
+#elif LINUX_VERSION_IS_GEQ(5,4,0)
+ return 0;
+#endif
}
static struct vm_operations_struct pktlog_vmops = {
--- a/drivers/net/wireless/ath/ath11k/qmi.c
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
@@ -4408,18 +4408,18 @@ static const struct qmi_ops ath11k_qmi_o
.del_server = ath11k_qmi_ops_del_server,
};
-static int ath11k_wait_for_qgic_msi(struct ath11k_base *ab)
+static int ath11k_wait_for_gic_msi(struct ath11k_base *ab)
{
int timeout;
if (ab->hw_rev != ATH11K_HW_QCN6122)
return 0;
- timeout = wait_event_timeout(ab->ipci.qgic_msi_waitq,
- (ab->ipci.qgic_enabled == 1),
- ATH11K_RCV_QGIC_MSI_HDLR_DELAY);
+ timeout = wait_event_timeout(ab->ipci.gic_msi_waitq,
+ (ab->ipci.gic_enabled == 1),
+ ATH11K_RCV_GIC_MSI_HDLR_DELAY);
if (timeout <= 0) {
- ath11k_warn(ab, "Receive qgic msi handler timed out\n");
+ ath11k_warn(ab, "Receive gic msi handler timed out\n");
return -ETIMEDOUT;
}
return 0;
@@ -4478,7 +4478,7 @@ static void ath11k_qmi_driver_event_work
clear_bit(ATH11K_FLAG_CRASH_FLUSH,
&ab->dev_flags);
clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
- ret = ath11k_wait_for_qgic_msi(ab);
+ ret = ath11k_wait_for_gic_msi(ab);
if (ret) {
ath11k_warn(ab,
"Failed to get qgic handler for dev %d ret: %d\n",
@@ -4607,7 +4607,7 @@ int ath11k_qmi_init_service(struct ath11
destroy_workqueue(ab->qmi.event_wq);
return ret;
}
- init_waitqueue_head(&ab->ipci.qgic_msi_waitq);
+ init_waitqueue_head(&ab->ipci.gic_msi_waitq);
return ret;
}
--- a/drivers/net/wireless/ath/ath11k/qmi.h
+++ b/drivers/net/wireless/ath/ath11k/qmi.h
@@ -63,7 +63,7 @@
#define QCN6122_USERPD_0 1
#define QCN6122_USERPD_1 2
#define QCN6122_DEVICE_BAR_SIZE 0x200000
-#define ATH11K_RCV_QGIC_MSI_HDLR_DELAY (3 * HZ)
+#define ATH11K_RCV_GIC_MSI_HDLR_DELAY (3 * HZ)
struct ath11k_base;
extern unsigned int ath11k_host_ddr_addr;

View File

@@ -1,349 +0,0 @@
From 0459a4506b6655cd72a876b5296b223134dc3874 Mon Sep 17 00:00:00 2001
From: Tamizh Chelvam <tamizhr@codeaurora.org>
Date: Wed, 26 May 2021 11:27:25 +0530
Subject: [PATCH] ath11k: Use gic irq related api for irq allocation
Use latest GIC irq related API for allocate and request irq
for the radio.
Signed-off-by: Tamizh Chelvam <tamizhr@codeaurora.org>
---
drivers/net/wireless/ath/ath11k/ahb.c | 87 +++++++++++++++++++++++++++-
drivers/net/wireless/ath/ath11k/ce.c | 10 +++-
drivers/net/wireless/ath/ath11k/ce.h | 1 +
drivers/net/wireless/ath/ath11k/core.h | 5 ++
drivers/net/wireless/ath/ath11k/dp.c | 15 ++++-
drivers/net/wireless/ath/ath11k/mhi.c | 1 -
drivers/net/wireless/ath/ath11k/pci.c | 102 ++++++++++++++++++++++++++++++++-
drivers/net/wireless/ath/ath11k/pci.h | 5 ++
8 files changed, 218 insertions(+), 8 deletions(-)
--- a/drivers/net/wireless/ath/ath11k/ahb.c
+++ b/drivers/net/wireless/ath/ath11k/ahb.c
@@ -608,12 +608,26 @@ static int ath11k_ahb_ext_irq_config(str
static void ath11k_internal_pci_free_irq(struct ath11k_base *ab)
{
+ struct platform_device *pdev = ab->pdev;
+
ath11k_pci_free_irq(ab);
+ platform_msi_domain_free_irqs(&pdev->dev);
+}
+
+static void ath11k_gicv2m_msg_handler(struct msi_desc *desc, struct msi_msg *msg)
+{
+ desc->msg.address_lo = msg->address_lo;
+ desc->msg.address_hi = msg->address_hi;
+ desc->msg.data = msg->data;
}
static int ath11k_config_irq_internal_pci(struct ath11k_base *ab)
{
int ret;
+ struct platform_device *pdev = ab->pdev;
+ struct msi_desc *msi_desc;
+ bool ce_done = false;
+ int i = 0;
if (ab->userpd_id != QCN6122_USERPD_0 &&
ab->userpd_id != QCN6122_USERPD_1) {
@@ -621,6 +635,74 @@ static int ath11k_config_irq_internal_pc
return -ENODEV;
}
+ ab->ipci.msi_cfg = &ath11k_msi_config[ATH11K_MSI_CONFIG_QCN6122];
+
+ ret = platform_msi_domain_alloc_irqs(&pdev->dev, ab->ipci.msi_cfg->total_vectors,
+ ath11k_gicv2m_msg_handler);
+ if (ret) {
+ ath11k_warn(ab, "failed to alloc irqs %d ab %pM\n", ret, ab);
+ return ret;
+ }
+
+ for_each_msi_entry(msi_desc, &pdev->dev) {
+ if (!ce_done && i == ab->hw_params.ce_count) {
+ i = 0;
+ ce_done = true;
+ }
+
+ if (!ce_done && i < ab->hw_params.ce_count) {
+ if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR)
+ i++;
+
+ ret = ath11k_pci_config_gic_msi_irq(ab, pdev, msi_desc, i);
+ if (ret) {
+ ath11k_warn(ab, "failed to request irq %d\n", ret);
+ return ret;
+ }
+ } else {
+ ret = ath11k_pci_ext_config_gic_msi_irq(ab, pdev, msi_desc, i);
+ if (ret) {
+ ath11k_warn(ab, "failed to config ext msi irq %d\n", ret);
+ return ret;
+ }
+ }
+
+ i++;
+ ab->ipci.address_lo = msi_desc->msg.address_lo;
+ ab->ipci.address_hi = msi_desc->msg.address_hi;
+
+ if (i == 0 && !ce_done)
+ ab->ipci.gic_ep_base_data = msi_desc->msg.data;
+
+ }
+
+ for_each_msi_entry(msi_desc, &pdev->dev) {
+ u32 user_base_data = 0, base_vector = 0;
+ int vector, num_vectors = 0;
+
+ ret = ath11k_pci_get_user_msi_assignment(ab, ab->ipci.msi_cfg, 0,
+ "DP", &num_vectors, &user_base_data,
+ &base_vector);
+ if (ret < 0)
+ return ret;
+
+ vector = (i % num_vectors) + base_vector;
+
+ if (i >= ATH11K_EXT_IRQ_GRP_NUM_MAX)
+ break;
+
+ if (ab->ipci.dp_irq_num[vector] != msi_desc->irq)
+ continue;
+
+ ret = ath11k_pci_ext_config_gic_msi_irq(ab, pdev, msi_desc, i);
+ if (ret) {
+ ath11k_warn(ab, "failed to config ext msi irq %d\n", ret);
+ return ret;
+ }
+
+ i++;
+ }
+
ab->ipci.gic_enabled = 1;
wake_up(&ab->ipci.gic_msi_waitq);
--- a/drivers/net/wireless/ath/ath11k/ce.c
+++ b/drivers/net/wireless/ath/ath11k/ce.c
@@ -552,7 +552,10 @@ static void ath11k_ce_srng_msi_ring_para
ring_params->msi_addr = addr_lo;
ring_params->msi_addr |= (dma_addr_t)(((uint64_t)addr_hi) << 32);
- ring_params->msi_data = (msi_data_idx % msi_data_count) + msi_data_start;
+ if (!ab->userpd_id)
+ ring_params->msi_data = (msi_data_idx % msi_data_count) + msi_data_start;
+ else
+ ring_params->msi_data = ab->ipci.ce_msi_data[ce_id];
ring_params->flags |= HAL_SRNG_FLAGS_MSI_INTR;
}
--- a/drivers/net/wireless/ath/ath11k/ce.h
+++ b/drivers/net/wireless/ath/ath11k/ce.h
@@ -7,6 +7,7 @@
#define ATH11K_CE_H
#define CE_COUNT_MAX 12
+#define ATH11K_QCN6122_CE_COUNT 6
/* Byte swap data words */
#define CE_ATTR_BYTE_SWAP_DATA 2
@@ -192,6 +193,7 @@ struct ath11k_ce_pipe {
struct ce_tasklet_time tracker[CE_TIME_DURATION_MAX];
u32 sched_delay_gt_500US;
u32 exec_delay_gt_500US;
+ u32 msi_data;
};
struct ath11k_ce {
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -854,6 +854,12 @@ struct ath11k_internal_pci {
const struct ath11k_msi_config *msi_cfg;
bool gic_enabled;
wait_queue_head_t gic_msi_waitq;
+ u32 address_lo;
+ u32 address_hi;
+ u32 dp_msi_data[ATH11K_EXT_IRQ_GRP_NUM_MAX];
+ u32 ce_msi_data[ATH11K_QCN6122_CE_COUNT];
+ u32 gic_ep_base_data;
+ u32 dp_irq_num[8];
};
struct ath11k_memory_stats {
--- a/drivers/net/wireless/ath/ath11k/dp.c
+++ b/drivers/net/wireless/ath/ath11k/dp.c
@@ -231,8 +231,14 @@ static void ath11k_dp_srng_msi_setup(str
ring_params->msi_addr = addr_lo;
ring_params->msi_addr |= (dma_addr_t)(((uint64_t)addr_hi) << 32);
- ring_params->msi_data = (msi_group_number % msi_data_count)
- + msi_data_start;
+
+ if (!ab->userpd_id)
+ ring_params->msi_data = (msi_group_number % msi_data_count)
+ + msi_data_start;
+ else
+ ring_params->msi_data = ab->ipci.dp_msi_data[msi_group_number];
+
+
ring_params->flags |= HAL_SRNG_FLAGS_MSI_INTR;
}
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -3,8 +3,8 @@
* Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
*/
+#include <linux/platform_device.h>
#include <linux/module.h>
-#include <linux/msi.h>
#include <linux/pci.h>
#include "pci.h"
@@ -465,7 +465,7 @@ void ath11k_pci_get_msi_address(struct a
void ath11k_pci_get_qgic_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo,
u32 *msi_addr_hi)
{
- *msi_addr_lo = 0;
+ *msi_addr_lo = ab->ipci.address_lo;
*msi_addr_hi = 0;
}
EXPORT_SYMBOL(ath11k_pci_get_qgic_msi_address);
@@ -497,6 +497,7 @@ int ath11k_pci_get_user_msi_assignment(s
return -EINVAL;
}
+EXPORT_SYMBOL(ath11k_pci_get_user_msi_assignment);
void ath11k_pci_get_ce_msi_idx(struct ath11k_base *ab, u32 ce_id,
u32 *msi_idx)
@@ -775,11 +776,12 @@ static int ath11k_pci_ext_irq_config(str
{
int i, j, ret, num_vectors = 0;
u32 user_base_data = 0, base_vector = 0, base_idx;
+ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab);
u8 domain_id;
domain_id = ath11k_pci_get_domain_id(ab);
base_idx = ATH11K_PCI_IRQ_CE0_OFFSET + CE_COUNT_MAX;
- ret = ath11k_pci_get_user_msi_assignment(ab, msi_config, msi_ep_base_data,
+ ret = ath11k_pci_get_user_msi_assignment(ab, ab_pci->msi_config, msi_ep_base_data,
"DP", &num_vectors, &user_base_data,
&base_vector);
if (ret < 0)
@@ -894,6 +896,96 @@ static int ath11k_config_msi_irq(struct
return 0;
}
+int ath11k_pci_ext_config_gic_msi_irq(struct ath11k_base *ab, struct platform_device *pdev,
+ struct msi_desc *msi_desc, int i)
+{
+ u32 user_base_data = 0, base_vector = 0, base_idx;
+ struct ath11k_ext_irq_grp *irq_grp;
+ int j, ret = 0, num_vectors = 0;
+ u8 domain_id;
+ u32 num_irq = 0;
+
+ domain_id = ath11k_pci_get_domain_id(ab);
+ base_idx = ATH11K_PCI_IRQ_CE0_OFFSET + CE_COUNT_MAX;
+ ret = ath11k_pci_get_user_msi_assignment(ab, ab->ipci.msi_cfg, 0,
+ "DP", &num_vectors, &user_base_data,
+ &base_vector);
+ if (ret < 0)
+ return ret;
+
+ irq_grp = &ab->ext_irq_grp[i];
+ irq_grp->ab = ab;
+ irq_grp->grp_id = i;
+ init_dummy_netdev(&irq_grp->napi_ndev);
+ netif_napi_add(&irq_grp->napi_ndev, &irq_grp->napi,
+ ath11k_pci_ext_grp_napi_poll, NAPI_POLL_WEIGHT);
+
+ if (ab->hw_params.ring_mask->tx[i] ||
+ ab->hw_params.ring_mask->rx[i] ||
+ ab->hw_params.ring_mask->rx_err[i] ||
+ ab->hw_params.ring_mask->rx_wbm_rel[i] ||
+ ab->hw_params.ring_mask->reo_status[i] ||
+ ab->hw_params.ring_mask->rxdma2host[i] ||
+ ab->hw_params.ring_mask->host2rxdma[i] ||
+ ab->hw_params.ring_mask->rx_mon_status[i]) {
+ num_irq = 1;
+ }
+
+ irq_grp->num_irq = num_irq;
+ irq_grp->irqs[0] = base_idx + i;
+
+ for (j = 0; j < irq_grp->num_irq; j++) {
+
+ int irq_idx = irq_grp->irqs[j];
+ int vector = (i % num_vectors) + base_vector;
+
+ irq_set_status_flags(msi_desc->irq, IRQ_DISABLE_UNLAZY);
+ ret = devm_request_irq(&pdev->dev, msi_desc->irq,
+ ath11k_pci_ext_interrupt_handler,
+ IRQF_SHARED, dp_irq_name[domain_id][i],
+ irq_grp);
+ if (ret) {
+ ath11k_err(ab, "failed request irq %d: %d\n",
+ irq_idx, ret);
+ return ret;
+ }
+ ab->irq_num[irq_idx] = msi_desc->irq;
+ ab->ipci.dp_irq_num[vector] = msi_desc->irq;
+ ab->ipci.dp_msi_data[i] = msi_desc->msg.data;
+ disable_irq_nosync(ab->irq_num[irq_idx]);
+ }
+ return ret;
+}
+EXPORT_SYMBOL(ath11k_pci_ext_config_gic_msi_irq);
+
+int ath11k_pci_config_gic_msi_irq(struct ath11k_base *ab, struct platform_device *pdev,
+ struct msi_desc *msi_desc, int i)
+{
+ struct ath11k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i];
+ int irq_idx, ret;
+ u8 domain_id;
+
+ domain_id = ath11k_pci_get_domain_id(ab);
+ tasklet_setup(&ce_pipe->intr_tq, ath11k_pci_ce_tasklet);
+ irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + i;
+
+ ret = devm_request_irq(&pdev->dev, msi_desc->irq,
+ ath11k_pci_ce_interrupt_handler,
+ IRQF_SHARED, ce_irq_name[domain_id][i],
+ ce_pipe);
+ if (ret) {
+ ath11k_warn(ab, "failed to request irq %d: %d\n",
+ irq_idx, ret);
+ return ret;
+ }
+ ab->irq_num[irq_idx] = msi_desc->irq;
+ ab->ipci.ce_msi_data[i] = msi_desc->msg.data;
+ ath11k_pci_ce_irq_disable(ab, i);
+
+ return ret;
+}
+EXPORT_SYMBOL(ath11k_pci_config_gic_msi_irq);
+
static int ath11k_pci_config_irq(struct ath11k_base *ab)
{
int ret;
--- a/drivers/net/wireless/ath/ath11k/pci.h
+++ b/drivers/net/wireless/ath/ath11k/pci.h
@@ -6,6 +6,7 @@
#define _ATH11K_PCI_H
#include <linux/mhi.h>
+#include <linux/msi.h>
#include "core.h"
@@ -189,4 +190,8 @@ void ath11k_pci_free_irq(struct ath11k_b
int ath11k_ipci_start(struct ath11k_base *ab);
void ath11k_ipci_write32(struct ath11k_base *ab, u32 offset, u32 value);
u32 ath11k_ipci_read32(struct ath11k_base *ab, u32 offset);
+int ath11k_pci_config_gic_msi_irq(struct ath11k_base *ab, struct platform_device *pdev,
+ struct msi_desc *msi_desc, int i);
+int ath11k_pci_ext_config_gic_msi_irq(struct ath11k_base *ab, struct platform_device *pdev,
+ struct msi_desc *msi_desc, int i);
#endif

View File

@@ -1,381 +0,0 @@
From 508d7cfbae86d06a580bd92f2e1fc1f88af66f6b Mon Sep 17 00:00:00 2001
From: P Praneesh <quic_ppranees@quicinc.com>
Date: Mon, 10 Jan 2022 16:21:33 +0530
Subject: [PATCH] ath11k: retain debugfs during firmware recovery
During core restart, mac80211 add interface invokes debugfs creation
which is not yet destroyed during firmware recovery. Below warning
prints observed during firmware restart.
debugfs: File 'mac_filter' in directory 'netdev:wlan2' already present!
debugfs: File 'wbm_tx_completion_stats' in directory 'netdev:wlan2' already present!
debugfs: File 'ampdu_aggr_size' in directory 'netdev:wlan2' already present!
debugfs: File 'amsdu_aggr_size' in directory 'netdev:wlan2' already present!
debugfs: File 'wmi_ctrl_stats' in directory 'netdev:wlan2' already present!
Fix this warning by preventing debugfs re-creation during core restart.
Signed-off-by: P Praneesh <quic_ppranees@quicinc.com>
---
drivers/net/wireless/ath/ath11k/core.c | 6 +-
drivers/net/wireless/ath/ath11k/debug_smart_ant.c | 27 ++++++++
drivers/net/wireless/ath/ath11k/debugfs.c | 78 ++++++++++++++++++++++
.../net/wireless/ath/ath11k/debugfs_htt_stats.c | 7 ++
drivers/net/wireless/ath/ath11k/dp.c | 7 +-
drivers/net/wireless/ath/ath11k/dp.h | 2 +-
drivers/net/wireless/ath/ath11k/mac.c | 12 ++--
7 files changed, 128 insertions(+), 11 deletions(-)
Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/core.c
===================================================================
--- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/core.c
+++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/core.c
@@ -924,7 +924,7 @@ err_mac_unregister:
err_nss_tear:
ath11k_nss_teardown(ab);
err_dp_pdev_free:
- ath11k_dp_pdev_free(ab);
+ ath11k_dp_pdev_free(ab, true);
err_pdev_debug:
ath11k_debugfs_pdev_destroy(ab);
@@ -942,7 +942,7 @@ static void ath11k_core_pdev_destroy(str
ab->nss.enabled = false;
ath11k_hif_irq_disable(ab);
- ath11k_dp_pdev_free(ab);
+ ath11k_dp_pdev_free(ab, true);
ath11k_debugfs_pdev_destroy(ab);
}
@@ -1224,7 +1224,7 @@ static int ath11k_core_reconfigure_on_cr
#endif
ath11k_thermal_unregister(ab);
ath11k_hif_irq_disable(ab);
- ath11k_dp_pdev_free(ab);
+ ath11k_dp_pdev_free(ab, false);
ath11k_spectral_deinit(ab);
ath11k_cfr_deinit(ab);
ath11k_hif_stop(ab);
Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/debugfs.c
===================================================================
--- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/debugfs.c
+++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/debugfs.c
@@ -17,6 +17,7 @@
#include "qmi.h"
struct dentry *debugfs_ath11k;
+struct dentry *debugfs_debug_infra;
static const char *htt_bp_umac_ring[HTT_SW_UMAC_RING_IDX_MAX] = {
"REO2SW1_RING",
@@ -258,9 +259,18 @@ static ssize_t ath11k_write_wmi_ctrl_pat
{
struct ath11k_vif *arvif = file->private_data;
struct wmi_ctrl_path_stats_cmd_param param = {0};
+ struct ath11k *ar = arvif->ar;
u8 buf[128] = {0};
int ret;
+ mutex_lock(&ar->conf_mutex);
+ if (ar->state != ATH11K_STATE_ON) {
+ ath11k_warn(ar->ab, "pdev %d not in ON state\n", ar->pdev->pdev_id);
+ mutex_unlock(&ar->conf_mutex);
+ return -ENETDOWN;
+ }
+ mutex_unlock(&ar->conf_mutex);
+
ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count);
if (ret < 0) {
return ret;
@@ -609,10 +619,19 @@ static ssize_t ath11k_write_amsdu_aggr_s
{
struct ath11k_vif *arvif = file->private_data;
struct ath11k_base *ab = arvif->ar->ab;
+ struct ath11k *ar = arvif->ar;
unsigned int tx_aggr_size = 0;
int ret;
struct set_custom_aggr_size_params params = {0};
+ mutex_lock(&ar->conf_mutex);
+ if (ar->state != ATH11K_STATE_ON) {
+ ath11k_warn(ar->ab, "pdev %d not in ON state\n", ar->pdev->pdev_id);
+ mutex_unlock(&ar->conf_mutex);
+ return -ENETDOWN;
+ }
+ mutex_unlock(&ar->conf_mutex);
+
if (kstrtouint_from_user(ubuf, count, 0, &tx_aggr_size))
return -EINVAL;
@@ -2059,6 +2078,7 @@ void ath11k_debugfs_destroy()
{
debugfs_remove_recursive(debugfs_ath11k);
debugfs_ath11k = NULL;
+ debugfs_debug_infra = NULL;
}
void ath11k_debugfs_fw_stats_init(struct ath11k *ar)
@@ -2256,6 +2276,12 @@ static ssize_t ath11k_write_simulate_rad
struct ath11k *ar = file->private_data;
int ret;
+ if (ar->state != ATH11K_STATE_ON) {
+ ath11k_warn(ar->ab, "pdev %d not in ON state\n", ar->pdev->pdev_id);
+ mutex_unlock(&ar->conf_mutex);
+ return -ENETDOWN;
+ }
+
ret = ath11k_wmi_simulate_radar(ar);
if (ret)
return ret;
@@ -2312,6 +2338,14 @@ static ssize_t ath11k_write_btcoex(struc
if (!ar)
return -EINVAL;
+ mutex_lock(&ar->conf_mutex);
+ if (ar->state != ATH11K_STATE_ON) {
+ ath11k_warn(ar->ab, "pdev %d not in ON state\n", ar->pdev->pdev_id);
+ mutex_unlock(&ar->conf_mutex);
+ return -ENETDOWN;
+ }
+ mutex_unlock(&ar->conf_mutex);
+
buf_size = min(count, (sizeof(buf) - 1));
if (copy_from_user(buf, ubuf, buf_size))
return -EFAULT;
@@ -2404,6 +2438,14 @@ static ssize_t ath11k_write_btcoex_duty_
if (!ar)
return -EINVAL;
+ mutex_lock(&ar->conf_mutex);
+ if (ar->state != ATH11K_STATE_ON) {
+ ath11k_warn(ar->ab, "pdev %d not in ON state\n", ar->pdev->pdev_id);
+ mutex_unlock(&ar->conf_mutex);
+ return -ENETDOWN;
+ }
+ mutex_unlock(&ar->conf_mutex);
+
if (!test_bit(ATH11K_FLAG_BTCOEX, &ar->dev_flags))
return -EINVAL;
@@ -2495,6 +2537,12 @@ static ssize_t ath11k_write_btcoex_algo(
mutex_lock(&ar->conf_mutex);
+ if (ar->state != ATH11K_STATE_ON) {
+ ath11k_warn(ar->ab, "pdev %d not in ON state\n", ar->pdev->pdev_id);
+ mutex_unlock(&ar->conf_mutex);
+ return -ENETDOWN;
+ }
+
arvif = list_first_entry(&ar->arvifs, typeof(*arvif), list);
if (!arvif->is_started) {
ret = -EINVAL;
@@ -2685,6 +2733,12 @@ static ssize_t ath11k_write_ps_state_ena
mutex_lock(&ar->conf_mutex);
+ if (ar->state != ATH11K_STATE_ON) {
+ ath11k_warn(ar->ab, "pdev %d not in ON state\n", ar->pdev->pdev_id);
+ ret = -ENETDOWN;
+ goto exit;
+ }
+
if (ar->ps_state_enable == ps_state_enable) {
ret = count;
goto exit;
@@ -2975,6 +3029,14 @@ static ssize_t ath11k_athdiag_read(struc
mutex_lock(&ar->conf_mutex);
+ if (ar->state != ATH11K_STATE_ON) {
+ ath11k_warn(ar->ab, "pdev %d not in ON state\n", ar->pdev->pdev_id);
+ mutex_unlock(&ar->conf_mutex);
+ return -ENETDOWN;
+ }
+
+ mutex_unlock(&ar->conf_mutex);
+
buf = vmalloc(count);
if (!buf) {
ret = -ENOMEM;
@@ -3921,6 +3983,12 @@ static ssize_t ath11k_write_ani_enable(s
mutex_lock(&ar->conf_mutex);
+ if (ar->state != ATH11K_STATE_ON) {
+ ath11k_warn(ar->ab, "pdev %d not in ON state\n", ar->pdev->pdev_id);
+ mutex_unlock(&ar->conf_mutex);
+ return -ENETDOWN;
+ }
+
if (ar->ani_enabled == enable) {
ret = count;
goto exit;
@@ -3976,6 +4044,12 @@ static ssize_t ath11k_write_ani_poll_per
mutex_lock(&ar->conf_mutex);
+ if (ar->state != ATH11K_STATE_ON) {
+ ath11k_warn(ar->ab, "pdev %d not in ON state\n", ar->pdev->pdev_id);
+ mutex_unlock(&ar->conf_mutex);
+ return -ENETDOWN;
+ }
+
ret = ath11k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_ANI_POLL_PERIOD,
ani_poll_period, ar->pdev->pdev_id);
if (ret) {
@@ -4026,6 +4100,12 @@ static ssize_t ath11k_write_ani_listen_p
mutex_lock(&ar->conf_mutex);
+ if (ar->state != ATH11K_STATE_ON) {
+ ath11k_warn(ar->ab, "pdev %d not in ON state\n", ar->pdev->pdev_id);
+ mutex_unlock(&ar->conf_mutex);
+ return -ENETDOWN;
+ }
+
ret = ath11k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
ani_listen_period, ar->pdev->pdev_id);
if (ret) {
Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c
===================================================================
--- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c
+++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c
@@ -5410,6 +5410,13 @@ static ssize_t ath11k_write_htt_stats_re
return -E2BIG;
mutex_lock(&ar->conf_mutex);
+
+ if (ar->state != ATH11K_STATE_ON) {
+ ath11k_warn(ar->ab, "pdev %d not in ON state\n", ar->pdev->pdev_id);
+ mutex_unlock(&ar->conf_mutex);
+ return -ENETDOWN;
+ }
+
cfg_params.cfg0 = HTT_STAT_DEFAULT_RESET_START_OFFSET;
cfg_params.cfg1 = 1 << (cfg_params.cfg0 + type);
ret = ath11k_dp_tx_htt_h2t_ext_stats_req(ar,
Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/dp.c
===================================================================
--- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/dp.c
+++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/dp.c
@@ -972,7 +972,7 @@ done:
}
EXPORT_SYMBOL(ath11k_dp_service_srng);
-void ath11k_dp_pdev_free(struct ath11k_base *ab)
+void ath11k_dp_pdev_free(struct ath11k_base *ab, bool ureg_dbgfs)
{
struct ath11k *ar;
int i;
@@ -982,7 +982,8 @@ void ath11k_dp_pdev_free(struct ath11k_b
for (i = 0; i < ab->num_radios; i++) {
ar = ab->pdevs[i].ar;
ath11k_dp_rx_pdev_free(ab, i);
- ath11k_debugfs_unregister(ar);
+ if (ureg_dbgfs)
+ ath11k_debugfs_unregister(ar);
ath11k_dp_rx_pdev_mon_detach(ar);
}
}
@@ -1037,7 +1038,7 @@ int ath11k_dp_pdev_alloc(struct ath11k_b
return 0;
err:
- ath11k_dp_pdev_free(ab);
+ ath11k_dp_pdev_free(ab, true);
return ret;
}
Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/dp.h
===================================================================
--- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/dp.h
+++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/dp.h
@@ -1907,7 +1907,7 @@ void ath11k_dp_free(struct ath11k_base *
int ath11k_dp_alloc(struct ath11k_base *ab);
int ath11k_dp_pdev_alloc(struct ath11k_base *ab);
void ath11k_dp_pdev_pre_alloc(struct ath11k_base *ab);
-void ath11k_dp_pdev_free(struct ath11k_base *ab);
+void ath11k_dp_pdev_free(struct ath11k_base *ab, bool ureg_dbgfs);
int ath11k_dp_tx_htt_srng_setup(struct ath11k_base *ab, u32 ring_id,
int mac_id, enum hal_ring_type ring_type);
int ath11k_dp_peer_setup(struct ath11k *ar, int vdev_id, const u8 *addr);
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
@@ -6763,7 +6763,11 @@ static int ath11k_mac_op_add_interface(s
goto err;
}
- ath11k_debugfs_dbg_mac_filter(arvif);
+ if (ar->state != ATH11K_STATE_RESTARTED) {
+ ath11k_debugfs_dbg_mac_filter(arvif);
+ } else {
+ INIT_LIST_HEAD(&arvif->mac_filters);
+ }
switch (vif->type) {
case NL80211_IFTYPE_UNSPECIFIED:
@@ -6946,6 +6950,14 @@ static int ath11k_mac_op_add_interface(s
if (vif->type != NL80211_IFTYPE_MONITOR && ar->monitor_conf_enabled)
ath11k_mac_monitor_vdev_create(ar);
+ if (ar->state != ATH11K_STATE_RESTARTED) {
+ ath11k_debug_aggr_size_config_init(arvif);
+ ath11k_debugfs_wmi_ctrl_stats(arvif);
+ } else {
+ INIT_LIST_HEAD(&arvif->ar->debug.wmi_list);
+ init_completion(&arvif->ar->debug.wmi_ctrl_path_stats_rcvd);
+ }
+
mutex_unlock(&ar->conf_mutex);
return ret;
@@ -7176,9 +7188,6 @@ static int ath11k_mac_op_ampdu_action(st
break;
}
- ath11k_debug_aggr_size_config_init(arvif);
- ath11k_debugfs_wmi_ctrl_stats(arvif);
-
mutex_unlock(&ar->conf_mutex);
return ret;
Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/debug_nss.c
===================================================================
--- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/debug_nss.c
+++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/debug_nss.c
@@ -11,6 +11,8 @@
#include "debug.h"
#include "debug_nss.h"
+extern struct dentry *debugfs_debug_infra;
+
static unsigned int
debug_nss_fill_mpp_dump(struct ath11k_vif *arvif, char *buf, ssize_t size)
{
@@ -908,16 +910,17 @@ void ath11k_debugfs_nss_mesh_vap_create(
void ath11k_debugfs_nss_soc_create(struct ath11k_base *ab)
{
- struct dentry *debugfs_dbg_infra;
+ if (debugfs_debug_infra)
+ return;
- debugfs_dbg_infra = debugfs_create_dir("dbg_infra", debugfs_ath11k);
+ debugfs_debug_infra = debugfs_create_dir("dbg_infra", debugfs_ath11k);
debugfs_create_file("links", 0200,
- debugfs_dbg_infra, ab,
+ debugfs_debug_infra, ab,
&fops_nss_links);
debugfs_create_file("mpp_mode", 0600,
- debugfs_dbg_infra, ab,
+ debugfs_debug_infra, ab,
&fops_nss_mpp_mode);
}