diff --git a/include/linux/ieee80211-uhr.h b/include/linux/ieee80211-uhr.h
index f904b1e65f10..cda8251a1a9a 100644
--- a/include/linux/ieee80211-uhr.h
+++ b/include/linux/ieee80211-uhr.h
@@ -743,6 +743,65 @@ ieee80211_uhr_mode_change_tuple_size(const struct ieee80211_uhr_mode_change_tupl
IEEE80211_UHR_MODE_CHANGE_CONTROL_MODE_LENGTH);
}
+/**
+ * ieee80211_is_uhr_link_reconf_req - check if frame is UHR Link Reconf Request
+ * @skb: the SKB to check
+ * Return: whether or not the frame is a UHR Link Reconf Request frame
+ */
+static inline bool ieee80211_is_uhr_link_reconf_req(struct sk_buff *skb)
+{
+ struct ieee80211_mgmt *mgmt = (void *)skb->data;
+ u8 category, action;
+
+ if (!ieee80211_is_action(mgmt->frame_control))
+ return false;
+
+ if (skb->len < IEEE80211_MIN_ACTION_SIZE(uhr_link_reconf_req))
+ return false;
+
+ category = mgmt->u.action.category;
+ action = mgmt->u.action.action_code;
+
+ return category == WLAN_CATEGORY_PROTECTED_UHR &&
+ action == IEEE80211_PROTECTED_UHR_ACTION_LINK_RECONFIG_REQUEST;
+}
+
+/**
+ * ieee80211_is_st_prep_req - check if frame is ST Preparation Request
+ * @skb: the SKB to check
+ * Return: whether or not the frame is an ST Prep request frame
+ */
+static inline bool ieee80211_is_st_prep_req(struct sk_buff *skb)
+{
+ struct ieee80211_mgmt *mgmt = (void *)skb->data;
+ u8 type;
+
+ if (!ieee80211_is_uhr_link_reconf_req(skb))
+ return false;
+
+ type = mgmt->u.action.uhr_link_reconf_req.type;
+
+ return type == IEEE80211_UHR_LINK_RECONFIG_REQUEST_ST_PREP;
+}
+
+/**
+ * ieee80211_is_st_exec_req - check if frame is ST Execution Request
+ * @skb: the SKB to check
+ * Return: whether or not the frame is an ST Exec request frame
+ */
+static inline bool ieee80211_is_st_exec_req(struct sk_buff *skb)
+{
+ struct ieee80211_mgmt *mgmt = (void *)skb->data;
+ u8 type;
+
+ if (!ieee80211_is_uhr_link_reconf_req(skb))
+ return false;
+
+ type = mgmt->u.action.uhr_link_reconf_req.type;
+
+ return type == IEEE80211_UHR_LINK_RECONFIG_REQUEST_ST_EXEC;
+}
+
#define for_each_uhr_mode_change_tuple(data, len, tuple) \
for (tuple = (const void *)(data); \
(len) - ((const u8 *)tuple - (data)) >= sizeof(*tuple) && \diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 75d0123fbb5d..7b0f328fec79 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4887,6 +4887,17 @@ struct mgmt_frame_regs {
u32 global_mcast_stypes, interface_mcast_stypes;
};
+/**
+ * struct cfg80211_smd_transition_info - SMD BSS Transition info
+ *
+ * @ctx: Dynamic context to be transferred as part of ST
+ * @type: Type of ST indication
+ */
+struct cfg80211_smd_transition_info {
+ struct ieee80211_smd_ctx *ctx;
+ enum nl80211_smd_ctx_type type;
+};
+
/**
* struct cfg80211_ops - backend description for wireless configuration
*@@ -9543,6 +9554,7 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
* @flags: flags, as defined in &enum nl80211_rxmgmt_flags
* @rx_tstamp: Hardware timestamp of frame RX in nanoseconds
* @ack_tstamp: Hardware timestamp of ack TX in nanoseconds
+ * @st_info: SMD BSS Transition data in skb extension
*/
struct cfg80211_rx_info {
int freq;@@ -9554,6 +9566,7 @@ struct cfg80211_rx_info {
u32 flags;
u64 rx_tstamp;
u64 ack_tstamp;
+ struct cfg80211_smd_transition_info st_info;
};
/**diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 40ed03a775ba..156a4c0d55ac 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3993,6 +3993,24 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
return RX_QUEUED;
}
+static void
+ieee80211_rx_h_userspace_mgmt_st_frame(struct cfg80211_rx_info *info,
+ struct sk_buff *skb)
+{
+ struct ieee80211_mgmt *mgmt = (void *)info->buf;
+ struct wireless_skb_ext *ext;
+ u8 type;
+
+ type = mgmt->u.action.uhr_link_reconf_req.type;
+
+ ext = skb_ext_find(skb, SKB_EXT_WIRELESS);
+ if (!ext || ext->type != WIRELESS_SKB_EXT_UHR_SMD)
+ return;
+
+ info->st_info.type = type;
+ info->st_info.ctx = ext->uhr_smd_ctx->smd_ctx;
+}
+
static ieee80211_rx_result debug_noinline
ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)
{@@ -4003,6 +4021,7 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)
.len = rx->skb->len,
.link_id = rx->link_id,
.have_link_id = rx->link_id >= 0,
+ .st_info.ctx = NULL,
};
/* skip known-bad action frames and return them in the next handler */
@@ -4024,6 +4043,9 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)
ieee80211_is_ftm(rx->skb)) {
info.rx_tstamp = ktime_to_ns(skb_hwtstamps(rx->skb)->hwtstamp);
info.ack_tstamp = ktime_to_ns(status->ack_tx_hwtstamp);
+ } else if (ieee80211_is_st_prep_req(rx->skb) ||
+ ieee80211_is_st_exec_req(rx->skb)) {
+ ieee80211_rx_h_userspace_mgmt_st_frame(&info, rx->skb);
}
if (cfg80211_rx_mgmt_ext(&rx->sdata->wdev, &info)) {
--
2.34.1