blob: aab6297088b092153fa789fd076ee73aef626f69 [file] [log] [blame]
From ff5cdddc754c347baa757ca225e18e40d8b263a4 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 12/15] 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 6e5ad3e..cc02639 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4207,6 +4207,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
@@ -4570,6 +4572,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 1c3a2c9..0057535 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1470,6 +1470,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 a18f80d..b82065c 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -936,6 +936,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,
@@ -945,6 +967,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 608f927..fd63ee3 100644
--- 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