[rdk-b][common][bsp][Refactor and sync kernel/wifi from Openwrt]
[Description]
Refactor and sync kernel/wifi from Openwrt
[Release-log]
N/A
diff --git a/recipes-wifi/linux-mac80211/files/patches/subsys/99902-mac80211-mtk-register-.ndo_setup_tc-to-support-wifi2.patch b/recipes-wifi/linux-mac80211/files/patches/subsys/99902-mac80211-mtk-register-.ndo_setup_tc-to-support-wifi2.patch
new file mode 100755
index 0000000..0ea84cb
--- /dev/null
+++ b/recipes-wifi/linux-mac80211/files/patches/subsys/99902-mac80211-mtk-register-.ndo_setup_tc-to-support-wifi2.patch
@@ -0,0 +1,89 @@
+From cd9544a72d01f115e97b4967f416b07691196e5f Mon Sep 17 00:00:00 2001
+From: Sujuan Chen <sujuan.chen@mediatek.com>
+Date: Fri, 23 Dec 2022 18:12:41 +0800
+Subject: [PATCH] mac80211: mtk: register .ndo_setup_tc to support wifi2wifi
+ offload
+
+Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
+---
+ include/net/mac80211.h | 5 +++++
+ net/mac80211/iface.c | 26 ++++++++++++++++++++++++++
+ 2 files changed, 31 insertions(+)
+
+diff --git a/include/net/mac80211.h b/include/net/mac80211.h
+index bf4469b..3b2b2bb 100644
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -3978,6 +3978,8 @@ struct ieee80211_prep_tx_info {
+ * resolve a path for hardware flow offloading
+ * @net_fill_receive_path: Called from .ndo_fill_receive_path in order to
+ * get a path for hardware flow offloading
++ * @net_setup_tc: Called from .ndo_setup_tc in order to register flowblock
++ * callback function
+ */
+ struct ieee80211_ops {
+ void (*tx)(struct ieee80211_hw *hw,
+@@ -4316,6 +4318,9 @@ struct ieee80211_ops {
+ int (*net_fill_receive_path)(struct ieee80211_hw *hw,
+ struct net_device_path_ctx *ctx,
+ struct net_device_path *path);
++ int (*net_setup_tc)(struct ieee80211_hw *hw,
++ struct net_device *dev,
++ int type, void *type_data);
+ };
+
+ /**
+diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
+index 35f1233..43f6cb0 100644
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
+@@ -932,6 +932,30 @@ static int ieee80211_netdev_fill_receive_path(struct net_device_path_ctx *ctx,
+ return ret;
+ }
+
++static int ieee80211_netdev_setup_tc(struct net_device *dev,
++ enum tc_setup_type type, void *type_data)
++{
++ struct ieee80211_sub_if_data *sdata;
++ struct ieee80211_local *local;
++ int ret = -ENOENT;
++
++ sdata = IEEE80211_DEV_TO_SUB_IF(dev);
++ local = sdata->local;
++
++ if (!local->ops->net_setup_tc)
++ return -EOPNOTSUPP;
++
++ if (!type_data)
++ return -EINVAL;
++
++ rcu_read_lock();
++
++ ret = local->ops->net_setup_tc(&local->hw, dev, (int)type, type_data);
++
++ rcu_read_unlock();
++
++ return ret;
++}
+
+ static const struct net_device_ops ieee80211_dataif_8023_ops = {
+ #if LINUX_VERSION_IS_LESS(4,10,0)
+@@ -952,6 +976,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = {
+ #endif
+ .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path,
+ .ndo_fill_receive_path = ieee80211_netdev_fill_receive_path,
++ .ndo_setup_tc = ieee80211_netdev_setup_tc,
+ };
+
+ static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype)
+@@ -1504,6 +1529,7 @@ static void ieee80211_if_setup(struct net_device *dev)
+ dev->priv_flags &= ~IFF_TX_SKB_SHARING;
+ dev->netdev_ops = &ieee80211_dataif_ops;
+ netdev_set_priv_destructor(dev, ieee80211_if_free);
++ dev->features |= NETIF_F_HW_TC;
+ }
+
+ static void ieee80211_if_setup_no_queue(struct net_device *dev)
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mac80211/files/patches/subsys/subsys.inc b/recipes-wifi/linux-mac80211/files/patches/subsys/subsys.inc
index 5bdb454..0d24888 100644
--- a/recipes-wifi/linux-mac80211/files/patches/subsys/subsys.inc
+++ b/recipes-wifi/linux-mac80211/files/patches/subsys/subsys.inc
@@ -65,4 +65,5 @@
file://913-mac80211-mtk-fix-tx-amsdu-aggregation.patch \
file://99900-mac80211-mtk-mask-kernel-version-limitation-and-fil.patch \
file://99901-mac80211-mtk-add-fill-receive-path-ops-to-get-wed-i.patch \
+ file://99902-mac80211-mtk-register-.ndo_setup_tc-to-support-wifi2.patch \
"
diff --git a/recipes-wifi/linux-mt76/files/patches/3014-mt76-mt7915-add-mt7915_net_setup_tc-to-support-wifi2.patch b/recipes-wifi/linux-mt76/files/patches/3014-mt76-mt7915-add-mt7915_net_setup_tc-to-support-wifi2.patch
new file mode 100755
index 0000000..772ae62
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/3014-mt76-mt7915-add-mt7915_net_setup_tc-to-support-wifi2.patch
@@ -0,0 +1,47 @@
+From 2d4b5900f533b412215b14125d766c84f43e5bdb Mon Sep 17 00:00:00 2001
+From: Sujuan Chen <sujuan.chen@mediatek.com>
+Date: Tue, 27 Dec 2022 09:45:14 +0800
+Subject: [PATCH] mt76: mt7915: add mt7915_net_setup_tc to support wifi2wifi
+ offload
+
+Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
+---
+ mt7915/main.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/mt7915/main.c b/mt7915/main.c
+index 28509d94..ad5cd002 100644
+--- a/mt7915/main.c
++++ b/mt7915/main.c
+@@ -1598,6 +1598,21 @@ mt7915_net_fill_receive_path(struct ieee80211_hw *hw,
+ return 0;
+ }
+
++static int mt7915_net_setup_tc(struct ieee80211_hw *hw,
++ struct net_device *ndev,
++ int type, void *type_data)
++{
++ struct mt7915_dev *dev = mt7915_hw_dev(hw);
++ struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
++
++ if (!mtk_wed_device_active(wed))
++ return -ENODEV;
++
++ mtk_wed_device_setup_tc(wed, ndev, type, type_data);
++
++ return 0;
++}
++
+ #endif
+
+ const struct ieee80211_ops mt7915_ops = {
+@@ -1651,5 +1666,6 @@ const struct ieee80211_ops mt7915_ops = {
+ #ifdef CONFIG_NET_MEDIATEK_SOC_WED
+ .net_fill_forward_path = mt7915_net_fill_forward_path,
+ .net_fill_receive_path = mt7915_net_fill_receive_path,
++ .net_setup_tc = mt7915_net_setup_tc,
+ #endif
+ };
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches/patches.inc b/recipes-wifi/linux-mt76/files/patches/patches.inc
index fd3b6f2..94d6747 100644
--- a/recipes-wifi/linux-mt76/files/patches/patches.inc
+++ b/recipes-wifi/linux-mt76/files/patches/patches.inc
@@ -49,6 +49,7 @@
file://3011-mt76-mt7915-wed-add-mt7916-2-pcie-support-when-wed-o.patch \
file://3012-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rro-dev.patch \
file://3013-mt76-mt7915-wed-fix-potential-memory-leakage.patch \
+ file://3014-mt76-mt7915-add-mt7915_net_setup_tc-to-support-wifi2.patch \
file://4001-mt76-revert-get_of_mac_addr.patch \
file://4002-mt76-include-header-files-for-module-param.patch \
file://4003-mt76-revert-for-backports-5.15-wireless-stack.patch \