From patchwork Thu Feb 13 17:16:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 865303 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F9DD204088 for ; Thu, 13 Feb 2025 17:17:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467043; cv=none; b=t0/WS7IgevvvmNYipfjH5w6uunLyYzr+N/p2agRcN6qYXj+EZvLmuBMFiPWGfZySqGjVEmn6Vi7U8kXznj1hmalFuL3uKpnyj67l1NJnliCn1h9ki8Dw74I9lniAe0dM6xyIO+iL8V/mnvkPHtnJBZcRU6P9pellgYjIMjd3wrc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467043; c=relaxed/simple; bh=dcar7gNOptbGJVbQN3q3ecA1gj6PGpkK9PF6tCHzxSg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hzYa2DURv5itoxvKw7ktcftj0H4d7HTEjknc1Zkpvp9AYTFH2+BLbC1Vk3j8X3q50R4qBKdOBASJ8asZmG9hHX8xSju8CA2sw17BAlTqgbKDmzeZp7CDp8wVzcYV7jJ9hnZj2xTtsH6TXt437vD1ULaCg6LvouMbAz89addp66w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=VreQTk6G; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="VreQTk6G" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51DA7dLx001752; Thu, 13 Feb 2025 17:17:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= zpqSUBvILs8l/UBZ/5L3Mnd0o+DgJyhh1WnU3pTDV2g=; b=VreQTk6GcjlEQYhv BvfNoAEge2fwk9rJFr3ZBDTyBiR2vQ6hjgigrtGC3zGi+bvPiwdVEeKwMhMoa0di qOuaHrfRpXRZDrAvdfOAsfKJ2iecqipOpt+XUf6ZsjtqXC0LkuESGZsBdrQ4g8cd k6NEKJD0EkXxOsLHAB0vVyCcUkSvp+xHx3sC6ph3F6K/Dm0DBVZhVE3oRSmAapBn u2EXKlf82vLQayym5DgEMZfDbLmvpfy9jIMfetgGvzwP4aBQUkbZ/wz+e6cWaaz4 f3H9vNLz3TX1hEBuXGVhaqIokeFc3Ul+D07FXsdvRaCvvVxgb6bA2YJrypc/KO6u yHr1Dw== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44seq013d4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:16 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51DHHGYQ010472 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:16 GMT Received: from hu-sarishar-blr.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 13 Feb 2025 09:17:14 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH v3 01/12] wifi: cfg80211: reorg sinfo structure elements for mesh Date: Thu, 13 Feb 2025 22:46:21 +0530 Message-ID: <20250213171632.1646538-2-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250213171632.1646538-1-quic_sarishar@quicinc.com> References: <20250213171632.1646538-1-quic_sarishar@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: Ahq74mS8QF9Yym38m9YR0_7LixaroUbA X-Proofpoint-ORIG-GUID: Ahq74mS8QF9Yym38m9YR0_7LixaroUbA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-13_07,2025-02-13_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 adultscore=0 mlxscore=0 malwarescore=0 phishscore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502130123 Currently, as multi-link operation(MLO) is not supported for mesh, reorganize the sinfo structure for mesh-specific fields and embed mesh related NL attributes together in organized view. This will allow for the simplified reorganization of sinfo structure for link level in a subsequent patch to add support for MLO station statistics. No functionality changes added. Pahole summary before the reorg of sinfo structure: - size: 256, cachelines: 4, members: 50 - sum members: 239, holes: 4, sum holes: 17 - paddings: 2, sum paddings: 2 - forced alignments: 1, forced holes: 1, sum forced holes: 1 Pahole summary after the reorg of sinfo structure: - size: 248, cachelines: 4, members: 50 - sum members: 239, holes: 4, sum holes: 9 - paddings: 2, sum paddings: 2 - forced alignments: 1, last cacheline: 56 bytes Signed-off-by: Sarika Sharma --- include/net/cfg80211.h | 43 +++++++++++++++++++++--------------------- net/wireless/nl80211.c | 11 ++++++----- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index a72e7eb7027f..ef93e220ddb2 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2045,9 +2045,6 @@ struct cfg80211_tid_stats { * @assoc_at: bootime (ns) of the last association * @rx_bytes: bytes (size of MPDUs) received from this station * @tx_bytes: bytes (size of MPDUs) transmitted to this station - * @llid: mesh local link id - * @plid: mesh peer link id - * @plink_state: mesh peer link state * @signal: The signal strength, type depends on the wiphy's signal_type. * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. @@ -2067,14 +2064,20 @@ struct cfg80211_tid_stats { * This number should increase every time the list of stations * changes, i.e. when a station is added or removed, so that * userspace can tell whether it got a consistent snapshot. + * @beacon_loss_count: Number of times beacon loss event has triggered. * @assoc_req_ies: IEs from (Re)Association Request. * This is used only when in AP mode with drivers that do not use * user space MLME/SME implementation. The information is provided for * the cfg80211_new_sta() calls to notify user space of the IEs. * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. * @sta_flags: station flags mask & values - * @beacon_loss_count: Number of times beacon loss event has triggered. * @t_offset: Time offset of the station relative to this host. + * @llid: mesh local link id + * @plid: mesh peer link id + * @plink_state: mesh peer link state + * @connected_to_gate: true if mesh STA has a path to mesh gate + * @connected_to_as: true if mesh STA has a path to authentication server + * @airtime_link_metric: mesh airtime link metric. * @local_pm: local mesh STA power save mode * @peer_pm: peer mesh STA power save mode * @nonpeer_pm: non-peer mesh STA power save mode @@ -2083,7 +2086,6 @@ struct cfg80211_tid_stats { * @rx_beacon: number of beacons received from this peer * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received * from this peer - * @connected_to_gate: true if mesh STA has a path to mesh gate * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer * @airtime_weight: current airtime scheduling weight @@ -2097,8 +2099,6 @@ struct cfg80211_tid_stats { * @fcs_err_count: number of packets (MPDUs) received from this station with * an FCS error. This counter should be incremented only when TA of the * received packet with an FCS error matches the peer MAC address. - * @airtime_link_metric: mesh airtime link metric. - * @connected_to_as: true if mesh STA has a path to authentication server * @mlo_params_valid: Indicates @assoc_link_id and @mld_addr fields are filled * by driver. Drivers use this only in cfg80211_new_sta() calls when AP * MLD's MLME/SME is offload to driver. Drivers won't fill this @@ -2125,9 +2125,6 @@ struct station_info { u64 assoc_at; u64 rx_bytes; u64 tx_bytes; - u16 llid; - u16 plid; - u8 plink_state; s8 signal; s8 signal_avg; @@ -2147,36 +2144,38 @@ struct station_info { int generation; + u32 beacon_loss_count; + const u8 *assoc_req_ies; size_t assoc_req_ies_len; - u32 beacon_loss_count; s64 t_offset; + u16 llid; + u16 plid; + u8 plink_state; + u8 connected_to_gate; + u8 connected_to_as; + u32 airtime_link_metric; enum nl80211_mesh_power_mode local_pm; enum nl80211_mesh_power_mode peer_pm; enum nl80211_mesh_power_mode nonpeer_pm; u32 expected_throughput; - u64 tx_duration; - u64 rx_duration; - u64 rx_beacon; - u8 rx_beacon_signal_avg; - u8 connected_to_gate; + u16 airtime_weight; - struct cfg80211_tid_stats *pertid; s8 ack_signal; s8 avg_ack_signal; + struct cfg80211_tid_stats *pertid; - u16 airtime_weight; + u64 tx_duration; + u64 rx_duration; + u64 rx_beacon; + u8 rx_beacon_signal_avg; u32 rx_mpdu_count; u32 fcs_err_count; - u32 airtime_link_metric; - - u8 connected_to_as; - bool mlo_params_valid; u8 assoc_link_id; u8 mld_addr[ETH_ALEN] __aligned(2); diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 8bd09110d393..02311d5b0e48 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6750,9 +6750,6 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, PUT_SINFO_U64(RX_BYTES64, rx_bytes); PUT_SINFO_U64(TX_BYTES64, tx_bytes); - PUT_SINFO(LLID, llid, u16); - PUT_SINFO(PLID, plid, u16); - PUT_SINFO(PLINK_STATE, plink_state, u8); PUT_SINFO_U64(RX_DURATION, rx_duration); PUT_SINFO_U64(TX_DURATION, tx_duration); @@ -6796,13 +6793,18 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, PUT_SINFO(TX_RETRIES, tx_retries, u32); PUT_SINFO(TX_FAILED, tx_failed, u32); PUT_SINFO(EXPECTED_THROUGHPUT, expected_throughput, u32); - PUT_SINFO(AIRTIME_LINK_METRIC, airtime_link_metric, u32); PUT_SINFO(BEACON_LOSS, beacon_loss_count, u32); + + PUT_SINFO(LLID, llid, u16); + PUT_SINFO(PLID, plid, u16); + PUT_SINFO(PLINK_STATE, plink_state, u8); + PUT_SINFO(AIRTIME_LINK_METRIC, airtime_link_metric, u32); PUT_SINFO(LOCAL_PM, local_pm, u32); PUT_SINFO(PEER_PM, peer_pm, u32); PUT_SINFO(NONPEER_PM, nonpeer_pm, u32); PUT_SINFO(CONNECTED_TO_GATE, connected_to_gate, u8); PUT_SINFO(CONNECTED_TO_AS, connected_to_as, u8); + PUT_SINFO_U64(T_OFFSET, t_offset); if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_BSS_PARAM)) { bss_param = nla_nest_start_noflag(msg, @@ -6830,7 +6832,6 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, &sinfo->sta_flags)) goto nla_put_failure; - PUT_SINFO_U64(T_OFFSET, t_offset); PUT_SINFO_U64(RX_DROP_MISC, rx_dropped_misc); PUT_SINFO_U64(BEACON_RX, rx_beacon); PUT_SINFO(BEACON_SIGNAL_AVG, rx_beacon_signal_avg, u8); From patchwork Thu Feb 13 17:16:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 865064 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD7C42045A8 for ; Thu, 13 Feb 2025 17:17:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467044; cv=none; b=qoM0Ikp2mjtrtxzrS8zMQU/NAEUXHrRwLdlXXmGesXjJQCKi50pPviOtQ4W+ItCjnc72L23eVOsS9fMjtAG9Jn2zA+gZeSvqGmskEJJDxbNLE2Z3Tjmt+nluWjkG3LZLqZi88RrtZwU6RvA2qPq+Rsm+cFW9k4Zav+m4afq30Z4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467044; c=relaxed/simple; bh=EXCYWTLcjmGn1pi2ZxE7N0yoL7gufCW91oMg6n62l5c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=L+cf16AgenIxkXrRsdBEPfnTFHLM305lsfMCoH372yxhDWaGb5bpLHeJs4QFXNuvx8YqW1aB5CBQOP8dVtELS6aaBTpRDOOeQk7rJ7ahlGsbJxHQYhr2cOMdCDL5rlnkN4kqLPf4KeZodtMt0n1k6tSfIqAk7fU9QGES+QEDGZk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=kE7cEv6t; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="kE7cEv6t" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51DGaipt008261; Thu, 13 Feb 2025 17:17:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= iyZl1CCW6MBuRB9RzInk2+F/XyOp3HAc8X9WheGslyM=; b=kE7cEv6t5eQPNEet 9WasKu1nLt4HKSNswchv2xAKLpORjRImLYW1gjkV1qwBjUxiLbg3RQa5e8wstKUz YLr6FBM7+w3XE5+nBgZ6ea/YQ+900m3cMlkvgZT/nGHhrIwH9QeaKYml0tzlY6s/ N4F4kK1fuqiD+hbC7ABUgr8brGTLT1tfee4M8CCa7xox40kwRm8yy1JBfOV6qoGo vpt3KzjMScUNBT/WF9LHzzv8Fv0uYhzMB9TlGFIn8GxPs0FjoxNqfosaD/rZEDcZ kBVF7CqbX4N0SGZKKrjssLgaSA9J0HZ6/v0wddSU0gl8Glv3zv6+xzqc68eQNV8d m6CdOA== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44qewhbm88-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:18 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51DHHHJr004899 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:17 GMT Received: from hu-sarishar-blr.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 13 Feb 2025 09:17:16 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH v3 02/12] wifi: mac80211: add API to populated mesh related fields in sinfo Date: Thu, 13 Feb 2025 22:46:22 +0530 Message-ID: <20250213171632.1646538-3-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250213171632.1646538-1-quic_sarishar@quicinc.com> References: <20250213171632.1646538-1-quic_sarishar@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: HU6binvb6vsMF-BMeNRWU8uZw3NoKVzY X-Proofpoint-GUID: HU6binvb6vsMF-BMeNRWU8uZw3NoKVzY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-13_07,2025-02-13_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 impostorscore=0 mlxlogscore=999 phishscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 suspectscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502130123 Introduce the sta_set_mesh_sinfo() API to populate mesh related fields in sinfo structure for station statistics. This will allow for the simplified population of other fields in the sinfo structure for link level in a subsequent patch to add support for MLO station statistics. No functionality changes added. Signed-off-by: Sarika Sharma --- net/mac80211/sta_info.c | 64 ++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index f83268fa9f92..a4b4506cd35b 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2584,6 +2584,39 @@ static inline u64 sta_get_stats_bytes(struct ieee80211_sta_rx_stats *rxstats) return value; } +#ifdef CONFIG_MAC80211_MESH +static void sta_set_mesh_sinfo(struct sta_info *sta, + struct station_info *sinfo) +{ + struct ieee80211_local *local = sta->sdata->local; + + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_LLID) | + BIT_ULL(NL80211_STA_INFO_PLID) | + BIT_ULL(NL80211_STA_INFO_PLINK_STATE) | + BIT_ULL(NL80211_STA_INFO_LOCAL_PM) | + BIT_ULL(NL80211_STA_INFO_PEER_PM) | + BIT_ULL(NL80211_STA_INFO_NONPEER_PM) | + BIT_ULL(NL80211_STA_INFO_CONNECTED_TO_GATE) | + BIT_ULL(NL80211_STA_INFO_CONNECTED_TO_AS); + + sinfo->llid = sta->mesh->llid; + sinfo->plid = sta->mesh->plid; + sinfo->plink_state = sta->mesh->plink_state; + if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) { + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_T_OFFSET); + sinfo->t_offset = sta->mesh->t_offset; + } + sinfo->local_pm = sta->mesh->local_pm; + sinfo->peer_pm = sta->mesh->peer_pm; + sinfo->nonpeer_pm = sta->mesh->nonpeer_pm; + sinfo->connected_to_gate = sta->mesh->connected_to_gate; + sinfo->connected_to_as = sta->mesh->connected_to_as; + + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_LINK_METRIC); + sinfo->airtime_link_metric = airtime_link_metric_get(local, sta); +} +#endif + void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, bool tidstats) { @@ -2768,31 +2801,10 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, sta_set_tidstats(sta, &sinfo->pertid[i], i); } - if (ieee80211_vif_is_mesh(&sdata->vif)) { #ifdef CONFIG_MAC80211_MESH - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_LLID) | - BIT_ULL(NL80211_STA_INFO_PLID) | - BIT_ULL(NL80211_STA_INFO_PLINK_STATE) | - BIT_ULL(NL80211_STA_INFO_LOCAL_PM) | - BIT_ULL(NL80211_STA_INFO_PEER_PM) | - BIT_ULL(NL80211_STA_INFO_NONPEER_PM) | - BIT_ULL(NL80211_STA_INFO_CONNECTED_TO_GATE) | - BIT_ULL(NL80211_STA_INFO_CONNECTED_TO_AS); - - sinfo->llid = sta->mesh->llid; - sinfo->plid = sta->mesh->plid; - sinfo->plink_state = sta->mesh->plink_state; - if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_T_OFFSET); - sinfo->t_offset = sta->mesh->t_offset; - } - sinfo->local_pm = sta->mesh->local_pm; - sinfo->peer_pm = sta->mesh->peer_pm; - sinfo->nonpeer_pm = sta->mesh->nonpeer_pm; - sinfo->connected_to_gate = sta->mesh->connected_to_gate; - sinfo->connected_to_as = sta->mesh->connected_to_as; + if (ieee80211_vif_is_mesh(&sdata->vif)) + sta_set_mesh_sinfo(sta, sinfo); #endif - } sinfo->bss_param.flags = 0; if (sdata->vif.bss_conf.use_cts_prot) @@ -2848,12 +2860,6 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG); } - - if (ieee80211_vif_is_mesh(&sdata->vif)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_LINK_METRIC); - sinfo->airtime_link_metric = - airtime_link_metric_get(local, sta); - } } u32 sta_get_expected_throughput(struct sta_info *sta) From patchwork Thu Feb 13 17:16:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 865302 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 973EE2040BA for ; Thu, 13 Feb 2025 17:17:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467046; cv=none; b=ega5hZQBJR6GIbaUQoW81QHLyPXNZZzhwKGJmDXs1Uo/3eao3w1Y9ZCz06ETq9AF/2JR0fvK9z+4BQIq0p1qSuMbgwuvN81iOfDPluI2d7Vn7gCg37m4/7AoqvpIiEQC94I8/5JW+KwjJW7bnWICmrSCskN99UdCLSzHAswTkVg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467046; c=relaxed/simple; bh=ImHju88ogogM0+XnDwakUE4cIk6dKwTL5WBj6eISiaY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OQ5OUK7z7PDKGggADWjHDbh4PQglIOk1AEiTGtltJR/uAB5uuUp0KmszVc+HkCs7FjnJLvGNodA1feFEDpkrb5bBux8hB9vsfoO2Z4FVr2TBP/MfnBBAYhsNdG4bUg6j+L8bdeX4Y0tZnpjfqFoMTsbb64N9T4oj3n4SfMHwqLc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=hGUz/DQv; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="hGUz/DQv" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51D9WUYe015774; Thu, 13 Feb 2025 17:17:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= vZOMbxFp/+6sJyKXpVtcF32GzeQRERfmL2QRm0Uh8ZM=; b=hGUz/DQveP4xgIsT RNk4HAVYm3I8JI+GCOkIOrcBLbNlN01AAXPQ6we43tW+XrfShXOhRrnTsZDLQsSc HSkqtYnsh/IqWTdbjmUcfF2ePnccIX3molUOhbQ+3TzfATPpV9HKQ/p4oze31fBg 2kUn2NYbnOPf4S53HlNLYVmzML2OkRe7zP/bEW9orl/fLkSWOeHyuG2m7aBRb81V oKXreBYGcI303dJpoG9EejmWnw3y7o84VSIVGjCrU2AEqJvrLQdjp/tRWRandnXa dhUIebwQWsufoHPrq1HPPvMlQs0Gtt8ju/KktY4y8GbU/AY4Uu2twUK167bN97sQ TOtzmw== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44rgpgnt3n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:20 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51DHHJNK010507 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:19 GMT Received: from hu-sarishar-blr.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 13 Feb 2025 09:17:18 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH v3 03/12] wifi: mac80211: add support towards MLO handling of station statistics Date: Thu, 13 Feb 2025 22:46:23 +0530 Message-ID: <20250213171632.1646538-4-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250213171632.1646538-1-quic_sarishar@quicinc.com> References: <20250213171632.1646538-1-quic_sarishar@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: i8d8fZ8MFnIVi1CqPxgR2fby6XIWo-Rv X-Proofpoint-GUID: i8d8fZ8MFnIVi1CqPxgR2fby6XIWo-Rv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-13_07,2025-02-13_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=999 priorityscore=1501 mlxscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 phishscore=0 malwarescore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502130123 Currently, in supporting API's to fill sinfo structure from sta structure, is mapped to fill the fields from sta->deflink. However, for multi-link (ML) station, sinfo structure should be filled from corresponding link_id. Therefore, add link_id as an additional argument in supporting API's for filling sinfo structure correctly. Link_id is set to -1 for non-ML station and corresponding link_id for ML stations. In supporting API's for filling sinfo structure, check for link_id, if link_id < 0, fill the sinfo structure from sta-> deflink, otherwise fill from sta->link[link_id]. Current, changes are done at the deflink level i.e, pass -1 as link_id. Actual link_id will be added in subsequent patches to support station statistics for MLO. Signed-off-by: Sarika Sharma --- drivers/net/wireless/intel/iwlwifi/dvm/lib.c | 2 +- include/net/mac80211.h | 3 +- net/mac80211/ibss.c | 4 +- net/mac80211/sta_info.c | 74 ++++++++++++++------ net/mac80211/sta_info.h | 2 +- net/mac80211/util.c | 18 ++++- 6 files changed, 73 insertions(+), 30 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/lib.c b/drivers/net/wireless/intel/iwlwifi/dvm/lib.c index 1dc974e2c511..48711dbcfa5a 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/lib.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/lib.c @@ -586,7 +586,7 @@ static bool iwlagn_fill_txpower_mode(struct iwl_priv *priv, return false; } - ave_rssi = ieee80211_ave_rssi(ctx->vif); + ave_rssi = ieee80211_ave_rssi(ctx->vif, -1); if (!ave_rssi) { /* no rssi data, no changes to reduce tx power */ IWL_DEBUG_COEX(priv, "no rssi data available\n"); diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 22d32419e8a0..dc14fcd5544a 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -7227,13 +7227,14 @@ void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif); * ieee80211_ave_rssi - report the average RSSI for the specified interface * * @vif: the specified virtual interface + * @link_id: the link ID for MLO, or -1 for non-MLO * * Note: This function assumes that the given vif is valid. * * Return: The average RSSI value for the requested interface, or 0 if not * applicable. */ -int ieee80211_ave_rssi(struct ieee80211_vif *vif); +int ieee80211_ave_rssi(struct ieee80211_vif *vif, int link_id); /** * ieee80211_report_wowlan_wakeup - report WoWLAN wakeup diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 05a945df3259..438d7a3caa9c 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c @@ -643,7 +643,7 @@ static int ieee80211_sta_active_ibss(struct ieee80211_sub_if_data *sdata) rcu_read_lock(); list_for_each_entry_rcu(sta, &local->sta_list, list) { - unsigned long last_active = ieee80211_sta_last_active(sta); + unsigned long last_active = ieee80211_sta_last_active(sta, -1); if (sta->sdata == sdata && time_is_after_jiffies(last_active + @@ -1236,7 +1236,7 @@ static void ieee80211_ibss_sta_expire(struct ieee80211_sub_if_data *sdata) lockdep_assert_wiphy(local->hw.wiphy); list_for_each_entry_safe(sta, tmp, &local->sta_list, list) { - unsigned long last_active = ieee80211_sta_last_active(sta); + unsigned long last_active = ieee80211_sta_last_active(sta, -1); if (sdata != sta->sdata) continue; diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index a4b4506cd35b..0f280a89b60a 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -1643,7 +1643,7 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, lockdep_assert_wiphy(local->hw.wiphy); list_for_each_entry_safe(sta, tmp, &local->sta_list, list) { - unsigned long last_active = ieee80211_sta_last_active(sta); + unsigned long last_active = ieee80211_sta_last_active(sta, -1); if (sdata != sta->sdata) continue; @@ -2412,18 +2412,28 @@ void ieee80211_sta_update_pending_airtime(struct ieee80211_local *local, } static struct ieee80211_sta_rx_stats * -sta_get_last_rx_stats(struct sta_info *sta) +sta_get_last_rx_stats(struct sta_info *sta, int link_id) { - struct ieee80211_sta_rx_stats *stats = &sta->deflink.rx_stats; + struct ieee80211_sta_rx_stats *stats; + struct link_sta_info *link_sta_info; int cpu; - if (!sta->deflink.pcpu_rx_stats) + if (link_id < 0) + link_sta_info = &sta->deflink; + else + link_sta_info = + rcu_dereference_protected(sta->link[link_id], + lockdep_is_held(&sta->local->hw.wiphy->mtx)); + + stats = &link_sta_info->rx_stats; + + if (!link_sta_info->pcpu_rx_stats) return stats; for_each_possible_cpu(cpu) { struct ieee80211_sta_rx_stats *cpustats; - cpustats = per_cpu_ptr(sta->deflink.pcpu_rx_stats, cpu); + cpustats = per_cpu_ptr(link_sta_info->pcpu_rx_stats, cpu); if (time_after(cpustats->last_rx, stats->last_rx)) stats = cpustats; @@ -2491,9 +2501,10 @@ static void sta_stats_decode_rate(struct ieee80211_local *local, u32 rate, } } -static int sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo) +static int sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo, + int link_id) { - u32 rate = READ_ONCE(sta_get_last_rx_stats(sta)->last_rate); + u32 rate = READ_ONCE(sta_get_last_rx_stats(sta, link_id)->last_rate); if (rate == STA_STATS_RATE_INVALID) return -EINVAL; @@ -2518,20 +2529,28 @@ static inline u64 sta_get_tidstats_msdu(struct ieee80211_sta_rx_stats *rxstats, static void sta_set_tidstats(struct sta_info *sta, struct cfg80211_tid_stats *tidstats, - int tid) + int tid, int link_id) { struct ieee80211_local *local = sta->local; + struct link_sta_info *link_sta_info; int cpu; + if (link_id < 0) + link_sta_info = &sta->deflink; + else + link_sta_info = + rcu_dereference_protected(sta->link[link_id], + lockdep_is_held(&local->hw.wiphy->mtx)); + if (!(tidstats->filled & BIT(NL80211_TID_STATS_RX_MSDU))) { - tidstats->rx_msdu += sta_get_tidstats_msdu(&sta->deflink.rx_stats, + tidstats->rx_msdu += sta_get_tidstats_msdu(&link_sta_info->rx_stats, tid); if (sta->deflink.pcpu_rx_stats) { for_each_possible_cpu(cpu) { struct ieee80211_sta_rx_stats *cpurxs; - cpurxs = per_cpu_ptr(sta->deflink.pcpu_rx_stats, + cpurxs = per_cpu_ptr(link_sta_info->pcpu_rx_stats, cpu); tidstats->rx_msdu += sta_get_tidstats_msdu(cpurxs, tid); @@ -2543,19 +2562,19 @@ static void sta_set_tidstats(struct sta_info *sta, if (!(tidstats->filled & BIT(NL80211_TID_STATS_TX_MSDU))) { tidstats->filled |= BIT(NL80211_TID_STATS_TX_MSDU); - tidstats->tx_msdu = sta->deflink.tx_stats.msdu[tid]; + tidstats->tx_msdu = link_sta_info->tx_stats.msdu[tid]; } if (!(tidstats->filled & BIT(NL80211_TID_STATS_TX_MSDU_RETRIES)) && ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { tidstats->filled |= BIT(NL80211_TID_STATS_TX_MSDU_RETRIES); - tidstats->tx_msdu_retries = sta->deflink.status_stats.msdu_retries[tid]; + tidstats->tx_msdu_retries = link_sta_info->status_stats.msdu_retries[tid]; } if (!(tidstats->filled & BIT(NL80211_TID_STATS_TX_MSDU_FAILED)) && ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { tidstats->filled |= BIT(NL80211_TID_STATS_TX_MSDU_FAILED); - tidstats->tx_msdu_failed = sta->deflink.status_stats.msdu_failed[tid]; + tidstats->tx_msdu_failed = link_sta_info->status_stats.msdu_failed[tid]; } if (tid < IEEE80211_NUM_TIDS) { @@ -2626,7 +2645,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, int i, ac, cpu; struct ieee80211_sta_rx_stats *last_rxstats; - last_rxstats = sta_get_last_rx_stats(sta); + last_rxstats = sta_get_last_rx_stats(sta, -1); sinfo->generation = sdata->local->sta_generation; @@ -2654,7 +2673,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, sinfo->connected_time = ktime_get_seconds() - sta->last_connected; sinfo->assoc_at = sta->assoc_at; sinfo->inactive_time = - jiffies_to_msecs(jiffies - ieee80211_sta_last_active(sta)); + jiffies_to_msecs(jiffies - ieee80211_sta_last_active(sta, -1)); if (!(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_TX_BYTES64) | BIT_ULL(NL80211_STA_INFO_TX_BYTES)))) { @@ -2743,7 +2762,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, !(sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER)) { sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_RX) | BIT_ULL(NL80211_STA_INFO_BEACON_SIGNAL_AVG); - sinfo->rx_beacon_signal_avg = ieee80211_ave_rssi(&sdata->vif); + sinfo->rx_beacon_signal_avg = ieee80211_ave_rssi(&sdata->vif, -1); } if (ieee80211_hw_check(&sta->local->hw, SIGNAL_DBM) || @@ -2792,13 +2811,13 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_RX_BITRATE)) && !sta->sta.valid_links) { - if (sta_set_rate_info_rx(sta, &sinfo->rxrate) == 0) + if (sta_set_rate_info_rx(sta, &sinfo->rxrate, -1) == 0) sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); } if (tidstats && !cfg80211_sinfo_alloc_tid_stats(sinfo, GFP_KERNEL)) { for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) - sta_set_tidstats(sta, &sinfo->pertid[i], i); + sta_set_tidstats(sta, &sinfo->pertid[i], i, -1); } #ifdef CONFIG_MAC80211_MESH @@ -2881,14 +2900,23 @@ u32 sta_get_expected_throughput(struct sta_info *sta) return thr; } -unsigned long ieee80211_sta_last_active(struct sta_info *sta) +unsigned long ieee80211_sta_last_active(struct sta_info *sta, int link_id) { - struct ieee80211_sta_rx_stats *stats = sta_get_last_rx_stats(sta); + struct ieee80211_sta_rx_stats *stats = sta_get_last_rx_stats(sta, link_id); + struct link_sta_info *link_sta_info; + + if (link_id < 0) + link_sta_info = &sta->deflink; + else + link_sta_info = + rcu_dereference_protected(sta->link[link_id], + lockdep_is_held(&sta->local->hw.wiphy->mtx)); - if (!sta->deflink.status_stats.last_ack || - time_after(stats->last_rx, sta->deflink.status_stats.last_ack)) + if (!link_sta_info->status_stats.last_ack || + time_after(stats->last_rx, link_sta_info->status_stats.last_ack)) return stats->last_rx; - return sta->deflink.status_stats.last_ack; + + return link_sta_info->status_stats.last_ack; } static void sta_update_codel_params(struct sta_info *sta, u32 thr) diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 07b7ec39a52f..7e600c82a6e1 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h @@ -947,7 +947,7 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta); void ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta); void ieee80211_sta_ps_deliver_uapsd(struct sta_info *sta); -unsigned long ieee80211_sta_last_active(struct sta_info *sta); +unsigned long ieee80211_sta_last_active(struct sta_info *sta, int link_id); void ieee80211_sta_set_max_amsdu_subframes(struct sta_info *sta, const u8 *ext_capab, diff --git a/net/mac80211/util.c b/net/mac80211/util.c index f6b631faf4f7..1e2cb33030da 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -3276,14 +3276,28 @@ int ieee80211_put_srates_elem(struct sk_buff *skb, return 0; } -int ieee80211_ave_rssi(struct ieee80211_vif *vif) +int ieee80211_ave_rssi(struct ieee80211_vif *vif, int link_id) { struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); + struct ieee80211_link_data *link_data; + int rssi; if (WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION)) return 0; - return -ewma_beacon_signal_read(&sdata->deflink.u.mgd.ave_beacon_signal); + if (link_id < 0) + link_data = &sdata->deflink; + else + link_data = + rcu_dereference_protected(sdata->link[link_id], + lockdep_is_held(&sdata->local->hw.wiphy->mtx)); + + if (WARN_ON(!link_data)) + return -99; + + rssi = -ewma_beacon_signal_read(&link_data->u.mgd.ave_beacon_signal); + + return rssi; } EXPORT_SYMBOL_GPL(ieee80211_ave_rssi); From patchwork Thu Feb 13 17:16:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 865063 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50910204F74 for ; Thu, 13 Feb 2025 17:17:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467048; cv=none; b=n8/Yj8A8vml2skKwoMjdWU6x39Aw2fSsfL2Gc0OAs+SGwYfJ+4/RATeR4puyLio3E0Y4wj21VWLaBoZW/TNl57MnnjuhV63wn/tGXlFbK5gWWikOYcDQZwF7P+gyJq19GbtmIOCCUJlHUHzJj4DlfoRik+8DRX/ugtBNbdNOdsQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467048; c=relaxed/simple; bh=0tJ/Kl30iRNlWfP/67NzeXNmOLushnN5UJs702gdScM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cfX0V4kBHb+6xvue3WMkuog4AG7oDKT/d5F10WpOpimN+ZVzifXxG5W5yKlZz4ytCOpzL4q3TUpKgZN38PHYHcIpPo6rWsUp5pPSGyH7U/TY69VI700rKxIfPlqSbT9K6CJA3Qf/3EboBpBfNoaUu5R4K426lbLa47OSj3k0dCE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=K228mEPA; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="K228mEPA" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51D9cKmX015820; Thu, 13 Feb 2025 17:17:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= A/HJVR0vwu59MjhoS0katbL6bkEtzbp60yqh/spaDes=; b=K228mEPAsfVB/wH0 V9jHtSuu/X8+2DsRdIpGqCmedREEObWLUBDNCTdXp21miM2lj9A6LgbZjJLmWm5s HJJy6tR378Akk+D7sZC8Fg09kvgFUX/QMIMpvdqdspwp8vbaPlTPyBnRyNwx35vP KqW7gip1M8Of09SBUhc6TY0qVZgZLN0bolu6mzhCj3QkIejjKNKOSDJ7xqln8/Qc w+XTVewmltw8I1kKL6yz0RMzAyzJo3NvjD8HdBtvqpJTUzF084ufLHyBTx80MMTZ xCvPjBe1cV77AShZjpPa064Ei0vvWE8oN2dQ4149NhOJY+E9Ez40SQyomc36LLCx dsK0vw== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44rgpgnt3p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:22 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51DHHLbQ011779 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:21 GMT Received: from hu-sarishar-blr.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 13 Feb 2025 09:17:19 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH v3 04/12] wifi: mac80211: introduce sta_set_link_sinfo API to add support towards MLO statistics Date: Thu, 13 Feb 2025 22:46:24 +0530 Message-ID: <20250213171632.1646538-5-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250213171632.1646538-1-quic_sarishar@quicinc.com> References: <20250213171632.1646538-1-quic_sarishar@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: CwfazlVood4y00hxVEyXP5dE4gJPsOya X-Proofpoint-GUID: CwfazlVood4y00hxVEyXP5dE4gJPsOya X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-13_07,2025-02-13_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=999 priorityscore=1501 mlxscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 phishscore=0 malwarescore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502130123 Introduce sta_set_link_sinfo() API to fill fields in sinfo structure for station statistics. This is done as code cleanup to allow for simplified filling of link level station statistics in subsequent patch to add support for multi-link (ML) station statistics. No functionality changes added. Signed-off-by: Sarika Sharma --- net/mac80211/sta_info.c | 128 ++++++++++++++++++++++------------------ 1 file changed, 70 insertions(+), 58 deletions(-) diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 0f280a89b60a..1d4177f9fbf3 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2636,42 +2636,36 @@ static void sta_set_mesh_sinfo(struct sta_info *sta, } #endif -void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, - bool tidstats) +static void sta_set_link_sinfo(struct sta_info *sta, struct station_info *sinfo, + struct ieee80211_link_data *link_sdata, bool tidstats) { + struct link_sta_info *link_sta_info = &sta->deflink; struct ieee80211_sub_if_data *sdata = sta->sdata; struct ieee80211_local *local = sdata->local; + struct ieee80211_sta_rx_stats *last_rxstats; u32 thr = 0; int i, ac, cpu; - struct ieee80211_sta_rx_stats *last_rxstats; last_rxstats = sta_get_last_rx_stats(sta, -1); - sinfo->generation = sdata->local->sta_generation; - /* do before driver, so beacon filtering drivers have a * chance to e.g. just add the number of filtered beacons * (or just modify the value entirely, of course) */ if (sdata->vif.type == NL80211_IFTYPE_STATION) - sinfo->rx_beacon = sdata->deflink.u.mgd.count_beacon_signal; + sinfo->rx_beacon = link_sdata->u.mgd.count_beacon_signal; drv_sta_statistics(local, sdata, &sta->sta, sinfo); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME) | - BIT_ULL(NL80211_STA_INFO_STA_FLAGS) | BIT_ULL(NL80211_STA_INFO_BSS_PARAM) | - BIT_ULL(NL80211_STA_INFO_CONNECTED_TIME) | - BIT_ULL(NL80211_STA_INFO_ASSOC_AT_BOOTTIME) | BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC); if (sdata->vif.type == NL80211_IFTYPE_STATION) { sinfo->beacon_loss_count = - sdata->deflink.u.mgd.beacon_loss_count; + link_sdata->u.mgd.beacon_loss_count; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_LOSS); } - sinfo->connected_time = ktime_get_seconds() - sta->last_connected; - sinfo->assoc_at = sta->assoc_at; sinfo->inactive_time = jiffies_to_msecs(jiffies - ieee80211_sta_last_active(sta, -1)); @@ -2679,26 +2673,26 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, BIT_ULL(NL80211_STA_INFO_TX_BYTES)))) { sinfo->tx_bytes = 0; for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) - sinfo->tx_bytes += sta->deflink.tx_stats.bytes[ac]; + sinfo->tx_bytes += link_sta_info->tx_stats.bytes[ac]; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64); } if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_PACKETS))) { sinfo->tx_packets = 0; for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) - sinfo->tx_packets += sta->deflink.tx_stats.packets[ac]; + sinfo->tx_packets += link_sta_info->tx_stats.packets[ac]; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); } if (!(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_RX_BYTES64) | BIT_ULL(NL80211_STA_INFO_RX_BYTES)))) { - sinfo->rx_bytes += sta_get_stats_bytes(&sta->deflink.rx_stats); + sinfo->rx_bytes += sta_get_stats_bytes(&link_sta_info->rx_stats); - if (sta->deflink.pcpu_rx_stats) { + if (link_sta_info->pcpu_rx_stats) { for_each_possible_cpu(cpu) { struct ieee80211_sta_rx_stats *cpurxs; - cpurxs = per_cpu_ptr(sta->deflink.pcpu_rx_stats, + cpurxs = per_cpu_ptr(link_sta_info->pcpu_rx_stats, cpu); sinfo->rx_bytes += sta_get_stats_bytes(cpurxs); } @@ -2708,12 +2702,12 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, } if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_RX_PACKETS))) { - sinfo->rx_packets = sta->deflink.rx_stats.packets; - if (sta->deflink.pcpu_rx_stats) { + sinfo->rx_packets = link_sta_info->rx_stats.packets; + if (link_sta_info->pcpu_rx_stats) { for_each_possible_cpu(cpu) { struct ieee80211_sta_rx_stats *cpurxs; - cpurxs = per_cpu_ptr(sta->deflink.pcpu_rx_stats, + cpurxs = per_cpu_ptr(link_sta_info->pcpu_rx_stats, cpu); sinfo->rx_packets += cpurxs->packets; } @@ -2722,12 +2716,12 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, } if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_RETRIES))) { - sinfo->tx_retries = sta->deflink.status_stats.retry_count; + sinfo->tx_retries = link_sta_info->status_stats.retry_count; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES); } if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_FAILED))) { - sinfo->tx_failed = sta->deflink.status_stats.retry_failed; + sinfo->tx_failed = link_sta_info->status_stats.retry_failed; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); } @@ -2748,12 +2742,12 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT); } - sinfo->rx_dropped_misc = sta->deflink.rx_stats.dropped; - if (sta->deflink.pcpu_rx_stats) { + sinfo->rx_dropped_misc = link_sta_info->rx_stats.dropped; + if (link_sta_info->pcpu_rx_stats) { for_each_possible_cpu(cpu) { struct ieee80211_sta_rx_stats *cpurxs; - cpurxs = per_cpu_ptr(sta->deflink.pcpu_rx_stats, cpu); + cpurxs = per_cpu_ptr(link_sta_info->pcpu_rx_stats, cpu); sinfo->rx_dropped_misc += cpurxs->dropped; } } @@ -2775,7 +2769,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, if (!sta->deflink.pcpu_rx_stats && !(sinfo->filled & BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG))) { sinfo->signal_avg = - -ewma_signal_read(&sta->deflink.rx_stats_avg.signal); + -ewma_signal_read(&link_sta_info->rx_stats_avg.signal); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); } } @@ -2788,7 +2782,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, !(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL) | BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG)))) { sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); - if (!sta->deflink.pcpu_rx_stats) + if (!link_sta_info->pcpu_rx_stats) sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG); sinfo->chains = last_rxstats->chains; @@ -2797,14 +2791,14 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, sinfo->chain_signal[i] = last_rxstats->chain_signal_last[i]; sinfo->chain_signal_avg[i] = - -ewma_signal_read(&sta->deflink.rx_stats_avg.chain_signal[i]); + -ewma_signal_read(&link_sta_info->rx_stats_avg.chain_signal[i]); } } if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE)) && !sta->sta.valid_links && - ieee80211_rate_valid(&sta->deflink.tx_stats.last_rate)) { - sta_set_rate_info_tx(sta, &sta->deflink.tx_stats.last_rate, + ieee80211_rate_valid(&link_sta_info->tx_stats.last_rate)) { + sta_set_rate_info_tx(sta, &link_sta_info->tx_stats.last_rate, &sinfo->txrate); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); } @@ -2820,11 +2814,6 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, sta_set_tidstats(sta, &sinfo->pertid[i], i, -1); } -#ifdef CONFIG_MAC80211_MESH - if (ieee80211_vif_is_mesh(&sdata->vif)) - sta_set_mesh_sinfo(sta, sinfo); -#endif - sinfo->bss_param.flags = 0; if (sdata->vif.bss_conf.use_cts_prot) sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT; @@ -2832,8 +2821,51 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; if (sdata->vif.bss_conf.use_short_slot) sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; - sinfo->bss_param.dtim_period = sdata->vif.bss_conf.dtim_period; - sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int; + sinfo->bss_param.dtim_period = link_sdata->conf->dtim_period; + sinfo->bss_param.beacon_interval = link_sdata->conf->beacon_int; + + thr = sta_get_expected_throughput(sta); + + if (thr != 0) { + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_EXPECTED_THROUGHPUT); + sinfo->expected_throughput = thr; + } + + if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL)) && + link_sta_info->status_stats.ack_signal_filled) { + sinfo->ack_signal = link_sta_info->status_stats.last_ack_signal; + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL); + } + + if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG)) && + link_sta_info->status_stats.ack_signal_filled) { + sinfo->avg_ack_signal = + -(s8)ewma_avg_signal_read( + &link_sta_info->status_stats.avg_ack_signal); + sinfo->filled |= + BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG); + } +} + +void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, + bool tidstats) +{ + struct ieee80211_sub_if_data *sdata = sta->sdata; + struct ieee80211_link_data *link_sdata = &sdata->deflink; + + sinfo->generation = sdata->local->sta_generation; + + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_STA_FLAGS) | + BIT_ULL(NL80211_STA_INFO_CONNECTED_TIME) | + BIT_ULL(NL80211_STA_INFO_ASSOC_AT_BOOTTIME); + + sinfo->connected_time = ktime_get_seconds() - sta->last_connected; + sinfo->assoc_at = sta->assoc_at; + +#ifdef CONFIG_MAC80211_MESH + if (ieee80211_vif_is_mesh(&sdata->vif)) + sta_set_mesh_sinfo(sta, sinfo); +#endif sinfo->sta_flags.set = 0; sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) | @@ -2858,27 +2890,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, if (test_sta_flag(sta, WLAN_STA_TDLS_PEER)) sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER); - thr = sta_get_expected_throughput(sta); - - if (thr != 0) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_EXPECTED_THROUGHPUT); - sinfo->expected_throughput = thr; - } - - if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL)) && - sta->deflink.status_stats.ack_signal_filled) { - sinfo->ack_signal = sta->deflink.status_stats.last_ack_signal; - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL); - } - - if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG)) && - sta->deflink.status_stats.ack_signal_filled) { - sinfo->avg_ack_signal = - -(s8)ewma_avg_signal_read( - &sta->deflink.status_stats.avg_ack_signal); - sinfo->filled |= - BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG); - } + sta_set_link_sinfo(sta, sinfo, link_sdata, tidstats); } u32 sta_get_expected_throughput(struct sta_info *sta) From patchwork Thu Feb 13 17:16:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 865301 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DB8B2040BA for ; Thu, 13 Feb 2025 17:17:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467049; cv=none; b=H85l0znNLpyY3uK/UiahsGTajXKZN1Rwel78g8KN33f2XjgufZoolcztVXFLCcSZmFCsj4eYVKfWPpTb/8PbWE7CcIswjh2EEH48evY/s9YSXB9iP7QnFrZqujbmmM40pqdT4fyc6wY3hlv7XCdzhg2YdvzYUuxmAYAW/CutKcY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467049; c=relaxed/simple; bh=KMWRxbHwKQi6+k4BnHJW1uHJc0uBCFl/sfWT5pWNpqc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=G6QgFGHH06CljZKBWWsvvEC8j/hSsjNaEQgCqZoho8b0PXt0wPh3Pomfs45R+A70z4mGX0oTrg0nuQefbAv1QrdC4sCCqwONaXkz5v+4S7xcJmrYRzS+jtGcZD5yGbnTbqUb5xDVlYqmg6jCM0FvzAWn6kT1Q3f75tt007OJFvA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=cNaZQt6t; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="cNaZQt6t" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51DH5fnu008940; Thu, 13 Feb 2025 17:17:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= af/zd1XoqVsurwy2i3Th1G9HvyigEjgvlnRf4QbFtVE=; b=cNaZQt6tENSuKi5i StRIPwbg+lmMN35l45b1L7aqT37raHNpjJgP45EIt8di7Jz2IfZzSuiPJsq9ECBx Oumn0mrRUanhXvyamZSYiV1oYfNTa1MPpYJOjLH42n4Ps6pwkSKo5X6eBsCi5UXc czAJ3dPIelrLEBBiKO+2p3sOOEfUvVvYsEvfVjGkhig4HpJtnNfXkMBZ6nvta1wN TY6tU7Df0yl39ei+/CSua4G55g06akfK7TKLkbh1RPE0qKeXnNrIUNoj9YU07GkT IWCHzcoweaOUskKFSqs0cAe1C25v7IRLFNkwOzHzuJZpSgg8Ki5/tqS+yutR12Yr W19s7w== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44rr1qvr1j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:23 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51DHHNBD004965 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:23 GMT Received: from hu-sarishar-blr.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 13 Feb 2025 09:17:21 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH v3 05/12] wifi: cfg80211: introduced nl80211_fill_link_station API for link attributes towards MLO Date: Thu, 13 Feb 2025 22:46:25 +0530 Message-ID: <20250213171632.1646538-6-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250213171632.1646538-1-quic_sarishar@quicinc.com> References: <20250213171632.1646538-1-quic_sarishar@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: RoZsN2mV0EvOI85EanuIUxBxAYKjPlHK X-Proofpoint-ORIG-GUID: RoZsN2mV0EvOI85EanuIUxBxAYKjPlHK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-13_07,2025-02-13_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 mlxscore=0 impostorscore=0 spamscore=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502130122 Introduce nl80211_fill_link_station() API to fill link level NL attributes for station statistics. This will allow to add support for MLO station statistics in ease way in subsequent patches. No functionality changes added. Signed-off-by: Sarika Sharma --- net/wireless/nl80211.c | 107 ++++++++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 45 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 02311d5b0e48..11ea97a98067 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6694,30 +6694,6 @@ static bool nl80211_put_signal(struct sk_buff *msg, u8 mask, s8 *signal, return true; } -static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, - u32 seq, int flags, - struct cfg80211_registered_device *rdev, - struct net_device *dev, - const u8 *mac_addr, struct station_info *sinfo) -{ - void *hdr; - struct nlattr *sinfoattr, *bss_param; - - hdr = nl80211hdr_put(msg, portid, seq, flags, cmd); - if (!hdr) { - cfg80211_sinfo_release_content(sinfo); - return -1; - } - - if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || - nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr) || - nla_put_u32(msg, NL80211_ATTR_GENERATION, sinfo->generation)) - goto nla_put_failure; - - sinfoattr = nla_nest_start_noflag(msg, NL80211_ATTR_STA_INFO); - if (!sinfoattr) - goto nla_put_failure; - #define PUT_SINFO(attr, memb, type) do { \ BUILD_BUG_ON(sizeof(type) == sizeof(u64)); \ if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_ ## attr) && \ @@ -6732,9 +6708,13 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, goto nla_put_failure; \ } while (0) - PUT_SINFO(CONNECTED_TIME, connected_time, u32); +static int nl80211_fill_link_station(struct sk_buff *msg, + struct cfg80211_registered_device *rdev, + struct station_info *sinfo) +{ + struct nlattr *bss_param; + PUT_SINFO(INACTIVE_TIME, inactive_time, u32); - PUT_SINFO_U64(ASSOC_AT_BOOTTIME, assoc_at); if (sinfo->filled & (BIT_ULL(NL80211_STA_INFO_RX_BYTES) | BIT_ULL(NL80211_STA_INFO_RX_BYTES64)) && @@ -6795,17 +6775,6 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, PUT_SINFO(EXPECTED_THROUGHPUT, expected_throughput, u32); PUT_SINFO(BEACON_LOSS, beacon_loss_count, u32); - PUT_SINFO(LLID, llid, u16); - PUT_SINFO(PLID, plid, u16); - PUT_SINFO(PLINK_STATE, plink_state, u8); - PUT_SINFO(AIRTIME_LINK_METRIC, airtime_link_metric, u32); - PUT_SINFO(LOCAL_PM, local_pm, u32); - PUT_SINFO(PEER_PM, peer_pm, u32); - PUT_SINFO(NONPEER_PM, nonpeer_pm, u32); - PUT_SINFO(CONNECTED_TO_GATE, connected_to_gate, u8); - PUT_SINFO(CONNECTED_TO_AS, connected_to_as, u8); - PUT_SINFO_U64(T_OFFSET, t_offset); - if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_BSS_PARAM)) { bss_param = nla_nest_start_noflag(msg, NL80211_STA_INFO_BSS_PARAM); @@ -6826,11 +6795,6 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, nla_nest_end(msg, bss_param); } - if ((sinfo->filled & BIT_ULL(NL80211_STA_INFO_STA_FLAGS)) && - nla_put(msg, NL80211_STA_INFO_STA_FLAGS, - sizeof(struct nl80211_sta_flag_update), - &sinfo->sta_flags)) - goto nla_put_failure; PUT_SINFO_U64(RX_DROP_MISC, rx_dropped_misc); PUT_SINFO_U64(BEACON_RX, rx_beacon); @@ -6843,9 +6807,6 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, PUT_SINFO(ACK_SIGNAL_AVG, avg_ack_signal, s8); } -#undef PUT_SINFO -#undef PUT_SINFO_U64 - if (sinfo->pertid) { struct nlattr *tidsattr; int tid; @@ -6893,6 +6854,59 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, nla_nest_end(msg, tidsattr); } + return 0; + +nla_put_failure: + return -EMSGSIZE; +} + +static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, + u32 seq, int flags, + struct cfg80211_registered_device *rdev, + struct net_device *dev, + const u8 *mac_addr, struct station_info *sinfo) +{ + void *hdr; + struct nlattr *sinfoattr; + + hdr = nl80211hdr_put(msg, portid, seq, flags, cmd); + if (!hdr) { + cfg80211_sinfo_release_content(sinfo); + return -1; + } + + if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || + nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr) || + nla_put_u32(msg, NL80211_ATTR_GENERATION, sinfo->generation)) + goto nla_put_failure; + + sinfoattr = nla_nest_start_noflag(msg, NL80211_ATTR_STA_INFO); + if (!sinfoattr) + goto nla_put_failure; + + PUT_SINFO(CONNECTED_TIME, connected_time, u32); + PUT_SINFO_U64(ASSOC_AT_BOOTTIME, assoc_at); + + PUT_SINFO(LLID, llid, u16); + PUT_SINFO(PLID, plid, u16); + PUT_SINFO(PLINK_STATE, plink_state, u8); + PUT_SINFO(AIRTIME_LINK_METRIC, airtime_link_metric, u32); + PUT_SINFO(LOCAL_PM, local_pm, u32); + PUT_SINFO(PEER_PM, peer_pm, u32); + PUT_SINFO(NONPEER_PM, nonpeer_pm, u32); + PUT_SINFO(CONNECTED_TO_GATE, connected_to_gate, u8); + PUT_SINFO(CONNECTED_TO_AS, connected_to_as, u8); + PUT_SINFO_U64(T_OFFSET, t_offset); + + if ((sinfo->filled & BIT_ULL(NL80211_STA_INFO_STA_FLAGS)) && + nla_put(msg, NL80211_STA_INFO_STA_FLAGS, + sizeof(struct nl80211_sta_flag_update), + &sinfo->sta_flags)) + goto nla_put_failure; + + if (nl80211_fill_link_station(msg, rdev, sinfo)) + goto nla_put_failure; + nla_nest_end(msg, sinfoattr); if (sinfo->assoc_req_ies_len && @@ -6926,6 +6940,9 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, return -EMSGSIZE; } +#undef PUT_SINFO +#undef PUT_SINFO_U64 + static int nl80211_dump_station(struct sk_buff *skb, struct netlink_callback *cb) { From patchwork Thu Feb 13 17:16:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 865300 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 659BE2040AF for ; Thu, 13 Feb 2025 17:17:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467055; cv=none; b=D5TXv9NNNYynHenS5j/rvJqgAPZ3fsLw1qArYOduqTzopQdbq/uonHp0QC7MT6r0RdwOAeWyRhAnh0CA5kPL7y4Qccdl5KsOO4w99Tdvhkc/K0fSeADYECyBg9NrHHPkO9S8KX7gLi2b1ZtAYoKRTSHvtbg26JpAkTuEHQ1jNDI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467055; c=relaxed/simple; bh=FMT5ddZzmYtxC5RAac++92HXTcnKIMVxvqt2Hb2ylOQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=arPsX1TFtMx2zKk5OZUxxp8B9IR1Rj9oX0K9hP7FQ1lhMvlQ+dQT8e3tUjh2LM452SaxnHF48jDyZqmuUfVCJqRvDalDwnNrh2v05QB4pD6ujkofMg5gIsYWdOhX8GbX7DJGIk+2N1l34/I0WfaWSJcGXv8pTIbgKcHHHV4dlds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=VM1oTYdv; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="VM1oTYdv" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51DGrp5X008337; Thu, 13 Feb 2025 17:17:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= fizj6wDpMdUU2P4HB7CTfaPP3k0pR9UpBbIHdxyKrt4=; b=VM1oTYdvAg2p36eS URflyDOK6CwuBEkNmm34BASj69kDHb+4Jq/+fWqUdzR5h3hk98NzBLLRycZiEK0j Cup6wlN7KSg5WUpJ8Df1xM6/UAaST7Dp4vgPXFYfsh4O5mpQgPRS1jxW72A1FnAb T+SX1Gf4vE5d1dH/neDhWthbTJQxmlyskR715c4lRPec3g22/iOugYrAqW6Dl8gK I+w5eY8QkQNVjso/pJowfzqcjeyVKu2JGPLVP72JHv9Vo73NqyUIa49BrHrXCrzF Qb1zWFHkP7NV4uF9MbCFI7Tv/nt/BIMFnJXxPdqOTpKCt3K7r+frlCpxAiQK4KM2 8xa4Mg== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44qewhbm8j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:26 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51DHHP9t010609 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:25 GMT Received: from hu-sarishar-blr.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 13 Feb 2025 09:17:23 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH v3 06/12] wifi: cfg80211: reorg sinfo structure elements for MLO Date: Thu, 13 Feb 2025 22:46:26 +0530 Message-ID: <20250213171632.1646538-7-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250213171632.1646538-1-quic_sarishar@quicinc.com> References: <20250213171632.1646538-1-quic_sarishar@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 3_i2xjVm9_Njp_zFKIYkXfwD2Nm47mes X-Proofpoint-GUID: 3_i2xjVm9_Njp_zFKIYkXfwD2Nm47mes X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-13_07,2025-02-13_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 impostorscore=0 mlxlogscore=999 phishscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 suspectscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502130123 Current implementation of NL80211_GET_STATION does not work for multi-link operation(MLO) since in case of MLO only deflink (or one of the links) is considered and not all links. Therefore to support for MLO, start reorganizing sinfo structure related data elements and add link_sinfo structure for link-level statistics and keep station related data at sinfo structure. Currently, changes are done at the deflink(or one of the links) level. Actual link-level changes will be added in subsequent changes. Also currently, mac80211 ops .sta_statistics() is mapped to fill sinfo structure. But to add support for station statistics at link level, change the ops to .link_sta_statistics() to fill link_sinfo structure. Additionally, move connected_time before assoc_at in station_info structure to get minimal holes. pahole summary before this change: - size: 232, cachelines: 4, members: 23 - sum members: 223, holes: 3, sum holes: 9 - forced alignments: 1 - last cacheline: 40 bytes pahole summary after this change: - size: 224, cachelines: 4, members: 23 - sum members: 223, holes: 1, sum holes: 1 - forced alignments: 1 - last cacheline: 32 bytes NOTE: - Included driver changes for fixing compilation issue. Signed-off-by: Sarika Sharma --- drivers/net/wireless/ath/ath10k/mac.c | 6 +- drivers/net/wireless/ath/ath11k/mac.c | 6 +- drivers/net/wireless/ath/ath12k/mac.c | 10 +- drivers/net/wireless/ath/ath6kl/cfg80211.c | 56 +++--- drivers/net/wireless/ath/wcn36xx/main.c | 4 +- drivers/net/wireless/ath/wcn36xx/smd.c | 2 +- drivers/net/wireless/ath/wcn36xx/smd.h | 2 +- drivers/net/wireless/ath/wil6210/cfg80211.c | 32 ++-- drivers/net/wireless/ath/wil6210/debugfs.c | 11 +- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 74 ++++---- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 4 +- .../wireless/intel/iwlwifi/mvm/mld-mac80211.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 +- drivers/net/wireless/marvell/libertas/cfg.c | 19 +- .../net/wireless/marvell/mwifiex/cfg80211.c | 60 +++--- .../net/wireless/mediatek/mt76/mt7915/main.c | 4 +- .../net/wireless/mediatek/mt76/mt7921/main.c | 2 +- .../net/wireless/mediatek/mt76/mt7925/main.c | 2 +- drivers/net/wireless/mediatek/mt76/mt792x.h | 2 +- .../net/wireless/mediatek/mt76/mt792x_core.c | 2 +- .../net/wireless/mediatek/mt76/mt7996/main.c | 4 +- .../net/wireless/quantenna/qtnfmac/commands.c | 60 +++--- drivers/net/wireless/realtek/rtl8xxxu/core.c | 4 +- drivers/net/wireless/realtek/rtw88/mac80211.c | 4 +- drivers/net/wireless/realtek/rtw89/mac80211.c | 4 +- drivers/net/wireless/ti/wlcore/main.c | 4 +- drivers/net/wireless/virtual/virt_wifi.c | 10 +- include/net/cfg80211.h | 171 +++++++++++------- include/net/mac80211.h | 18 +- net/mac80211/driver-ops.h | 14 +- net/mac80211/ethtool.c | 31 ++-- net/mac80211/sta_info.c | 11 +- net/mac80211/trace.h | 2 +- net/wireless/nl80211.c | 9 +- net/wireless/trace.h | 33 ++-- net/wireless/util.c | 6 +- net/wireless/wext-compat.c | 22 +-- 37 files changed, 385 insertions(+), 324 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index c61b95a928da..23774c9bbacd 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -9267,7 +9267,7 @@ static void ath10k_mac_parse_bitrate(struct ath10k *ar, u32 rate_code, static void ath10k_mac_sta_get_peer_stats_info(struct ath10k *ar, struct ieee80211_sta *sta, - struct station_info *sinfo) + struct link_station_info *sinfo) { struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; struct ath10k_peer *peer; @@ -9326,7 +9326,7 @@ static void ath10k_mac_sta_get_peer_stats_info(struct ath10k *ar, static void ath10k_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct station_info *sinfo) + struct link_station_info *sinfo) { struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; struct ath10k *ar = arsta->arvif->ar; @@ -9478,7 +9478,7 @@ static const struct ieee80211_ops ath10k_ops = { .unassign_vif_chanctx = ath10k_mac_op_unassign_vif_chanctx, .switch_vif_chanctx = ath10k_mac_op_switch_vif_chanctx, .sta_pre_rcu_remove = ath10k_mac_op_sta_pre_rcu_remove, - .sta_statistics = ath10k_sta_statistics, + .link_sta_statistics = ath10k_sta_statistics, .set_tid_config = ath10k_mac_op_set_tid_config, .reset_tid_config = ath10k_mac_op_reset_tid_config, diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 1556392f7ad4..e6d61d2021d3 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -8908,7 +8908,7 @@ static int ath11k_mac_op_get_survey(struct ieee80211_hw *hw, int idx, return ret; } -static void ath11k_mac_put_chain_rssi(struct station_info *sinfo, +static void ath11k_mac_put_chain_rssi(struct link_station_info *sinfo, struct ath11k_sta *arsta, char *pre, bool clear) @@ -8940,7 +8940,7 @@ static void ath11k_mac_put_chain_rssi(struct station_info *sinfo, static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct station_info *sinfo) + struct link_station_info *sinfo) { struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); struct ath11k *ar = arsta->arvif->ar; @@ -9724,7 +9724,7 @@ static const struct ieee80211_ops ath11k_ops = { .set_bitrate_mask = ath11k_mac_op_set_bitrate_mask, .get_survey = ath11k_mac_op_get_survey, .flush = ath11k_mac_op_flush, - .sta_statistics = ath11k_mac_op_sta_statistics, + .link_sta_statistics = ath11k_mac_op_sta_statistics, CFG80211_TESTMODE_CMD(ath11k_tm_cmd) #ifdef CONFIG_PM diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 2d062b5904a8..82fc1a5d71e8 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -10017,10 +10017,10 @@ static int ath12k_mac_op_get_survey(struct ieee80211_hw *hw, int idx, return 0; } -static void ath12k_mac_op_sta_statistics(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct station_info *sinfo) +static void ath12k_mac_op_link_sta_statistics(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + struct link_station_info *sinfo) { struct ath12k_sta *ahsta = ath12k_sta_to_ahsta(sta); struct ath12k_link_sta *arsta; @@ -10289,7 +10289,7 @@ static const struct ieee80211_ops ath12k_ops = { .set_bitrate_mask = ath12k_mac_op_set_bitrate_mask, .get_survey = ath12k_mac_op_get_survey, .flush = ath12k_mac_op_flush, - .sta_statistics = ath12k_mac_op_sta_statistics, + .link_sta_statistics = ath12k_mac_op_link_sta_statistics, .remain_on_channel = ath12k_mac_op_remain_on_channel, .cancel_remain_on_channel = ath12k_mac_op_cancel_remain_on_channel, .change_sta_links = ath12k_mac_op_change_sta_links, diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index 72ce321f2a77..ef783cd2671e 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c @@ -1783,6 +1783,10 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev, int ret; u8 mcs; + sinfo->links[0] = kzalloc(sizeof(struct link_station_info), GFP_KERNEL); + if (!sinfo->links[0]) + return -ENOMEM; + if (memcmp(mac, vif->bssid, ETH_ALEN) != 0) return -ENOENT; @@ -1811,46 +1815,46 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev, return left; if (vif->target_stats.rx_byte) { - sinfo->rx_bytes = vif->target_stats.rx_byte; - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64); - sinfo->rx_packets = vif->target_stats.rx_pkt; - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS); + sinfo->links[0]->rx_bytes = vif->target_stats.rx_byte; + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64); + sinfo->links[0]->rx_packets = vif->target_stats.rx_pkt; + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS); } if (vif->target_stats.tx_byte) { - sinfo->tx_bytes = vif->target_stats.tx_byte; - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64); - sinfo->tx_packets = vif->target_stats.tx_pkt; - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); + sinfo->links[0]->tx_bytes = vif->target_stats.tx_byte; + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64); + sinfo->links[0]->tx_packets = vif->target_stats.tx_pkt; + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); } - sinfo->signal = vif->target_stats.cs_rssi; - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); + sinfo->links[0]->signal = vif->target_stats.cs_rssi; + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); rate = vif->target_stats.tx_ucast_rate; if (is_rate_legacy(rate)) { - sinfo->txrate.legacy = rate / 100; + sinfo->links[0]->txrate.legacy = rate / 100; } else if (is_rate_ht20(rate, &mcs, &sgi)) { if (sgi) { - sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; - sinfo->txrate.mcs = mcs - 1; + sinfo->links[0]->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; + sinfo->links[0]->txrate.mcs = mcs - 1; } else { - sinfo->txrate.mcs = mcs; + sinfo->links[0]->txrate.mcs = mcs; } - sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; - sinfo->txrate.bw = RATE_INFO_BW_20; + sinfo->links[0]->txrate.flags |= RATE_INFO_FLAGS_MCS; + sinfo->links[0]->txrate.bw = RATE_INFO_BW_20; } else if (is_rate_ht40(rate, &mcs, &sgi)) { if (sgi) { - sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; - sinfo->txrate.mcs = mcs - 1; + sinfo->links[0]->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; + sinfo->links[0]->txrate.mcs = mcs - 1; } else { - sinfo->txrate.mcs = mcs; + sinfo->links[0]->txrate.mcs = mcs; } - sinfo->txrate.bw = RATE_INFO_BW_40; - sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; + sinfo->links[0]->txrate.bw = RATE_INFO_BW_40; + sinfo->links[0]->txrate.flags |= RATE_INFO_FLAGS_MCS; } else { ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "invalid rate from stats: %d\n", rate); @@ -1858,15 +1862,15 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev, return 0; } - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); if (test_bit(CONNECTED, &vif->flags) && test_bit(DTIM_PERIOD_AVAIL, &vif->flags) && vif->nw_type == INFRA_NETWORK) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM); - sinfo->bss_param.flags = 0; - sinfo->bss_param.dtim_period = vif->assoc_bss_dtim_period; - sinfo->bss_param.beacon_interval = vif->assoc_bss_beacon_int; + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM); + sinfo->links[0]->bss_param.flags = 0; + sinfo->links[0]->bss_param.dtim_period = vif->assoc_bss_dtim_period; + sinfo->links[0]->bss_param.beacon_interval = vif->assoc_bss_beacon_int; } return 0; diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index 94d08d6ae1a3..d2e6e5d4d5e0 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1332,7 +1332,7 @@ static int wcn36xx_get_survey(struct ieee80211_hw *hw, int idx, } static void wcn36xx_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, struct station_info *sinfo) + struct ieee80211_sta *sta, struct link_station_info *sinfo) { struct wcn36xx *wcn; u8 sta_index; @@ -1374,7 +1374,7 @@ static const struct ieee80211_ops wcn36xx_ops = { .set_rts_threshold = wcn36xx_set_rts_threshold, .sta_add = wcn36xx_sta_add, .sta_remove = wcn36xx_sta_remove, - .sta_statistics = wcn36xx_sta_statistics, + .link_sta_statistics = wcn36xx_sta_statistics, .ampdu_action = wcn36xx_ampdu_action, #if IS_ENABLED(CONFIG_IPV6) .ipv6_addr_change = wcn36xx_ipv6_addr_change, diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 2cf86fc3f8fe..e494fb34c4fc 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2590,7 +2590,7 @@ int wcn36xx_smd_del_ba(struct wcn36xx *wcn, u16 tid, u8 direction, u8 sta_index) } int wcn36xx_smd_get_stats(struct wcn36xx *wcn, u8 sta_index, u32 stats_mask, - struct station_info *sinfo) + struct link_station_info *sinfo) { struct wcn36xx_hal_stats_req_msg msg_body; struct wcn36xx_hal_stats_rsp_msg *rsp; diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index 2c1ed9e570bf..f6a7944aa464 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -136,7 +136,7 @@ int wcn36xx_smd_add_ba(struct wcn36xx *wcn, u8 session_id); int wcn36xx_smd_del_ba(struct wcn36xx *wcn, u16 tid, u8 direction, u8 sta_index); int wcn36xx_smd_trigger_ba(struct wcn36xx *wcn, u8 sta_index, u16 tid, u16 *ssn); int wcn36xx_smd_get_stats(struct wcn36xx *wcn, u8 sta_index, u32 stats_mask, - struct station_info *sinfo); + struct link_station_info *sinfo); int wcn36xx_smd_update_cfg(struct wcn36xx *wcn, u32 cfg_id, u32 value); diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index a1a0a9223e74..5c257be4ba35 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c @@ -476,7 +476,7 @@ int wil_cid_fill_sinfo(struct wil6210_vif *vif, int cid, sinfo->generation = wil->sinfo_gen; - sinfo->filled = BIT_ULL(NL80211_STA_INFO_RX_BYTES) | + sinfo->links[0]->filled = BIT_ULL(NL80211_STA_INFO_RX_BYTES) | BIT_ULL(NL80211_STA_INFO_TX_BYTES) | BIT_ULL(NL80211_STA_INFO_RX_PACKETS) | BIT_ULL(NL80211_STA_INFO_TX_PACKETS) | @@ -504,29 +504,29 @@ int wil_cid_fill_sinfo(struct wil6210_vif *vif, int cid, rx_mcs = WIL_BASE_MCS_FOR_EXTENDED_26; } - sinfo->txrate.flags = tx_rate_flag; - sinfo->rxrate.flags = rx_rate_flag; - sinfo->txrate.mcs = tx_mcs; - sinfo->rxrate.mcs = rx_mcs; + sinfo->links[0]->txrate.flags = tx_rate_flag; + sinfo->links[0]->rxrate.flags = rx_rate_flag; + sinfo->links[0]->txrate.mcs = tx_mcs; + sinfo->links[0]->rxrate.mcs = rx_mcs; - sinfo->txrate.n_bonded_ch = + sinfo->links[0]->txrate.n_bonded_ch = wil_tx_cb_mode_to_n_bonded(reply.evt.tx_mode); - sinfo->rxrate.n_bonded_ch = + sinfo->links[0]->rxrate.n_bonded_ch = wil_rx_cb_mode_to_n_bonded(stats->last_cb_mode_rx); - sinfo->rx_bytes = stats->rx_bytes; - sinfo->rx_packets = stats->rx_packets; - sinfo->rx_dropped_misc = stats->rx_dropped; - sinfo->tx_bytes = stats->tx_bytes; - sinfo->tx_packets = stats->tx_packets; - sinfo->tx_failed = stats->tx_errors; + sinfo->links[0]->rx_bytes = stats->rx_bytes; + sinfo->links[0]->rx_packets = stats->rx_packets; + sinfo->links[0]->rx_dropped_misc = stats->rx_dropped; + sinfo->links[0]->tx_bytes = stats->tx_bytes; + sinfo->links[0]->tx_packets = stats->tx_packets; + sinfo->links[0]->tx_failed = stats->tx_errors; if (test_bit(wil_vif_fwconnected, vif->status)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); if (test_bit(WMI_FW_CAPABILITY_RSSI_REPORTING, wil->fw_capabilities)) - sinfo->signal = reply.evt.rssi; + sinfo->links[0]->signal = reply.evt.rssi; else - sinfo->signal = reply.evt.sqi; + sinfo->links[0]->signal = reply.evt.sqi; } return rc; diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index c021ebcddee7..329f03942d80 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -1396,6 +1396,10 @@ static int link_show(struct seq_file *s, void *data) if (!sinfo) return -ENOMEM; + sinfo->links[0] = kzalloc(sizeof(struct link_station_info), GFP_KERNEL); + if (!sinfo->links[0]) + return -ENOMEM; + for (i = 0; i < wil->max_assoc_sta; i++) { struct wil_sta_info *p = &wil->sta[i]; char *status = "unknown"; @@ -1427,16 +1431,17 @@ static int link_show(struct seq_file *s, void *data) goto out; seq_printf(s, " Tx_mcs = %s\n", - WIL_EXTENDED_MCS_CHECK(sinfo->txrate.mcs)); + WIL_EXTENDED_MCS_CHECK(sinfo->links[0]->txrate.mcs)); seq_printf(s, " Rx_mcs = %s\n", - WIL_EXTENDED_MCS_CHECK(sinfo->rxrate.mcs)); - seq_printf(s, " SQ = %d\n", sinfo->signal); + WIL_EXTENDED_MCS_CHECK(sinfo->links[0]->rxrate.mcs)); + seq_printf(s, " SQ = %d\n", sinfo->links[0]->signal); } else { seq_puts(s, " INVALID MID\n"); } } out: + kfree(sinfo->links[0]); kfree(sinfo); return rc; } diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 4b70845e1a26..2a265e56afe6 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -3028,7 +3028,7 @@ static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si) sfu->set |= BIT(NL80211_STA_FLAG_AUTHORIZED); } -static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si) +static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct link_station_info *si) { struct brcmf_pub *drvr = ifp->drvr; struct { @@ -3066,7 +3066,7 @@ static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si) static s32 brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp, - struct station_info *sinfo) + struct link_station_info *sinfo) { struct brcmf_pub *drvr = ifp->drvr; struct brcmf_scb_val_le scbval; @@ -3131,12 +3131,16 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, int rssi; u32 i; + sinfo->links[0] = kzalloc(sizeof(struct link_station_info), GFP_KERNEL); + if (sinfo->links[0]) + return -ENOMEM; + brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac); if (!check_vif_up(ifp->vif)) return -EIO; if (brcmf_is_ibssmode(ifp->vif)) - return brcmf_cfg80211_get_station_ibss(ifp, sinfo); + return brcmf_cfg80211_get_station_ibss(ifp, sinfo->links[0]); memset(&sta_info_le, 0, sizeof(sta_info_le)); memcpy(&sta_info_le, mac, ETH_ALEN); @@ -3154,8 +3158,8 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, } } brcmf_dbg(TRACE, "version %d\n", le16_to_cpu(sta_info_le.ver)); - sinfo->filled = BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME); - sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000; + sinfo->links[0]->filled = BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME); + sinfo->links[0]->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000; sta_flags = le32_to_cpu(sta_info_le.flags); brcmf_convert_sta_flags(sta_flags, sinfo); sinfo->sta_flags.mask |= BIT(NL80211_STA_FLAG_TDLS_PEER); @@ -3166,54 +3170,54 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, if (sta_flags & BRCMF_STA_ASSOC) { sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CONNECTED_TIME); sinfo->connected_time = le32_to_cpu(sta_info_le.in); - brcmf_fill_bss_param(ifp, sinfo); + brcmf_fill_bss_param(ifp, sinfo->links[0]); } if (sta_flags & BRCMF_STA_SCBSTATS) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); - sinfo->tx_failed = le32_to_cpu(sta_info_le.tx_failures); - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); - sinfo->tx_packets = le32_to_cpu(sta_info_le.tx_pkts); - sinfo->tx_packets += le32_to_cpu(sta_info_le.tx_mcast_pkts); - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS); - sinfo->rx_packets = le32_to_cpu(sta_info_le.rx_ucast_pkts); - sinfo->rx_packets += le32_to_cpu(sta_info_le.rx_mcast_pkts); - if (sinfo->tx_packets) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); - sinfo->txrate.legacy = + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); + sinfo->links[0]->tx_failed = le32_to_cpu(sta_info_le.tx_failures); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); + sinfo->links[0]->tx_packets = le32_to_cpu(sta_info_le.tx_pkts); + sinfo->links[0]->tx_packets += le32_to_cpu(sta_info_le.tx_mcast_pkts); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS); + sinfo->links[0]->rx_packets = le32_to_cpu(sta_info_le.rx_ucast_pkts); + sinfo->links[0]->rx_packets += le32_to_cpu(sta_info_le.rx_mcast_pkts); + if (sinfo->links[0]->tx_packets) { + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); + sinfo->links[0]->txrate.legacy = le32_to_cpu(sta_info_le.tx_rate) / 100; } - if (sinfo->rx_packets) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); - sinfo->rxrate.legacy = + if (sinfo->links[0]->rx_packets) { + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); + sinfo->links[0]->rxrate.legacy = le32_to_cpu(sta_info_le.rx_rate) / 100; } if (le16_to_cpu(sta_info_le.ver) >= 4) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES); - sinfo->tx_bytes = le64_to_cpu(sta_info_le.tx_tot_bytes); - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES); - sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES); + sinfo->links[0]->tx_bytes = le64_to_cpu(sta_info_le.tx_tot_bytes); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES); + sinfo->links[0]->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes); } for (i = 0; i < BRCMF_ANT_MAX; i++) { if (sta_info_le.rssi[i] == 0 || sta_info_le.rx_lastpkt_rssi[i] == 0) continue; - sinfo->chains |= BIT(count_rssi); - sinfo->chain_signal[count_rssi] = + sinfo->links[0]->chains |= BIT(count_rssi); + sinfo->links[0]->chain_signal[count_rssi] = sta_info_le.rx_lastpkt_rssi[i]; - sinfo->chain_signal_avg[count_rssi] = + sinfo->links[0]->chain_signal_avg[count_rssi] = sta_info_le.rssi[i]; total_rssi += sta_info_le.rx_lastpkt_rssi[i]; total_rssi_avg += sta_info_le.rssi[i]; count_rssi++; } if (count_rssi) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); - sinfo->filled |= + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG); - sinfo->signal = total_rssi / count_rssi; - sinfo->signal_avg = total_rssi_avg / count_rssi; + sinfo->links[0]->signal = total_rssi / count_rssi; + sinfo->links[0]->signal_avg = total_rssi_avg / count_rssi; } else if (test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state)) { memset(&scb_val, 0, sizeof(scb_val)); @@ -3225,8 +3229,8 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, goto done; } else { rssi = le32_to_cpu(scb_val.val); - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); - sinfo->signal = rssi; + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); + sinfo->links[0]->signal = rssi; brcmf_dbg(CONN, "RSSI %d dBm\n", rssi); } } diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 014777c9cc5d..42e18f055665 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -6240,7 +6240,7 @@ static void iwl_mvm_set_sta_rate(u32 rate_n_flags, struct rate_info *rinfo) void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct station_info *sinfo) + struct link_station_info *sinfo) { struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); @@ -6648,7 +6648,7 @@ const struct ieee80211_ops iwl_mvm_hw_ops = { .set_default_unicast_key = iwl_mvm_set_default_unicast_key, #endif .get_survey = iwl_mvm_mac_get_survey, - .sta_statistics = iwl_mvm_mac_sta_statistics, + .link_sta_statistics = iwl_mvm_mac_sta_statistics, .get_ftm_responder_stats = iwl_mvm_mac_get_ftm_responder_stats, .start_pmsr = iwl_mvm_start_pmsr, .abort_pmsr = iwl_mvm_abort_pmsr, diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c index 341a2a7a49ec..668ceed9387d 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c @@ -1416,7 +1416,7 @@ const struct ieee80211_ops iwl_mvm_mld_hw_ops = { .set_default_unicast_key = iwl_mvm_set_default_unicast_key, #endif .get_survey = iwl_mvm_mac_get_survey, - .sta_statistics = iwl_mvm_mac_sta_statistics, + .link_sta_statistics = iwl_mvm_mac_sta_statistics, .get_ftm_responder_stats = iwl_mvm_mac_get_ftm_responder_stats, .start_pmsr = iwl_mvm_start_pmsr, .abort_pmsr = iwl_mvm_abort_pmsr, diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index d17592d3f6c8..243d9c7b65fc 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -2964,7 +2964,7 @@ int iwl_mvm_mac_get_survey(struct ieee80211_hw *hw, int idx, void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct station_info *sinfo); + struct link_station_info *sinfo); int iwl_mvm_mac_get_ftm_responder_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif, diff --git a/drivers/net/wireless/marvell/libertas/cfg.c b/drivers/net/wireless/marvell/libertas/cfg.c index 2e2c193716d9..c67a29dd4258 100644 --- a/drivers/net/wireless/marvell/libertas/cfg.c +++ b/drivers/net/wireless/marvell/libertas/cfg.c @@ -1612,27 +1612,28 @@ static int lbs_cfg_get_station(struct wiphy *wiphy, struct net_device *dev, int ret; size_t i; - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES) | + sinfo->links[0] = kzalloc(sizeof(struct link_station_info), GFP_KERNEL); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES) | BIT_ULL(NL80211_STA_INFO_TX_PACKETS) | BIT_ULL(NL80211_STA_INFO_RX_BYTES) | BIT_ULL(NL80211_STA_INFO_RX_PACKETS); - sinfo->tx_bytes = priv->dev->stats.tx_bytes; - sinfo->tx_packets = priv->dev->stats.tx_packets; - sinfo->rx_bytes = priv->dev->stats.rx_bytes; - sinfo->rx_packets = priv->dev->stats.rx_packets; + sinfo->links[0]->tx_bytes = priv->dev->stats.tx_bytes; + sinfo->links[0]->tx_packets = priv->dev->stats.tx_packets; + sinfo->links[0]->rx_bytes = priv->dev->stats.rx_bytes; + sinfo->links[0]->rx_packets = priv->dev->stats.rx_packets; /* Get current RSSI */ ret = lbs_get_rssi(priv, &signal, &noise); if (ret == 0) { - sinfo->signal = signal; - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); + sinfo->links[0]->signal = signal; + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); } /* Convert priv->cur_rate from hw_value to NL80211 value */ for (i = 0; i < ARRAY_SIZE(lbs_rates); i++) { if (priv->cur_rate == lbs_rates[i].hw_value) { - sinfo->txrate.legacy = lbs_rates[i].bitrate; - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); + sinfo->links[0]->txrate.legacy = lbs_rates[i].bitrate; + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); break; } } diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index a099fdaafa45..c7dce033093f 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -1461,7 +1461,9 @@ mwifiex_dump_station_info(struct mwifiex_private *priv, { u32 rate; - sinfo->filled = BIT_ULL(NL80211_STA_INFO_RX_BYTES) | BIT_ULL(NL80211_STA_INFO_TX_BYTES) | + sinfo->links[0] = kzalloc(sizeof(struct link_station_info), GFP_KERNEL); + + sinfo->links[0]->filled = BIT_ULL(NL80211_STA_INFO_RX_BYTES) | BIT_ULL(NL80211_STA_INFO_TX_BYTES) | BIT_ULL(NL80211_STA_INFO_RX_PACKETS) | BIT_ULL(NL80211_STA_INFO_TX_PACKETS) | BIT_ULL(NL80211_STA_INFO_TX_BITRATE) | BIT_ULL(NL80211_STA_INFO_SIGNAL) | BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); @@ -1470,23 +1472,23 @@ mwifiex_dump_station_info(struct mwifiex_private *priv, if (!node) return -ENOENT; - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME) | + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME) | BIT_ULL(NL80211_STA_INFO_TX_FAILED); - sinfo->inactive_time = + sinfo->links[0]->inactive_time = jiffies_to_msecs(jiffies - node->stats.last_rx); - sinfo->signal = node->stats.rssi; - sinfo->signal_avg = node->stats.rssi; - sinfo->rx_bytes = node->stats.rx_bytes; - sinfo->tx_bytes = node->stats.tx_bytes; - sinfo->rx_packets = node->stats.rx_packets; - sinfo->tx_packets = node->stats.tx_packets; - sinfo->tx_failed = node->stats.tx_failed; + sinfo->links[0]->signal = node->stats.rssi; + sinfo->links[0]->signal_avg = node->stats.rssi; + sinfo->links[0]->rx_bytes = node->stats.rx_bytes; + sinfo->links[0]->tx_bytes = node->stats.tx_bytes; + sinfo->links[0]->rx_packets = node->stats.rx_packets; + sinfo->links[0]->tx_packets = node->stats.tx_packets; + sinfo->links[0]->tx_failed = node->stats.tx_failed; mwifiex_parse_htinfo(priv, priv->tx_rate, node->stats.last_tx_htinfo, - &sinfo->txrate); - sinfo->txrate.legacy = node->stats.last_tx_rate * 5; + &sinfo->links[0]->txrate); + sinfo->links[0]->txrate.legacy = node->stats.last_tx_rate * 5; return 0; } @@ -1511,34 +1513,34 @@ mwifiex_dump_station_info(struct mwifiex_private *priv, &priv->dtim_period, true); mwifiex_parse_htinfo(priv, priv->tx_rate, priv->tx_htinfo, - &sinfo->txrate); - - sinfo->signal_avg = priv->bcn_rssi_avg; - sinfo->rx_bytes = priv->stats.rx_bytes; - sinfo->tx_bytes = priv->stats.tx_bytes; - sinfo->rx_packets = priv->stats.rx_packets; - sinfo->tx_packets = priv->stats.tx_packets; - sinfo->signal = priv->bcn_rssi_avg; + &sinfo->links[0]->txrate); + + sinfo->links[0]->signal_avg = priv->bcn_rssi_avg; + sinfo->links[0]->rx_bytes = priv->stats.rx_bytes; + sinfo->links[0]->tx_bytes = priv->stats.tx_bytes; + sinfo->links[0]->rx_packets = priv->stats.rx_packets; + sinfo->links[0]->tx_packets = priv->stats.tx_packets; + sinfo->links[0]->signal = priv->bcn_rssi_avg; /* bit rate is in 500 kb/s units. Convert it to 100kb/s units */ - sinfo->txrate.legacy = rate * 5; + sinfo->links[0]->txrate.legacy = rate * 5; - sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE); + sinfo->links[0]->filled |= BIT(NL80211_STA_INFO_RX_BITRATE); mwifiex_parse_htinfo(priv, priv->rxpd_rate, priv->rxpd_htinfo, - &sinfo->rxrate); + &sinfo->links[0]->rxrate); if (priv->bss_mode == NL80211_IFTYPE_STATION) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM); - sinfo->bss_param.flags = 0; + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM); + sinfo->links[0]->bss_param.flags = 0; if (priv->curr_bss_params.bss_descriptor.cap_info_bitmap & WLAN_CAPABILITY_SHORT_PREAMBLE) - sinfo->bss_param.flags |= + sinfo->links[0]->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; if (priv->curr_bss_params.bss_descriptor.cap_info_bitmap & WLAN_CAPABILITY_SHORT_SLOT_TIME) - sinfo->bss_param.flags |= + sinfo->links[0]->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; - sinfo->bss_param.dtim_period = priv->dtim_period; - sinfo->bss_param.beacon_interval = + sinfo->links[0]->bss_param.dtim_period = priv->dtim_period; + sinfo->links[0]->bss_param.beacon_interval = priv->curr_bss_params.bss_descriptor.beacon_period; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c index 3aa31c5cefa6..a2becae6a84a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c @@ -1148,7 +1148,7 @@ mt7915_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) static void mt7915_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct station_info *sinfo) + struct link_station_info *sinfo) { struct mt7915_phy *phy = mt7915_hw_phy(hw); struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; @@ -1794,7 +1794,7 @@ const struct ieee80211_ops mt7915_ops = { .set_antenna = mt7915_set_antenna, .set_bitrate_mask = mt7915_set_bitrate_mask, .set_coverage_class = mt7915_set_coverage_class, - .sta_statistics = mt7915_sta_statistics, + .link_sta_statistics = mt7915_sta_statistics, .sta_set_txpwr = mt7915_sta_set_txpwr, .sta_set_4addr = mt7915_sta_set_4addr, .sta_set_decap_offload = mt7915_sta_set_decap_offload, diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 13e58c328aff..5be45548c654 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -1544,7 +1544,7 @@ const struct ieee80211_ops mt7921_ops = { .set_coverage_class = mt792x_set_coverage_class, .hw_scan = mt7921_hw_scan, .cancel_hw_scan = mt7921_cancel_hw_scan, - .sta_statistics = mt792x_sta_statistics, + .link_sta_statistics = mt792x_sta_statistics, .sched_scan_start = mt7921_start_sched_scan, .sched_scan_stop = mt7921_stop_sched_scan, CFG80211_TESTMODE_CMD(mt7921_testmode_cmd) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 98daf80ac131..ea5e8ee1f1af 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -2177,7 +2177,7 @@ const struct ieee80211_ops mt7925_ops = { .set_coverage_class = mt792x_set_coverage_class, .hw_scan = mt7925_hw_scan, .cancel_hw_scan = mt7925_cancel_hw_scan, - .sta_statistics = mt792x_sta_statistics, + .link_sta_statistics = mt792x_sta_statistics, .sched_scan_start = mt7925_start_sched_scan, .sched_scan_stop = mt7925_stop_sched_scan, #ifdef CONFIG_PM diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index 32ed01a96bf7..a617c39593ff 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -400,7 +400,7 @@ void mt792x_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif, void mt792x_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct station_info *sinfo); + struct link_station_info *sinfo); void mt792x_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class); void mt792x_dma_cleanup(struct mt792x_dev *dev); int mt792x_dma_enable(struct mt792x_dev *dev); diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c index 8799627f6292..2afd9b404486 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c @@ -544,7 +544,7 @@ EXPORT_SYMBOL_GPL(mt792x_get_et_stats); void mt792x_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct station_info *sinfo) + struct link_station_info *sinfo) { struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; struct rate_info *txrate = &msta->deflink.wcid.rate; diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c index 69dd565d8319..c3b1fff4fd6f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c @@ -1141,7 +1141,7 @@ mt7996_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) static void mt7996_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct station_info *sinfo) + struct link_station_info *sinfo) { struct mt7996_dev *dev = mt7996_hw_dev(hw); struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; @@ -1664,7 +1664,7 @@ const struct ieee80211_ops mt7996_ops = { .set_antenna = mt7996_set_antenna, .set_bitrate_mask = mt7996_set_bitrate_mask, .set_coverage_class = mt7996_set_coverage_class, - .sta_statistics = mt7996_sta_statistics, + .link_sta_statistics = mt7996_sta_statistics, .sta_set_4addr = mt7996_sta_set_4addr, .sta_set_decap_offload = mt7996_sta_set_decap_offload, .add_twt_setup = mt7996_mac_add_twt_setup, diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 956c5763662f..7c0e68b95f5d 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -615,9 +615,13 @@ qtnf_cmd_sta_info_parse(struct station_info *sinfo, const u8 *data, if (!map || !stats) return; + sinfo->links[0] = kzalloc(sizeof(struct link_station_info), GFP_KERNEL); + if (!sinfo->links[0]) + return; + if (qtnf_sta_stat_avail(inactive_time, QLINK_STA_INFO_INACTIVE_TIME)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME); - sinfo->inactive_time = le32_to_cpu(stats->inactive_time); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME); + sinfo->links[0]->inactive_time = le32_to_cpu(stats->inactive_time); } if (qtnf_sta_stat_avail(connected_time, @@ -627,23 +631,23 @@ qtnf_cmd_sta_info_parse(struct station_info *sinfo, const u8 *data, } if (qtnf_sta_stat_avail(signal, QLINK_STA_INFO_SIGNAL)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); - sinfo->signal = stats->signal - QLINK_RSSI_OFFSET; + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); + sinfo->links[0]->signal = stats->signal - QLINK_RSSI_OFFSET; } if (qtnf_sta_stat_avail(signal_avg, QLINK_STA_INFO_SIGNAL_AVG)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); - sinfo->signal_avg = stats->signal_avg - QLINK_RSSI_OFFSET; + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); + sinfo->links[0]->signal_avg = stats->signal_avg - QLINK_RSSI_OFFSET; } if (qtnf_sta_stat_avail(rxrate, QLINK_STA_INFO_RX_BITRATE)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); - qtnf_sta_info_parse_rate(&sinfo->rxrate, &stats->rxrate); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); + qtnf_sta_info_parse_rate(&sinfo->links[0]->rxrate, &stats->rxrate); } if (qtnf_sta_stat_avail(txrate, QLINK_STA_INFO_TX_BITRATE)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); - qtnf_sta_info_parse_rate(&sinfo->txrate, &stats->txrate); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); + qtnf_sta_info_parse_rate(&sinfo->links[0]->txrate, &stats->txrate); } if (qtnf_sta_stat_avail(sta_flags, QLINK_STA_INFO_STA_FLAGS)) { @@ -652,48 +656,48 @@ qtnf_cmd_sta_info_parse(struct station_info *sinfo, const u8 *data, } if (qtnf_sta_stat_avail(rx_bytes, QLINK_STA_INFO_RX_BYTES)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES); - sinfo->rx_bytes = le64_to_cpu(stats->rx_bytes); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES); + sinfo->links[0]->rx_bytes = le64_to_cpu(stats->rx_bytes); } if (qtnf_sta_stat_avail(tx_bytes, QLINK_STA_INFO_TX_BYTES)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES); - sinfo->tx_bytes = le64_to_cpu(stats->tx_bytes); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES); + sinfo->links[0]->tx_bytes = le64_to_cpu(stats->tx_bytes); } if (qtnf_sta_stat_avail(rx_bytes, QLINK_STA_INFO_RX_BYTES64)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64); - sinfo->rx_bytes = le64_to_cpu(stats->rx_bytes); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64); + sinfo->links[0]->rx_bytes = le64_to_cpu(stats->rx_bytes); } if (qtnf_sta_stat_avail(tx_bytes, QLINK_STA_INFO_TX_BYTES64)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64); - sinfo->tx_bytes = le64_to_cpu(stats->tx_bytes); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64); + sinfo->links[0]->tx_bytes = le64_to_cpu(stats->tx_bytes); } if (qtnf_sta_stat_avail(rx_packets, QLINK_STA_INFO_RX_PACKETS)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS); - sinfo->rx_packets = le32_to_cpu(stats->rx_packets); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS); + sinfo->links[0]->rx_packets = le32_to_cpu(stats->rx_packets); } if (qtnf_sta_stat_avail(tx_packets, QLINK_STA_INFO_TX_PACKETS)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); - sinfo->tx_packets = le32_to_cpu(stats->tx_packets); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); + sinfo->links[0]->tx_packets = le32_to_cpu(stats->tx_packets); } if (qtnf_sta_stat_avail(rx_beacon, QLINK_STA_INFO_BEACON_RX)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_RX); - sinfo->rx_beacon = le64_to_cpu(stats->rx_beacon); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_RX); + sinfo->links[0]->rx_beacon = le64_to_cpu(stats->rx_beacon); } if (qtnf_sta_stat_avail(rx_dropped_misc, QLINK_STA_INFO_RX_DROP_MISC)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC); - sinfo->rx_dropped_misc = le32_to_cpu(stats->rx_dropped_misc); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC); + sinfo->links[0]->rx_dropped_misc = le32_to_cpu(stats->rx_dropped_misc); } if (qtnf_sta_stat_avail(tx_failed, QLINK_STA_INFO_TX_FAILED)) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); - sinfo->tx_failed = le32_to_cpu(stats->tx_failed); + sinfo->links[0]->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); + sinfo->links[0]->tx_failed = le32_to_cpu(stats->tx_failed); } #undef qtnf_sta_stat_avail diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c index 569856ca677f..03a54bdb516b 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c @@ -7138,7 +7138,7 @@ rtl8xxxu_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, static void rtl8xxxu_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, struct station_info *sinfo) + struct ieee80211_sta *sta, struct link_station_info *sinfo) { struct rtl8xxxu_priv *priv = hw->priv; @@ -7636,7 +7636,7 @@ static const struct ieee80211_ops rtl8xxxu_ops = { .sw_scan_complete = rtl8xxxu_sw_scan_complete, .set_key = rtl8xxxu_set_key, .ampdu_action = rtl8xxxu_ampdu_action, - .sta_statistics = rtl8xxxu_sta_statistics, + .link_sta_statistics = rtl8xxxu_sta_statistics, .get_antenna = rtl8xxxu_get_antenna, .set_tim = rtl8xxxu_set_tim, .sta_add = rtl8xxxu_sta_add, diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c index 026fbf4ad9cc..a3318fa7b728 100644 --- a/drivers/net/wireless/realtek/rtw88/mac80211.c +++ b/drivers/net/wireless/realtek/rtw88/mac80211.c @@ -720,7 +720,7 @@ static int rtw_ops_set_rts_threshold(struct ieee80211_hw *hw, u32 value) static void rtw_ops_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct station_info *sinfo) + struct link_station_info *sinfo) { struct rtw_sta_info *si = (struct rtw_sta_info *)sta->drv_priv; @@ -967,7 +967,7 @@ const struct ieee80211_ops rtw_ops = { .sw_scan_complete = rtw_ops_sw_scan_complete, .mgd_prepare_tx = rtw_ops_mgd_prepare_tx, .set_rts_threshold = rtw_ops_set_rts_threshold, - .sta_statistics = rtw_ops_sta_statistics, + .link_sta_statistics = rtw_ops_sta_statistics, .flush = rtw_ops_flush, .set_bitrate_mask = rtw_ops_set_bitrate_mask, .set_antenna = rtw_ops_set_antenna, diff --git a/drivers/net/wireless/realtek/rtw89/mac80211.c b/drivers/net/wireless/realtek/rtw89/mac80211.c index 778ca8589284..4ab4da3be05d 100644 --- a/drivers/net/wireless/realtek/rtw89/mac80211.c +++ b/drivers/net/wireless/realtek/rtw89/mac80211.c @@ -1012,7 +1012,7 @@ static int rtw89_ops_set_rts_threshold(struct ieee80211_hw *hw, u32 value) static void rtw89_ops_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct station_info *sinfo) + struct link_station_info *sinfo) { struct rtw89_sta *rtwsta = sta_to_rtwsta(sta); struct rtw89_sta_link *rtwsta_link; @@ -1771,7 +1771,7 @@ const struct ieee80211_ops rtw89_ops = { .set_key = rtw89_ops_set_key, .ampdu_action = rtw89_ops_ampdu_action, .set_rts_threshold = rtw89_ops_set_rts_threshold, - .sta_statistics = rtw89_ops_sta_statistics, + .link_sta_statistics = rtw89_ops_sta_statistics, .flush = rtw89_ops_flush, .set_bitrate_mask = rtw89_ops_set_bitrate_mask, .set_antenna = rtw89_ops_set_antenna, diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 8fb58a5d911c..faadde7c6999 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -5810,7 +5810,7 @@ static void wlcore_op_sta_rc_update(struct ieee80211_hw *hw, static void wlcore_op_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct station_info *sinfo) + struct link_station_info *sinfo) { struct wl1271 *wl = hw->priv; struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); @@ -6054,7 +6054,7 @@ static const struct ieee80211_ops wl1271_ops = { .unassign_vif_chanctx = wlcore_op_unassign_vif_chanctx, .switch_vif_chanctx = wlcore_op_switch_vif_chanctx, .link_sta_rc_update = wlcore_op_sta_rc_update, - .sta_statistics = wlcore_op_sta_statistics, + .link_sta_statistics = wlcore_op_sta_statistics, .get_expected_throughput = wlcore_op_get_expected_throughput, CFG80211_TESTMODE_CMD(wl1271_tm_cmd) }; diff --git a/drivers/net/wireless/virtual/virt_wifi.c b/drivers/net/wireless/virtual/virt_wifi.c index 4ee374080466..66c86ed37121 100644 --- a/drivers/net/wireless/virtual/virt_wifi.c +++ b/drivers/net/wireless/virtual/virt_wifi.c @@ -328,15 +328,15 @@ static int virt_wifi_get_station(struct wiphy *wiphy, struct net_device *dev, if (!priv->is_connected || !ether_addr_equal(mac, fake_router_bssid)) return -ENOENT; - sinfo->filled = BIT_ULL(NL80211_STA_INFO_TX_PACKETS) | + sinfo->links[0]->filled = BIT_ULL(NL80211_STA_INFO_TX_PACKETS) | BIT_ULL(NL80211_STA_INFO_TX_FAILED) | BIT_ULL(NL80211_STA_INFO_SIGNAL) | BIT_ULL(NL80211_STA_INFO_TX_BITRATE); - sinfo->tx_packets = priv->tx_packets; - sinfo->tx_failed = priv->tx_failed; + sinfo->links[0]->tx_packets = priv->tx_packets; + sinfo->links[0]->tx_failed = priv->tx_failed; /* For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_ */ - sinfo->signal = -50; - sinfo->txrate = (struct rate_info) { + sinfo->links[0]->signal = -50; + sinfo->links[0]->txrate = (struct rate_info) { .legacy = 10, /* units are 100kbit/s */ }; return 0; diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index ef93e220ddb2..db1f9b79b280 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2034,17 +2034,18 @@ struct cfg80211_tid_stats { #define IEEE80211_MAX_CHAINS 4 /** - * struct station_info - station information + * struct link_station_info - link station information * - * Station information filled by driver for get_station() and dump_station. + * Link station information filled by driver for get_station() and dump_station. * + * @link_id: Link ID uniquely identifying the link STA. This is -1 for non-ML * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to * indicate the relevant values in this struct for them - * @connected_time: time(in secs) since a station is last connected - * @inactive_time: time since last station activity (tx/rx) in milliseconds - * @assoc_at: bootime (ns) of the last association - * @rx_bytes: bytes (size of MPDUs) received from this station - * @tx_bytes: bytes (size of MPDUs) transmitted to this station + * @connected_time: time(in secs) since a link station is last connected + * @inactive_time: time since last link station activity (tx/rx) in milliseconds + * @assoc_at: bootime (ns) of the last link station association + * @rx_bytes: bytes (size of MPDUs) received from this link station + * @tx_bytes: bytes (size of MPDUs) transmitted to this link station * @signal: The signal strength, type depends on the wiphy's signal_type. * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. @@ -2052,19 +2053,95 @@ struct cfg80211_tid_stats { * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg * @chain_signal: per-chain signal strength of last received packet in dBm * @chain_signal_avg: per-chain signal strength average in dBm - * @txrate: current unicast bitrate from this station - * @rxrate: current unicast bitrate to this station - * @rx_packets: packets (MSDUs & MMPDUs) received from this station - * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station + * @txrate: current unicast bitrate from this link station + * @rxrate: current unicast bitrate to this link station + * @rx_packets: packets (MSDUs & MMPDUs) received from this link station + * @tx_packets: packets (MSDUs & MMPDUs) transmitted to thislink station * @tx_retries: cumulative retry counts (MPDUs) * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK) * @rx_dropped_misc: Dropped for un-specified reason. * @bss_param: current BSS parameters + * @beacon_loss_count: Number of times beacon loss event has triggered. + * @expected_throughput: expected throughput in kbps (including 802.11 headers) + * towards this link station. + * @rx_beacon: number of beacons received from this peer + * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received + * from this peer + * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer + * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer + * @airtime_weight: current airtime scheduling weight + * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last + * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. + * Note that this doesn't use the @filled bit, but is used if non-NULL. + * @ack_signal: signal strength (in dBm) of the last ACK frame. + * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has + * been sent. + * @rx_mpdu_count: number of MPDUs received from this link station + * @fcs_err_count: number of packets (MPDUs) received from this link station with + * an FCS error. This counter should be incremented only when TA of the + * received packet with an FCS error matches the peer MAC address. + * @addr: For MLO STA connection, filled with address of the link station. + * For non-MLO STA connection, filled with all zeros. + */ +struct link_station_info { + int link_id; + u64 filled; + u32 connected_time; + u32 inactive_time; + u64 assoc_at; + u64 rx_bytes; + u64 tx_bytes; + s8 signal; + s8 signal_avg; + + u8 chains; + s8 chain_signal[IEEE80211_MAX_CHAINS]; + s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; + + struct rate_info txrate; + struct rate_info rxrate; + u32 rx_packets; + u32 tx_packets; + u32 tx_retries; + u32 tx_failed; + u32 rx_dropped_misc; + struct sta_bss_parameters bss_param; + + u32 beacon_loss_count; + + u32 expected_throughput; + + u64 tx_duration; + u64 rx_duration; + u64 rx_beacon; + u8 rx_beacon_signal_avg; + + u16 airtime_weight; + + s8 ack_signal; + s8 avg_ack_signal; + struct cfg80211_tid_stats *pertid; + + u32 rx_mpdu_count; + u32 fcs_err_count; + + u8 addr[ETH_ALEN] __aligned(2); +}; + +/** + * struct station_info - station information + * + * Station information filled by driver for get_station() and dump_station. + * + * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to + * indicate the relevant values in this struct for them + * @connected_time: time(in secs) since a station is last connected + * @assoc_at: bootime (ns) of the last association + * @sta_flags: station flags mask & values * @generation: generation number for nl80211 dumps. * This number should increase every time the list of stations * changes, i.e. when a station is added or removed, so that * userspace can tell whether it got a consistent snapshot. - * @beacon_loss_count: Number of times beacon loss event has triggered. * @assoc_req_ies: IEs from (Re)Association Request. * This is used only when in AP mode with drivers that do not use * user space MLME/SME implementation. The information is provided for @@ -2081,24 +2158,6 @@ struct cfg80211_tid_stats { * @local_pm: local mesh STA power save mode * @peer_pm: peer mesh STA power save mode * @nonpeer_pm: non-peer mesh STA power save mode - * @expected_throughput: expected throughput in kbps (including 802.11 headers) - * towards this station. - * @rx_beacon: number of beacons received from this peer - * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received - * from this peer - * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer - * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer - * @airtime_weight: current airtime scheduling weight - * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last - * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. - * Note that this doesn't use the @filled bit, but is used if non-NULL. - * @ack_signal: signal strength (in dBm) of the last ACK frame. - * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has - * been sent. - * @rx_mpdu_count: number of MPDUs received from this station - * @fcs_err_count: number of packets (MPDUs) received from this station with - * an FCS error. This counter should be incremented only when TA of the - * received packet with an FCS error matches the peer MAC address. * @mlo_params_valid: Indicates @assoc_link_id and @mld_addr fields are filled * by driver. Drivers use this only in cfg80211_new_sta() calls when AP * MLD's MLME/SME is offload to driver. Drivers won't fill this @@ -2117,35 +2176,19 @@ struct cfg80211_tid_stats { * dump_station() callbacks. User space needs this information to determine * the accepted and rejected affiliated links of the connected station. * @assoc_resp_ies_len: Length of @assoc_resp_ies buffer in octets. + * @links: reference to Link sta entries for MLO STA. For non-MLO STA + * and case where the driver offload link decisions and do not provide + * per-link statistics, all link specific information is accessed + * through links[0]. */ struct station_info { u64 filled; - u32 connected_time; - u32 inactive_time; u64 assoc_at; - u64 rx_bytes; - u64 tx_bytes; - s8 signal; - s8 signal_avg; - - u8 chains; - s8 chain_signal[IEEE80211_MAX_CHAINS]; - s8 chain_signal_avg[IEEE80211_MAX_CHAINS]; - - struct rate_info txrate; - struct rate_info rxrate; - u32 rx_packets; - u32 tx_packets; - u32 tx_retries; - u32 tx_failed; - u32 rx_dropped_misc; - struct sta_bss_parameters bss_param; + u32 connected_time; struct nl80211_sta_flag_update sta_flags; int generation; - u32 beacon_loss_count; - const u8 *assoc_req_ies; size_t assoc_req_ies_len; @@ -2160,27 +2203,14 @@ struct station_info { enum nl80211_mesh_power_mode peer_pm; enum nl80211_mesh_power_mode nonpeer_pm; - u32 expected_throughput; - - u16 airtime_weight; - - s8 ack_signal; - s8 avg_ack_signal; - struct cfg80211_tid_stats *pertid; - - u64 tx_duration; - u64 rx_duration; - u64 rx_beacon; - u8 rx_beacon_signal_avg; - - u32 rx_mpdu_count; - u32 fcs_err_count; - bool mlo_params_valid; u8 assoc_link_id; u8 mld_addr[ETH_ALEN] __aligned(2); const u8 *assoc_resp_ies; size_t assoc_resp_ies_len; + + /* TODO: Need to check and add protection access to links memory */ + struct link_station_info *links[IEEE80211_MLD_MAX_NUM_LINKS]; }; /** @@ -8461,7 +8491,7 @@ void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie, * * Return: 0 on success. Non-zero on error. */ -int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp); +int cfg80211_sinfo_alloc_tid_stats(struct link_station_info *sinfo, gfp_t gfp); /** * cfg80211_sinfo_release_content - release contents of station info @@ -8473,7 +8503,10 @@ int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp); */ static inline void cfg80211_sinfo_release_content(struct station_info *sinfo) { - kfree(sinfo->pertid); + if (sinfo->links[0]) { + kfree(sinfo->links[0]->pertid); + kfree(sinfo->links[0]); + } } /** diff --git a/include/net/mac80211.h b/include/net/mac80211.h index dc14fcd5544a..85a792c6f1ab 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -4119,11 +4119,11 @@ struct ieee80211_prep_tx_info { * is only used if the configured rate control algorithm actually uses * the new rate table API, and is therefore optional. Must be atomic. * - * @sta_statistics: Get statistics for this station. For example with beacon - * filtering, the statistics kept by mac80211 might not be accurate, so - * let the driver pre-fill the statistics. The driver can fill most of - * the values (indicating which by setting the filled bitmap), but not - * all of them make sense - see the source for which ones are possible. + * @link_sta_statistics: Get statistics for this link station. For example + * with beacon filtering, the statistics kept by mac80211 might not be + * accurate, so let the driver pre-fill the statistics. The driver can + * fill most of the values (indicating which by setting the filled bitmap), + * but not all of them make sense - see the source for which ones are possible. * Statistics that the driver doesn't fill will be filled by mac80211. * The callback can sleep. * @@ -4606,10 +4606,10 @@ struct ieee80211_ops { void (*sta_rate_tbl_update)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta); - void (*sta_statistics)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct station_info *sinfo); + void (*link_sta_statistics)(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + struct link_station_info *link_sinfo); int (*conf_tx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, unsigned int link_id, u16 ac, diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 307587c8a003..a3c6cc56ca41 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -613,10 +613,10 @@ static inline void drv_sta_rate_tbl_update(struct ieee80211_local *local, trace_drv_return_void(local); } -static inline void drv_sta_statistics(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct ieee80211_sta *sta, - struct station_info *sinfo) +static inline void drv_link_sta_statistics(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct ieee80211_sta *sta, + struct link_station_info *link_sinfo) { might_sleep(); lockdep_assert_wiphy(local->hw.wiphy); @@ -625,9 +625,9 @@ static inline void drv_sta_statistics(struct ieee80211_local *local, if (!check_sdata_in_driver(sdata)) return; - trace_drv_sta_statistics(local, sdata, sta); - if (local->ops->sta_statistics) - local->ops->sta_statistics(&local->hw, &sdata->vif, sta, sinfo); + trace_drv_link_sta_statistics(local, sdata, sta); + if (local->ops->link_sta_statistics) + local->ops->link_sta_statistics(&local->hw, &sdata->vif, sta, link_sinfo); trace_drv_return_void(local); } diff --git a/net/mac80211/ethtool.c b/net/mac80211/ethtool.c index 42f7ee142ce3..72ee417cd899 100644 --- a/net/mac80211/ethtool.c +++ b/net/mac80211/ethtool.c @@ -79,6 +79,7 @@ static void ieee80211_get_stats(struct net_device *dev, struct sta_info *sta; struct ieee80211_local *local = sdata->local; struct station_info sinfo; + struct link_station_info *link_sinfo; struct survey_info survey; int i, q; #define STA_STATS_SURVEY_LEN 7 @@ -87,17 +88,16 @@ static void ieee80211_get_stats(struct net_device *dev, #define ADD_STA_STATS(sta) \ do { \ - data[i++] += sinfo.rx_packets; \ - data[i++] += sinfo.rx_bytes; \ + data[i++] += link_sinfo->rx_packets; \ + data[i++] += link_sinfo->rx_bytes; \ data[i++] += (sta)->rx_stats.num_duplicates; \ data[i++] += (sta)->rx_stats.fragments; \ - data[i++] += sinfo.rx_dropped_misc; \ - \ - data[i++] += sinfo.tx_packets; \ - data[i++] += sinfo.tx_bytes; \ + data[i++] += link_sinfo->rx_dropped_misc; \ + data[i++] += link_sinfo->tx_packets; \ + data[i++] += link_sinfo->tx_bytes; \ data[i++] += (sta)->status_stats.filtered; \ - data[i++] += sinfo.tx_failed; \ - data[i++] += sinfo.tx_retries; \ + data[i++] += link_sinfo->tx_failed; \ + data[i++] += link_sinfo->tx_retries; \ } while (0) /* For Managed stations, find the single station based on BSSID @@ -117,23 +117,23 @@ static void ieee80211_get_stats(struct net_device *dev, memset(&sinfo, 0, sizeof(sinfo)); sta_set_sinfo(sta, &sinfo, false); + link_sinfo = sinfo.links[0]; i = 0; ADD_STA_STATS(&sta->deflink); data[i++] = sta->sta_state; - - if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE)) + if (link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE)) data[i] = 100000ULL * - cfg80211_calculate_bitrate(&sinfo.txrate); + cfg80211_calculate_bitrate(&link_sinfo->txrate); i++; - if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_RX_BITRATE)) + if (link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_RX_BITRATE)) data[i] = 100000ULL * - cfg80211_calculate_bitrate(&sinfo.rxrate); + cfg80211_calculate_bitrate(&link_sinfo->rxrate); i++; - if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG)) - data[i] = (u8)sinfo.signal_avg; + if (link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG)) + data[i] = (u8)link_sinfo->signal_avg; i++; } else { list_for_each_entry(sta, &local->sta_list, list) { @@ -143,6 +143,7 @@ static void ieee80211_get_stats(struct net_device *dev, memset(&sinfo, 0, sizeof(sinfo)); sta_set_sinfo(sta, &sinfo, false); + link_sinfo = sinfo.links[0]; i = 0; ADD_STA_STATS(&sta->deflink); } diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 1d4177f9fbf3..3522afaf94ca 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2636,7 +2636,7 @@ static void sta_set_mesh_sinfo(struct sta_info *sta, } #endif -static void sta_set_link_sinfo(struct sta_info *sta, struct station_info *sinfo, +static void sta_set_link_sinfo(struct sta_info *sta, struct link_station_info *sinfo, struct ieee80211_link_data *link_sdata, bool tidstats) { struct link_sta_info *link_sta_info = &sta->deflink; @@ -2655,7 +2655,7 @@ static void sta_set_link_sinfo(struct sta_info *sta, struct station_info *sinfo, if (sdata->vif.type == NL80211_IFTYPE_STATION) sinfo->rx_beacon = link_sdata->u.mgd.count_beacon_signal; - drv_sta_statistics(local, sdata, &sta->sta, sinfo); + drv_link_sta_statistics(local, sdata, &sta->sta, sinfo); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME) | BIT_ULL(NL80211_STA_INFO_BSS_PARAM) | BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC); @@ -2851,6 +2851,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, bool tidstats) { struct ieee80211_sub_if_data *sdata = sta->sdata; + struct link_station_info *link_sinfo = sinfo->links[0]; struct ieee80211_link_data *link_sdata = &sdata->deflink; sinfo->generation = sdata->local->sta_generation; @@ -2890,7 +2891,11 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, if (test_sta_flag(sta, WLAN_STA_TDLS_PEER)) sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER); - sta_set_link_sinfo(sta, sinfo, link_sdata, tidstats); + link_sinfo = kzalloc(sizeof(*link_sinfo), GFP_KERNEL); + if (!link_sinfo) + return; + + sta_set_link_sinfo(sta, link_sinfo, link_sdata, tidstats); } u32 sta_get_expected_throughput(struct sta_info *sta) diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index 72fad8ea8bb9..e936d519ee9f 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h @@ -995,7 +995,7 @@ DECLARE_EVENT_CLASS(sta_event, ) ); -DEFINE_EVENT(sta_event, drv_sta_statistics, +DEFINE_EVENT(sta_event, drv_link_sta_statistics, TP_PROTO(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata, struct ieee80211_sta *sta), diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 11ea97a98067..db0175052c65 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6710,7 +6710,7 @@ static bool nl80211_put_signal(struct sk_buff *msg, u8 mask, s8 *signal, static int nl80211_fill_link_station(struct sk_buff *msg, struct cfg80211_registered_device *rdev, - struct station_info *sinfo) + struct link_station_info *sinfo) { struct nlattr *bss_param; @@ -6868,6 +6868,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, { void *hdr; struct nlattr *sinfoattr; + struct link_station_info *link_sinfo = sinfo->links[0]; hdr = nl80211hdr_put(msg, portid, seq, flags, cmd); if (!hdr) { @@ -6904,7 +6905,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, &sinfo->sta_flags)) goto nla_put_failure; - if (nl80211_fill_link_station(msg, rdev, sinfo)) + if (link_sinfo && nl80211_fill_link_station(msg, rdev, link_sinfo)) goto nla_put_failure; nla_nest_end(msg, sinfoattr); @@ -13064,9 +13065,9 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev, return err; cfg80211_sinfo_release_content(&sinfo); - if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_BEACON_SIGNAL_AVG)) + if (sinfo.links[0]->filled & BIT_ULL(NL80211_STA_INFO_BEACON_SIGNAL_AVG)) cqm_config->last_rssi_event_value = - (s8) sinfo.rx_beacon_signal_avg; + (s8)sinfo.links[0]->rx_beacon_signal_avg; } last = cqm_config->last_rssi_event_value; diff --git a/net/wireless/trace.h b/net/wireless/trace.h index 9aa8081ca454..f1340d267f4c 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -200,22 +200,23 @@ __field(u16, llid) \ __field(u16, plid) \ __field(u8, plink_state) -#define SINFO_ASSIGN \ - do { \ - __entry->generation = sinfo->generation; \ - __entry->connected_time = sinfo->connected_time; \ - __entry->inactive_time = sinfo->inactive_time; \ - __entry->rx_bytes = sinfo->rx_bytes; \ - __entry->tx_bytes = sinfo->tx_bytes; \ - __entry->rx_packets = sinfo->rx_packets; \ - __entry->tx_packets = sinfo->tx_packets; \ - __entry->tx_retries = sinfo->tx_retries; \ - __entry->tx_failed = sinfo->tx_failed; \ - __entry->rx_dropped_misc = sinfo->rx_dropped_misc; \ - __entry->beacon_loss_count = sinfo->beacon_loss_count; \ - __entry->llid = sinfo->llid; \ - __entry->plid = sinfo->plid; \ - __entry->plink_state = sinfo->plink_state; \ +#define SINFO_ASSIGN \ + struct link_station_info *link_sinfo = sinfo->links[0]; \ + do { \ + __entry->generation = sinfo->generation; \ + __entry->connected_time = link_sinfo->connected_time; \ + __entry->inactive_time = link_sinfo->inactive_time; \ + __entry->rx_bytes = link_sinfo->rx_bytes; \ + __entry->tx_bytes = link_sinfo->tx_bytes; \ + __entry->rx_packets = link_sinfo->rx_packets; \ + __entry->tx_packets = link_sinfo->tx_packets; \ + __entry->tx_retries = link_sinfo->tx_retries; \ + __entry->tx_failed = link_sinfo->tx_failed; \ + __entry->rx_dropped_misc = link_sinfo->rx_dropped_misc; \ + __entry->beacon_loss_count = link_sinfo->beacon_loss_count; \ + __entry->llid = sinfo->llid; \ + __entry->plid = sinfo->plid; \ + __entry->plink_state = sinfo->plink_state; \ } while (0) #define BOOL_TO_STR(bo) (bo) ? "true" : "false" diff --git a/net/wireless/util.c b/net/wireless/util.c index 60157943d351..cbc0de1b6c6c 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -2626,11 +2626,11 @@ bool cfg80211_does_bw_fit_range(const struct ieee80211_freq_range *freq_range, return false; } -int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp) +int cfg80211_sinfo_alloc_tid_stats(struct link_station_info *sinfo, gfp_t gfp) { sinfo->pertid = kcalloc(IEEE80211_NUM_TIDS + 1, - sizeof(*(sinfo->pertid)), - gfp); + sizeof(*(sinfo->pertid)), + gfp); if (!sinfo->pertid) return -ENOMEM; diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index a74b1afc594e..1da85440e6be 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c @@ -1267,12 +1267,12 @@ static int cfg80211_wext_giwrate(struct net_device *dev, if (err) return err; - if (!(sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE))) { + if (!(sinfo.links[0]->filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE))) { err = -EOPNOTSUPP; goto free; } - rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate); + rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.links[0]->txrate); free: cfg80211_sinfo_release_content(&sinfo); @@ -1316,8 +1316,8 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev) switch (rdev->wiphy.signal_type) { case CFG80211_SIGNAL_TYPE_MBM: - if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_SIGNAL)) { - int sig = sinfo.signal; + if (sinfo.links[0]->filled & BIT_ULL(NL80211_STA_INFO_SIGNAL)) { + int sig = sinfo.links[0]->signal; wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED; wstats.qual.updated |= IW_QUAL_QUAL_UPDATED; wstats.qual.updated |= IW_QUAL_DBM; @@ -1331,11 +1331,11 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev) } fallthrough; case CFG80211_SIGNAL_TYPE_UNSPEC: - if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_SIGNAL)) { + if (sinfo.links[0]->filled & BIT_ULL(NL80211_STA_INFO_SIGNAL)) { wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED; wstats.qual.updated |= IW_QUAL_QUAL_UPDATED; - wstats.qual.level = sinfo.signal; - wstats.qual.qual = sinfo.signal; + wstats.qual.level = sinfo.links[0]->signal; + wstats.qual.qual = sinfo.links[0]->signal; break; } fallthrough; @@ -1345,10 +1345,10 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev) } wstats.qual.updated |= IW_QUAL_NOISE_INVALID; - if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC)) - wstats.discard.misc = sinfo.rx_dropped_misc; - if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_FAILED)) - wstats.discard.retries = sinfo.tx_failed; + if (sinfo.links[0]->filled & BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC)) + wstats.discard.misc = sinfo.links[0]->rx_dropped_misc; + if (sinfo.links[0]->filled & BIT_ULL(NL80211_STA_INFO_TX_FAILED)) + wstats.discard.retries = sinfo.links[0]->tx_failed; cfg80211_sinfo_release_content(&sinfo); From patchwork Thu Feb 13 17:16:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 865062 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88A9F2040BA for ; Thu, 13 Feb 2025 17:17:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467054; cv=none; b=p9s0ZMv2FgWqlZR9EYP6975PLUowX4yIlS3CcJsTRFkGcpUy26vgT+3anxsJxT4oMR7/ZEM1vEJMSYuGgpY9ILEs6UVyqk6cQ+8Wwf/D4Fa2mwNlzs8KBmQbMb+bMpXsdhKkx2RI+YuzHRbwedGNdG1CBjHeeLu85GN+y3WgMFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467054; c=relaxed/simple; bh=X7RiXboVPZ0qHYFd0F+q6NpRxHBV+Lm1OEk2nL4NGBM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ub2kLHNqJ0Rz4Sq+20ZPhuV8nJbo+B+ByZNjJbb4kI9pIMVboe8ru0Zr2I6MNTkDfav/13tcUZpc6f/r9wfeEQlD4kcbzSLpUlGJOQEmww0D+vMd8u0QV9M0zSVPiP5tR0RbSFVRDiRNo6O3jwtAMH4VE/YH97ZrpY6MGDLdh4s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=hoAL4nG1; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="hoAL4nG1" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51DAUamf002088; Thu, 13 Feb 2025 17:17:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= YVMgTs3eKlyrnrJ7SNcAq4c4AEROEu5Kt34wYGHQFvM=; b=hoAL4nG1kJZmfdRk heJR4ORIpkw6hDF1udhyrTk/ivR05hvt6/bgs9dDSt7UsdJ9c+Q1/rUYwwQoWdQx X+pK+225QvT/bLcLcu1VO7xYegsydpmeLZEUS+BSPKPDBJuzq9R18iLUNpNxXTeK WmPvh+Ilmy38Q5sCsNtRfbyJ7A6IRqqSjqu5329xaBtO8yUSBxo56Erh6vrx28tu 7InIJAFjZ9cFMRsirg0j3LFR8x37xBnG+ojRE9wwVpEIEWTtKRWw9d5vnMD+Ij8w ttcCS4kS6vCC4F7BI0TyV9UTiL4QeahOVHu5VqkN2XrUL0IHFAswSIykmP8hmzad NpKM9g== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44s5w4afc3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:27 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51DHHRAS005022 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:27 GMT Received: from hu-sarishar-blr.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 13 Feb 2025 09:17:25 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH v3 07/12] wifi: cfg80211: extend statistics for link level in sinfo Date: Thu, 13 Feb 2025 22:46:27 +0530 Message-ID: <20250213171632.1646538-8-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250213171632.1646538-1-quic_sarishar@quicinc.com> References: <20250213171632.1646538-1-quic_sarishar@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: A62PVMIAHYEvuinoLwivcAdFt4NpN_w0 X-Proofpoint-ORIG-GUID: A62PVMIAHYEvuinoLwivcAdFt4NpN_w0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-13_07,2025-02-13_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 suspectscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502130123 Currently, statistics is supported at deflink( or one of the links) level for station. This has problems when applied to multi-link(ML) connections. Hence, add changes to support link level statistics in sinfo structure. Additionally, remove mlo_params_valid from the sinfo structure and add valid_links to indicate bitmap of valid links for MLO. This will be helpful to check the link related statistics during MLO. The statistics could be embedded into NL message as below: For MLO: cmd -> NL80211_ATTR_IFINDEX NL80211_ATTR_MAC NL80211_ATTR_GENERATION .......etc NL80211_ATTR_STA_INFO | nest flag NL80211_STA_INFO_CONNECTED_TIME, NL80211_STA_INFO_STA_FLAGS, ........etc NL80211_ATTR_MLO_LINK_ID, NL80211_ATTR_MLD_ADDR, NL80211_ATTR_MLO_LINKS | nested link_id-1 | nested NL80211_ATTR_MLO_LINK_ID, NL80211_ATTR_MAC, NL80211_ATTR_STA_INFO | nest flag NL80211_STA_INFO_RX_BYTES, NL80211_STA_INFO_TX_BYTES, ..........etc. link_id-2 | nested NL80211_ATTR_MLO_LINK_ID, NL80211_ATTR_MAC, NL80211_ATTR_STA_INFO | nest flag NL80211_STA_INFO_RX_BYTES, NL80211_STA_INFO_TX_BYTES, .........etc For non-ML: cmd-> NL80211_ATTR_IFINDEX NL80211_ATTR_MAC NL80211_ATTR_GENERATION .... NL80211_ATTR_STA_INFO | nest flag NL80211_STA_INFO_CONNECTED_TIME, NL80211_STA_INFO_STA_FLAGS, NL80211_STA_INFO_RX_BYTES, NL80211_STA_INFO_TX_BYTES, .........etc The output of iw dev wlan0 station dump for MLO could look like below: Station 00:03:7f:04:31:78 (on wlan0) authorized: yes authenticated: yes associated: yes preamble: long WMM/WME: yes MFP: yes TDLS peer: no connected time: 383 seconds associated at [boottime]: 93.740s associated at: 93685 ms current time: 340046 ms MLD address: 00:03:7f:04:31:78 Link 0: Address: 00:03:7f:04:31:78 inactive time: 330120 ms rx bytes: 116 rx packets: 3 tx bytes: 0 tx packets: 0 tx retries: 0 tx failed: 0 rx drop misc: 0 signal: -95 dBm tx bitrate: 6.0 MBit/s tx duration: 2669 us rx duration: 0 us DTIM period: 2 beacon interval:100 Link 1: Address: 00:03:7f:04:31:79 inactive time: 81268 ms rx bytes: 1323 rx packets: 12 tx bytes: 1538 tx packets: 8 tx retries: 0 tx failed: 0 rx drop misc: 0 signal: -95 dBm tx bitrate: 6.0 MBit/s tx duration: 2669 us rx bitrate: 6.0 MBit/s rx duration: 0 us DTIM period: 2 beacon interval:100 Signed-off-by: Sarika Sharma --- include/net/cfg80211.h | 27 ++++++++++----- net/mac80211/sta_info.c | 69 +++++++++++++++++++++++++++++--------- net/wireless/nl80211.c | 74 ++++++++++++++++++++++++++++++++--------- 3 files changed, 129 insertions(+), 41 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index db1f9b79b280..e07eb657fdfe 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2158,11 +2158,6 @@ struct link_station_info { * @local_pm: local mesh STA power save mode * @peer_pm: peer mesh STA power save mode * @nonpeer_pm: non-peer mesh STA power save mode - * @mlo_params_valid: Indicates @assoc_link_id and @mld_addr fields are filled - * by driver. Drivers use this only in cfg80211_new_sta() calls when AP - * MLD's MLME/SME is offload to driver. Drivers won't fill this - * information in cfg80211_del_sta_sinfo(), get_station() and - * dump_station() callbacks. * @assoc_link_id: Indicates MLO link ID of the AP, with which the station * completed (re)association. This information filled for both MLO * and non-MLO STA connections when the AP affiliated with an MLD. @@ -2176,6 +2171,9 @@ struct link_station_info { * dump_station() callbacks. User space needs this information to determine * the accepted and rejected affiliated links of the connected station. * @assoc_resp_ies_len: Length of @assoc_resp_ies buffer in octets. + * @valid_links: bitmap of valid links, or 0 for non-MLO. Drivers fill this + * information in cfg80211_new_sta(), cfg80211_del_sta_sinfo(), + * get_station() and dump_station() callbacks. * @links: reference to Link sta entries for MLO STA. For non-MLO STA * and case where the driver offload link decisions and do not provide * per-link statistics, all link specific information is accessed @@ -2203,12 +2201,12 @@ struct station_info { enum nl80211_mesh_power_mode peer_pm; enum nl80211_mesh_power_mode nonpeer_pm; - bool mlo_params_valid; u8 assoc_link_id; u8 mld_addr[ETH_ALEN] __aligned(2); const u8 *assoc_resp_ies; size_t assoc_resp_ies_len; + u16 valid_links; /* TODO: Need to check and add protection access to links memory */ struct link_station_info *links[IEEE80211_MLD_MAX_NUM_LINKS]; }; @@ -8503,9 +8501,20 @@ int cfg80211_sinfo_alloc_tid_stats(struct link_station_info *sinfo, gfp_t gfp); */ static inline void cfg80211_sinfo_release_content(struct station_info *sinfo) { - if (sinfo->links[0]) { - kfree(sinfo->links[0]->pertid); - kfree(sinfo->links[0]); + int link_id; + + if (sinfo->valid_links) { + for_each_valid_link(sinfo, link_id) { + if (sinfo->links[link_id]) { + kfree(sinfo->links[link_id]->pertid); + kfree(sinfo->links[link_id]); + } + } + } else { + if (sinfo->links[0]) { + kfree(sinfo->links[0]->pertid); + kfree(sinfo->links[0]); + } } } diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 3522afaf94ca..1bfe1a55888d 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2639,14 +2639,23 @@ static void sta_set_mesh_sinfo(struct sta_info *sta, static void sta_set_link_sinfo(struct sta_info *sta, struct link_station_info *sinfo, struct ieee80211_link_data *link_sdata, bool tidstats) { - struct link_sta_info *link_sta_info = &sta->deflink; struct ieee80211_sub_if_data *sdata = sta->sdata; struct ieee80211_local *local = sdata->local; struct ieee80211_sta_rx_stats *last_rxstats; + struct link_sta_info *link_sta_info; u32 thr = 0; - int i, ac, cpu; + int i, ac, cpu, link_id; + - last_rxstats = sta_get_last_rx_stats(sta, -1); + link_id = sinfo->link_id; + last_rxstats = sta_get_last_rx_stats(sta, link_id); + + if (link_id < 0) + link_sta_info = &sta->deflink; + else + link_sta_info = + rcu_dereference_protected(sta->link[link_id], + lockdep_is_held(&local->hw.wiphy->mtx)); /* do before driver, so beacon filtering drivers have a * chance to e.g. just add the number of filtered beacons @@ -2655,6 +2664,8 @@ static void sta_set_link_sinfo(struct sta_info *sta, struct link_station_info *s if (sdata->vif.type == NL80211_IFTYPE_STATION) sinfo->rx_beacon = link_sdata->u.mgd.count_beacon_signal; + memcpy(sinfo->addr, link_sta_info->addr, ETH_ALEN); + drv_link_sta_statistics(local, sdata, &sta->sta, sinfo); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME) | BIT_ULL(NL80211_STA_INFO_BSS_PARAM) | @@ -2667,7 +2678,7 @@ static void sta_set_link_sinfo(struct sta_info *sta, struct link_station_info *s } sinfo->inactive_time = - jiffies_to_msecs(jiffies - ieee80211_sta_last_active(sta, -1)); + jiffies_to_msecs(jiffies - ieee80211_sta_last_active(sta, link_id)); if (!(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_TX_BYTES64) | BIT_ULL(NL80211_STA_INFO_TX_BYTES)))) { @@ -2756,7 +2767,7 @@ static void sta_set_link_sinfo(struct sta_info *sta, struct link_station_info *s !(sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER)) { sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_RX) | BIT_ULL(NL80211_STA_INFO_BEACON_SIGNAL_AVG); - sinfo->rx_beacon_signal_avg = ieee80211_ave_rssi(&sdata->vif, -1); + sinfo->rx_beacon_signal_avg = ieee80211_ave_rssi(&sdata->vif, link_id); } if (ieee80211_hw_check(&sta->local->hw, SIGNAL_DBM) || @@ -2796,22 +2807,20 @@ static void sta_set_link_sinfo(struct sta_info *sta, struct link_station_info *s } if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE)) && - !sta->sta.valid_links && ieee80211_rate_valid(&link_sta_info->tx_stats.last_rate)) { sta_set_rate_info_tx(sta, &link_sta_info->tx_stats.last_rate, &sinfo->txrate); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); } - if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_RX_BITRATE)) && - !sta->sta.valid_links) { - if (sta_set_rate_info_rx(sta, &sinfo->rxrate, -1) == 0) + if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_RX_BITRATE))) { + if (sta_set_rate_info_rx(sta, &sinfo->rxrate, link_id) == 0) sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); } if (tidstats && !cfg80211_sinfo_alloc_tid_stats(sinfo, GFP_KERNEL)) { for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) - sta_set_tidstats(sta, &sinfo->pertid[i], i, -1); + sta_set_tidstats(sta, &sinfo->pertid[i], i, link_id); } sinfo->bss_param.flags = 0; @@ -2851,10 +2860,13 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, bool tidstats) { struct ieee80211_sub_if_data *sdata = sta->sdata; - struct link_station_info *link_sinfo = sinfo->links[0]; - struct ieee80211_link_data *link_sdata = &sdata->deflink; + struct link_station_info *link_sinfo; + struct ieee80211_link_data *link_sdata; + struct link_sta_info *link_sta; + int link_id; sinfo->generation = sdata->local->sta_generation; + sinfo->valid_links = sta->sta.valid_links; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_STA_FLAGS) | BIT_ULL(NL80211_STA_INFO_CONNECTED_TIME) | @@ -2891,11 +2903,36 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, if (test_sta_flag(sta, WLAN_STA_TDLS_PEER)) sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER); - link_sinfo = kzalloc(sizeof(*link_sinfo), GFP_KERNEL); - if (!link_sinfo) - return; + if (sinfo->valid_links) { + memcpy(sinfo->mld_addr, sta->addr, ETH_ALEN); + + for_each_valid_link(sinfo, link_id) { + link_sta = + rcu_dereference_protected(sta->link[link_id], + lockdep_is_held(&sta->local->hw.wiphy->mtx)); + if (!link_sta) + continue; - sta_set_link_sinfo(sta, link_sinfo, link_sdata, tidstats); + link_sinfo = kzalloc(sizeof(*link_sinfo), GFP_KERNEL); + if (!link_sinfo) + return; + + link_sinfo->link_id = link_id; + link_sdata = + rcu_dereference_protected(sdata->link[link_id], + lockdep_is_held(&sdata->local->hw.wiphy->mtx)); + sta_set_link_sinfo(sta, link_sinfo, link_sdata, tidstats); + sinfo->links[link_id] = link_sinfo; + } + } else { + link_sinfo = kzalloc(sizeof(*link_sinfo), GFP_KERNEL); + if (!link_sinfo) + return; + link_sinfo->link_id = -1; + link_sdata = &sdata->deflink; + sta_set_link_sinfo(sta, link_sinfo, link_sdata, tidstats); + sinfo->links[0] = link_sinfo; + } } u32 sta_get_expected_throughput(struct sta_info *sta) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index db0175052c65..3527cea4e071 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6867,8 +6867,9 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, const u8 *mac_addr, struct station_info *sinfo) { void *hdr; - struct nlattr *sinfoattr; - struct link_station_info *link_sinfo = sinfo->links[0]; + struct nlattr *sinfoattr, *link_sinfoattr, *links, *link; + struct link_station_info *link_sinfo; + int link_id; hdr = nl80211hdr_put(msg, portid, seq, flags, cmd); if (!hdr) { @@ -6905,22 +6906,16 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, &sinfo->sta_flags)) goto nla_put_failure; - if (link_sinfo && nl80211_fill_link_station(msg, rdev, link_sinfo)) - goto nla_put_failure; - - nla_nest_end(msg, sinfoattr); - - if (sinfo->assoc_req_ies_len && - nla_put(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len, - sinfo->assoc_req_ies)) - goto nla_put_failure; + if (sinfo->valid_links) { + /* TODO: Add accumulated stats for packets, bytes for + * better representation at MLO level. + */ - if (sinfo->assoc_resp_ies_len && - nla_put(msg, NL80211_ATTR_RESP_IE, sinfo->assoc_resp_ies_len, - sinfo->assoc_resp_ies)) - goto nla_put_failure; + /* Closing nested STA_INFO as MLO links ATTR should not + * be in nested STA_INFO + */ + nla_nest_end(msg, sinfoattr); - if (sinfo->mlo_params_valid) { if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, sinfo->assoc_link_id)) goto nla_put_failure; @@ -6929,8 +6924,55 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, nla_put(msg, NL80211_ATTR_MLD_ADDR, ETH_ALEN, sinfo->mld_addr)) goto nla_put_failure; + + links = nla_nest_start(msg, NL80211_ATTR_MLO_LINKS); + if (!links) + goto nla_put_failure; + + for_each_valid_link(sinfo, link_id) { + link_sinfo = sinfo->links[link_id]; + link = nla_nest_start(msg, link_id + 1); + if (!link) + goto nla_put_failure; + + if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, + link_id)) + goto nla_put_failure; + + if (link_sinfo && !is_zero_ether_addr(link_sinfo->addr) && + nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, + link_sinfo->addr)) + goto nla_put_failure; + + link_sinfoattr = nla_nest_start_noflag(msg, NL80211_ATTR_STA_INFO); + if (!link_sinfoattr) + goto nla_put_failure; + + if (link_sinfo && nl80211_fill_link_station(msg, rdev, link_sinfo)) + goto nla_put_failure; + + nla_nest_end(msg, link_sinfoattr); + nla_nest_end(msg, link); + } + nla_nest_end(msg, links); + } else { + link_sinfo = sinfo->links[0]; + if (link_sinfo && nl80211_fill_link_station(msg, rdev, link_sinfo)) + goto nla_put_failure; + + nla_nest_end(msg, sinfoattr); } + if (sinfo->assoc_req_ies_len && + nla_put(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len, + sinfo->assoc_req_ies)) + goto nla_put_failure; + + if (sinfo->assoc_resp_ies_len && + nla_put(msg, NL80211_ATTR_RESP_IE, sinfo->assoc_resp_ies_len, + sinfo->assoc_resp_ies)) + goto nla_put_failure; + cfg80211_sinfo_release_content(sinfo); genlmsg_end(msg, hdr); return 0; From patchwork Thu Feb 13 17:16:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 865061 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC8D02045BD for ; Thu, 13 Feb 2025 17:17:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467055; cv=none; b=jsp0dSzBjy7fet7XTL20qT73bl4X4m4ViPnO8jEg2gwq5WDVUbULhAurRl4l7rhMt2JF5JG48lf7/Ku2g3T24p4MjC2zfQ1c25VojuO2U75znAlU6LqFKHv/LwUkLk75z6ZkYdJ9Fb+hQBQ6WGLGYn31H8LLL5YB5Zs1TozcVZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467055; c=relaxed/simple; bh=oQWgt4oUl5aA4fLRdDnGb/pVIJTC3YWmTe0J50QIUY8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=P4hX/7mSFvCYPThW/m/DrZpsuk3qj1qjBph5ghNWHCVXksGOpr1XzXdfxD25d9nRSqHddWt9yPGegowyqKm5YlPMwbAAxuH7C4ilCpTkCiHht4RHfLItA7/RTdu1oFOWxpNebFzC9Lii1tYqJBUXosn+SNe+ZnPpV+UDiuw//Iw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=HycCiZeo; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="HycCiZeo" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51DA2T2T002672; Thu, 13 Feb 2025 17:17:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= doNGXOtworPWqNThpwZb166Zp7vEEFOlEnpy8F2P3lo=; b=HycCiZeoruAKMc6I edgfQg8+Hx5Hi/gdQ7f1WN3M33nuuRVsp1nQasZYhqYrsQLW2lrmX7Nnnt/VfYrO cx3bfAQe2/PGyZ+FOTSS91Dkq2EbLGSWn2AzFlJRl69DViLb3E3DHxRz02BmmQ/c pD9Gu6ejxQJDUEdwWwQZ0y8bY8l70PfAsJmkM8/5pFBa9yVgjYJS6RIkY02rbphf oSnZTT9gY7sKsUz/yvK1Od4DZDIfxHWebKiJqbN8kJkfhSDHH5tOsCbM0dvh+AQY 1TohIrvK0TtfVn0D6OekHnUYqbDZdxoOepf7TTOfy5Xdu9z8lR346lnRTeT+ravb joztBA== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44semp944s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:29 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51DHHTid011893 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:29 GMT Received: from hu-sarishar-blr.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 13 Feb 2025 09:17:27 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH v3 08/12] wifi: cfg80211: add flag to indicate driver supports ML station statistics Date: Thu, 13 Feb 2025 22:46:28 +0530 Message-ID: <20250213171632.1646538-9-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250213171632.1646538-1-quic_sarishar@quicinc.com> References: <20250213171632.1646538-1-quic_sarishar@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: JqtPjh6O8fP70vhGhxy9su5GwhIl1vBU X-Proofpoint-GUID: JqtPjh6O8fP70vhGhxy9su5GwhIl1vBU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-13_07,2025-02-13_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502130123 Currently, while filling the link level station statistics, valid_links is checked. There might be the case when driver offload link station statistics and does not provide per-link statistics. Hence, add flag WIPHY_FLAG_SUPPORTS_MLO_STA_PER_LINK_STATS in wiphy structure to indicate that driver supports per link station statistics. Set this flag during hw_register if driver supports per-link station statistics and check this flag while filling the station_info structure for MLO. Signed-off-by: Sarika Sharma --- drivers/net/wireless/ath/ath12k/mac.c | 1 + include/net/cfg80211.h | 9 ++++++++- net/mac80211/sta_info.c | 4 +++- net/wireless/nl80211.c | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 82fc1a5d71e8..7767971ae4c8 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -10942,6 +10942,7 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah) * once WIPHY_FLAG_SUPPORTS_MLO is enabled. */ wiphy->flags |= WIPHY_FLAG_DISABLE_WEXT; + wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO_STA_PER_LINK_STATS; /* Copy over MLO related capabilities received from * WMI_SERVICE_READY_EXT2_EVENT if single_chip_mlo_supp is set. diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index e07eb657fdfe..eb0fba002776 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2158,6 +2158,9 @@ struct link_station_info { * @local_pm: local mesh STA power save mode * @peer_pm: peer mesh STA power save mode * @nonpeer_pm: non-peer mesh STA power save mode + * @is_per_link_stats_support: 0- for non-ML STA and for ML STA,if driver + * offload link decisions and do not provide per-link statistics. + * 1- if driver provides per-link statistics. * @assoc_link_id: Indicates MLO link ID of the AP, with which the station * completed (re)association. This information filled for both MLO * and non-MLO STA connections when the AP affiliated with an MLD. @@ -2201,6 +2204,7 @@ struct station_info { enum nl80211_mesh_power_mode peer_pm; enum nl80211_mesh_power_mode nonpeer_pm; + bool is_per_link_stats_support; u8 assoc_link_id; u8 mld_addr[ETH_ALEN] __aligned(2); const u8 *assoc_resp_ies; @@ -5062,6 +5066,8 @@ struct cfg80211_ops { * @WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY: support connection to non-primary link * of an NSTR mobile AP MLD. * @WIPHY_FLAG_DISABLE_WEXT: disable wireless extensions for this device + * @WIPHY_FLAG_SUPPORTS_MLO_STA_PER_LINK_STATS: The driver does not offload + * link decisions and provide per-link statistics for MLO STA. */ enum wiphy_flags { WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0), @@ -5090,6 +5096,7 @@ enum wiphy_flags { WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER = BIT(24), WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON = BIT(25), + WIPHY_FLAG_SUPPORTS_MLO_STA_PER_LINK_STATS = BIT(26), }; /** @@ -8503,7 +8510,7 @@ static inline void cfg80211_sinfo_release_content(struct station_info *sinfo) { int link_id; - if (sinfo->valid_links) { + if (sinfo->is_per_link_stats_support && sinfo->valid_links) { for_each_valid_link(sinfo, link_id) { if (sinfo->links[link_id]) { kfree(sinfo->links[link_id]->pertid); diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 1bfe1a55888d..694ba84ec778 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2867,6 +2867,8 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, sinfo->generation = sdata->local->sta_generation; sinfo->valid_links = sta->sta.valid_links; + sinfo->is_per_link_stats_support = + !!(sdata->local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO_STA_PER_LINK_STATS); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_STA_FLAGS) | BIT_ULL(NL80211_STA_INFO_CONNECTED_TIME) | @@ -2903,7 +2905,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, if (test_sta_flag(sta, WLAN_STA_TDLS_PEER)) sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER); - if (sinfo->valid_links) { + if (sinfo->is_per_link_stats_support && sinfo->valid_links) { memcpy(sinfo->mld_addr, sta->addr, ETH_ALEN); for_each_valid_link(sinfo, link_id) { diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 3527cea4e071..7c68c5f87f9d 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6906,7 +6906,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, &sinfo->sta_flags)) goto nla_put_failure; - if (sinfo->valid_links) { + if (sinfo->is_per_link_stats_support && sinfo->valid_links) { /* TODO: Add accumulated stats for packets, bytes for * better representation at MLO level. */ From patchwork Thu Feb 13 17:16:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 865299 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68439221553 for ; Thu, 13 Feb 2025 17:17:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467057; cv=none; b=YixOVOIvPjTdmGXd+XiZUdTqyMwz/2IoFAVkY7gnpavITACZ1lSW4LJTGb409V09FQ9+X3xG6sAIdrBKbX2OoH4rPiZ3YWDIuOYo212AtrkaR1A8BzTpgzFiAgtcmAXa94zHmq0MH8ApPUiBPkQVdzV26sbguwMm5qdkYVQVbUY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467057; c=relaxed/simple; bh=mCpMlH4HbUx4W78bH3QdLVvS6hWE/AC4ytz3YvlYcL4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cKGPJl+x3Trot2ApdAOCYzpocdkhLQ4vG5eQcvJqhf3S4Kd3McDQdyvQQM+ZoDj4PQUhz5HTvNU0J4dRIv62yNbOzkzqhE1w5aFPvEUWGylfaGh88hQjw7kmnva8QWUAUHaLsyLS0lZSWTbvIXtSMQGvpwUOV0kxalmwDB56hr8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=jsfHnQlB; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="jsfHnQlB" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51D9gmHb027466; Thu, 13 Feb 2025 17:17:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= kKP45nSZPm4Gggc3mAcpX/hV69BaQzj9bencpwaGTCY=; b=jsfHnQlBsjYtOkW9 b86dpGNS6Y5y+5UstOhYtoKA00tidbnBQHbfmIaBETXGHyfLYWBfBGl4gDjLhqBA YoHjLQ9yPTp26ZkduSUY+LGHGuATe5FjqcApnbSbvUXvpmc1k+aTZKy6n44aepU7 BOvE152/NtWAlEF5SRwESrIzPiX+mNQOQqm9/1RTeoo57FX3EkFoJ8j4e+Kriq0I aSTtDVyu0EIXR0fMi2kuHwTRMFEgbzrf4QjcYFLfHLicM8vlKSQbw49AhmU6QKZd Ch4vjm1pBNLQ9SoUg4mkrUhB4LRYNvTAgYMXT84WEXRfkfeNBR2Tb37bQyt8n5S9 IXjv9g== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44sebn978v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:31 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51DHHV4c024059 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:31 GMT Received: from hu-sarishar-blr.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 13 Feb 2025 09:17:29 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH v3 09/12] wifi: cfg80211: add accumulated statistics for MLO links Date: Thu, 13 Feb 2025 22:46:29 +0530 Message-ID: <20250213171632.1646538-10-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250213171632.1646538-1-quic_sarishar@quicinc.com> References: <20250213171632.1646538-1-quic_sarishar@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 1DgEnUVR-plsreK0ogrNlkDAsfM_vcot X-Proofpoint-ORIG-GUID: 1DgEnUVR-plsreK0ogrNlkDAsfM_vcot X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-13_07,2025-02-13_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 suspectscore=0 malwarescore=0 priorityscore=1501 adultscore=1 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502130123 Currently statistics are handled at link level for multi-link operation(MLO). There is no provision to check accumulated statistics for a multi-link(ML) station. Accumulated statistics are useful to provide comprehensive overview for the ML stations. Statistics such as packets and bytes are useful for observing the total packets sent and received at the station level. However, MLO statistics for rates and signal can not be accumulated since it won't make much sense. Hence, a subsequent change will handle signal and rates bit differently at MLO level. Hence, add accumulated statistics for MLO station. Also, for non-ML station accumulated statistics make no sense. The statistics could be embedded into NL message as below: For MLO: cmd -> NL80211_ATTR_IFINDEX NL80211_ATTR_MAC NL80211_ATTR_GENERATION ......etc NL80211_ATTR_STA_INFO | nest flag NL80211_STA_INFO_CONNECTED_TIME, NL80211_STA_INFO_STA_FLAGS, NL80211_STA_INFO_RX_BYTES, //accumulated data NL80211_STA_INFO_TX_BYTES, ......etc NL80211_ATTR_MLO_LINK_ID, NL80211_ATTR_MLD_ADDR, NL80211_ATTR_MLO_LINKS | nested link_id-1 | nested NL80211_ATTR_MLO_LINK_ID, NL80211_ATTR_MAC, NL80211_ATTR_STA_INFO | nest flag NL80211_STA_INFO_RX_BYTES, NL80211_STA_INFO_TX_BYTES, ..........etc. link_id-2 | nested NL80211_ATTR_MLO_LINK_ID, NL80211_ATTR_MAC, NL80211_ATTR_STA_INFO | nest flag NL80211_STA_INFO_RX_BYTES, NL80211_STA_INFO_TX_BYTES, .........etc The output of iw dev wlan0 station dump for MLO could look like below: Station 00:03:7f:04:31:78 (on wlan0) authorized: yes authenticated: yes associated: yes preamble: long WMM/WME: yes MFP: yes TDLS peer: no connected time: 383 seconds associated at [boottime]: 93.740s associated at: 93685 ms rx bytes: 1439 rx packets: 15 tx bytes: 1538 tx packets: 8 tx retries: 0 tx failed: 0 current time: 474340 ms MLD address: 00:03:7f:04:31:78 Link 0: Address: 00:03:7f:04:31:78 inactive time: 330120 ms rx bytes: 116 rx packets: 3 tx bytes: 0 tx packets: 0 tx retries: 0 tx failed: 0 rx drop misc: 0 signal: -95 dBm tx bitrate: 6.0 MBit/s tx duration: 2669 us rx duration: 0 us DTIM period: 2 beacon interval:100 Link 1: Address: 00:03:7f:04:31:79 inactive time: 81268 ms rx bytes: 1323 rx packets: 12 tx bytes: 1538 tx packets: 8 tx retries: 0 tx failed: 0 rx drop misc: 0 signal: -95 dBm tx bitrate: 6.0 MBit/s tx duration: 2669 us rx bitrate: 6.0 MBit/s rx duration: 0 us DTIM period: 2 beacon interval:100 Signed-off-by: Sarika Sharma --- include/net/cfg80211.h | 13 ++++++++ net/wireless/nl80211.c | 69 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 79 insertions(+), 3 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index eb0fba002776..1a6b428b2699 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2174,6 +2174,12 @@ struct link_station_info { * dump_station() callbacks. User space needs this information to determine * the accepted and rejected affiliated links of the connected station. * @assoc_resp_ies_len: Length of @assoc_resp_ies buffer in octets. + * @rx_packets: total packets (MSDUs & MMPDUs) received from this station + * @tx_packets: total packets (MSDUs & MMPDUs) transmitted to this station + * @rx_bytes: total bytes (size of MPDUs) received from this station + * @tx_bytes: total bytes (size of MPDUs) transmitted to this station + * @tx_retries: cumulative retry counts (MPDUs) + * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK) * @valid_links: bitmap of valid links, or 0 for non-MLO. Drivers fill this * information in cfg80211_new_sta(), cfg80211_del_sta_sinfo(), * get_station() and dump_station() callbacks. @@ -2210,6 +2216,13 @@ struct station_info { const u8 *assoc_resp_ies; size_t assoc_resp_ies_len; + u32 rx_packets; + u32 tx_packets; + u64 rx_bytes; + u64 tx_bytes; + u32 tx_retries; + u32 tx_failed; + u16 valid_links; /* TODO: Need to check and add protection access to links memory */ struct link_station_info *links[IEEE80211_MLD_MAX_NUM_LINKS]; diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7c68c5f87f9d..0a0e8ea488a1 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6860,6 +6860,22 @@ static int nl80211_fill_link_station(struct sk_buff *msg, return -EMSGSIZE; } +static int nl80211_fill_mld_station(struct sk_buff *msg, + struct station_info *sinfo) +{ + PUT_SINFO(RX_PACKETS, rx_packets, u32); + PUT_SINFO(TX_PACKETS, tx_packets, u32); + PUT_SINFO_U64(RX_BYTES, rx_bytes); + PUT_SINFO_U64(TX_BYTES, tx_bytes); + PUT_SINFO(TX_RETRIES, tx_retries, u32); + PUT_SINFO(TX_FAILED, tx_failed, u32); + + return 0; + +nla_put_failure: + return -EMSGSIZE; +} + static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, u32 seq, int flags, struct cfg80211_registered_device *rdev, @@ -6907,9 +6923,8 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, goto nla_put_failure; if (sinfo->is_per_link_stats_support && sinfo->valid_links) { - /* TODO: Add accumulated stats for packets, bytes for - * better representation at MLO level. - */ + if (nl80211_fill_mld_station(msg, sinfo)) + goto nla_put_failure; /* Closing nested STA_INFO as MLO links ATTR should not * be in nested STA_INFO @@ -6986,6 +7001,50 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, #undef PUT_SINFO #undef PUT_SINFO_U64 +static void cfg80211_sta_set_mld_sinfo(struct station_info *sinfo) +{ + struct link_station_info *link_sinfo; + int link_id; + + for_each_valid_link(sinfo, link_id) { + link_sinfo = sinfo->links[link_id]; + if (!link_sinfo) + continue; + + if ((link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_PACKETS))) { + sinfo->tx_packets += link_sinfo->tx_packets; + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); + } + + if ((link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_RX_PACKETS))) { + sinfo->rx_packets += link_sinfo->rx_packets; + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS); + } + + if (link_sinfo->filled & (BIT_ULL(NL80211_STA_INFO_TX_BYTES) | + BIT_ULL(NL80211_STA_INFO_TX_BYTES64))) { + sinfo->tx_bytes += link_sinfo->tx_bytes; + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES); + } + + if (link_sinfo->filled & (BIT_ULL(NL80211_STA_INFO_RX_BYTES) | + BIT_ULL(NL80211_STA_INFO_TX_BYTES64))) { + sinfo->rx_bytes += link_sinfo->rx_bytes; + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES); + } + + if (link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_RETRIES)) { + sinfo->tx_retries += link_sinfo->tx_retries; + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES); + } + + if (link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_FAILED)) { + sinfo->tx_failed += link_sinfo->tx_failed; + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); + } + } +} + static int nl80211_dump_station(struct sk_buff *skb, struct netlink_callback *cb) { @@ -7021,6 +7080,8 @@ static int nl80211_dump_station(struct sk_buff *skb, if (err) goto out_err; + cfg80211_sta_set_mld_sinfo(&sinfo); + if (nl80211_send_station(skb, NL80211_CMD_NEW_STATION, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, NLM_F_MULTI, @@ -7063,6 +7124,8 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info) if (err) return err; + cfg80211_sta_set_mld_sinfo(&sinfo); + msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!msg) { cfg80211_sinfo_release_content(&sinfo); From patchwork Thu Feb 13 17:16:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 865060 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10FBE2222AE for ; Thu, 13 Feb 2025 17:17:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467059; cv=none; b=b0Z5mkmJMEUVWS5B5irwVTc/2QeOwoUWZ4lOWpFdfMUEsoOR7ErZpNCXKit3yII5xpHV7zhknbhHzKktdkRaPLJnguBn3qR2f/t69zWeKRk6UEpiPqdMbuHOzXcqgcp4dDn8FVz12H0qP/CdZwYV8gJuxgVgFRwZgP7DNziUdTc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467059; c=relaxed/simple; bh=U8xYrntlkSnHV3o7BIpppeCG564dzrXS4dF4GbdALEA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oVxkIOLz3SO5Xd4JUacC/oKrddH7AjGxwC5MD3L0Hd++M/B+PlXUIW1K0y3WfyqAuKtI+taN5nkLcYXI+aSixDc7n8p1TkRRbLJvtQQQNBoKxcqrpXOSbKlJJ3ov5qcgcZZe4XlVz5cR9FA3ItyjDPJFfZ0IftgCOUOD6qzFaYE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=MnIj6xD/; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="MnIj6xD/" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51DA2NpY002033; Thu, 13 Feb 2025 17:17:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= EqleIO+l/mbUkkAIx10mPHLBeYqkvU3xHE9VFVCtX8U=; b=MnIj6xD/3jvQ+iyu 7O5oXl0di0YKd+nxyqnW1IFF/LE9euSTiroePhgFSc3h7K4xc5acExc2uMoFbrCo uHeZC9T/yqLDKUJOrAJxQ+o2S64wBzXtT1KDRSb0Cg874qswOxmJJ4DpI8ZZ4kuF x4dsVF/FGah22CVWerFriWw71i2xXNFfzwXFkd7ZWRw3togPDolTZkNOYvCMSpTX uCU7v0iXulpN+Ujoffglw8YK/rqW9l81JumJ5Q5/OK1kCfOR9bV9Ip29GzsSN7Km ivQjGBZV+/7vZMCGZe1SaMuRyoKMwoC/pTeE9FATZaB8WI6mrK/8oqjhKl9DOA1c 0h/L1Q== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44semp944w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:33 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51DHHWNt022245 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:32 GMT Received: from hu-sarishar-blr.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 13 Feb 2025 09:17:31 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH v3 10/12] wifi: mac80211: add support to accumulate removed link statistics Date: Thu, 13 Feb 2025 22:46:30 +0530 Message-ID: <20250213171632.1646538-11-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250213171632.1646538-1-quic_sarishar@quicinc.com> References: <20250213171632.1646538-1-quic_sarishar@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 5RGRx-X9yGeMs5P73lNv1JyluKwOrxRL X-Proofpoint-GUID: 5RGRx-X9yGeMs5P73lNv1JyluKwOrxRL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-13_07,2025-02-13_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502130123 Currently, if a link gets removed in between for a station then directly accumulated data will fall down to sum of other active links. This will bring inconsistency in station dump statistics. For instance, let's take Tx packets - at t=0-> link-0:2 link-1:3 Tx packets => accumulated = 5 - at t=1-> link-0:4 link-1:6 Tx packets => accumulated = 10 let say at t=2, link-0 went down => link-0:0 link-1:7 => accumulated = 7 Here, suddenly accumulated Tx packets will come down to 7 from 10. This is showing inconsistency. Therefore, store link-0 data when it went down and add to accumulated Tx packet = 11. Hence, store the removed link statistics data in sta structure and add it in accumulated statistics for consistency. Signed-off-by: Sarika Sharma --- net/mac80211/sta_info.c | 36 ++++++++++++++++++++++++++++++++++++ net/mac80211/sta_info.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 694ba84ec778..e2c18df9c152 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -356,6 +356,24 @@ static void sta_info_free_link(struct link_sta_info *link_sta) free_percpu(link_sta->pcpu_rx_stats); } +static void sta_accumulate_removed_link_stats(struct sta_info *sta, int link_id) +{ + struct link_sta_info *link_sta = + rcu_dereference_protected(sta->link[link_id], + lockdep_is_held(&sta->local->hw.wiphy->mtx)); + int ac; + + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { + sta->rem_link_stats.tx_packets += link_sta->tx_stats.packets[ac]; + sta->rem_link_stats.tx_bytes += link_sta->tx_stats.bytes[ac]; + } + + sta->rem_link_stats.rx_packets += link_sta->rx_stats.packets; + sta->rem_link_stats.rx_bytes += link_sta->rx_stats.bytes; + sta->rem_link_stats.tx_retries += link_sta->status_stats.retry_count; + sta->rem_link_stats.tx_failed += link_sta->status_stats.retry_failed; +} + static void sta_remove_link(struct sta_info *sta, unsigned int link_id, bool unhash) { @@ -378,6 +396,10 @@ static void sta_remove_link(struct sta_info *sta, unsigned int link_id, alloc = container_of(link_sta, typeof(*alloc), info); sta->sta.valid_links &= ~BIT(link_id); + + /* store removed link info for accumulated stats consistency */ + sta_accumulate_removed_link_stats(sta, link_id); + RCU_INIT_POINTER(sta->link[link_id], NULL); RCU_INIT_POINTER(sta->sta.link[link_id], NULL); if (alloc) { @@ -2856,6 +2878,17 @@ static void sta_set_link_sinfo(struct sta_info *sta, struct link_station_info *s } } +static void sta_set_accumulated_removed_links_sinfo(struct sta_info *sta, + struct station_info *sinfo) +{ + sinfo->tx_packets += sta->rem_link_stats.tx_packets; + sinfo->rx_packets += sta->rem_link_stats.rx_packets; + sinfo->tx_bytes += sta->rem_link_stats.tx_bytes; + sinfo->rx_bytes += sta->rem_link_stats.rx_bytes; + sinfo->tx_retries += sta->rem_link_stats.tx_retries; + sinfo->tx_failed += sta->rem_link_stats.tx_failed; +} + void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, bool tidstats) { @@ -2926,6 +2959,9 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, sta_set_link_sinfo(sta, link_sinfo, link_sdata, tidstats); sinfo->links[link_id] = link_sinfo; } + + /* Add accumulated removed link data to sinfo data for consistency */ + sta_set_accumulated_removed_links_sinfo(sta, sinfo); } else { link_sinfo = kzalloc(sizeof(*link_sinfo), GFP_KERNEL); if (!link_sinfo) diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 7e600c82a6e1..b2dc92ba0070 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h @@ -576,6 +576,32 @@ struct link_sta_info { struct ieee80211_link_sta *pub; }; +/** + * struct ieee80211_sta_removed_link_stats - Removed link sta data + * + * keep required accumulated removed link data for stats + * + * @rx_packets: accumulated packets (MSDUs & MMPDUs) received from + * this station for removed links + * @tx_packets: accumulated packets (MSDUs & MMPDUs) transmitted to + * this station for removed links + * @rx_bytes: accumulated bytes (size of MPDUs) received from this + * station for removed links + * @tx_bytes: accumulated bytes (size of MPDUs) transmitted to this + * station for removed links + * @tx_retries: cumulative retry counts (MPDUs) for removed links + * @tx_failed: accumulated number of failed transmissions (MPDUs) + * (retries exceeded, no ACK) for removed links + */ +struct ieee80211_sta_removed_link_stats { + u32 rx_packets; + u32 tx_packets; + u64 rx_bytes; + u64 tx_bytes; + u32 tx_retries; + u32 tx_failed; +}; + /** * struct sta_info - STA information * @@ -653,6 +679,7 @@ struct link_sta_info { * @deflink address and remaining would be allocated and the address * would be assigned to link[link_id] where link_id is the id assigned * by the AP. + * @rem_link_stats: accumulated removed link stats */ struct sta_info { /* General information, mostly static */ @@ -729,6 +756,7 @@ struct sta_info { struct ieee80211_sta_aggregates cur; struct link_sta_info deflink; struct link_sta_info __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS]; + struct ieee80211_sta_removed_link_stats rem_link_stats; /* keep last! */ struct ieee80211_sta sta; From patchwork Thu Feb 13 17:16:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 865298 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 406F1207A11 for ; Thu, 13 Feb 2025 17:17:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467062; cv=none; b=P3NTyUkIACrUb63p5XEjXfjNOOZ1Spx3Y6ATvHAJetdOGE0euWTz1LxPFXETcWcZbHJ6CAwX8i8M6jHfktGJBn9j0LfsYmZmpod9+L339t1LJyo1xt6cTnyTbzzoO4cmRok3Q/XPL7+BwlV5uJAnT6iHf/jfqXvldPpJO3Dm5LM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467062; c=relaxed/simple; bh=bB91Ks1vza2/DUAZrL8iZ5iNWSwWCuX9ZnwP3KHW5LA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sDVGZK9BJnQjmjVQqDseUEuxSbIU49Y+nF0bI0V/Nwwf0paCcsBTs9+9bUh5SPc5ySopUglwFimeE+qhk0b59kxQNycAxWflV9VJUyW7FzP4maLY3dNx3q+cww04TTk8pSqBa8+LWYnvkGa9rSppUE+GAeRHi3PyEAiOvlECUog= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=pERqWDRq; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="pERqWDRq" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51D8Nbej007881; Thu, 13 Feb 2025 17:17:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= YZurnuYW/VDL4M8vov83Yh85P3WopfyZ6VqepReNFUM=; b=pERqWDRq0A847NWu 8LH2EB0/WwRJescyzNYyNq50dAbp+UHsLGBzd4Qvx7S7g+iU0MT9t3gclJfrcCOc G43DY6PG/v0y8V16AVG7+kjDZIFGmtbUQOmLvsMdbBUDT+dKlooJjqrF5OkaIk1M 19UzUjD3O7IdqnyeiZysEJfFHzrl7t7dA8sRzMhGiQbnLLAChbDBbbR0Zrjn+hVJ c9c5S/9BC58wCdqPIyB4I+0MlIho14sC7EUbTYiJfWWI4opbe+hVw4gIE5DcL+jZ FfpAPETfS+DNBfFuaK1acEyTpDKVQAsRR2YpnalKy3MMZ1jvwdEiNOmGjMimLC9K k4IEJQ== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44rr1qvr20-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:35 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51DHHYpt012008 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:34 GMT Received: from hu-sarishar-blr.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 13 Feb 2025 09:17:33 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH v3 11/12] wifi: cfg80211: add additional MLO statistics Date: Thu, 13 Feb 2025 22:46:31 +0530 Message-ID: <20250213171632.1646538-12-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250213171632.1646538-1-quic_sarishar@quicinc.com> References: <20250213171632.1646538-1-quic_sarishar@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: eNG7i2lQNZ0pYG5suvETZKYtiwxO0--k X-Proofpoint-ORIG-GUID: eNG7i2lQNZ0pYG5suvETZKYtiwxO0--k X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-13_07,2025-02-13_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 mlxscore=0 impostorscore=0 spamscore=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502130122 Currently, the accumulable statistics for multi-link operation(MLO) are handled. Other statistics, such as signal and rates, are managed at the link level. Therefore, add signal and rates at the MLO level to provide an comprehensive overview of the station. The signal could be the best of all links- e.g. if Link 1 has a signal strength of -70 dBm and Link 2 has -65 dBm, the signal for MLO will be -65 dBm. The rate could be determined based on the most recently updated link- e.g. if link 1 has a rate of 300 Mbps and link 2 has a rate of 450 Mbps, the MLO rate can be calculated based on the inactivity of each link. If the inactive time for link 1 is 20 seconds and for link 2 is 10 seconds, the MLO rate will be the most recently updated rate, which is link 2's rate of 450 Mbps. Signed-off-by: Sarika Sharma --- include/net/cfg80211.h | 7 ++++ net/wireless/nl80211.c | 79 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 83 insertions(+), 3 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 1a6b428b2699..fddbd37c2385 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2180,6 +2180,10 @@ struct link_station_info { * @tx_bytes: total bytes (size of MPDUs) transmitted to this station * @tx_retries: cumulative retry counts (MPDUs) * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK) + * @signal: The signal strength, type depends on the wiphy's signal_type. + * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. + * @txrate: last updated unicast bitrate from this station + * @rxrate: last updated unicast bitrate to this station * @valid_links: bitmap of valid links, or 0 for non-MLO. Drivers fill this * information in cfg80211_new_sta(), cfg80211_del_sta_sinfo(), * get_station() and dump_station() callbacks. @@ -2222,6 +2226,9 @@ struct station_info { u64 tx_bytes; u32 tx_retries; u32 tx_failed; + s8 signal; + struct rate_info txrate; + struct rate_info rxrate; u16 valid_links; /* TODO: Need to check and add protection access to links memory */ diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 0a0e8ea488a1..34d7efd0f018 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6861,7 +6861,8 @@ static int nl80211_fill_link_station(struct sk_buff *msg, } static int nl80211_fill_mld_station(struct sk_buff *msg, - struct station_info *sinfo) + struct station_info *sinfo, + struct cfg80211_registered_device *rdev) { PUT_SINFO(RX_PACKETS, rx_packets, u32); PUT_SINFO(TX_PACKETS, tx_packets, u32); @@ -6870,6 +6871,26 @@ static int nl80211_fill_mld_station(struct sk_buff *msg, PUT_SINFO(TX_RETRIES, tx_retries, u32); PUT_SINFO(TX_FAILED, tx_failed, u32); + switch (rdev->wiphy.signal_type) { + case CFG80211_SIGNAL_TYPE_MBM: + PUT_SINFO(SIGNAL, signal, u8); + break; + default: + break; + } + + if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE)) { + if (!nl80211_put_sta_rate(msg, &sinfo->txrate, + NL80211_STA_INFO_TX_BITRATE)) + goto nla_put_failure; + } + + if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_RX_BITRATE)) { + if (!nl80211_put_sta_rate(msg, &sinfo->rxrate, + NL80211_STA_INFO_RX_BITRATE)) + goto nla_put_failure; + } + return 0; nla_put_failure: @@ -6923,7 +6944,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, goto nla_put_failure; if (sinfo->is_per_link_stats_support && sinfo->valid_links) { - if (nl80211_fill_mld_station(msg, sinfo)) + if (nl80211_fill_mld_station(msg, sinfo, rdev)) goto nla_put_failure; /* Closing nested STA_INFO as MLO links ATTR should not @@ -7001,10 +7022,40 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, #undef PUT_SINFO #undef PUT_SINFO_U64 +static void cfg80211_sta_set_mld_rate_info(struct rate_info *sinfo_rate, + struct rate_info *link_sinfo_rate) +{ + if (link_sinfo_rate->flags) + sinfo_rate->flags = link_sinfo_rate->flags; + if (link_sinfo_rate->legacy) + sinfo_rate->legacy = link_sinfo_rate->legacy; + if (link_sinfo_rate->mcs) + sinfo_rate->mcs = link_sinfo_rate->mcs; + if (link_sinfo_rate->nss) + sinfo_rate->nss = link_sinfo_rate->nss; + if (link_sinfo_rate->bw) + sinfo_rate->bw = link_sinfo_rate->bw; + if (link_sinfo_rate->he_gi) + sinfo_rate->he_gi = link_sinfo_rate->he_gi; + if (link_sinfo_rate->he_dcm) + sinfo_rate->he_dcm = link_sinfo_rate->he_dcm; + if (link_sinfo_rate->he_ru_alloc) + sinfo_rate->he_ru_alloc = link_sinfo_rate->he_ru_alloc; + if (link_sinfo_rate->n_bonded_ch) + sinfo_rate->n_bonded_ch = link_sinfo_rate->n_bonded_ch; + if (link_sinfo_rate->eht_gi) + sinfo_rate->eht_gi = link_sinfo_rate->eht_gi; + if (link_sinfo_rate->eht_ru_alloc) + sinfo_rate->eht_ru_alloc = link_sinfo_rate->eht_ru_alloc; +} + static void cfg80211_sta_set_mld_sinfo(struct station_info *sinfo) { struct link_station_info *link_sinfo; - int link_id; + int link_id, init = 0;; + u32 link_inactive_time; + + sinfo->signal = -99; for_each_valid_link(sinfo, link_id) { link_sinfo = sinfo->links[link_id]; @@ -7042,6 +7093,28 @@ static void cfg80211_sta_set_mld_sinfo(struct station_info *sinfo) sinfo->tx_failed += link_sinfo->tx_failed; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); } + + /* Update MLO signal as per best of all link signal */ + if ((link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_SIGNAL)) && + (link_sinfo->signal > sinfo->signal)) { + sinfo->signal = link_sinfo->signal; + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); + } + + /* Update MLO rates as per last updated link rate */ + if ((link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE)) && + (!init || link_inactive_time > link_sinfo->inactive_time)) { + link_inactive_time = link_sinfo->inactive_time; + cfg80211_sta_set_mld_rate_info(&sinfo->txrate, &link_sinfo->txrate); + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); + } + if ((link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_RX_BITRATE)) && + (!init || link_inactive_time > link_sinfo->inactive_time)) { + link_inactive_time = link_sinfo->inactive_time; + cfg80211_sta_set_mld_rate_info(&sinfo->rxrate, &link_sinfo->rxrate); + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); + } + init++; } } From patchwork Thu Feb 13 17:16:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 865059 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBE25205505 for ; Thu, 13 Feb 2025 17:17:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467064; cv=none; b=mH3UPj2ed7fpGDcx5EvF4CwUCZ09wZXQryngt8qor8mV1/eZyS4tj/Pzyt8okfBiBXJ1Y0D2v7EDXNGwAGy+vF1dxjy4C2J+XU52w2+GT/6+efl/FWr2/a39w419vyblsGQYaXtYdL6YRv6eGBtbzLwRHVobEpfpXAfuvEODcG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739467064; c=relaxed/simple; bh=m/LV1RpDQ5aOulxsmNUC9DyflXl9fg10DIqyQO81ed4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NPqiJyme3L5C72L2pe5evMAvsZqYagol9VrqxAnSEnk6McKlkFnVyoEpmPOs/wjcxPvdpqIhZLPRjiRHNQdDEe79fGtnEbMQ5hIDNRTKkJ1BhknhGDWb83apXLhzKqyeONNd0hIBz5e912xm3nLQHwV6x6edkWKhSikQzgxKDrA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=diYt9soJ; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="diYt9soJ" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51D81FoJ008091; Thu, 13 Feb 2025 17:17:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= QVbjbeUFmzBy+XVijdUnQmTxYT+HdP+MYIiRZe0IzcA=; b=diYt9soJ8GKJpOC4 EczSza+MyWX95ecnmi49VC6wMHwSrS5oUFTUAghFLFjhWHZOt+I4Dntu+sV0ro3o 1QhWAz757xhmO5TWsCzpcSsUNx61N/+EgiMcZ0LWruLUbtTHQ0s0N1IKLQzPmO7R DcIs1DJhgU6wzT4qJOn/D4esuMmzvVJ/+uGgeBQwImJ+uLkTc3VUb2Ml4KVmD0A2 SK9XAiXlMN2PFQlIjK4mpG6ZAvq5RtZeozHES62bBSh7GR7QlUauvFDiI9vY/gCg 6r19kHsCFXBs53l/KactlPW8D7Ajz4GN7uqzRiSrhKHTPOG9qRoLXjGUwzs1ZuBp vYQrjA== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44rr1qvr25-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:37 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 51DHHa0X012053 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2025 17:17:36 GMT Received: from hu-sarishar-blr.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 13 Feb 2025 09:17:34 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH v3 12/12] wifi: ath12k: correctly fetch arsta for MLO Date: Thu, 13 Feb 2025 22:46:32 +0530 Message-ID: <20250213171632.1646538-13-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250213171632.1646538-1-quic_sarishar@quicinc.com> References: <20250213171632.1646538-1-quic_sarishar@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: aSBg71vVWBJPzfT9X8WWmzEN8uE_cxnp X-Proofpoint-ORIG-GUID: aSBg71vVWBJPzfT9X8WWmzEN8uE_cxnp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-13_07,2025-02-13_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 mlxscore=0 impostorscore=0 spamscore=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=529 priorityscore=1501 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502130122 Currently in ath12k_mac_op_sta_statistics(), link sinfo structure is filled from arsta structure and arsta is fetched from ahsta->deflink. For both non-ML and multi-link operation (MLO), deflink is used. While this is correct for non-ML, but the corresponding link_id should be used for MLO. Therefore, add support for MLO by taking the link_id from the link_sinfo structure, fetching arsta from ahsta->link[link_id], and filling the link_sinfo structure if valid_links. Signed-off-by: Sarika Sharma --- drivers/net/wireless/ath/ath12k/mac.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 7767971ae4c8..611cdab85329 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -10023,11 +10023,18 @@ static void ath12k_mac_op_link_sta_statistics(struct ieee80211_hw *hw, struct link_station_info *sinfo) { struct ath12k_sta *ahsta = ath12k_sta_to_ahsta(sta); + int link_id = sinfo->link_id; struct ath12k_link_sta *arsta; lockdep_assert_wiphy(hw->wiphy); - arsta = &ahsta->deflink; + if (link_id < 0) + arsta = &ahsta->deflink; + else + arsta = wiphy_dereference(hw->wiphy, ahsta->link[link_id]); + + if (!arsta) + return; sinfo->rx_duration = arsta->rx_duration; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION);