[][MAC80211][WED][Add wed driver to support tx/rx offload]
[Description]
Add wed driver to support tx/rx offload
[Release-log]
N/A
Change-Id: Ic77fdde01ce06ef5638d077d880864dffa8ba821
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6197267
diff --git a/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/910-mac80211-offload.patch b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/910-mac80211-offload.patch
new file mode 100755
index 0000000..3650a3e
--- /dev/null
+++ b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/910-mac80211-offload.patch
@@ -0,0 +1,103 @@
+From 03e816970e354ae3521f94dc56b94e2ff046a305 Mon Sep 17 00:00:00 2001
+From: Sujuan Chen <sujuan.chen@mediatek.com>
+Date: Fri, 11 Mar 2022 11:34:11 +0800
+Subject: [PATCH] mask kernel version limitation and fill forward path in
+ kernel 5.4
+
+Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
+---
+ include/net/mac80211.h | 2 --
+ net/mac80211/driver-ops.h | 2 --
+ net/mac80211/iface.c | 4 ----
+ net/mac80211/trace.h | 2 --
+ 4 files changed, 10 deletions(-)
+
+diff --git a/include/net/mac80211.h b/include/net/mac80211.h
+index 54df8c4..0fb2de9 100644
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -4279,13 +4279,11 @@ struct ieee80211_ops {
+ struct ieee80211_sta *sta, u8 flowid);
+ int (*set_radar_background)(struct ieee80211_hw *hw,
+ struct cfg80211_chan_def *chandef);
+-#if LINUX_VERSION_IS_GEQ(5,10,0)
+ int (*net_fill_forward_path)(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ struct net_device_path_ctx *ctx,
+ struct net_device_path *path);
+-#endif
+ };
+
+ /**
+diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
+index 5c4adca..ce90549 100644
+--- a/net/mac80211/driver-ops.h
++++ b/net/mac80211/driver-ops.h
+@@ -1483,7 +1483,6 @@ static inline void drv_twt_teardown_request(struct ieee80211_local *local,
+ trace_drv_return_void(local);
+ }
+
+-#if LINUX_VERSION_IS_GEQ(5,10,0)
+ static inline int drv_net_fill_forward_path(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+@@ -1505,6 +1504,5 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local,
+
+ return ret;
+ }
+-#endif
+
+ #endif /* __MAC80211_DRIVER_OPS */
+diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
+index 6a44826..98b6d1c 100644
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
+@@ -822,7 +822,6 @@ static const struct net_device_ops ieee80211_monitorif_ops = {
+
+ };
+
+-#if LINUX_VERSION_IS_GEQ(5,10,0)
+ static int ieee80211_netdev_fill_forward_path(struct net_device_path_ctx *ctx,
+ struct net_device_path *path)
+ {
+@@ -880,7 +879,6 @@ out:
+
+ return ret;
+ }
+-#endif
+
+ static const struct net_device_ops ieee80211_dataif_8023_ops = {
+ #if LINUX_VERSION_IS_LESS(4,10,0)
+@@ -899,9 +897,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = {
+ #else
+ .ndo_get_stats64 = bp_ieee80211_get_stats64,
+ #endif
+-#if LINUX_VERSION_IS_GEQ(5,10,0)
+ .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path,
+-#endif
+ };
+
+ static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype)
+diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
+index bbda9e9..d91498f 100644
+--- a/net/mac80211/trace.h
++++ b/net/mac80211/trace.h
+@@ -2892,14 +2892,12 @@ TRACE_EVENT(drv_twt_teardown_request,
+ )
+ );
+
+-#if LINUX_VERSION_IS_GEQ(5,10,0)
+ DEFINE_EVENT(sta_event, drv_net_fill_forward_path,
+ TP_PROTO(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta),
+ TP_ARGS(local, sdata, sta)
+ );
+-#endif
+
+ #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
+
+--
+2.18.0
+
diff --git a/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/911-add-fill-receive-path-ops-to-get-wed-idx-v2.patch b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/911-add-fill-receive-path-ops-to-get-wed-idx-v2.patch
new file mode 100755
index 0000000..3c2cd27
--- /dev/null
+++ b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/911-add-fill-receive-path-ops-to-get-wed-idx-v2.patch
@@ -0,0 +1,143 @@
+From bf39e0bef2dff4419f51b7a8bb7da3de04a38bd7 Mon Sep 17 00:00:00 2001
+From: Sujuan Chen <sujuan.chen@mediatek.com>
+Date: Wed, 18 May 2022 15:10:22 +0800
+Subject: [PATCH] add fill receive path ops to get wed idx
+
+Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
+---
+ include/net/mac80211.h | 12 ++++++++++++
+ net/mac80211/driver-ops.h | 13 +++++++++++++
+ net/mac80211/iface.c | 24 ++++++++++++++++++++++++
+ net/mac80211/util.c | 9 +++++++++
+ 4 files changed, 58 insertions(+)
+ mode change 100644 => 100755 include/net/mac80211.h
+ mode change 100644 => 100755 net/mac80211/util.c
+
+diff --git a/include/net/mac80211.h b/include/net/mac80211.h
+old mode 100644
+new mode 100755
+index 1f6ddf6..17672ac
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -1791,6 +1791,13 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
+ */
+ struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif);
+
++/**
++ * ieee80211_vif_to_wdev - return a net_device struct from a vif
++ * @vif: the vif to get the net_device for
++ */
++struct net_device *ieee80211_vif_to_netdev(struct ieee80211_vif *vif);
++
++
+ /**
+ * enum ieee80211_key_flags - key flags
+ *
+@@ -3957,6 +3964,8 @@ struct ieee80211_prep_tx_info {
+ * disable background CAC/radar detection.
+ * @net_fill_forward_path: Called from .ndo_fill_forward_path in order to
+ * 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
+ */
+ struct ieee80211_ops {
+ void (*tx)(struct ieee80211_hw *hw,
+@@ -4292,6 +4301,9 @@ struct ieee80211_ops {
+ struct ieee80211_sta *sta,
+ struct net_device_path_ctx *ctx,
+ struct net_device_path *path);
++ int (*net_fill_receive_path)(struct ieee80211_hw *hw,
++ struct net_device_path_ctx *ctx,
++ struct net_device_path *path);
+ };
+
+ /**
+diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
+index d2b68ef..27da75e 100644
+--- a/net/mac80211/driver-ops.h
++++ b/net/mac80211/driver-ops.h
+@@ -1508,4 +1508,17 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local,
+ return ret;
+ }
+
++static inline int drv_net_fill_receive_path(struct ieee80211_local *local,
++ struct net_device_path_ctx *ctx,
++ struct net_device_path *path)
++{
++ int ret = -EOPNOTSUPP;
++
++ if (local->ops->net_fill_receive_path)
++ ret = local->ops->net_fill_receive_path(&local->hw,
++ ctx, path);
++
++ return ret;
++}
++
+ #endif /* __MAC80211_DRIVER_OPS */
+diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
+index 797fe24..a72bdea 100644
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
+@@ -911,6 +911,29 @@ out:
+ return ret;
+ }
+
++static int ieee80211_netdev_fill_receive_path(struct net_device_path_ctx *ctx,
++ struct net_device_path *path)
++{
++ struct ieee80211_sub_if_data *sdata;
++ struct ieee80211_local *local;
++ int ret = -ENOENT;
++
++ sdata = IEEE80211_DEV_TO_SUB_IF(ctx->dev);
++ local = sdata->local;
++
++ if (!local->ops->net_fill_receive_path)
++ return -EOPNOTSUPP;
++
++ rcu_read_lock();
++
++ ret = drv_net_fill_receive_path(local, ctx, path);
++
++ rcu_read_unlock();
++
++ return ret;
++}
++
++
+ static const struct net_device_ops ieee80211_dataif_8023_ops = {
+ #if LINUX_VERSION_IS_LESS(4,10,0)
+ .ndo_change_mtu = __change_mtu,
+@@ -929,6 +952,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = {
+ .ndo_get_stats64 = bp_ieee80211_get_stats64,
+ #endif
+ .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path,
++ .ndo_fill_receive_path = ieee80211_netdev_fill_receive_path,
+ };
+
+ static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype)
+diff --git a/net/mac80211/util.c b/net/mac80211/util.c
+old mode 100644
+new mode 100755
+index d85a39a..d515956
+--- a/net/mac80211/util.c
++++ b/net/mac80211/util.c
+@@ -898,6 +898,15 @@ struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif)
+ }
+ EXPORT_SYMBOL_GPL(ieee80211_vif_to_wdev);
+
++struct net_device *ieee80211_vif_to_netdev(struct ieee80211_vif *vif)
++{
++ if (!vif)
++ return NULL;
++
++ return vif_to_sdata(vif)->dev;
++}
++EXPORT_SYMBOL_GPL(ieee80211_vif_to_netdev);
++
+ /*
+ * Nothing should have been stuffed into the workqueue during
+ * the suspend->resume cycle. Since we can't check each caller
+--
+2.18.0
+