developer | ebaa551 | 2023-04-19 18:23:21 +0800 | [diff] [blame] | 1 | From ea115965135f78dc8993f1a73a0600fb5b83cdf7 Mon Sep 17 00:00:00 2001 |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 2 | From: Sujuan Chen <sujuan.chen@mediatek.com> |
| 3 | Date: Wed, 18 May 2022 15:10:22 +0800 |
developer | ebaa551 | 2023-04-19 18:23:21 +0800 | [diff] [blame] | 4 | Subject: [PATCH 10/14] mac80211: mtk: add fill receive path ops to get wed idx |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 5 | |
| 6 | Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com> |
| 7 | --- |
developer | 6ca1756 | 2023-03-24 17:07:44 +0800 | [diff] [blame] | 8 | include/net/mac80211.h | 5 +++++ |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 9 | net/mac80211/driver-ops.h | 13 +++++++++++++ |
developer | 6ca1756 | 2023-03-24 17:07:44 +0800 | [diff] [blame] | 10 | net/mac80211/iface.c | 23 +++++++++++++++++++++++ |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 11 | net/mac80211/util.c | 9 +++++++++ |
developer | 6ca1756 | 2023-03-24 17:07:44 +0800 | [diff] [blame] | 12 | 4 files changed, 50 insertions(+) |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 13 | |
| 14 | diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
developer | ebaa551 | 2023-04-19 18:23:21 +0800 | [diff] [blame] | 15 | index bd257ce..9208a8d 100644 |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 16 | --- a/include/net/mac80211.h |
| 17 | +++ b/include/net/mac80211.h |
developer | ebaa551 | 2023-04-19 18:23:21 +0800 | [diff] [blame] | 18 | @@ -4226,6 +4226,8 @@ struct ieee80211_prep_tx_info { |
developer | 6ca1756 | 2023-03-24 17:07:44 +0800 | [diff] [blame] | 19 | * disable background CAC/radar detection. |
| 20 | * @net_fill_forward_path: Called from .ndo_fill_forward_path in order to |
| 21 | * resolve a path for hardware flow offloading |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 22 | + * @net_fill_receive_path: Called from .ndo_fill_receive_path in order to |
| 23 | + * get a path for hardware flow offloading |
developer | 6ca1756 | 2023-03-24 17:07:44 +0800 | [diff] [blame] | 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 |
developer | ebaa551 | 2023-04-19 18:23:21 +0800 | [diff] [blame] | 27 | @@ -4591,6 +4593,9 @@ struct ieee80211_ops { |
developer | 6ca1756 | 2023-03-24 17:07:44 +0800 | [diff] [blame] | 28 | struct ieee80211_sta *sta, |
| 29 | struct net_device_path_ctx *ctx, |
| 30 | struct net_device_path *path); |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 31 | + int (*net_fill_receive_path)(struct ieee80211_hw *hw, |
| 32 | + struct net_device_path_ctx *ctx, |
| 33 | + struct net_device_path *path); |
developer | 6ca1756 | 2023-03-24 17:07:44 +0800 | [diff] [blame] | 34 | int (*change_vif_links)(struct ieee80211_hw *hw, |
| 35 | struct ieee80211_vif *vif, |
| 36 | u16 old_links, u16 new_links, |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 37 | diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h |
developer | ebaa551 | 2023-04-19 18:23:21 +0800 | [diff] [blame] | 38 | index 37f428e..b076658 100644 |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 39 | --- a/net/mac80211/driver-ops.h |
| 40 | +++ b/net/mac80211/driver-ops.h |
developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame] | 41 | @@ -1485,6 +1485,19 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local, |
developer | 6ca1756 | 2023-03-24 17:07:44 +0800 | [diff] [blame] | 42 | return ret; |
| 43 | } |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 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 | + |
developer | 6ca1756 | 2023-03-24 17:07:44 +0800 | [diff] [blame] | 58 | static inline int drv_net_setup_tc(struct ieee80211_local *local, |
| 59 | struct ieee80211_sub_if_data *sdata, |
| 60 | struct net_device *dev, |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 61 | diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c |
developer | 6ca1756 | 2023-03-24 17:07:44 +0800 | [diff] [blame] | 62 | index a18f80d..b82065c 100644 |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 63 | --- a/net/mac80211/iface.c |
| 64 | +++ b/net/mac80211/iface.c |
developer | 6ca1756 | 2023-03-24 17:07:44 +0800 | [diff] [blame] | 65 | @@ -936,6 +936,28 @@ out: |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 66 | 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 | + |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 91 | static const struct net_device_ops ieee80211_dataif_8023_ops = { |
| 92 | .ndo_open = ieee80211_open, |
| 93 | .ndo_stop = ieee80211_stop, |
developer | 6ca1756 | 2023-03-24 17:07:44 +0800 | [diff] [blame] | 94 | @@ -945,6 +967,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = { |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 95 | .ndo_set_mac_address = ieee80211_change_mac, |
| 96 | .ndo_get_stats64 = ieee80211_get_stats64, |
| 97 | .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path, |
developer | 6ca1756 | 2023-03-24 17:07:44 +0800 | [diff] [blame] | 98 | + .ndo_fill_receive_path = ieee80211_netdev_fill_receive_path, |
| 99 | .ndo_setup_tc = ieee80211_netdev_setup_tc, |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 100 | }; |
| 101 | |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 102 | diff --git a/net/mac80211/util.c b/net/mac80211/util.c |
developer | ebaa551 | 2023-04-19 18:23:21 +0800 | [diff] [blame] | 103 | index 5a6c091..f6a2561 100644 |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 104 | --- a/net/mac80211/util.c |
| 105 | +++ b/net/mac80211/util.c |
developer | ebaa551 | 2023-04-19 18:23:21 +0800 | [diff] [blame] | 106 | @@ -888,6 +888,15 @@ struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif) |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 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 | -- |
developer | ebaa551 | 2023-04-19 18:23:21 +0800 | [diff] [blame] | 123 | 2.39.2 |
developer | 4a339e8 | 2022-12-12 19:00:30 +0800 | [diff] [blame] | 124 | |