blob: aa96627ab4be05a5b08c53bb55867d5d7eb7e691 [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From 7e201d350d68f2c0588b8e5f7748e4f733fd8bbc Mon Sep 17 00:00:00 2001
developer66e89bc2024-04-23 14:50:01 +08002From: Sujuan Chen <sujuan.chen@mediatek.com>
3Date: Wed, 18 May 2022 15:10:22 +0800
developer05f3b2b2024-08-19 19:17:34 +08004Subject: [PATCH 24/89] mtk: mac80211: add fill receive path ops to get wed idx
developer66e89bc2024-04-23 14:50:01 +08005
6Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
developer66e89bc2024-04-23 14:50:01 +08007---
8 include/net/mac80211.h | 5 +++++
9 net/mac80211/driver-ops.h | 13 +++++++++++++
10 net/mac80211/iface.c | 23 +++++++++++++++++++++++
11 net/mac80211/util.c | 9 +++++++++
12 4 files changed, 50 insertions(+)
13
14diff --git a/include/net/mac80211.h b/include/net/mac80211.h
developer05f3b2b2024-08-19 19:17:34 +080015index 859afcf..5856fc6 100644
developer66e89bc2024-04-23 14:50:01 +080016--- a/include/net/mac80211.h
17+++ b/include/net/mac80211.h
developer05f3b2b2024-08-19 19:17:34 +080018@@ -4420,6 +4420,8 @@ struct ieee80211_prep_tx_info {
developer66e89bc2024-04-23 14:50:01 +080019 * resolve a path for hardware flow offloading
20 * @can_activate_links: Checks if a specific active_links bitmap is
21 * supported by the driver.
22+ * @net_fill_receive_path: Called from .ndo_fill_receive_path in order to
23+ * get a path for hardware flow offloading
24 * @change_vif_links: Change the valid links on an interface, note that while
25 * removing the old link information is still valid (link_conf pointer),
26 * but may immediately disappear after the function returns. The old or
developer05f3b2b2024-08-19 19:17:34 +080027@@ -4808,6 +4810,9 @@ struct ieee80211_ops {
developer66e89bc2024-04-23 14:50:01 +080028 bool (*can_activate_links)(struct ieee80211_hw *hw,
29 struct ieee80211_vif *vif,
30 u16 active_links);
31+ int (*net_fill_receive_path)(struct ieee80211_hw *hw,
32+ struct net_device_path_ctx *ctx,
33+ struct net_device_path *path);
34 int (*change_vif_links)(struct ieee80211_hw *hw,
35 struct ieee80211_vif *vif,
36 u16 old_links, u16 new_links,
37diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
developer05f3b2b2024-08-19 19:17:34 +080038index 9ffbca2..4cddc3c 100644
developer66e89bc2024-04-23 14:50:01 +080039--- a/net/mac80211/driver-ops.h
40+++ b/net/mac80211/driver-ops.h
developer05f3b2b2024-08-19 19:17:34 +080041@@ -1661,6 +1661,19 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local,
developer66e89bc2024-04-23 14:50:01 +080042 return ret;
43 }
44
45+static inline int drv_net_fill_receive_path(struct ieee80211_local *local,
46+ struct net_device_path_ctx *ctx,
47+ struct net_device_path *path)
48+{
49+ int ret = -EOPNOTSUPP;
50+
51+ if (local->ops->net_fill_receive_path)
52+ ret = local->ops->net_fill_receive_path(&local->hw,
53+ ctx, path);
54+
55+ return ret;
56+}
57+
58 static inline int drv_net_setup_tc(struct ieee80211_local *local,
59 struct ieee80211_sub_if_data *sdata,
60 struct net_device *dev,
61diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
developer05f3b2b2024-08-19 19:17:34 +080062index 71e8b0d..c454826 100644
developer66e89bc2024-04-23 14:50:01 +080063--- a/net/mac80211/iface.c
64+++ b/net/mac80211/iface.c
developer05f3b2b2024-08-19 19:17:34 +080065@@ -931,6 +931,28 @@ out:
developer66e89bc2024-04-23 14:50:01 +080066 return ret;
67 }
68
69+static int ieee80211_netdev_fill_receive_path(struct net_device_path_ctx *ctx,
70+ struct net_device_path *path)
71+{
72+ struct ieee80211_sub_if_data *sdata;
73+ struct ieee80211_local *local;
74+ int ret = -ENOENT;
75+
76+ sdata = IEEE80211_DEV_TO_SUB_IF(ctx->dev);
77+ local = sdata->local;
78+
79+ if (!local->ops->net_fill_receive_path)
80+ return -EOPNOTSUPP;
81+
82+ rcu_read_lock();
83+
84+ ret = drv_net_fill_receive_path(local, ctx, path);
85+
86+ rcu_read_unlock();
87+
88+ return ret;
89+}
90+
91 static const struct net_device_ops ieee80211_dataif_8023_ops = {
developer05f3b2b2024-08-19 19:17:34 +080092 .ndo_open = ieee80211_open,
93 .ndo_stop = ieee80211_stop,
94@@ -939,6 +961,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = {
95 .ndo_set_rx_mode = ieee80211_set_multicast_list,
96 .ndo_set_mac_address = ieee80211_change_mac,
developer66e89bc2024-04-23 14:50:01 +080097 .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path,
98+ .ndo_fill_receive_path = ieee80211_netdev_fill_receive_path,
99 .ndo_setup_tc = ieee80211_netdev_setup_tc,
100 };
101
102diff --git a/net/mac80211/util.c b/net/mac80211/util.c
developer05f3b2b2024-08-19 19:17:34 +0800103index ecda005..1877400 100644
developer66e89bc2024-04-23 14:50:01 +0800104--- a/net/mac80211/util.c
105+++ b/net/mac80211/util.c
106@@ -874,6 +874,15 @@ struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif)
107 }
108 EXPORT_SYMBOL_GPL(ieee80211_vif_to_wdev);
109
110+struct net_device *ieee80211_vif_to_netdev(struct ieee80211_vif *vif)
111+{
112+ if (!vif)
113+ return NULL;
114+
115+ return vif_to_sdata(vif)->dev;
116+}
117+EXPORT_SYMBOL_GPL(ieee80211_vif_to_netdev);
118+
119 /*
120 * Nothing should have been stuffed into the workqueue during
121 * the suspend->resume cycle. Since we can't check each caller
122--
developer05f3b2b2024-08-19 19:17:34 +08001232.18.0
developer66e89bc2024-04-23 14:50:01 +0800124