From patchwork Fri Jan 17 12:45:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 858481 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 BB74B1FECB8 for ; Fri, 17 Jan 2025 12:46: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=1737117989; cv=none; b=Niw3iKlNZ5WHtMtwZ7zEcoVCLHBk7rJ0EhREshNAjs+mYQAOzK2YNNeW4NvV+a8Ntm/KmLG439t8UBhjflPeJXMg4JvRF88i26lQmOaeK9cn7lC4Hg2La2gfWaRZzz9YIROAVfY8vuuChpc+QDjdn0/wE8qwa8m7xyMZd6MWNTY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737117989; c=relaxed/simple; bh=3gNowETp2T5A6zYcjNux+Hkf4lG+vTl8QDUq2WHHUCw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RRx6jcbQErZSeLR3mmZx6sf6N/MRzh7IQ51BkqX2w7mTjr7Ji0mNOjt7+X8GOZCbE9fGno/+oODAVsH6D9dXf4bZ0/A6Iq3ow9XNyLAuPIBf6JEUBwOv0gCQZ9GaP+hmb5SwEPNqOmwI5qJ8Y9cXJStRNeSZ0KSKZoKZAFjNnj0= 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=TvaoEY+Q; 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="TvaoEY+Q" 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 50HALjni005042; Fri, 17 Jan 2025 12:46:23 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= Z87gomJ1DnwoYbgZte+98/SbfkZOUOMwLZWzn354b4E=; b=TvaoEY+QhNQLSmBy h+8coyKh3cDdhAHWGZwauk61wDQGVDSMQ/rp5PYd7SaqXaNMMA9X7sfzR5xgvuWO vpCnVbMfXdbAoK1zEom21iMOK6zPUsmiw8q/rvM3erLlo10WIX3aBLKNOP4Oud5S w+em+BliYYjFqgksIQaqPXpoz4ptJNb4fLVaHxuQnqX0eGixAnfgKBzRhyofI2G/ Moq+Bzd0Kax4jMefEgr++fTtnXcgcboaIv+khlwvlEBdv10a1gCMAisFOGbem/Te xpuP/ZBUYFKwuqFOi0FswZ7xQQ6/FOOYIhRZ1Lod1448xnfcnzz5Wxn2GbcZ+ekK v0fNrg== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 447ncsgb7r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jan 2025 12:46: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 50HCkMwV031034 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jan 2025 12:46:22 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; Fri, 17 Jan 2025 04:46:21 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH RFC v2 01/12] wifi: cfg80211: reorg sinfo structure elements for mesh Date: Fri, 17 Jan 2025 18:15:43 +0530 Message-ID: <20250117124554.3719808-2-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250117124554.3719808-1-quic_sarishar@quicinc.com> References: <20250117124554.3719808-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: UmrGBd8eCZK5hkythiiPHs4EimaiAw9r X-Proofpoint-GUID: UmrGBd8eCZK5hkythiiPHs4EimaiAw9r 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-01-17_05,2025-01-16_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 mlxlogscore=999 adultscore=0 impostorscore=0 bulkscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 malwarescore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501170103 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 7790af534b7f..77f72a46ce42 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 8789d8b73f0f..d90033e03dd6 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6726,9 +6726,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); @@ -6772,13 +6769,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, @@ -6806,7 +6808,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 Fri Jan 17 12:45:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 858479 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 97A361FF5F5 for ; Fri, 17 Jan 2025 12:46:33 +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=1737117995; cv=none; b=gCEosYF71yQ5dPcAlpDT1rUUQjyAYYOGwcWYeoGuno1Fe7sJRGcYEl0mLMYXePz2rT9vWkA99VnD4+JO5pfO3J/i5pIddE6DjZwc6LHy/JI0LALsxBZuA9id4UiOmSGTdrCX8pExinKWbw6Lo6MHa7dqDMdPe+pDYIdkbnKPlVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737117995; c=relaxed/simple; bh=PyMX4PbLyJU3IKJ5JmdgMqKYbNlctXDkkkwr055qO50=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sj4Rwzd5X/9timywkEhHVlom7AxCucilQM4LuG10IWDJHs1aiHgQrEs+x1BnlnIM+srOtiyCe6RPwYmKB5X9ZiD415DN9wC07eIHU4OwxOcUeE+TMRUGQji8AJIKOrTvOYmTqu6Jam4n3vBni0PkZb5f2z1EiTM4DKZN0DMxTaY= 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=T584bNiq; 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="T584bNiq" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50H9nn5T019979; Fri, 17 Jan 2025 12:46:29 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= VZcglt0NTMuWO5/mDeo+N4DHaSNejAkSTEdLNtqcPr4=; b=T584bNiqH3fmvngz ZXOt6GdZ1IsUZ5A6t4/RrWnSKlt1z7jfCgfNQJ/ISGkJWZNkhT1QyauN82P8ay13 TyA1a1U26VTDIbz2ev/TwaVLrDKc2mBnvg1N7svFxEFVvA0pAZeahjF5Bwa+R7lM dAZSJ5matJMA4zNJ4p5kefzHlgLBZRvp7mGt+4Tvkg5DcTMFPmWgjjFiSgPuUJhd SZ7miHAh+hC8GctM0C+Km43JhkHL8xcJRhhjTyWt3RGriX8SUleLIbanTyvi4IZc z3kSNOyl6g9rXta7I4gop5PSBacbl2oHNz879MhBLGXfmr0OEeKoCWk65NEE9ZhH e0+NBQ== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 447mwq0fad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jan 2025 12:46:29 +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 50HCkSO2031097 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jan 2025 12:46:28 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; Fri, 17 Jan 2025 04:46:26 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH RFC v2 04/12] wifi: mac80211: introduce sta_set_link_sinfo API to add support towards MLO statistics Date: Fri, 17 Jan 2025 18:15:46 +0530 Message-ID: <20250117124554.3719808-5-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250117124554.3719808-1-quic_sarishar@quicinc.com> References: <20250117124554.3719808-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: eI7SwbapSOwtU-RGxB76knOUyYcC-EOD X-Proofpoint-GUID: eI7SwbapSOwtU-RGxB76knOUyYcC-EOD 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-01-17_05,2025-01-16_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 malwarescore=0 mlxscore=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 impostorscore=0 mlxlogscore=999 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501170102 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 e0465068a97f..1060b6d7c6f9 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2615,42 +2615,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)); @@ -2658,26 +2652,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); } @@ -2687,12 +2681,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; } @@ -2701,12 +2695,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); } @@ -2727,12 +2721,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; } } @@ -2754,7 +2748,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); } } @@ -2767,7 +2761,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; @@ -2776,14 +2770,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); } @@ -2799,11 +2793,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; @@ -2811,8 +2800,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) | @@ -2837,27 +2869,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 Fri Jan 17 12:45:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 858478 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 E596A1FF7A9 for ; Fri, 17 Jan 2025 12:46:36 +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=1737117999; cv=none; b=YeS0MyIUkeQRnuxizTuYZM0aw+G4PS3kS8BowZgrxLztRt8vB096PfmEHF8Uf7nV6mVQM+RYA6tXNlZyHtNRzigvZZuJ4MH/JyAbKut7DXjXqLKr5Zz0sYi3/fY0YzKMo1jPE0crHKGpZjdkoomXAKG/kMo/G7yKDqaOendZ04M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737117999; c=relaxed/simple; bh=jhSOQfCkNFrI3/qKnDoFDREmjjhA/jBCQhiplSW2JuM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Mc/PgcMC7J7IoPNOr74Z0FyquXc/jJcoNzcxLE+eVYCgyGcmIondGW0fSXz+LYH0eQm9XMzCcFnn7XVsox+HIiJYv5b9KdZMtsntaz/TfFsynp6BhJ4fiXnLsI3Rqz3p+HTLL6tANFhZVAHm+xPmf2IbNT99e2G9k/a+LIhXwzY= 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=RWdbrG//; 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="RWdbrG//" 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 50H9Saxk009414; Fri, 17 Jan 2025 12:46: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= 28XlwDNKxLF2KeSnmnZzdwoxeJoKziFn1/uCqis5PJ4=; b=RWdbrG//ztOW6tx9 phZiJC4Uvf4DWu2tTp8hOI5/TK3QdvHsyA1gqVffsucU4e3mUoSRrWqnsuKKHjuZ qGf8s5udV2pQk0IxIyio/Sy9HOqqPxEMkD14IR5vMOakGfniWJFjAecrWpCvbyC6 OnIsC0HM+nBkxJAy/E/YhVtfdMxQ4z6Zo0msyFeIf7w4Q4jZwRWa65tvyKS3Zy0s cTkn31rFBgIBMsllOUldyQksDYSB95lRgiFuG4d3ZUjhXcczwZt+aHoAAQaD1fRe Qm6fpQBWbsCQXZyc9PMNk6ktfEuuIOwThV/PmthXB7UiHsmpn25q2hJOzJqTwbbb gEuVyQ== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 447mm00gjk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jan 2025 12:46:32 +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 50HCkWcL023190 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jan 2025 12:46: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; Fri, 17 Jan 2025 04:46:30 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH RFC v2 06/12] wifi: cfg80211: reorg sinfo structure elements for MLO Date: Fri, 17 Jan 2025 18:15:48 +0530 Message-ID: <20250117124554.3719808-7-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250117124554.3719808-1-quic_sarishar@quicinc.com> References: <20250117124554.3719808-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: Avv5PcgzJlQy2Mx-LM9xf2fUONSyI2vY X-Proofpoint-ORIG-GUID: Avv5PcgzJlQy2Mx-LM9xf2fUONSyI2vY 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-01-17_05,2025-01-16_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 clxscore=1015 adultscore=0 malwarescore=0 suspectscore=0 bulkscore=0 phishscore=0 impostorscore=0 mlxlogscore=999 lowpriorityscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501170103 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: - Currently this patch is not-bisectable, once RFC patches are approved could add other required driver changes. - Have included ath12k driver changes as an example that could be used as reference for other drivers. Signed-off-by: Sarika Sharma --- drivers/net/wireless/ath/ath12k/mac.c | 12 +- include/net/cfg80211.h | 169 +++++++++++++++----------- 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 ++-- 11 files changed, 183 insertions(+), 144 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index c4eab4c1c10e..ef4f7eb07763 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -9896,10 +9896,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; @@ -10177,7 +10177,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/include/net/cfg80211.h b/include/net/cfg80211.h index 77f72a46ce42..9c7a0dbf5d3d 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]; }; /** @@ -8434,7 +8464,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 @@ -8446,7 +8476,8 @@ 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); + kfree(sinfo->links[0]->pertid); + kfree(sinfo->links[0]); } /** diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 70ece0083d40..c1e88761b5e8 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -4106,11 +4106,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. * @@ -4593,10 +4593,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 c64531e0a60e..33365870ce86 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 1060b6d7c6f9..20b7465ac962 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2615,7 +2615,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; @@ -2634,7 +2634,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); @@ -2830,6 +2830,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; @@ -2869,7 +2870,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 dc35fed7e9b0..1477506c76d6 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 bf4426fbbabd..422c31da4c24 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6686,7 +6686,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; @@ -6844,6 +6844,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) { @@ -6880,7 +6881,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 (nl80211_fill_link_station(msg, rdev, link_sinfo)) goto nla_put_failure; nla_nest_end(msg, sinfoattr); @@ -13024,9 +13025,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 a57210c8087c..93b7b31b89bc 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 Fri Jan 17 12:45:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 858477 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 0E451149DF4 for ; Fri, 17 Jan 2025 12:46:41 +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=1737118003; cv=none; b=Doc2L/PECA2gN/b0xDbUD79gXU9BzNp0OwJR3nHO8v5bbI9hrOcwAtaUqlCDt410iJ/tt/c7ve9XRadzSutjxDcLcltLc/mZ2kCKe6AJObO8BDahVBMnS4tyjjvS2h4H7hzimrDy/yV2JIZR2lzHr0J2vPtyNNZue4e8wpLErJY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737118003; c=relaxed/simple; bh=Ye1pZfVacywLyoPb2Ms+nebg99S1LQIfIg61D1EVB7E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jAR8yzUd8E+dh3P4EAFS3UdiZWnlyKGSfoc2JcuK+CKr2FftBXsb0Da4BpOLHWzi10lC4LRMhmV57PRwOQf/sDKcRs8qlrBNMzB2gvdbfC2rer8WYW+6V/Ml13uB2+eCsSWQZfJf6R/7IYn+ztCE5XbpE0kwPTannQFBNGAagNw= 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=Dryb+GA0; 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="Dryb+GA0" 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 50H97bCm017787; Fri, 17 Jan 2025 12:46:36 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= 3Cyjmy5WWsNyQ77/lADJHC/7hS1O3R1jn3rFoNSKQ+U=; b=Dryb+GA0aPH4AxU1 S5nhyuvLZeqDuUzFGn7sG/dT0K5MaSPqKrLNYS/H/f5YDXYb37ZOOTVeH814eKmY ZFhyZtzTC9Cy/FQR7uVBD2APpgAK1+rJOzvOajogf4jIk12C/SEt94add3GUwGgi wj8nfx9npd0fLgIfAs7GgT7GJycPalGHEgIOUumnjjPx1Gv0aOYBH+mmp7rXwost bFveeQZMFbXfEfHegMhrPf3n3lkMN3BjPB1CMteQ7AWM2UwXuixcI8307t/ZQH6K CiBcD6P1RTUbBKbT9+WvWXcsBFwz8zUPH8/lQ7cVU0hmgJQyQUCDr9pzUKoXp5Nj 1gxSlg== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 447ma50j1t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jan 2025 12:46:36 +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 50HCkZia014113 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jan 2025 12:46:35 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; Fri, 17 Jan 2025 04:46:34 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH RFC v2 08/12] wifi: cfg80211: add flag to indicate driver supports ML station statistics Date: Fri, 17 Jan 2025 18:15:50 +0530 Message-ID: <20250117124554.3719808-9-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250117124554.3719808-1-quic_sarishar@quicinc.com> References: <20250117124554.3719808-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: rOBR94_xE7dsfL95kOVx8pUkzalTym2C X-Proofpoint-ORIG-GUID: rOBR94_xE7dsfL95kOVx8pUkzalTym2C 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-01-17_05,2025-01-16_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 priorityscore=1501 suspectscore=0 bulkscore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 adultscore=2 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501170103 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 ef4f7eb07763..8023b8943fa4 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -10670,6 +10670,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; hw->queues = ATH12K_HW_MAX_QUEUES; wiphy->tx_queue_len = ATH12K_QUEUE_LEN; diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 21eafad17d4b..218ecf2b52d1 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; @@ -5035,6 +5039,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), @@ -5063,6 +5069,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), }; /** @@ -8476,7 +8483,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) { kfree(sinfo->links[link_id]->pertid); kfree(sinfo->links[link_id]); diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 508bb7aff1f6..4c0235f01eba 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2846,6 +2846,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) | @@ -2882,7 +2884,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 2e9dee9c4ef7..ef589a7b3bdb 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6882,7 +6882,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 Fri Jan 17 12:45:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 858476 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 457C31FF7D1 for ; Fri, 17 Jan 2025 12:46:44 +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=1737118005; cv=none; b=Zxb8Jc0okO2sCXdVXUkMzSWeM3aIizFUi/5KUvIYVey7K9xD0y0xGMmOSCPpUpxXEioDSE1buufw1j3PH4/jdOgG1jzSqKqmWZdFWQEiykKOFRW29qBxiAwBnbCWtdGneHXIDZOsM8BSeAL1sVWh02266g9WNaHBPgLx3TijQS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737118005; c=relaxed/simple; bh=kigGH+umwlJxM4OmWq/bgswCd1kiT486u/VlRP8jpfs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LkSBhJZF3PNJawaFShBs+vfiLT5LTtxYljegufFV2uUb3Gr4Mz7sQnAFZa9cR6+2sZoZGWYeK6lf3t+gHsBqfuUAMoDuAMmXPhVwBoAb9kkeKto/6KhLtUEzBD56GMhUhPu+JMx3dU/NKpNeJzKUVcztFMwPZDf4Z3OIWEtcTtM= 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=psRZ1bS2; 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="psRZ1bS2" 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 50HAv2xI028810; Fri, 17 Jan 2025 12:46:40 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= dSMuA1KWLKXAbHuq/XYZKwjgXODmYi0g5UvI7c7dkr4=; b=psRZ1bS2TCoAhd/J mEmdVr+LLEi+Z34pY96U02bIP/y2dHO4bMFPAcpJWNQCNxdFnWNeSPa1QVNywDMe LXZ96Wk419gkM/8iZV9TNhmdILCCpEBfV/48/1Hd9zgmM/P/jTAwHYD3TU7VzgbT Y3hQAkCyTCaaBI6qaBc9Zj/YlCyhV4gDNXkiArmDz53wGfhgW17tvUzwKF/DyQXe ymi9twTg3QhTkSHLAL28h04tK8xJv2LXSHVThHXlCbENVrdWWqvHGDUhMTwmqtUR lHy9vrA9c0+OFD5OJGusBsAg6CrQALlbIWnL2HwjmN2uQ/qC/f1EbPc8F+7YP2Kz p4HEIw== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 447nw908mp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jan 2025 12:46:39 +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 50HCkdZu026031 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jan 2025 12:46:39 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; Fri, 17 Jan 2025 04:46:37 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH RFC v2 10/12] wifi: mac80211: add support to accumulate removed link statistics Date: Fri, 17 Jan 2025 18:15:52 +0530 Message-ID: <20250117124554.3719808-11-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250117124554.3719808-1-quic_sarishar@quicinc.com> References: <20250117124554.3719808-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: gxzLt4f2Hh75_Quk3m2Mjui8oUL60Okj X-Proofpoint-ORIG-GUID: gxzLt4f2Hh75_Quk3m2Mjui8oUL60Okj 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-01-17_05,2025-01-16_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 spamscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501170102 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 4c0235f01eba..7adacd055893 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) { @@ -2835,6 +2857,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) { @@ -2905,6 +2938,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 1d82519319fe..2ddea966d500 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h @@ -569,6 +569,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 * @@ -646,6 +672,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 */ @@ -722,6 +749,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 Fri Jan 17 12:45:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 858475 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 467FE1FF7D1 for ; Fri, 17 Jan 2025 12:46:47 +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=1737118009; cv=none; b=VQ/iO4v4IOlYdBfURI7pMTo75tEshQUaDJbBfqEb/rEkdjZNQ6GDdOW8791GnmW1VO0D7nk8fvh/6wRMPJI04KZiKl3V5d3SOWyon7iYuEP6nlisCXqD9igFC93wJFn+vCzVNjKP+z3M95H8TXmi5Rh+cZGgSa9iBYzHd15JXgM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737118009; c=relaxed/simple; bh=N7AOMXOlxpWKliW8rjOTsAxZiPgxUJJ5yVcjMLDKRy0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=V2P26MaWQ7yra6jtKcbGDJzwuTxQG19IaV3TeWre+12iHTOewMbrjNC9SfflNR6xp1bbR5ScYkkESz50fXn1vnkonh8TtpmL1B5pDf1deWn6Ql7ckci0cWGzmFEvRETOfNXZFFIygypUXBTQd7KacROZSsZ5VhXoUIahFGYMyLU= 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=dKQEFgzf; 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="dKQEFgzf" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50H7KuDC015434; Fri, 17 Jan 2025 12:46:44 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= sEGdGdQg91cjLr4IRTqigPGHulFSRD470Yhbk+3/904=; b=dKQEFgzfDcp0Iuo9 fQ4BJHUubVhQXvkmQN/yqR2G1W2bW2/tbMAbFidx9NBZ1YFQj/xvqY+xSzqdAnN1 EHITBwC7YGJ4I4fjHJ4JJFvgyMuNkIMWeK03tVQQg89gP5hnpitehgL4OPTOIiYr xpkaNTR9w96ufZB0bHGFFhvYHrI3oda7J+zrw4nWXhlA9psmEqKy3r6giUbk3Eyw A0bJWpGQhALfPOGaPFdPGGFdBoH51x21i/j319Zb6cg2g3lB4YwgQUdlX2tPhEkT JYJyNva+MW+coEybAbAA4ZE3Xe61SSh4UHwHAwERHfB/FJoL4kbFwORTyv7mz5C7 XTBvbg== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 447jr38trx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jan 2025 12:46:43 +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 50HCkgwe014872 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jan 2025 12:46:43 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; Fri, 17 Jan 2025 04:46:41 -0800 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH RFC v2 12/12] wifi: ath12k: correctly fetch arsta for MLO Date: Fri, 17 Jan 2025 18:15:54 +0530 Message-ID: <20250117124554.3719808-13-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250117124554.3719808-1-quic_sarishar@quicinc.com> References: <20250117124554.3719808-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: RKiCCYbRZuvRq_Ou_ymDizb-haae85GG X-Proofpoint-GUID: RKiCCYbRZuvRq_Ou_ymDizb-haae85GG 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-01-17_05,2025-01-16_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 suspectscore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 malwarescore=0 bulkscore=0 adultscore=0 impostorscore=0 mlxlogscore=552 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501170103 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. NOTE: - Currently ath12k changes are only included as an reference to other drivers. 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 8023b8943fa4..17e799a9b2cb 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -9902,11 +9902,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);