| From 7e201d350d68f2c0588b8e5f7748e4f733fd8bbc Mon Sep 17 00:00:00 2001 |
| From: Sujuan Chen <sujuan.chen@mediatek.com> |
| Date: Wed, 18 May 2022 15:10:22 +0800 |
| Subject: [PATCH 24/89] mtk: mac80211: add fill receive path ops to get wed idx |
| |
| Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com> |
| --- |
| include/net/mac80211.h | 5 +++++ |
| net/mac80211/driver-ops.h | 13 +++++++++++++ |
| net/mac80211/iface.c | 23 +++++++++++++++++++++++ |
| net/mac80211/util.c | 9 +++++++++ |
| 4 files changed, 50 insertions(+) |
| |
| diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
| index 859afcf..5856fc6 100644 |
| --- a/include/net/mac80211.h |
| +++ b/include/net/mac80211.h |
| @@ -4420,6 +4420,8 @@ struct ieee80211_prep_tx_info { |
| * resolve a path for hardware flow offloading |
| * @can_activate_links: Checks if a specific active_links bitmap is |
| * supported by the driver. |
| + * @net_fill_receive_path: Called from .ndo_fill_receive_path in order to |
| + * get a path for hardware flow offloading |
| * @change_vif_links: Change the valid links on an interface, note that while |
| * removing the old link information is still valid (link_conf pointer), |
| * but may immediately disappear after the function returns. The old or |
| @@ -4808,6 +4810,9 @@ struct ieee80211_ops { |
| bool (*can_activate_links)(struct ieee80211_hw *hw, |
| struct ieee80211_vif *vif, |
| u16 active_links); |
| + int (*net_fill_receive_path)(struct ieee80211_hw *hw, |
| + struct net_device_path_ctx *ctx, |
| + struct net_device_path *path); |
| int (*change_vif_links)(struct ieee80211_hw *hw, |
| struct ieee80211_vif *vif, |
| u16 old_links, u16 new_links, |
| diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h |
| index 9ffbca2..4cddc3c 100644 |
| --- a/net/mac80211/driver-ops.h |
| +++ b/net/mac80211/driver-ops.h |
| @@ -1661,6 +1661,19 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local, |
| return ret; |
| } |
| |
| +static inline int drv_net_fill_receive_path(struct ieee80211_local *local, |
| + struct net_device_path_ctx *ctx, |
| + struct net_device_path *path) |
| +{ |
| + int ret = -EOPNOTSUPP; |
| + |
| + if (local->ops->net_fill_receive_path) |
| + ret = local->ops->net_fill_receive_path(&local->hw, |
| + ctx, path); |
| + |
| + return ret; |
| +} |
| + |
| static inline int drv_net_setup_tc(struct ieee80211_local *local, |
| struct ieee80211_sub_if_data *sdata, |
| struct net_device *dev, |
| diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c |
| index 71e8b0d..c454826 100644 |
| --- a/net/mac80211/iface.c |
| +++ b/net/mac80211/iface.c |
| @@ -931,6 +931,28 @@ out: |
| return ret; |
| } |
| |
| +static int ieee80211_netdev_fill_receive_path(struct net_device_path_ctx *ctx, |
| + struct net_device_path *path) |
| +{ |
| + struct ieee80211_sub_if_data *sdata; |
| + struct ieee80211_local *local; |
| + int ret = -ENOENT; |
| + |
| + sdata = IEEE80211_DEV_TO_SUB_IF(ctx->dev); |
| + local = sdata->local; |
| + |
| + if (!local->ops->net_fill_receive_path) |
| + return -EOPNOTSUPP; |
| + |
| + rcu_read_lock(); |
| + |
| + ret = drv_net_fill_receive_path(local, ctx, path); |
| + |
| + rcu_read_unlock(); |
| + |
| + return ret; |
| +} |
| + |
| static const struct net_device_ops ieee80211_dataif_8023_ops = { |
| .ndo_open = ieee80211_open, |
| .ndo_stop = ieee80211_stop, |
| @@ -939,6 +961,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = { |
| .ndo_set_rx_mode = ieee80211_set_multicast_list, |
| .ndo_set_mac_address = ieee80211_change_mac, |
| .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path, |
| + .ndo_fill_receive_path = ieee80211_netdev_fill_receive_path, |
| .ndo_setup_tc = ieee80211_netdev_setup_tc, |
| }; |
| |
| diff --git a/net/mac80211/util.c b/net/mac80211/util.c |
| index ecda005..1877400 100644 |
| --- a/net/mac80211/util.c |
| +++ b/net/mac80211/util.c |
| @@ -874,6 +874,15 @@ struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif) |
| } |
| EXPORT_SYMBOL_GPL(ieee80211_vif_to_wdev); |
| |
| +struct net_device *ieee80211_vif_to_netdev(struct ieee80211_vif *vif) |
| +{ |
| + if (!vif) |
| + return NULL; |
| + |
| + return vif_to_sdata(vif)->dev; |
| +} |
| +EXPORT_SYMBOL_GPL(ieee80211_vif_to_netdev); |
| + |
| /* |
| * Nothing should have been stuffed into the workqueue during |
| * the suspend->resume cycle. Since we can't check each caller |
| -- |
| 2.18.0 |
| |