[][mac80211][mt76][wed][sync wifi2wifi upstream patch]

[Description]
Fix patch error by sync wifi2wifi upstream patch

[Release-log]
N/A

Change-Id: Ibf80840e3a32c7367d2f49ff68a9710a0373f550
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7303832
diff --git a/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-9902-mac80211-mtk-add-support-for-letting-drivers-registe.patch b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-9902-mac80211-mtk-add-support-for-letting-drivers-registe.patch
new file mode 100644
index 0000000..5bfbd83
--- /dev/null
+++ b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-9902-mac80211-mtk-add-support-for-letting-drivers-registe.patch
@@ -0,0 +1,167 @@
+From 5b031e66dae802df853596a99c1ce73ad7761d09 Mon Sep 17 00:00:00 2001
+From: Sujuan Chen <sujuan.chen@mediatek.com>
+Date: Tue, 28 Mar 2023 10:53:31 +0800
+Subject: [PATCH] mac80211: mtk: add support for letting drivers register tc
+ offload support
+
+On newer MediaTek SoCs (e.g. MT7986), WLAN->WLAN or WLAN->Ethernet flows can
+be offloaded by the SoC. In order to support that, the .ndo_setup_tc op is
+needed.
+
+Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
+---
+ include/net/mac80211.h     |  9 +++++++++
+ net/mac80211/driver-ops.h  | 17 +++++++++++++++++
+ net/mac80211/ieee80211_i.h |  3 ++-
+ net/mac80211/iface.c       | 17 +++++++++++++++++
+ net/mac80211/trace.h       | 25 +++++++++++++++++++++++++
+ 5 files changed, 70 insertions(+), 1 deletion(-)
+
+diff --git a/include/net/mac80211.h b/include/net/mac80211.h
+index cb1d544..2d998be 100755
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -3980,6 +3980,10 @@ 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 prepare hardware
++ *	flow offloading for flows originating from the vif.
++ *	Note that the driver must not assume that the vif driver_data is valid
++ *	at this point, since the callback can be called during netdev teardown.
+  */
+ struct ieee80211_ops {
+ 	void (*tx)(struct ieee80211_hw *hw,
+@@ -4318,6 +4322,11 @@ 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 ieee80211_vif *vif,
++			    struct net_device *dev,
++			    enum tc_setup_type type,
++			    void *type_data);
+ };
+ 
+ /**
+diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
+index 27da75e..79f408f 100644
+--- a/net/mac80211/driver-ops.h
++++ b/net/mac80211/driver-ops.h
+@@ -1521,4 +1521,21 @@ static inline int drv_net_fill_receive_path(struct ieee80211_local *local,
+ 	return ret;
+ }
+ 
++static inline int drv_net_setup_tc(struct ieee80211_local *local,
++				   struct ieee80211_sub_if_data *sdata,
++				   struct net_device *dev,
++				   enum tc_setup_type type, void *type_data)
++{
++	int ret = -EOPNOTSUPP;
++
++	sdata = get_bss_sdata(sdata);
++	trace_drv_net_setup_tc(local, sdata, type);
++	if (local->ops->net_setup_tc)
++		ret = local->ops->net_setup_tc(&local->hw, &sdata->vif, dev,
++					       type, type_data);
++	trace_drv_return_int(local, ret);
++
++	return ret;
++}
++
+ #endif /* __MAC80211_DRIVER_OPS */
+diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
+index 2519c14..fe7a03a 100644
+--- a/net/mac80211/ieee80211_i.h
++++ b/net/mac80211/ieee80211_i.h
+@@ -1822,7 +1822,8 @@ void ieee80211_color_aging_work(struct work_struct *work);
+ /* interface handling */
+ #define MAC80211_SUPPORTED_FEATURES_TX	(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \
+ 					 NETIF_F_HW_CSUM | NETIF_F_SG | \
+-					 NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE)
++					 NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE | \
++					 NETIF_F_HW_TC)
+ #define MAC80211_SUPPORTED_FEATURES_RX	(NETIF_F_RXCSUM)
+ #define MAC80211_SUPPORTED_FEATURES	(MAC80211_SUPPORTED_FEATURES_TX | \
+ 					 MAC80211_SUPPORTED_FEATURES_RX)
+diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
+index 8a4f4e1..f3bf837 100644
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
+@@ -773,6 +773,21 @@ static int __change_mtu(struct net_device *ndev, int new_mtu){
+ }
+ #endif
+ 
++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;
++
++	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
++	local = sdata->local;
++
++	if (!local->ops->net_setup_tc)
++		return -EOPNOTSUPP;
++
++	return drv_net_setup_tc(local, sdata, dev, type, type_data);
++}
++
+ static const struct net_device_ops ieee80211_dataif_ops = {
+ #if LINUX_VERSION_IS_LESS(4,10,0)
+ 	.ndo_change_mtu = __change_mtu,
+@@ -790,6 +805,7 @@ static const struct net_device_ops ieee80211_dataif_ops = {
+ #else
+ 	.ndo_get_stats64 = bp_ieee80211_get_stats64,
+ #endif
++	.ndo_setup_tc		= ieee80211_netdev_setup_tc,
+ 
+ };
+ 
+@@ -953,6 +969,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)
+diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
+index 737ab86..25d3e30 100644
+--- a/net/mac80211/trace.h
++++ b/net/mac80211/trace.h
+@@ -2899,6 +2899,31 @@ DEFINE_EVENT(sta_event, drv_net_fill_forward_path,
+ 	TP_ARGS(local, sdata, sta)
+ );
+ 
++TRACE_EVENT(drv_net_setup_tc,
++	TP_PROTO(struct ieee80211_local *local,
++		 struct ieee80211_sub_if_data *sdata,
++		 u8 type),
++
++	TP_ARGS(local, sdata, type),
++
++	TP_STRUCT__entry(
++		LOCAL_ENTRY
++		VIF_ENTRY
++		__field(u8, type)
++	),
++
++	TP_fast_assign(
++		LOCAL_ASSIGN;
++		VIF_ASSIGN;
++		__entry->type = type;
++	),
++
++	TP_printk(
++		LOCAL_PR_FMT VIF_PR_FMT " type:%d\n",
++		LOCAL_PR_ARG, VIF_PR_ARG, __entry->type
++	)
++);
++
+ TRACE_EVENT(bss_color_bitmap,
+ 	TP_PROTO(u8 color,
+ 		 u64 color_bitmap),
+-- 
+2.18.0
+
diff --git a/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-9902-mac80211-mtk-register-.ndo_setup_tc-to-support-wifi2.patch b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-9902-mac80211-mtk-register-.ndo_setup_tc-to-support-wifi2.patch
deleted file mode 100644
index 0ea84cb..0000000
--- a/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-9902-mac80211-mtk-register-.ndo_setup_tc-to-support-wifi2.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-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
-