Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796207356; b=W5tIK0EuioIZCkgX0K0d1D5OCV+3XRA+Dk0pvgFqWcogl2w6PYq1ZSGj7sWRJcqik2JW 2ndHWyFbBiPf98IzRtoQcK3NW7YyhqPhT9e+UlyCJzSc1F4yCNvgGqfPbyDjU+8N8QF0w 6IzQY3mOw2SKXUGB3pvuk7ucrJQCqocDNklmxqzQjFIyOGQl4pbRy245ir8VgeGmmnEjE vra6zSToJKQwSE8n968pth5hou5yLoKV1IwxlBYlQtNXPQ8ix4O4E/8aXpOyWMf/Al7bB MYkLdn2H3vF/QHQLHwXWYwmoA4uR7hDJjqsfococJxYgdiGlvg0NDTv6nKxcG1TPf3w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796207356; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg: X-Received:X-Received:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-ORIG-GUID:X-Proofpoint-Spam-Info:X-Proofpoint-GUID: X-Authority-Analysis:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=sCUJP63N8cOAe8i8qdmg1Kc5PAdu/OwULhiQfJPGqsc=; b=Hyth6e2aPfL9a2UBbf4GXNKOAjYk8UZdIf89kyowpGZJmIcaEFxXcC9xpYzp54zGzzO7 nNKtt7GU+J+QVSKTrPOPQChr9IrviYw8jFx2+GFQkui3x8IzTtZ2+LajbwFqNOfLkhq/F 3vEw77KVr0jujYn7dfsnB+x4iwQxe24OW4xZMz1HYgOThLd89nxeMqjibnoHHRxS0ha7b hSa5tvuMSy60l7l7JSj7CX7zHsSn9draNeAma1bCt7uU7XQhivr6YDyuaXv9ddpv31K2a ozF98qDs06Y6QdjdOeBaSpDDOpwYJ3Jy9MKWgHYBnxQPaBqme7eIwlPkOTMPT6/jlPA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b="nelZb/km"; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=VWCHM+m1; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA2F8606A32E for ; Wed, 2 Dec 2026 10:29:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EA2F8606A32E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=nelZb/km; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=VWCHM+m1 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B26pSKp4111263 for ; Wed, 2 Dec 2026 10:29:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= sCUJP63N8cOAe8i8qdmg1Kc5PAdu/OwULhiQfJPGqsc=; b=nelZb/kmFehOiCgw WZziVOg6AjNqpofoMIP6IgUIWj5L4gGvRRXU4wC4j9RYWXsZ4WObEvh2Fskyr6Cl sPJj7tCDxy4Vhw3nBW2duB0Ojj73d7AP9CIZn+y30F3qqEJJc4Lm+SPkVNCsv24K Zzq1VcBHYla0eegTwPfhJKm/rBLKVIHttSlYT3Ip3LlOcCYmW7DIHMMsb03oCckI exiVYGVPYtkXsu7kVBGSoSKd+xKNISGkZsTCmYve5k4ThOhezUtHqehaAf2oZOgT 5g6NnbdoeU1JdExUIXFCQF3CIZcGkOVstPteP05FiXVV6XfAnFS9BhkD8tl+YZnG 8OCQNg== Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ja29vku74-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 02 Dec 2026 10:29:14 +0000 (GMT) Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-8a05b68f851so10316253b3a.1 for ; Wed, 02 Dec 2026 02:29:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796207354; x=1796812154; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=sCUJP63N8cOAe8i8qdmg1Kc5PAdu/OwULhiQfJPGqsc=; b=VWCHM+m1yNt0EvGhBOhIeggONSl1r6g1FOocqVO+8lWP9Z7ksQv2HHHMqBHlfoVLyN BbpJyjDt3Xx1j6SIphwnSbLowycQEnyTloCm68hRERMIpbvI/VM4giuZlDv6oEtY6b+S l9nhQCNSh81cWscn9SPkwEduWFF7hoe3pmtWT6L633mrFuVC45IMBPKxiYDaqHmqSrNN IXxFBFCEdvv5NTyVHiFiDuYqADUNIy5B9YXAMbXYIfsdkpgkLiJ5JMiqoYwrPngRQmw7 QUCA9R475X5Vo3N4XrRBkg6C16/Faj1JMJjD+wnCdp/USCg0nClczU1apnR9CI0iDRC2 smhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796207354; x=1796812154; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=sCUJP63N8cOAe8i8qdmg1Kc5PAdu/OwULhiQfJPGqsc=; b=YoUXrVwbDcIgMF/8BdePFIB17wElKocOmb2/o4ZqJecjbdGRy8Ro99bBwJSYyFJMkq QxU554MZ0RP6NNuxUbDuh0a2AWO0Cq78nz/9AURI3Ru1Zb6XhZeYITDJ+nMhNHC1k8Rv 2hVvPI5M9fAwieNBydQVzbVTP5X0UmrgobA5d9VP9kOsy6nSJ1TC/SClBNHaXvj4ayEg 82Jwi8x9eT8UoiDIjasGpJWX4oOnb+YOp1qm2Ph1coIQOfvLaeRNn8bmHhn8uqVJYUqg LNuayPz5po6xvj5qRAsIG9ej9hh+H8QMvb2Gye98Huiuhpljo9nJTlUN2sDH8FvaCJ5M eFZg== X-Gm-Message-State: APuU4Z9eI9FDxsEmwdXLzbr5MUJAyyBanAUJme1LFlux0dBuqQZXhnRp iIvVr1NY1iCFn4TGEboPXThDlIktdijRkEog5blvehM9AW9zneXBHMrhiTJfgRDl2mvKlrRPENZ l9Sko8dPsdOC0EJCaQm/h630TMsa6SLDLtjTgj8OL2YhKBhGtAyN0IcfzQ6IYRAvWPurM X-Gm-Gg: AZFdTZcbJoaWJ5zEeKZ8ei1CGJNCs/PdE1kGO8/Qawu0ZXWwlGAXK2n2jD9kfNutfh2 qlDzMdDe4ucGa9g/rfroFH9uAzl+oc9xllDCmXjZfbDNk8pxLlUKEdMia1uz93dIY3Dz10+Nnsh 61xuTTzOSFqVSfV7rJLxNh9931wEmIcKE7EJU76tBZ5QRsVR1TK2TAiJhL+XSsgkYmhlDpHrcQc 6yrkbMJEvWzkjMSyRo0iYdBTUvvbzppOXY7rExS/cnNskbbGAjCS1m9qatGeIUm432DOJszf0Wp TKxQte/bAdZpDn0m1KMIsFtWt7/2gM5y41171poFFrbTAorzbmAgRZmGfzZCm9G09oLFq/GrTa0 uqE06ur35pihYlA9BA1Rwr0P5ahS0Q/Ku++HEp+lvSNTWXu2qzLg7FfSc0c12ZOtaSiC6m/EMtq lQ5qZB3pjSlI//tKogAmuxCr3eFwhZqSXZ59mRwLP36A4XwgyLUdY7yu0E1MBEEWbuNjV/rLw= X-Received: by 2002:a05:6a20:4304:b0:3fa:3637:bece with SMTP id adf61e73a8af0-400ad774fb5mr35453302637.19.1796207354240; Wed, 02 Dec 2026 02:29:14 -0800 (PST) X-Received: by 2002:a05:6a20:4304:b0:3fa:3637:bece with SMTP id adf61e73a8af0-400ad774fb5mr35453286637.19.1796207353755; Wed, 02 Dec 2026 02:29:13 -0800 (PST) Received: from hu-pooventh-blr.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cde6d026d6fsm21699027a12.19.2026.12.02.02.29.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 02:29:13 -0800 (PST) From: Pooventhiran G Date: Wed, 02 Dec 2026 15:58:13 +0530 Subject: [PATCH wireless-next v5 18/19] wifi: mac80211: add mac80211 support to handle NL80211_CMD_GET_ST_CTX X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261202-smd-v5-18-1b020be65c7c@oss.qualcomm.com> References: <20261202-smd-v5-0-1b020be65c7c@oss.qualcomm.com> In-Reply-To: <20261202-smd-v5-0-1b020be65c7c@oss.qualcomm.com> To: Johannes Berg Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, pooventhiran.g@oss.qualcomm.com X-Mailer: b4 0.14.3 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAyMDA0MSBTYWx0ZWRfX4TZhqPR09lF9 2FpelzMbwis4u+3RWowlWP2INiaLx9MiyVzdRc5AWdzsFCNfe927WAQiRLUxUlIpPvtS6qUYdhi 50OvNC+VqTf4JcC9zzNIgahZQwUW1Kdm2GeM3syD6eRnenOJ050Jw6GEgZCFJrQAt6NrIGPpWUP rU4g1prfrOMeXepgH0dS0CQ5Z6hlKkmX0NpDFNsYSItQoNfc0UByl8zU3PzKzT9n6j6alNpezZU KiMh14LmVqA5LmZm/Up/j7NlwrflkKNNUSDq1KYGesFgu0+VDX5B07TcqxJArKLgP3Yctwp5+dC wdYnr3fa4e7ascYs+IfxGcLGoi1lnP0A7bqhLqJ6OFF2KvjdYTuDa2/uZ1rvhmX7pmtlxElgxt6 cc+0i7/dvU9+GMbp217dbmCoB3knb+AYaf0MPjNKq5CF/zjiEvARhPPpYD2Q/F75w0ySu4Wzqlw p8Tle0fIgNHAUAnk/0Q== X-Proofpoint-ORIG-GUID: 3qx_b7XWPesaxMsLR3qk8j5BkW6vBMCA X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAyMDA0MSBTYWx0ZWRfX5PyBKB29I/lo anFtBc1MXzBVQn/2rs1yRQxVTkoEwpkJ2V/QU2jiwmyzVYfwE4dlkfWg118Hjc44xXb9fsdqtyo NR5xBZ0syUiQadFBx7ZaPJHtE98OwJU= X-Proofpoint-GUID: 3qx_b7XWPesaxMsLR3qk8j5BkW6vBMCA X-Authority-Analysis: v=2.4 cv=JvFkP84C c=1 sm=1 tr=0 ts=6b0ff2fa cx=c_pps a=rEQLjTOiSrHUhVqRoksmgQ==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=102-YTlXaclM9MULl3UA:9 a=QEXdDO2ut3YA:10 a=2VI0MkxyNR6bbpdq8BZq:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-02_02,2026-12-01_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 adultscore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020041 cfg80211 supports NL80211_CMD_GET_ST_CTX from userspace on the current AP MLD to collect the station's context on the target AP MLD's behalf; this context is used by the target AP MLD to program its TX and RX queues to support seamless roaming of the non-AP MLD. Add mac80211 support for the same to invoke the driver to collect the requested station context. Since context collection is asynchronous, the driver reports the collected context later via ieee80211_get_st_ctx_done(), which then packs the context into NL80211_CMD_ST_CTX_EVENT and delivers it to userspace as a multicast event. Signed-off-by: Pooventhiran G --- include/net/mac80211.h | 26 ++++++++++++++++++++++++++ net/mac80211/cfg.c | 26 ++++++++++++++++++++++++++ net/mac80211/driver-ops.h | 24 ++++++++++++++++++++++++ net/mac80211/trace.h | 27 +++++++++++++++++++++++++++ 4 files changed, 103 insertions(+) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 6b500d039374..3d0297795081 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -4809,6 +4809,11 @@ enum ieee80211_sta_st_state { * transition of a station. The callback can sleep. * @set_st_ctx: Set the ST context for the non-AP MLD. This is used on the * target AP MLD side to program dynamic context. + * @get_st_ctx: Get the ST context for the non-AP MLD. This is used in the + * current AP MLD side on behalf of the target AP MLD to collect dynamic + * context, when the non-AP MLD sends ST Execute frame directly to the + * target. Since the response is asynchronous, the drivers that implement + * this should not store reference to @sta. */ struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw, @@ -5229,6 +5234,9 @@ struct ieee80211_ops { int (*set_st_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct cfg80211_smd_transition_info *st_info); + int (*get_st_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + enum nl80211_st_ctx_type type); }; /** @@ -8306,4 +8314,22 @@ bool ieee80211_vif_nan_started(struct ieee80211_vif *vif); * Return: 0 if success and non-zero on error */ int ieee80211_encrypt_tx_skb(struct sk_buff *skb); + +/** + * ieee80211_get_st_ctx_done - Deliver async get_st_ctx result to nl80211 + * @vif: virtual interface + * @sta_addr: non-AP MLD address the context was collected for + * @st_info: SMD Transition Info (set @st_info->ctx to NULL to indicate + * failure) + */ +static inline +void ieee80211_get_st_ctx_done(struct ieee80211_vif *vif, + const u8 *sta_addr, + struct cfg80211_smd_transition_info *st_info) +{ + struct wireless_dev *wdev = ieee80211_vif_to_wdev(vif); + + if (wdev) + cfg80211_notify_get_st_ctx_done(wdev, sta_addr, st_info); +} #endif /* MAC80211_H */ diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 9f0083fa7dd9..270f5bf47be3 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -6380,6 +6380,31 @@ static int ieee80211_set_st_ctx(struct wiphy *wiphy, struct wireless_dev *wdev, return drv_set_st_ctx(local, sdata, &sta->sta, st_info); } +static int ieee80211_get_st_ctx(struct wiphy *wiphy, struct wireless_dev *wdev, + const u8 *addr, + enum nl80211_st_ctx_type type) +{ + struct ieee80211_local *local = wiphy_priv(wiphy); + struct ieee80211_sub_if_data *sdata; + struct sta_info *sta; + + lockdep_assert_wiphy(wiphy); + + sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); + + if (sdata->vif.type != NL80211_IFTYPE_AP && + sdata->vif.type != NL80211_IFTYPE_AP_VLAN) + return -EOPNOTSUPP; + + sta = sta_info_get_bss(sdata, addr); + if (!sta) + return -ENOENT; + if (!sta->sta.smd_sta) + return -EINVAL; + + return drv_get_st_ctx(local, sdata, &sta->sta, type); +} + const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface, @@ -6504,4 +6529,5 @@ const struct cfg80211_ops mac80211_config_ops = { .nan_set_peer_sched = ieee80211_set_peer_nan_sched, .nan_set_non_evac_channels = ieee80211_set_nan_non_evac_channels, .set_st_ctx = ieee80211_set_st_ctx, + .get_st_ctx = ieee80211_get_st_ctx, }; diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 5cef900b7809..d29f68dc06b1 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -1817,4 +1817,28 @@ static inline int drv_set_st_ctx(struct ieee80211_local *local, return ret; } +static inline int drv_get_st_ctx(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct ieee80211_sta *sta, + enum nl80211_st_ctx_type type) +{ + int ret; + + if (!sdata || !local->ops->get_st_ctx) + return -EOPNOTSUPP; + + sdata = get_bss_sdata(sdata); + + lockdep_assert_wiphy(local->hw.wiphy); + + if (!check_sdata_in_driver(sdata)) + return -EIO; + + trace_drv_get_st_ctx(local, sdata, sta, type); + ret = local->ops->get_st_ctx(&local->hw, &sdata->vif, sta, type); + 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 c996f99ea1b2..5526a7db53d9 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h @@ -3490,6 +3490,33 @@ TRACE_EVENT(drv_set_st_ctx, ) ); +TRACE_EVENT(drv_get_st_ctx, + TP_PROTO(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct ieee80211_sta *sta, + enum nl80211_st_ctx_type type), + + TP_ARGS(local, sdata, sta, type), + + TP_STRUCT__entry( + LOCAL_ENTRY + VIF_ENTRY + STA_ENTRY + __field(u8, st_type) + ), + + TP_fast_assign( + LOCAL_ASSIGN; + VIF_ASSIGN; + STA_ASSIGN; + __entry->st_type = type; + ), + + TP_printk(LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT ", ST type=%u", + LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->st_type + ) +); + #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ #undef TRACE_INCLUDE_PATH -- 2.34.1