blob: 8dd492db8e050720ca6ce39b4b8a802c46a212ca [file] [log] [blame]
From 843e2b25433dc6c3cbc2ff4a754bef091cabe54b Mon Sep 17 00:00:00 2001
From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Date: Mon, 24 Jun 2024 17:50:08 +0800
Subject: [PATCH] mac80211: mtk: add callback function to set QoS map in HW
The mapping from IP DSCP to IEEE 802.11 user priority may be customized.
Therefore, the mapping needs to be passed to HW, so that the QoS type of traffic can be mapped in a consistent manner for both SW and HW paths.
Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
---
include/net/mac80211.h | 3 +++
net/mac80211/cfg.c | 2 +-
net/mac80211/driver-ops.h | 16 ++++++++++++++++
net/mac80211/trace.h | 6 ++++++
4 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 5c26752..b622c76 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3982,6 +3982,7 @@ 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
+ * @set_qos_map: Set QoS mapping information to driver.
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -4321,6 +4322,8 @@ struct ieee80211_ops {
struct net_device_path_ctx *ctx,
struct net_device_path *path);
#endif
+ int (*set_qos_map)(struct ieee80211_vif *vif,
+ struct cfg80211_qos_map *qos_map);
};
/**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index ffb60a2..80fba54 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -4040,7 +4040,7 @@ static int ieee80211_set_qos_map(struct wiphy *wiphy,
if (old_qos_map)
kfree_rcu(old_qos_map, rcu_head);
- return 0;
+ return drv_set_qos_map(sdata->local, sdata, qos_map);
}
static int ieee80211_set_ap_chanwidth(struct wiphy *wiphy,
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 9e8003f..d4723dc 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1525,4 +1525,20 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local,
}
#endif
+static inline int drv_set_qos_map(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct cfg80211_qos_map *qos_map)
+{
+ int ret = -EOPNOTSUPP;
+
+ might_sleep();
+
+ trace_drv_set_qos_map(local, sdata);
+ if (local->ops->set_qos_map)
+ ret = local->ops->set_qos_map(&sdata->vif, qos_map);
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
+
#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index d15dadd..c6fc75e 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -2929,6 +2929,12 @@ TRACE_EVENT(bss_color_bitmap,
)
);
+DEFINE_EVENT(local_sdata_evt, drv_set_qos_map,
+ TP_PROTO(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata),
+ TP_ARGS(local, sdata)
+);
+
#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH
--
2.18.0