developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame^] | 1 | From 2aa50f34a5e8378775028818a1e6f285498fd01e Mon Sep 17 00:00:00 2001 |
| 2 | From: Sujuan Chen <sujuan.chen@mediatek.com> |
| 3 | Date: Fri, 11 Mar 2022 11:34:11 +0800 |
| 4 | Subject: [PATCH 9900/9902] mac80211: mtk: mask kernel version limitation and |
| 5 | fill forward path in kernel 5.4 |
| 6 | |
| 7 | Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com> |
| 8 | --- |
| 9 | include/net/mac80211.h | 2 -- |
| 10 | include/net/mac80211.h.orig | 43 +++++++++++++++++++++++++++++++++++-- |
| 11 | net/mac80211/driver-ops.h | 2 -- |
| 12 | net/mac80211/iface.c | 4 ---- |
| 13 | net/mac80211/trace.h | 2 -- |
| 14 | 5 files changed, 41 insertions(+), 12 deletions(-) |
| 15 | |
| 16 | diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
| 17 | index 28ec7e8..9c35e0b 100644 |
| 18 | --- a/include/net/mac80211.h |
| 19 | +++ b/include/net/mac80211.h |
| 20 | @@ -4307,13 +4307,11 @@ struct ieee80211_ops { |
| 21 | struct ieee80211_sta *sta, u8 flowid); |
| 22 | int (*set_radar_background)(struct ieee80211_hw *hw, |
| 23 | struct cfg80211_chan_def *chandef); |
| 24 | -#if LINUX_VERSION_IS_GEQ(5,10,0) |
| 25 | int (*net_fill_forward_path)(struct ieee80211_hw *hw, |
| 26 | struct ieee80211_vif *vif, |
| 27 | struct ieee80211_sta *sta, |
| 28 | struct net_device_path_ctx *ctx, |
| 29 | struct net_device_path *path); |
| 30 | -#endif |
| 31 | }; |
| 32 | |
| 33 | /** |
| 34 | diff --git a/include/net/mac80211.h.orig b/include/net/mac80211.h.orig |
| 35 | index dba8550..28ec7e8 100644 |
| 36 | --- a/include/net/mac80211.h.orig |
| 37 | +++ b/include/net/mac80211.h.orig |
| 38 | @@ -505,6 +505,7 @@ struct ieee80211_ftm_responder_params { |
| 39 | struct ieee80211_fils_discovery { |
| 40 | u32 min_interval; |
| 41 | u32 max_interval; |
| 42 | + u8 disable; |
| 43 | }; |
| 44 | |
| 45 | /** |
| 46 | @@ -698,6 +699,8 @@ struct ieee80211_bss_conf { |
| 47 | } he_oper; |
| 48 | struct ieee80211_he_obss_pd he_obss_pd; |
| 49 | struct cfg80211_he_bss_color he_bss_color; |
| 50 | + u64 used_color_bitmap; |
| 51 | + u64 color_last_seen[64]; |
| 52 | struct ieee80211_fils_discovery fils_discovery; |
| 53 | u32 unsol_bcast_probe_resp_interval; |
| 54 | bool s1g; |
| 55 | @@ -1566,6 +1569,7 @@ enum ieee80211_smps_mode { |
| 56 | * |
| 57 | * @power_level: requested transmit power (in dBm), backward compatibility |
| 58 | * value only that is set to the minimum of all interfaces |
| 59 | + * @max_antenna_gain: maximum antenna gain adjusted by user config (in dBi) |
| 60 | * |
| 61 | * @chandef: the channel definition to tune to |
| 62 | * @radar_enabled: whether radar detection is enabled |
| 63 | @@ -1586,6 +1590,7 @@ enum ieee80211_smps_mode { |
| 64 | struct ieee80211_conf { |
| 65 | u32 flags; |
| 66 | int power_level, dynamic_ps_timeout; |
| 67 | + int max_antenna_gain; |
| 68 | |
| 69 | u16 listen_interval; |
| 70 | u8 ps_dtim_period; |
| 71 | @@ -1685,6 +1690,10 @@ enum ieee80211_offload_flags { |
| 72 | * write-protected by sdata_lock and local->mtx so holding either is fine |
| 73 | * for read access. |
| 74 | * @mu_mimo_owner: indicates interface owns MU-MIMO capability |
| 75 | + * @netdev_features: tx netdev features supported by the hardware for this |
| 76 | + * vif. mac80211 initializes this to hw->netdev_features, and the driver |
| 77 | + * can mask out specific tx features. mac80211 will handle software fixup |
| 78 | + * for masked offloads (GSO, CSUM) |
| 79 | * @driver_flags: flags/capabilities the driver has for this interface, |
| 80 | * these need to be set (or cleared) when the interface is added |
| 81 | * or, if supported by the driver, the interface type is changed |
| 82 | @@ -1736,6 +1745,7 @@ struct ieee80211_vif { |
| 83 | |
| 84 | struct ieee80211_chanctx_conf __rcu *chanctx_conf; |
| 85 | |
| 86 | + netdev_features_t netdev_features; |
| 87 | u32 driver_flags; |
| 88 | u32 offload_flags; |
| 89 | |
| 90 | @@ -2418,6 +2428,9 @@ struct ieee80211_txq { |
| 91 | * usage and 802.11 frames with %RX_FLAG_ONLY_MONITOR set for monitor to |
| 92 | * the stack. |
| 93 | * |
| 94 | + * @IEEE80211_HW_DETECTS_COLOR_COLLISION: HW/driver has support for BSS color |
| 95 | + * collision detection and doesn't need it in software. |
| 96 | + * |
| 97 | * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays |
| 98 | */ |
| 99 | enum ieee80211_hw_flags { |
| 100 | @@ -2473,6 +2486,7 @@ enum ieee80211_hw_flags { |
| 101 | IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD, |
| 102 | IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD, |
| 103 | IEEE80211_HW_SUPPORTS_CONC_MON_RX_DECAP, |
| 104 | + IEEE80211_HW_DETECTS_COLOR_COLLISION, |
| 105 | |
| 106 | /* keep last, obviously */ |
| 107 | NUM_IEEE80211_HW_FLAGS |
| 108 | @@ -2656,6 +2670,13 @@ static inline void _ieee80211_hw_set(struct ieee80211_hw *hw, |
| 109 | } |
| 110 | #define ieee80211_hw_set(hw, flg) _ieee80211_hw_set(hw, IEEE80211_HW_##flg) |
| 111 | |
| 112 | +static inline void _ieee80211_hw_clear(struct ieee80211_hw *hw, |
| 113 | + enum ieee80211_hw_flags flg) |
| 114 | +{ |
| 115 | + return __clear_bit(flg, hw->flags); |
| 116 | +} |
| 117 | +#define ieee80211_hw_clear(hw, flg) _ieee80211_hw_clear(hw, IEEE80211_HW_##flg) |
| 118 | + |
| 119 | /** |
| 120 | * struct ieee80211_scan_request - hw scan request |
| 121 | * |
| 122 | @@ -3688,6 +3709,10 @@ struct ieee80211_prep_tx_info { |
| 123 | * Note that vif can be NULL. |
| 124 | * The callback can sleep. |
| 125 | * |
| 126 | + * @flush_sta: Flush or drop all pending frames from the hardware queue(s) for |
| 127 | + * the given station, as it's about to be removed. |
| 128 | + * The callback can sleep. |
| 129 | + * |
| 130 | * @channel_switch: Drivers that need (or want) to offload the channel |
| 131 | * switch operation for CSAs received from the AP may implement this |
| 132 | * callback. They must then call ieee80211_chswitch_done() to indicate |
| 133 | @@ -4116,6 +4141,8 @@ struct ieee80211_ops { |
| 134 | #endif |
| 135 | void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 136 | u32 queues, bool drop); |
| 137 | + void (*flush_sta)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 138 | + struct ieee80211_sta *sta); |
| 139 | void (*channel_switch)(struct ieee80211_hw *hw, |
| 140 | struct ieee80211_vif *vif, |
| 141 | struct ieee80211_channel_switch *ch_switch); |
| 142 | @@ -5677,6 +5704,18 @@ void ieee80211_queue_delayed_work(struct ieee80211_hw *hw, |
| 143 | struct delayed_work *dwork, |
| 144 | unsigned long delay); |
| 145 | |
| 146 | +/** |
| 147 | + * ieee80211_refresh_tx_agg_session_timer - Refresh a tx agg session timer. |
| 148 | + * @sta: the station for which to start a BA session |
| 149 | + * @tid: the TID to BA on. |
| 150 | + * |
| 151 | + * This function allows low level driver to refresh tx agg session timer |
| 152 | + * to maintain BA session, the session level will still be managed by the |
| 153 | + * mac80211. |
| 154 | + */ |
| 155 | +void ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *sta, |
| 156 | + u16 tid); |
| 157 | + |
| 158 | /** |
| 159 | * ieee80211_start_tx_ba_session - Start a tx Block Ack session. |
| 160 | * @sta: the station for which to start a BA session |
| 161 | @@ -6844,7 +6883,7 @@ ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw, |
| 162 | struct ieee80211_vif *vif); |
| 163 | |
| 164 | /** |
| 165 | - * ieeee80211_obss_color_collision_notify - notify userland about a BSS color |
| 166 | + * ieee80211_obss_color_collision_notify - notify userland about a BSS color |
| 167 | * collision. |
| 168 | * |
| 169 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
| 170 | @@ -6852,7 +6891,7 @@ ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw, |
| 171 | * aware of. |
| 172 | */ |
| 173 | void |
| 174 | -ieeee80211_obss_color_collision_notify(struct ieee80211_vif *vif, |
| 175 | +ieee80211_obss_color_collision_notify(struct ieee80211_vif *vif, |
| 176 | u64 color_bitmap); |
| 177 | |
| 178 | /** |
| 179 | diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h |
| 180 | index 9e8003f..19e2ada 100644 |
| 181 | --- a/net/mac80211/driver-ops.h |
| 182 | +++ b/net/mac80211/driver-ops.h |
| 183 | @@ -1501,7 +1501,6 @@ static inline void drv_twt_teardown_request(struct ieee80211_local *local, |
| 184 | trace_drv_return_void(local); |
| 185 | } |
| 186 | |
| 187 | -#if LINUX_VERSION_IS_GEQ(5,10,0) |
| 188 | static inline int drv_net_fill_forward_path(struct ieee80211_local *local, |
| 189 | struct ieee80211_sub_if_data *sdata, |
| 190 | struct ieee80211_sta *sta, |
| 191 | @@ -1523,6 +1522,5 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local, |
| 192 | |
| 193 | return ret; |
| 194 | } |
| 195 | -#endif |
| 196 | |
| 197 | #endif /* __MAC80211_DRIVER_OPS */ |
| 198 | diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c |
| 199 | index 00b0443..a7169a5 100644 |
| 200 | --- a/net/mac80211/iface.c |
| 201 | +++ b/net/mac80211/iface.c |
| 202 | @@ -853,7 +853,6 @@ static const struct net_device_ops ieee80211_monitorif_ops = { |
| 203 | |
| 204 | }; |
| 205 | |
| 206 | -#if LINUX_VERSION_IS_GEQ(5,10,0) |
| 207 | static int ieee80211_netdev_fill_forward_path(struct net_device_path_ctx *ctx, |
| 208 | struct net_device_path *path) |
| 209 | { |
| 210 | @@ -911,7 +910,6 @@ out: |
| 211 | |
| 212 | return ret; |
| 213 | } |
| 214 | -#endif |
| 215 | |
| 216 | static const struct net_device_ops ieee80211_dataif_8023_ops = { |
| 217 | #if LINUX_VERSION_IS_LESS(4,10,0) |
| 218 | @@ -930,9 +928,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = { |
| 219 | #else |
| 220 | .ndo_get_stats64 = bp_ieee80211_get_stats64, |
| 221 | #endif |
| 222 | -#if LINUX_VERSION_IS_GEQ(5,10,0) |
| 223 | .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path, |
| 224 | -#endif |
| 225 | }; |
| 226 | |
| 227 | static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype) |
| 228 | diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h |
| 229 | index d15dadd..8770033 100644 |
| 230 | --- a/net/mac80211/trace.h |
| 231 | +++ b/net/mac80211/trace.h |
| 232 | @@ -2899,14 +2899,12 @@ TRACE_EVENT(drv_twt_teardown_request, |
| 233 | ) |
| 234 | ); |
| 235 | |
| 236 | -#if LINUX_VERSION_IS_GEQ(5,10,0) |
| 237 | DEFINE_EVENT(sta_event, drv_net_fill_forward_path, |
| 238 | TP_PROTO(struct ieee80211_local *local, |
| 239 | struct ieee80211_sub_if_data *sdata, |
| 240 | struct ieee80211_sta *sta), |
| 241 | TP_ARGS(local, sdata, sta) |
| 242 | ); |
| 243 | -#endif |
| 244 | |
| 245 | TRACE_EVENT(bss_color_bitmap, |
| 246 | TP_PROTO(u8 color, |
| 247 | -- |
| 248 | 2.18.0 |
| 249 | |