| From 5c16c13e56474ee77a9bd8ea59aeaeaae8923ea8 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 15/61] 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 8cda233..01cfcc0 100644 |
| --- a/include/net/mac80211.h |
| +++ b/include/net/mac80211.h |
| @@ -4390,6 +4390,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 |
| @@ -4778,6 +4780,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 1eda9ec..9be87b8 100644 |
| --- a/net/mac80211/driver-ops.h |
| +++ b/net/mac80211/driver-ops.h |
| @@ -1649,6 +1649,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 6363e8c..0ae31a9 100644 |
| --- a/net/mac80211/iface.c |
| +++ b/net/mac80211/iface.c |
| @@ -988,6 +988,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 = { |
| #if LINUX_VERSION_IS_LESS(4,10,0) |
| .ndo_change_mtu = __change_mtu, |
| @@ -1006,6 +1028,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = { |
| #endif |
| |
| .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 cda398d..dd06bd2 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.39.2 |
| |