developer | d8126d1 | 2023-02-17 11:50:45 +0800 | [diff] [blame] | 1 | From b36c1fd5e967880b025a8301aadbeb832a364639 Mon Sep 17 00:00:00 2001 |
developer | aa5b1b2 | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 2 | From: Sujuan Chen <sujuan.chen@mediatek.com> |
| 3 | Date: Wed, 18 May 2022 15:10:22 +0800 |
developer | d8126d1 | 2023-02-17 11:50:45 +0800 | [diff] [blame] | 4 | Subject: [PATCH 14/16] mac80211: mtk: add fill receive path ops to get wed idx |
developer | aa5b1b2 | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 5 | |
| 6 | Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com> |
| 7 | --- |
| 8 | include/net/mac80211.h | 15 +++++++++++++-- |
| 9 | net/mac80211/driver-ops.h | 13 +++++++++++++ |
| 10 | net/mac80211/iface.c | 24 ++++++++++++++++++++++++ |
| 11 | net/mac80211/util.c | 9 +++++++++ |
| 12 | 4 files changed, 59 insertions(+), 2 deletions(-) |
| 13 | mode change 100644 => 100755 net/mac80211/util.c |
| 14 | |
| 15 | diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
developer | d8126d1 | 2023-02-17 11:50:45 +0800 | [diff] [blame] | 16 | index 286810b..f68eb7d 100644 |
developer | aa5b1b2 | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 17 | --- a/include/net/mac80211.h |
| 18 | +++ b/include/net/mac80211.h |
| 19 | @@ -1354,7 +1354,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) |
| 20 | * @RX_FLAG_AMPDU_EOF_BIT_KNOWN: The EOF value is known |
| 21 | * @RX_FLAG_RADIOTAP_HE: HE radiotap data is present |
| 22 | * (&struct ieee80211_radiotap_he, mac80211 will fill in |
| 23 | - * |
| 24 | + * |
| 25 | * - DATA3_DATA_MCS |
| 26 | * - DATA3_DATA_DCM |
| 27 | * - DATA3_CODING |
| 28 | @@ -1362,7 +1362,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) |
| 29 | * - DATA5_DATA_BW_RU_ALLOC |
| 30 | * - DATA6_NSTS |
| 31 | * - DATA3_STBC |
| 32 | - * |
| 33 | + * |
| 34 | * from the RX info data, so leave those zeroed when building this data) |
| 35 | * @RX_FLAG_RADIOTAP_HE_MU: HE MU radiotap data is present |
| 36 | * (&struct ieee80211_radiotap_he_mu) |
developer | d8126d1 | 2023-02-17 11:50:45 +0800 | [diff] [blame] | 37 | @@ -1924,6 +1924,12 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev); |
developer | aa5b1b2 | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 38 | */ |
| 39 | struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif); |
| 40 | |
| 41 | +/** |
| 42 | + * ieee80211_vif_to_wdev - return a net_device struct from a vif |
| 43 | + * @vif: the vif to get the net_device for |
| 44 | + */ |
| 45 | +struct net_device *ieee80211_vif_to_netdev(struct ieee80211_vif *vif); |
| 46 | + |
| 47 | /** |
| 48 | * lockdep_vif_mutex_held - for lockdep checks on link poiners |
| 49 | * @vif: the interface to check |
developer | d8126d1 | 2023-02-17 11:50:45 +0800 | [diff] [blame] | 50 | @@ -4193,6 +4199,8 @@ struct ieee80211_prep_tx_info { |
developer | aa5b1b2 | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 51 | * Note that a sta can also be inserted or removed with valid links, |
| 52 | * i.e. passed to @sta_add/@sta_state with sta->valid_links not zero. |
| 53 | * In fact, cannot change from having valid_links and not having them. |
| 54 | + * @net_fill_receive_path: Called from .ndo_fill_receive_path in order to |
| 55 | + * get a path for hardware flow offloading |
| 56 | */ |
| 57 | struct ieee80211_ops { |
| 58 | void (*tx)(struct ieee80211_hw *hw, |
developer | d8126d1 | 2023-02-17 11:50:45 +0800 | [diff] [blame] | 59 | @@ -4548,6 +4556,9 @@ struct ieee80211_ops { |
developer | aa5b1b2 | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 60 | struct ieee80211_vif *vif, |
| 61 | struct ieee80211_sta *sta, |
| 62 | u16 old_links, u16 new_links); |
| 63 | + int (*net_fill_receive_path)(struct ieee80211_hw *hw, |
| 64 | + struct net_device_path_ctx *ctx, |
| 65 | + struct net_device_path *path); |
| 66 | }; |
| 67 | |
| 68 | /** |
| 69 | diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h |
| 70 | index 3d16b09..bbecd2e 100644 |
| 71 | --- a/net/mac80211/driver-ops.h |
| 72 | +++ b/net/mac80211/driver-ops.h |
| 73 | @@ -1479,4 +1479,17 @@ int drv_change_sta_links(struct ieee80211_local *local, |
| 74 | struct ieee80211_sta *sta, |
| 75 | u16 old_links, u16 new_links); |
| 76 | |
| 77 | +static inline int drv_net_fill_receive_path(struct ieee80211_local *local, |
| 78 | + struct net_device_path_ctx *ctx, |
| 79 | + struct net_device_path *path) |
| 80 | +{ |
| 81 | + int ret = -EOPNOTSUPP; |
| 82 | + |
| 83 | + if (local->ops->net_fill_receive_path) |
| 84 | + ret = local->ops->net_fill_receive_path(&local->hw, |
| 85 | + ctx, path); |
| 86 | + |
| 87 | + return ret; |
| 88 | +} |
| 89 | + |
| 90 | #endif /* __MAC80211_DRIVER_OPS */ |
| 91 | diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c |
developer | d8126d1 | 2023-02-17 11:50:45 +0800 | [diff] [blame] | 92 | index 25a7545..6e76b23 100644 |
developer | aa5b1b2 | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 93 | --- a/net/mac80211/iface.c |
| 94 | +++ b/net/mac80211/iface.c |
developer | d8126d1 | 2023-02-17 11:50:45 +0800 | [diff] [blame] | 95 | @@ -920,6 +920,29 @@ out: |
developer | aa5b1b2 | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 96 | return ret; |
| 97 | } |
| 98 | |
| 99 | +static int ieee80211_netdev_fill_receive_path(struct net_device_path_ctx *ctx, |
| 100 | + struct net_device_path *path) |
| 101 | +{ |
| 102 | + struct ieee80211_sub_if_data *sdata; |
| 103 | + struct ieee80211_local *local; |
| 104 | + int ret = -ENOENT; |
| 105 | + |
| 106 | + sdata = IEEE80211_DEV_TO_SUB_IF(ctx->dev); |
| 107 | + local = sdata->local; |
| 108 | + |
| 109 | + if (!local->ops->net_fill_receive_path) |
| 110 | + return -EOPNOTSUPP; |
| 111 | + |
| 112 | + rcu_read_lock(); |
| 113 | + |
| 114 | + ret = drv_net_fill_receive_path(local, ctx, path); |
| 115 | + |
| 116 | + rcu_read_unlock(); |
| 117 | + |
| 118 | + return ret; |
| 119 | +} |
| 120 | + |
| 121 | + |
| 122 | static const struct net_device_ops ieee80211_dataif_8023_ops = { |
| 123 | .ndo_open = ieee80211_open, |
| 124 | .ndo_stop = ieee80211_stop, |
developer | d8126d1 | 2023-02-17 11:50:45 +0800 | [diff] [blame] | 125 | @@ -929,6 +952,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = { |
developer | aa5b1b2 | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 126 | .ndo_set_mac_address = ieee80211_change_mac, |
| 127 | .ndo_get_stats64 = ieee80211_get_stats64, |
| 128 | .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path, |
| 129 | + .ndo_fill_receive_path = ieee80211_netdev_fill_receive_path, |
| 130 | }; |
| 131 | |
| 132 | static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype) |
| 133 | diff --git a/net/mac80211/util.c b/net/mac80211/util.c |
| 134 | old mode 100644 |
| 135 | new mode 100755 |
developer | d8126d1 | 2023-02-17 11:50:45 +0800 | [diff] [blame] | 136 | index 608f927..fd63ee3 |
developer | aa5b1b2 | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 137 | --- a/net/mac80211/util.c |
| 138 | +++ b/net/mac80211/util.c |
| 139 | @@ -914,6 +914,15 @@ struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif) |
| 140 | } |
| 141 | EXPORT_SYMBOL_GPL(ieee80211_vif_to_wdev); |
| 142 | |
| 143 | +struct net_device *ieee80211_vif_to_netdev(struct ieee80211_vif *vif) |
| 144 | +{ |
| 145 | + if (!vif) |
| 146 | + return NULL; |
| 147 | + |
| 148 | + return vif_to_sdata(vif)->dev; |
| 149 | +} |
| 150 | +EXPORT_SYMBOL_GPL(ieee80211_vif_to_netdev); |
| 151 | + |
| 152 | /* |
| 153 | * Nothing should have been stuffed into the workqueue during |
| 154 | * the suspend->resume cycle. Since we can't check each caller |
| 155 | -- |
developer | d8126d1 | 2023-02-17 11:50:45 +0800 | [diff] [blame] | 156 | 2.25.1 |
developer | aa5b1b2 | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 157 | |