| From 66fbfef0e7ae77359c9609aeec93a31463af59b4 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 10/21] mac80211: mtk: 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 eb229aa..2c282e6 100644 |
| --- a/include/net/mac80211.h |
| +++ b/include/net/mac80211.h |
| @@ -4255,6 +4255,8 @@ struct ieee80211_prep_tx_info { |
| * disable background CAC/radar detection. |
| * @net_fill_forward_path: Called from .ndo_fill_forward_path in order to |
| * resolve a path for hardware flow offloading |
| + * @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 |
| @@ -4631,6 +4633,9 @@ struct ieee80211_ops { |
| struct ieee80211_sta *sta, |
| struct net_device_path_ctx *ctx, |
| struct net_device_path *path); |
| + 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 650d8d1..d187206 100644 |
| --- a/net/mac80211/driver-ops.h |
| +++ b/net/mac80211/driver-ops.h |
| @@ -1519,6 +1519,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 be586bc..b8dfd32 100644 |
| --- a/net/mac80211/iface.c |
| +++ b/net/mac80211/iface.c |
| @@ -930,6 +930,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_mac_address = ieee80211_change_mac, |
| .ndo_get_stats64 = ieee80211_get_stats64, |
| .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 8a6917c..3650dcd 100644 |
| --- a/net/mac80211/util.c |
| +++ b/net/mac80211/util.c |
| @@ -868,6 +868,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 |
| |