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