developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 1 | From 0161154c18a464bbb350bcb5ef620bd255940640 Mon Sep 17 00:00:00 2001 |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 2 | From: Sujuan Chen <sujuan.chen@mediatek.com> |
| 3 | Date: Wed, 18 May 2022 15:10:22 +0800 |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 4 | Subject: [PATCH 9901/9903] mac80211: mtk: add fill receive path ops to get wed |
developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame] | 5 | idx |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 6 | |
| 7 | Signed-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 | |
| 17 | diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
| 18 | old mode 100644 |
| 19 | new mode 100755 |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 20 | index 42192cd..8a71026 |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 21 | --- a/include/net/mac80211.h |
| 22 | +++ b/include/net/mac80211.h |
developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame] | 23 | @@ -1798,6 +1798,13 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev); |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 24 | */ |
| 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 | * |
developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame] | 37 | @@ -3975,6 +3982,8 @@ struct ieee80211_prep_tx_info { |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 38 | * 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, |
developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame] | 46 | @@ -4312,6 +4321,9 @@ struct ieee80211_ops { |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 47 | 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 | /** |
| 56 | diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h |
developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame] | 57 | index 19e2ada..88dedfc 100644 |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 58 | --- a/net/mac80211/driver-ops.h |
| 59 | +++ b/net/mac80211/driver-ops.h |
developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame] | 60 | @@ -1523,4 +1523,17 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local, |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 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 */ |
| 78 | diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c |
developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame] | 79 | index a7169a5..8a4f4e1 100644 |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 80 | --- a/net/mac80211/iface.c |
| 81 | +++ b/net/mac80211/iface.c |
developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame] | 82 | @@ -911,6 +911,29 @@ out: |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 83 | 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, |
developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame] | 112 | @@ -929,6 +952,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = { |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 113 | .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) |
| 120 | diff --git a/net/mac80211/util.c b/net/mac80211/util.c |
| 121 | old mode 100644 |
| 122 | new mode 100755 |
developer | a09ec1d | 2022-11-26 11:00:33 +0800 | [diff] [blame] | 123 | index 8d36b05..d26a2b8 |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 124 | --- 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 | -- |
developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame] | 143 | 2.18.0 |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 144 | |