developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame^] | 1 | From 843e2b25433dc6c3cbc2ff4a754bef091cabe54b Mon Sep 17 00:00:00 2001 |
| 2 | From: Benjamin Lin <benjamin-jw.lin@mediatek.com> |
| 3 | Date: Mon, 24 Jun 2024 17:50:08 +0800 |
| 4 | Subject: [PATCH] mac80211: mtk: add callback function to set QoS map in HW |
| 5 | |
| 6 | The mapping from IP DSCP to IEEE 802.11 user priority may be customized. |
| 7 | 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. |
| 8 | |
| 9 | Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com> |
| 10 | --- |
| 11 | include/net/mac80211.h | 3 +++ |
| 12 | net/mac80211/cfg.c | 2 +- |
| 13 | net/mac80211/driver-ops.h | 16 ++++++++++++++++ |
| 14 | net/mac80211/trace.h | 6 ++++++ |
| 15 | 4 files changed, 26 insertions(+), 1 deletion(-) |
| 16 | |
| 17 | diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
| 18 | index 5c26752..b622c76 100644 |
| 19 | --- a/include/net/mac80211.h |
| 20 | +++ b/include/net/mac80211.h |
| 21 | @@ -3982,6 +3982,7 @@ struct ieee80211_prep_tx_info { |
| 22 | * disable background CAC/radar detection. |
| 23 | * @net_fill_forward_path: Called from .ndo_fill_forward_path in order to |
| 24 | * resolve a path for hardware flow offloading |
| 25 | + * @set_qos_map: Set QoS mapping information to driver. |
| 26 | */ |
| 27 | struct ieee80211_ops { |
| 28 | void (*tx)(struct ieee80211_hw *hw, |
| 29 | @@ -4321,6 +4322,8 @@ struct ieee80211_ops { |
| 30 | struct net_device_path_ctx *ctx, |
| 31 | struct net_device_path *path); |
| 32 | #endif |
| 33 | + int (*set_qos_map)(struct ieee80211_vif *vif, |
| 34 | + struct cfg80211_qos_map *qos_map); |
| 35 | }; |
| 36 | |
| 37 | /** |
| 38 | diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c |
| 39 | index ffb60a2..80fba54 100644 |
| 40 | --- a/net/mac80211/cfg.c |
| 41 | +++ b/net/mac80211/cfg.c |
| 42 | @@ -4040,7 +4040,7 @@ static int ieee80211_set_qos_map(struct wiphy *wiphy, |
| 43 | if (old_qos_map) |
| 44 | kfree_rcu(old_qos_map, rcu_head); |
| 45 | |
| 46 | - return 0; |
| 47 | + return drv_set_qos_map(sdata->local, sdata, qos_map); |
| 48 | } |
| 49 | |
| 50 | static int ieee80211_set_ap_chanwidth(struct wiphy *wiphy, |
| 51 | diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h |
| 52 | index 9e8003f..d4723dc 100644 |
| 53 | --- a/net/mac80211/driver-ops.h |
| 54 | +++ b/net/mac80211/driver-ops.h |
| 55 | @@ -1525,4 +1525,20 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local, |
| 56 | } |
| 57 | #endif |
| 58 | |
| 59 | +static inline int drv_set_qos_map(struct ieee80211_local *local, |
| 60 | + struct ieee80211_sub_if_data *sdata, |
| 61 | + struct cfg80211_qos_map *qos_map) |
| 62 | +{ |
| 63 | + int ret = -EOPNOTSUPP; |
| 64 | + |
| 65 | + might_sleep(); |
| 66 | + |
| 67 | + trace_drv_set_qos_map(local, sdata); |
| 68 | + if (local->ops->set_qos_map) |
| 69 | + ret = local->ops->set_qos_map(&sdata->vif, qos_map); |
| 70 | + trace_drv_return_int(local, ret); |
| 71 | + |
| 72 | + return ret; |
| 73 | +} |
| 74 | + |
| 75 | #endif /* __MAC80211_DRIVER_OPS */ |
| 76 | diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h |
| 77 | index d15dadd..c6fc75e 100644 |
| 78 | --- a/net/mac80211/trace.h |
| 79 | +++ b/net/mac80211/trace.h |
| 80 | @@ -2929,6 +2929,12 @@ TRACE_EVENT(bss_color_bitmap, |
| 81 | ) |
| 82 | ); |
| 83 | |
| 84 | +DEFINE_EVENT(local_sdata_evt, drv_set_qos_map, |
| 85 | + TP_PROTO(struct ieee80211_local *local, |
| 86 | + struct ieee80211_sub_if_data *sdata), |
| 87 | + TP_ARGS(local, sdata) |
| 88 | +); |
| 89 | + |
| 90 | #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ |
| 91 | |
| 92 | #undef TRACE_INCLUDE_PATH |
| 93 | -- |
| 94 | 2.18.0 |
| 95 | |