blob: 6d58e480b5750ddd3734ad189180910f375c22c9 [file] [log] [blame]
developerbf24a8a2022-11-30 14:52:20 +08001From f1d42518adad5791f668a46d3cad3a5efc5f0a30 Mon Sep 17 00:00:00 2001
developer8cb3ac72022-07-04 10:55:14 +08002From: Sujuan Chen <sujuan.chen@mediatek.com>
3Date: Wed, 18 May 2022 15:10:22 +0800
developerbf24a8a2022-11-30 14:52:20 +08004Subject: [PATCH 99901/99901] mac80211: mtk: add fill receive path ops to get
5 wed idx
developer8cb3ac72022-07-04 10:55:14 +08006
7Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
8---
9 include/net/mac80211.h | 12 ++++++++++++
10 net/mac80211/driver-ops.h | 13 +++++++++++++
11 net/mac80211/iface.c | 24 ++++++++++++++++++++++++
12 net/mac80211/util.c | 9 +++++++++
13 4 files changed, 58 insertions(+)
14 mode change 100644 => 100755 include/net/mac80211.h
15 mode change 100644 => 100755 net/mac80211/util.c
16
17diff --git a/include/net/mac80211.h b/include/net/mac80211.h
18old mode 100644
19new mode 100755
developera09ec1d2022-11-26 11:00:33 +080020index 95e5e66..9a38b9f
developer8cb3ac72022-07-04 10:55:14 +080021--- a/include/net/mac80211.h
22+++ b/include/net/mac80211.h
developera09ec1d2022-11-26 11:00:33 +080023@@ -1796,6 +1796,13 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
developer8cb3ac72022-07-04 10:55:14 +080024 */
25 struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif);
26
27+/**
28+ * ieee80211_vif_to_wdev - return a net_device struct from a vif
29+ * @vif: the vif to get the net_device for
30+ */
31+struct net_device *ieee80211_vif_to_netdev(struct ieee80211_vif *vif);
32+
33+
34 /**
35 * enum ieee80211_key_flags - key flags
36 *
developera09ec1d2022-11-26 11:00:33 +080037@@ -3962,6 +3969,8 @@ struct ieee80211_prep_tx_info {
developer8cb3ac72022-07-04 10:55:14 +080038 * disable background CAC/radar detection.
39 * @net_fill_forward_path: Called from .ndo_fill_forward_path in order to
40 * resolve a path for hardware flow offloading
41+ * @net_fill_receive_path: Called from .ndo_fill_receive_path in order to
42+ * get a path for hardware flow offloading
43 */
44 struct ieee80211_ops {
45 void (*tx)(struct ieee80211_hw *hw,
developera09ec1d2022-11-26 11:00:33 +080046@@ -4297,6 +4306,9 @@ struct ieee80211_ops {
developer8cb3ac72022-07-04 10:55:14 +080047 struct ieee80211_sta *sta,
48 struct net_device_path_ctx *ctx,
49 struct net_device_path *path);
50+ int (*net_fill_receive_path)(struct ieee80211_hw *hw,
51+ struct net_device_path_ctx *ctx,
52+ struct net_device_path *path);
53 };
54
55 /**
56diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
57index d2b68ef..27da75e 100644
58--- a/net/mac80211/driver-ops.h
59+++ b/net/mac80211/driver-ops.h
60@@ -1508,4 +1508,17 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local,
61 return ret;
62 }
63
64+static inline int drv_net_fill_receive_path(struct ieee80211_local *local,
65+ struct net_device_path_ctx *ctx,
66+ struct net_device_path *path)
67+{
68+ int ret = -EOPNOTSUPP;
69+
70+ if (local->ops->net_fill_receive_path)
71+ ret = local->ops->net_fill_receive_path(&local->hw,
72+ ctx, path);
73+
74+ return ret;
75+}
76+
77 #endif /* __MAC80211_DRIVER_OPS */
78diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
developera09ec1d2022-11-26 11:00:33 +080079index 455791f..98b2369 100644
developer8cb3ac72022-07-04 10:55:14 +080080--- a/net/mac80211/iface.c
81+++ b/net/mac80211/iface.c
developer3e4199d2022-10-19 14:18:06 +080082@@ -910,6 +910,29 @@ out:
developer8cb3ac72022-07-04 10:55:14 +080083 return ret;
84 }
85
86+static int ieee80211_netdev_fill_receive_path(struct net_device_path_ctx *ctx,
87+ struct net_device_path *path)
88+{
89+ struct ieee80211_sub_if_data *sdata;
90+ struct ieee80211_local *local;
91+ int ret = -ENOENT;
92+
93+ sdata = IEEE80211_DEV_TO_SUB_IF(ctx->dev);
94+ local = sdata->local;
95+
96+ if (!local->ops->net_fill_receive_path)
97+ return -EOPNOTSUPP;
98+
99+ rcu_read_lock();
100+
101+ ret = drv_net_fill_receive_path(local, ctx, path);
102+
103+ rcu_read_unlock();
104+
105+ return ret;
106+}
107+
108+
109 static const struct net_device_ops ieee80211_dataif_8023_ops = {
110 #if LINUX_VERSION_IS_LESS(4,10,0)
111 .ndo_change_mtu = __change_mtu,
developer3e4199d2022-10-19 14:18:06 +0800112@@ -928,6 +951,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = {
developer8cb3ac72022-07-04 10:55:14 +0800113 .ndo_get_stats64 = bp_ieee80211_get_stats64,
114 #endif
115 .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path,
116+ .ndo_fill_receive_path = ieee80211_netdev_fill_receive_path,
117 };
118
119 static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype)
120diff --git a/net/mac80211/util.c b/net/mac80211/util.c
121old mode 100644
122new mode 100755
developera09ec1d2022-11-26 11:00:33 +0800123index 8d36b05..d26a2b8
developer8cb3ac72022-07-04 10:55:14 +0800124--- a/net/mac80211/util.c
125+++ b/net/mac80211/util.c
126@@ -898,6 +898,15 @@ struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif)
127 }
128 EXPORT_SYMBOL_GPL(ieee80211_vif_to_wdev);
129
130+struct net_device *ieee80211_vif_to_netdev(struct ieee80211_vif *vif)
131+{
132+ if (!vif)
133+ return NULL;
134+
135+ return vif_to_sdata(vif)->dev;
136+}
137+EXPORT_SYMBOL_GPL(ieee80211_vif_to_netdev);
138+
139 /*
140 * Nothing should have been stuffed into the workqueue during
141 * the suspend->resume cycle. Since we can't check each caller
142--
developera09ec1d2022-11-26 11:00:33 +08001432.36.1
developer8cb3ac72022-07-04 10:55:14 +0800144