developer | 4eb49d9 | 2022-12-05 11:29:56 +0800 | [diff] [blame^] | 1 | From f1d42518adad5791f668a46d3cad3a5efc5f0a30 Mon Sep 17 00:00:00 2001 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 2 | From: Sujuan Chen <sujuan.chen@mediatek.com> |
| 3 | Date: Wed, 18 May 2022 15:10:22 +0800 |
developer | 4eb49d9 | 2022-12-05 11:29:56 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 99901/99901] mac80211: mtk: add fill receive path ops to get |
| 5 | wed idx |
developer | f79ad45 | 2022-07-12 11:37:54 +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 | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 20 | index 95e5e66..9a38b9f |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 21 | --- a/include/net/mac80211.h |
| 22 | +++ b/include/net/mac80211.h |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 23 | @@ -1796,6 +1796,13 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev); |
developer | f79ad45 | 2022-07-12 11:37:54 +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 | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 37 | @@ -3962,6 +3969,8 @@ struct ieee80211_prep_tx_info { |
developer | f79ad45 | 2022-07-12 11:37:54 +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 | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 46 | @@ -4297,6 +4306,9 @@ struct ieee80211_ops { |
developer | f79ad45 | 2022-07-12 11:37:54 +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 |
| 57 | index 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 */ |
| 78 | diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 79 | index 455791f..98b2369 100644 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 80 | --- a/net/mac80211/iface.c |
| 81 | +++ b/net/mac80211/iface.c |
developer | 18dec8f | 2022-10-25 12:20:54 +0800 | [diff] [blame] | 82 | @@ -910,6 +910,29 @@ out: |
developer | f79ad45 | 2022-07-12 11:37:54 +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 | 18dec8f | 2022-10-25 12:20:54 +0800 | [diff] [blame] | 112 | @@ -928,6 +951,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = { |
developer | f79ad45 | 2022-07-12 11:37:54 +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 | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 123 | index 8d36b05..d26a2b8 |
developer | f79ad45 | 2022-07-12 11:37:54 +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 | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 143 | 2.36.1 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 144 | |