developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 1 | From e5612cde83ef67f8fa4633f7d364e05bac6e02a3 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 | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 9901/9902] mac80211: mtk: add fill receive path ops to get wed |
developer | 8effbd3 | 2023-04-17 15:57:28 +0800 | [diff] [blame] | 5 | 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 ++++++++++++ |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 10 | net/mac80211/driver-ops.h | 14 +++++++++++++- |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 11 | net/mac80211/iface.c | 24 ++++++++++++++++++++++++ |
| 12 | net/mac80211/util.c | 9 +++++++++ |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 13 | 4 files changed, 58 insertions(+), 1 deletion(-) |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 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 | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 20 | index c6625c2..cb8b28d |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 21 | --- a/include/net/mac80211.h |
| 22 | +++ b/include/net/mac80211.h |
developer | 8effbd3 | 2023-04-17 15:57:28 +0800 | [diff] [blame] | 23 | @@ -1798,6 +1798,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 | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 37 | @@ -3982,6 +3989,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 |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 43 | * @set_qos_map: Set QoS mapping information to driver. |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 44 | */ |
| 45 | struct ieee80211_ops { |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 46 | @@ -4320,6 +4329,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); |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 53 | int (*set_qos_map)(struct ieee80211_vif *vif, |
| 54 | struct cfg80211_qos_map *qos_map); |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 55 | }; |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 56 | diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 57 | index 91ea8b2..348f815 100644 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 58 | --- a/net/mac80211/driver-ops.h |
| 59 | +++ b/net/mac80211/driver-ops.h |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 60 | @@ -1523,6 +1523,19 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local, |
developer | f79ad45 | 2022-07-12 11:37:54 +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 | + |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 77 | static inline int drv_set_qos_map(struct ieee80211_local *local, |
| 78 | struct ieee80211_sub_if_data *sdata, |
| 79 | struct cfg80211_qos_map *qos_map) |
| 80 | @@ -1538,5 +1551,4 @@ static inline int drv_set_qos_map(struct ieee80211_local *local, |
| 81 | |
| 82 | return ret; |
| 83 | } |
| 84 | - |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 85 | #endif /* __MAC80211_DRIVER_OPS */ |
| 86 | diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 87 | index 4b92867..c08bfbe 100644 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 88 | --- a/net/mac80211/iface.c |
| 89 | +++ b/net/mac80211/iface.c |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 90 | @@ -933,6 +933,29 @@ out: |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 91 | return ret; |
| 92 | } |
| 93 | |
| 94 | +static int ieee80211_netdev_fill_receive_path(struct net_device_path_ctx *ctx, |
| 95 | + struct net_device_path *path) |
| 96 | +{ |
| 97 | + struct ieee80211_sub_if_data *sdata; |
| 98 | + struct ieee80211_local *local; |
| 99 | + int ret = -ENOENT; |
| 100 | + |
| 101 | + sdata = IEEE80211_DEV_TO_SUB_IF(ctx->dev); |
| 102 | + local = sdata->local; |
| 103 | + |
| 104 | + if (!local->ops->net_fill_receive_path) |
| 105 | + return -EOPNOTSUPP; |
| 106 | + |
| 107 | + rcu_read_lock(); |
| 108 | + |
| 109 | + ret = drv_net_fill_receive_path(local, ctx, path); |
| 110 | + |
| 111 | + rcu_read_unlock(); |
| 112 | + |
| 113 | + return ret; |
| 114 | +} |
| 115 | + |
| 116 | + |
| 117 | static const struct net_device_ops ieee80211_dataif_8023_ops = { |
| 118 | #if LINUX_VERSION_IS_LESS(4,10,0) |
| 119 | .ndo_change_mtu = __change_mtu, |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 120 | @@ -951,6 +974,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = { |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 121 | .ndo_get_stats64 = bp_ieee80211_get_stats64, |
| 122 | #endif |
| 123 | .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path, |
| 124 | + .ndo_fill_receive_path = ieee80211_netdev_fill_receive_path, |
| 125 | }; |
| 126 | |
| 127 | static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype) |
| 128 | diff --git a/net/mac80211/util.c b/net/mac80211/util.c |
| 129 | old mode 100644 |
| 130 | new mode 100755 |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 131 | index e07fe73..809eb37 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 132 | --- a/net/mac80211/util.c |
| 133 | +++ b/net/mac80211/util.c |
| 134 | @@ -898,6 +898,15 @@ struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif) |
| 135 | } |
| 136 | EXPORT_SYMBOL_GPL(ieee80211_vif_to_wdev); |
| 137 | |
| 138 | +struct net_device *ieee80211_vif_to_netdev(struct ieee80211_vif *vif) |
| 139 | +{ |
| 140 | + if (!vif) |
| 141 | + return NULL; |
| 142 | + |
| 143 | + return vif_to_sdata(vif)->dev; |
| 144 | +} |
| 145 | +EXPORT_SYMBOL_GPL(ieee80211_vif_to_netdev); |
| 146 | + |
| 147 | /* |
| 148 | * Nothing should have been stuffed into the workqueue during |
| 149 | * the suspend->resume cycle. Since we can't check each caller |
| 150 | -- |
developer | 8effbd3 | 2023-04-17 15:57:28 +0800 | [diff] [blame] | 151 | 2.18.0 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 152 | |