[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 \
"