blob: 8d2067fc590d33f1a1ce2283b1615177603f2cb2 [file] [log] [blame]
From 2a801c07d58b8c9b9d5e9049856c7ef7b504d841 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 13/19] mac80211: mtk: add fill receive path ops to get wed idx
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
include/net/mac80211.h | 15 +++++++++++++--
net/mac80211/driver-ops.h | 13 +++++++++++++
net/mac80211/iface.c | 24 ++++++++++++++++++++++++
net/mac80211/util.c | 9 +++++++++
4 files changed, 59 insertions(+), 2 deletions(-)
mode change 100644 => 100755 net/mac80211/util.c
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index ad5f217..d1d7fc3 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1380,7 +1380,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
* @RX_FLAG_AMPDU_EOF_BIT_KNOWN: The EOF value is known
* @RX_FLAG_RADIOTAP_HE: HE radiotap data is present
* (&struct ieee80211_radiotap_he, mac80211 will fill in
- *
+ *
* - DATA3_DATA_MCS
* - DATA3_DATA_DCM
* - DATA3_CODING
@@ -1388,7 +1388,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
* - DATA5_DATA_BW_RU_ALLOC
* - DATA6_NSTS
* - DATA3_STBC
- *
+ *
* from the RX info data, so leave those zeroed when building this data)
* @RX_FLAG_RADIOTAP_HE_MU: HE MU radiotap data is present
* (&struct ieee80211_radiotap_he_mu)
@@ -1950,6 +1950,12 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
*/
struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif);
+/**
+ * ieee80211_vif_to_wdev - return a net_device struct from a vif
+ * @vif: the vif to get the net_device for
+ */
+struct net_device *ieee80211_vif_to_netdev(struct ieee80211_vif *vif);
+
/**
* lockdep_vif_mutex_held - for lockdep checks on link poiners
* @vif: the interface to check
@@ -4219,6 +4225,8 @@ struct ieee80211_prep_tx_info {
* Note that a sta can also be inserted or removed with valid links,
* i.e. passed to @sta_add/@sta_state with sta->valid_links not zero.
* In fact, cannot change from having valid_links and not having them.
+ * @net_fill_receive_path: Called from .ndo_fill_receive_path in order to
+ * get a path for hardware flow offloading
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -4574,6 +4582,9 @@ struct ieee80211_ops {
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
u16 old_links, u16 new_links);
+ int (*net_fill_receive_path)(struct ieee80211_hw *hw,
+ struct net_device_path_ctx *ctx,
+ struct net_device_path *path);
};
/**
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 3d16b09..bbecd2e 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1479,4 +1479,17 @@ int drv_change_sta_links(struct ieee80211_local *local,
struct ieee80211_sta *sta,
u16 old_links, u16 new_links);
+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;
+}
+
#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 25a7545..6e76b23 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -920,6 +920,29 @@ 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,
@@ -929,6 +952,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,
};
static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype)
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
old mode 100644
new mode 100755
index 608f927..fd63ee3
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -914,6 +914,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