From patchwork Tue Mar 11 06:26:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 14011197 X-Patchwork-Delegate: johannes@sipsolutions.net 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 1591C1EDA3D for ; Tue, 11 Mar 2025 06:27:29 +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=1741674452; cv=none; b=ah+sAo8wLBiDWXSjHCUz5CGCj8xCqKMsIe+vF92CRpOAaKww7G/y3mKOPD/Mj+4i/1xLlhLdcCk/ibVRHlbRg4Ptui/XhcApZ1emFQhCqUgS58KHywVDz2k54Lt5xZYJlxMw+nIVVsagJr99ksB5q5hZs4OLJyNqmUN+ywgmwRw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741674452; c=relaxed/simple; bh=eAjDpW4VCN0uhsWQXh9uufKx3mDnDhFn8BfyLTolrPM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GOvr4dX6rZsvNOOoOXqy1fqwP2xIhqRS9PdXlLW2mQrDuMug9gr9DueE17MhCgBxvmo9dW032iExnG3kMbMpA0+X4UHCAwwLJ9QLPR+CZn3Gqa2uU2UdnPXdPX/hwtI1AL40BVwlhni+jN4huJ7j+vmrmkSZKxnVATky6kBMu+c= 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=BzZw8UEv; 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="BzZw8UEv" 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 52B19PQc015125; Tue, 11 Mar 2025 06:27:16 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= h6sqnx+wBvH1HH9YzP5B+LS8zQH4Rl+G+C4BUiWp+Cc=; b=BzZw8UEvttGvA11L Tpmr9fQwYZevyAKfk6p4Zf/jTiiaBqM9L0rsD3cxLT4WgLiWOQHoOOWiobjZpzqG WLXUonWLsC5qgl2Y6kIqfCf0CtVG6m9jXEt5VPxPqVfwh85HKNL76AHc45aqIaEq APdoNgb7h34Q/pV17kjBpnTsDnsaYzXDO5jEK/6K1QP/RItgocHoMcWprdUAhC1H j0LNUYln33gmQD+lefAfstuM5igbo137f5FU1tCJA2m8rAJXOGQsPgnEK72VqIVp IFimxs8zUHX19RJO0DGnaLn0OsjDxIVh8eRyFqbrGm/Gu0drtUsTiOyYsh3unNXO xe9xpg== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45ab8m0qqn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:15 +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 52B6RFY6026402 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:15 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; Mon, 10 Mar 2025 23:27:13 -0700 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH wireless-next v4 01/11] wifi: mac80211: add support towards MLO handling of station statistics Date: Tue, 11 Mar 2025 11:56:44 +0530 Message-ID: <20250311062654.1407532-2-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250311062654.1407532-1-quic_sarishar@quicinc.com> References: <20250311062654.1407532-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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: k6r6-7_C__eC7VsyPoSfm2qyHdC1FU2e X-Authority-Analysis: v=2.4 cv=K9nYHzWI c=1 sm=1 tr=0 ts=67cfd7c3 cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=4qy7MeMMegWVXLquuOAA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: k6r6-7_C__eC7VsyPoSfm2qyHdC1FU2e X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-11_01,2025-03-07_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 spamscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 mlxscore=0 bulkscore=0 malwarescore=0 suspectscore=0 adultscore=0 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2503110041 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 | 71 +++++++++++++------- net/mac80211/sta_info.h | 2 +- net/mac80211/util.c | 14 +++- 6 files changed, 66 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 c498f685d01f..cbb154ce8551 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -7252,13 +7252,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..b89de1f67410 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,27 @@ 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 = wiphy_dereference(sta->local->hw.wiphy, + sta->link[link_id]); + + 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 +2500,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 +2528,27 @@ 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 = wiphy_dereference(sta->local->hw.wiphy, + sta->link[link_id]); + 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 +2560,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 +2643,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 +2671,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 +2760,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 +2809,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 +2898,22 @@ 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 = wiphy_dereference(sta->local->hw.wiphy, + sta->link[link_id]); - 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 49fa38fbe242..2478f412119a 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -3277,14 +3277,24 @@ 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; 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 = wiphy_dereference(sdata->local->hw.wiphy, + sdata->link[link_id]); + + if (WARN_ON(!link_data)) + return -99; + + return -ewma_beacon_signal_read(&link_data->u.mgd.ave_beacon_signal); } EXPORT_SYMBOL_GPL(ieee80211_ave_rssi); From patchwork Tue Mar 11 06:26:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 14011196 X-Patchwork-Delegate: johannes@sipsolutions.net 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 158BC1EDA1A for ; Tue, 11 Mar 2025 06:27:29 +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=1741674451; cv=none; b=VigT4cCk6RVPKsbzEdI/s4+ItkLEykTz7FFTu0LkoKzF/ZQcxJuXEP42w0gY+qN3zLDsvNzTv7kdmqfWABV7Jys6Kc+sh5ZFrWqPsILz9V8M4NVPBE6sUtaNzUHdoc65hlkHwIPKdAQE8gy1Mxym1pepc/SfmXjlQ+Fz5lFsDAU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741674451; c=relaxed/simple; bh=13E1wKmDoq9Wf6r1nk2Ixu/LzDLE6c/ZS7tZE6EJnbY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nTxvihG/2Jevnq4LfO4vX0KZ5G8ZdUMjXwSc86CBLOzc4D7JS1ckeUULkaq+2fKP06QFMHrltw9BUYaLosQZ6sRlGJTUIi+Bcf6hGvA05eUeObH9XLIpOPUmIcR3pZACH+5+vDmtD7feo7zMcMDaaRwh6wpPKpzkl0SNLqY9Nvc= 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=WlvcLuMq; 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="WlvcLuMq" 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 52AIpJlb001921; Tue, 11 Mar 2025 06:27: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= MLOww4LmOw5h0Xt64FjWsWbvMkkW7QFP4ar1xVAPBDE=; b=WlvcLuMqPZuWDdnh LtwOS6yFtjZr5S25mKN1JYRExi6B+3iTw4+VcCCWb3IgWlItRyOf+vky+wuyQxUK n8+CrnSROa+8/R4sqGj6F/d/WACSpzr8WFy8ZCQFGwttixNdCrQWOmjNY8I+3ggH lTyskpCljc9aCTDeocWka3sXubVOCVQ7+XZesJqSt3BWyS491ULu2bX+D7b7UfiW L1nSAjIv80qFkpkmdv/cdsrRYvFPxLSejt3rVyhpsJltZkJF84/lvWoHm3kSQafE Jr+KZK+dOxA/5r6ZirxTA6ZK2cZ2pCjDUmCEr/YrvwSrKZABHdQBG+RryxTc6MHm Bg9DGw== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 458f6afehe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:17 +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 52B6RFIE026409 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27: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; Mon, 10 Mar 2025 23:27:14 -0700 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH wireless-next v4 02/11] wifi: mac80211: refactoring sta_set_sinfo() to add support towards MLO statistics Date: Tue, 11 Mar 2025 11:56:45 +0530 Message-ID: <20250311062654.1407532-3-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250311062654.1407532-1-quic_sarishar@quicinc.com> References: <20250311062654.1407532-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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-Authority-Analysis: v=2.4 cv=WsDRMcfv c=1 sm=1 tr=0 ts=67cfd7c5 cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=QjELkqBCxScqrPlqOBgA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: R2LNWu2U5dyP0hR8p_nXOjiLHx8Rq3IX X-Proofpoint-ORIG-GUID: R2LNWu2U5dyP0hR8p_nXOjiLHx8Rq3IX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-11_01,2025-03-07_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 adultscore=0 impostorscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 clxscore=1015 spamscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2503110042 Refactor sta_set_sinfo() 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 b89de1f67410..e8802396905b 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2634,42 +2634,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)); @@ -2677,26 +2671,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); } @@ -2706,12 +2700,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; } @@ -2720,12 +2714,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); } @@ -2746,12 +2740,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; } } @@ -2773,7 +2767,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); } } @@ -2786,7 +2780,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; @@ -2795,14 +2789,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); } @@ -2818,11 +2812,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; @@ -2830,8 +2819,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) | @@ -2856,27 +2888,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 Tue Mar 11 06:26: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: 14011198 X-Patchwork-Delegate: johannes@sipsolutions.net 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 A98821E5B6D for ; Tue, 11 Mar 2025 06:27: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=1741674453; cv=none; b=s54v8h1u5KMHBHfZ+8HAR2yBynobQUTKjeE2tT7ktHOVva4GneyoPDTQOIodB8pdb/kw+qowqHg2+X1HKMLCmaeDj4kDJw4S5qMxRIpTbV5IP96hD+jBNpP5Rk8QofdOhh9Odj45l/xelKiN5l+uqAjI0KU1VucVBkT2AlE2lrQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741674453; c=relaxed/simple; bh=5ympzavJZUKsNvydZUU6XnsMmF0Uo6U5U8Ptb2BknSw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gKb7Aw/5XP+Y8B2nqvBSYoLEzGXoXG5U6IJaLb3IL1/yC183ue4RhaaE9L883lJu6oVSf9a4WyAw95NVmjWG7hWRIbFniGD+NHYQ+9Zx0bsG6iFloMpbo6r5KosCFWcx5GG8LtENIv+3L/g2ngKIamCqAf7HHH2/DGV+27F7+XI= 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=LrTQUxiy; 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="LrTQUxiy" 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 52AJJ6tw021474; Tue, 11 Mar 2025 06:27:19 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= oFeJGgD+mt7ivvopDpmMUFB0ZUFkc99Zz+stGfkvL4Q=; b=LrTQUxiynikzdpxi ycCRtlF0Js8Rn49eJNyAdXuLEOprpuEoU9gFXQ6d6WjqWDhTAbbzXzkaiBdC5i/Z lDUrQJGUBcB8TMkt/pFpimrIEXp8tMaPVg+uYZ3kl2YDqr3uE/Ac6iHmcHkuJj7l vIuIG9wjeN3NxKmWork24Y0SyZOVhxgyiXMc5c+ytV4BFNPWZdjpmPRMoJuGDQVT oA7dmfmlnhYAm4FHGBsxo6X01Ib9FIw/pNiX8DhukSSqZMtaDTWTFdLFxRcLhIJq Wm8pBEIpHlY+cZz4IOA6RUBQaoDOyQRjY6kzamDfGtJWUz5UvC+lg8RDX6iV0d9i rNx0lA== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 458f0w7b85-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:18 +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 52B6RIQi025486 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:18 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; Mon, 10 Mar 2025 23:27:16 -0700 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH wireless-next v4 03/11] wifi: cfg80211: refactoring nl80211_set_station() for link attributes towards MLO Date: Tue, 11 Mar 2025 11:56:46 +0530 Message-ID: <20250311062654.1407532-4-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250311062654.1407532-1-quic_sarishar@quicinc.com> References: <20250311062654.1407532-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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: NBiTaqh-E0JqLCf9YkpAInyKOY8OvRYR X-Proofpoint-GUID: NBiTaqh-E0JqLCf9YkpAInyKOY8OvRYR X-Authority-Analysis: v=2.4 cv=MICamNZl c=1 sm=1 tr=0 ts=67cfd7c7 cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=CUx-YjeCQ45KwRfDiH4A:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-11_01,2025-03-07_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 spamscore=0 suspectscore=0 priorityscore=1501 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 clxscore=1015 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2503110042 Refactor nl80211_send_station() 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 2c4e06610a79..a970c473a615 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 Tue Mar 11 06:26:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 14011201 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 0AACE1EF38D for ; Tue, 11 Mar 2025 06:27: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=1741674460; cv=none; b=UTSdDsL80r2D0T+2rVYFrEu66ugU4AEoQD2CrJOlUyzQnZp/qOD8wm0dEVMkazoEDqQAaVVDy1fGNVOGFsxeCvPVBB+eCgWjHaBqcUhDFvILRbp4bBJk8271KXkC1ea9eOHNYYx8u9JoH6xjqANHkKw/Cb9pshFEHLudBjZqrMo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741674460; c=relaxed/simple; bh=u4/aTQ24Ku0oyYT/62fC/rs5czDkFsxLMvWmOAtqy3M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=C1wK42DnAbLnC39ouPD6fwqkBPX0WonsSHvE4O0njLP8foDySdp7ppsDCh6J4X+1w/nwWgIE092wmZAiuUpGWKdXjQ5GDxyU7eVRNI9wywWgU2pvfv+AOk+DcvI9IQ+S4dszJg/v2xKw1/nmzFlhLtkSwr65KMDXS8pFMfK47ws= 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=j9RK0fq3; 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="j9RK0fq3" 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 52AL2tUi025411; Tue, 11 Mar 2025 06:27:21 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= ctkEyZI/SlykYV0aKXLrlJj87WahGvt/+ezt6kaGPSw=; b=j9RK0fq3FijVnGBZ XbAzM7y3yLPyqVEvej1ELKAGNzL02nEVmpndyWvn9o+IRG9GvnMiPNOZbM9UtI+b JFjb8vJB9qrnWhEa32ce7Q3Q8rQH/MPN8dsrQtAty+gFuU9MrSKWzYQU7mQmP1Do iwIqZdf0uvR+LurjdRIKmwcKEi6o5/jqx1lAtYjKZ4Hfddu7xTyNBHIjvVxJp4R0 C/hY0eEx8HiMOnJevmcmJ6qHulGcrf3T/hpD7zsAcuXb8uM3k4wEzj0tp2IlKpYQ C5AQKfrlDky20tRifUVWvKV4Lszd4p/NEl4kELJfNirhAVcKzDWeYbCX9ixaOfnE NGw2Cg== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 458ex6ycav-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:21 +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 52B6RKJL001865 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:20 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; Mon, 10 Mar 2025 23:27:18 -0700 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH wireless-next v4 04/11] wifi: cfg80211: reorg sinfo structure elements for MLO Date: Tue, 11 Mar 2025 11:56:47 +0530 Message-ID: <20250311062654.1407532-5-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250311062654.1407532-1-quic_sarishar@quicinc.com> References: <20250311062654.1407532-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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-Authority-Analysis: v=2.4 cv=G8bmE8k5 c=1 sm=1 tr=0 ts=67cfd7c9 cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=kPnKvKXjhSJyMM6TmREA:9 a=4x-jt1a3ahjGyfQ2:21 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: CxfQsKYXzmFwCtZS6GigsGN8PsYc5dNb X-Proofpoint-ORIG-GUID: CxfQsKYXzmFwCtZS6GigsGN8PsYc5dNb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-11_01,2025-03-07_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 suspectscore=0 clxscore=1015 bulkscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 impostorscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2503110042 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 20aaef913e3f..d9694348d88a 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 b6e0b63cbd3c..2a45c2132cfc 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 f9d11a023313..680952c825a8 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 6b170a8d086c..a198b6ee0629 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]; }; /** @@ -8464,7 +8494,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 @@ -8476,7 +8506,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 cbb154ce8551..2888dbdcf25c 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 0397755a3bd1..7d73c00d824d 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 e8802396905b..195eacaca492 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2634,7 +2634,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; @@ -2653,7 +2653,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); @@ -2849,6 +2849,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; @@ -2888,7 +2889,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 a970c473a615..1f51b295c958 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 Tue Mar 11 06:26: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: 14011200 X-Patchwork-Delegate: johannes@sipsolutions.net 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 6E4821E5B6D for ; Tue, 11 Mar 2025 06:27:37 +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=1741674459; cv=none; b=HGnBvA5UHWFXh8lUALrBEavOT4YcBHL6g1Ojd4dLFRGP/hKHmcnbPXcZixuPuPjzYz8TnPZ/BSNYBHmqfCpC5kljunbvxz34cYA6QlEtsrec81HJZqYS+JAHuHZHH0Vzjsaps+7vIuJYhE7PEiRZPCx86v2AL5U2FzmnzNj/z44= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741674459; c=relaxed/simple; bh=BjSdqNsTsHiTj3m7kVd3IZB6+ogeP2qKGDt4u5mdPaA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tc614TG8qxSqSxzr3yQCWui3p3bO9W1NoCHQEkHY48pCStFAT+zchNs8w8CR9UfIE0GmzmVe5vgIcym8vGpTxU0Yy+WwKiZdBnNAY75oZ8JevKkzfXgsZLVgPLGmsvUvyXg9LGM3jsn3QkmP7jyrZXdmr7tPsaov7ZPPIG8J5ck= 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=p5sJJ7EK; 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="p5sJJ7EK" 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 52AIMn9e025707; Tue, 11 Mar 2025 06:27: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= QQOm2TJMzUkv3Gh8QuCD4FHCFI2rJTjOjtMeIcjCmKk=; b=p5sJJ7EKS0d2Gs7I Jt8tNz+BntOP0Bgwt4PJo34SP6AaoHb3ylT4Y61vmQbRjEYCR3C6ZJIiTOkU1iZA t1okDFhS5BQACGFGvk329cbo71Adf1tV4OOyzwu6hgny6swX8A1hPSUm4Q/5Cl4v +SZGj4vKCtQwy8lW3nrcgvJvg7anjJ2iWTk5NMEBMOzmFkBPHi4Rnsd6fDinbwa1 3aJssEftCdMtg4bpYgDB+ItXCOf8pUjz9Mu595RXXQOA1m6KQ4UpM0AOcKvDn+bF nTwCr6BN1YoFkYuQnfQ6H1KIdYNb+KT8aaAr8sViVKkwcgmzEE65WeN3RYQ7en3S DJ4uuw== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 458ewk7bkq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:23 +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 52B6RMSQ025635 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27: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; Mon, 10 Mar 2025 23:27:20 -0700 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH wireless-next v4 05/11] wifi: cfg80211: extend statistics for link level in sinfo Date: Tue, 11 Mar 2025 11:56:48 +0530 Message-ID: <20250311062654.1407532-6-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250311062654.1407532-1-quic_sarishar@quicinc.com> References: <20250311062654.1407532-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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-Authority-Analysis: v=2.4 cv=Tr8chCXh c=1 sm=1 tr=0 ts=67cfd7cb cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=SwNc09q8ckjM_n_EI2QA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: u-sbnkESMGUdKtDS6zAA5QnqnC7NuwvS X-Proofpoint-ORIG-GUID: u-sbnkESMGUdKtDS6zAA5QnqnC7NuwvS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-11_01,2025-03-07_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 mlxlogscore=999 spamscore=0 lowpriorityscore=0 mlxscore=0 clxscore=1015 phishscore=0 malwarescore=0 impostorscore=0 bulkscore=0 adultscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2503110042 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 will be embedded into NL message as below: For MLO: cmd -> NL80211_ATTR_IFINDEX NL80211_ATTR_MAC NL80211_ATTR_GENERATION .......etc NL80211_ATTR_STA_INFO | nested 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 | nested 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 | nested NL80211_STA_INFO_RX_BYTES, NL80211_STA_INFO_TX_BYTES, .........etc For non-ML: cmd-> NL80211_ATTR_IFINDEX NL80211_ATTR_MAC NL80211_ATTR_GENERATION ....etc NL80211_ATTR_STA_INFO | nested 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 will 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 | 20 +++++++----- net/wireless/nl80211.c | 74 +++++++++++++++++++++++++++++++++--------- 2 files changed, 69 insertions(+), 25 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index a198b6ee0629..a7f7bfbc87f3 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]; }; @@ -8506,9 +8504,13 @@ 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; + + for_each_valid_link(sinfo, link_id) { + if (sinfo->links[link_id]) { + kfree(sinfo->links[link_id]->pertid); + kfree(sinfo->links[link_id]); + } } } diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 1f51b295c958..619427513361 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 Tue Mar 11 06:26:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 14011206 X-Patchwork-Delegate: johannes@sipsolutions.net 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 C113B1DE8A8 for ; Tue, 11 Mar 2025 06:27:50 +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=1741674472; cv=none; b=RMqvkPGzk102NzQoVwiQubfYMSGSJW2aFfPjh/bxJisZAzxFIdU369o1oBbKfplfhD63XZdbZUEYamnNxQw2oPuhLdqCRXMeAK9LOc8K/sI1ppDd3VM9ZP2TJtzVIHt2X+ceLYFEet7LDZyEqAn4KDgGVPr3iKt6eowzAPYFkgg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741674472; c=relaxed/simple; bh=zQAgmaBTBSBzbG0pOc9NxcA2P9fXuxmJHI4Ku/6Gfoo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IrdIfzuO5J5VJcfwgYH3xUwL4ioSNliZZ+mflFZ91mI/IrsbJimoltFghzaXIgtqTUNrIhv+w+8i4ryUprRX5D7VcURmC4HbpNW5ZK0j6IeXkEAscfDYeE+TKYWDaLmFN5xudbtWOI9rYv/0EVNN8lYEuK4A+3qYWjsoNO/Nh20= 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=Olvv6ep+; 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="Olvv6ep+" 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 52B19CZ5014492; Tue, 11 Mar 2025 06:27: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= k92y4hrpWKj2/gw4AWKYYwrdS6rTh1R4QVWyg9ReKVI=; b=Olvv6ep+NT52EDKP N2d28bWv7x2x/J3EXCFCjDay7MguAusu+NTMPy3zMBy5p8ywG0Xo8cpg6xlQ0BKS cfOfN4MwZ2RqjiKLImPHdCtpT8xIi90ic6UL2Uf/nXq3s11HhFiSBl2Coskkl6S2 DEqk/Ofd7zb/c1bTb3g8qHZDhimSVHMtsLh/0w2t9knQcn+HoDjbWD6Bqh+eA5y0 VxVA+wQUmTl2y1WTB4xpRgi6WPQhX6i0/vRb5hehLyQkAdT7CrFmpLkTg4GxcvJV CH40ywPiHjiSaIoq6clFwPDGPQbXVpijAAO1nC3P97Ddxxrl7LA5D0nV+coKiw/j ve7Wqw== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45ab8m0qr0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:40 +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 52B6ROoK017769 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:24 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; Mon, 10 Mar 2025 23:27:22 -0700 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH wireless-next v4 06/11] wifi: cfg80211: add flag to indicate driver supports ML station statistics Date: Tue, 11 Mar 2025 11:56:49 +0530 Message-ID: <20250311062654.1407532-7-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250311062654.1407532-1-quic_sarishar@quicinc.com> References: <20250311062654.1407532-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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: 2lhv-TfBieEpKNqeVJIA3OwxydxeQNKX X-Authority-Analysis: v=2.4 cv=K9nYHzWI c=1 sm=1 tr=0 ts=67cfd7dc cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=CilbYTUr6xf_O_4wI94A:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: 2lhv-TfBieEpKNqeVJIA3OwxydxeQNKX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-11_01,2025-03-07_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 spamscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 mlxscore=0 bulkscore=0 malwarescore=0 suspectscore=0 adultscore=0 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2503110042 Currently, while filling NL attributes for 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 if driver supports per-link station statistics and check this flag while filling the station_info structure for MLO and while embedding the info into NL message. Signed-off-by: Sarika Sharma --- include/net/cfg80211.h | 7 +++++++ net/wireless/nl80211.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index a7f7bfbc87f3..0874b0c54ef4 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: false- for non-ML STA and for ML STA,if driver + * offload link decisions and do not provide per-link statistics. + * true- 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; @@ -5065,6 +5069,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), @@ -5093,6 +5099,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), }; /** diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 619427513361..522bcad71874 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 Tue Mar 11 06:26: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: 14011199 X-Patchwork-Delegate: johannes@sipsolutions.net 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 5D2A61EB19F for ; Tue, 11 Mar 2025 06:27: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=1741674458; cv=none; b=edZXUjbOySfi+Zb/3Ju7G9VmmK/3sFozdOyUMl9bWukRlXbms3gOwH0NnXIqf+uFIXRLCG8StI2seNDJhjLXNgQyw+oRRgSJm3qJB34eG8frEoLxJGW6yM3Frze/ydA3xLpk7lwS7feRqU2CctC2ejvtXiuioykVXIddtTEiToQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741674458; c=relaxed/simple; bh=Pvov0gF6wrf7qrjHshWjpcTq+SKfmrE0ok22tEV4/7o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fYk2dVjZDxTA6Owlzm/x6dHxviVy1aIA9Sau6tUDcHMeQuqCHgaFd4xS56hmWcNE47y0Lmpq8HIzXlN1vtm0QHT7ndYdB+9tul8frk12l1woJA6dgnOTe0bBQjGkATmaiiJjJQxiV4386IAuAp5Ev/Fp7mow7l84Bm0y19rhNrY= 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=Xgz6u6Ck; 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="Xgz6u6Ck" 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 52AJh71V016124; Tue, 11 Mar 2025 06:27: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= U0rKKBUpalcbIUwPpCcYj/96C7/WYu9YEnMwJ096WN4=; b=Xgz6u6CkoXgexKFN hifBgWMGG+JgheHfWouV+VeeBjQ0UpBJ4xoHHRRFTDTPfPyTHja3Tmk+6NVZbNQm SOJZM3m0cm3lmw3yEG7MfSOVXzQEMdDxg9Gw5DgzysbZUqywuse3+Qr5FjN8bYLS zRa2Ps3jMeVfkP/AqOLlQJfGCGMizdgjxbMB9hqot5nnO1s5fdZSgvf12Rw7+xj/ gaVlDlhfRhU5qV6Em1Pl8PCodWQiFPix44cJVVALnWKbQ3sHjA6K/Q9im5Q6Rnq9 W1bA75swt2QCq7J55DMamQs5D4DbP4ZLfJ5mJz8lSKPH4+XpzED1A7xJMALK5jYg q36aJQ== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 458ex6ycbb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:26 +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 52B6RQhj027072 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:26 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; Mon, 10 Mar 2025 23:27:24 -0700 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH wireless-next v4 07/11] wifi: cfg80211: add accumulated statistics for MLO links Date: Tue, 11 Mar 2025 11:56:50 +0530 Message-ID: <20250311062654.1407532-8-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250311062654.1407532-1-quic_sarishar@quicinc.com> References: <20250311062654.1407532-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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-Authority-Analysis: v=2.4 cv=G8bmE8k5 c=1 sm=1 tr=0 ts=67cfd7ce cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=Xm4uXzMoczAWyOzwz2QA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: HT8qSIC5T4ohg35okLowRj570eDUVAMv X-Proofpoint-ORIG-GUID: HT8qSIC5T4ohg35okLowRj570eDUVAMv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-11_01,2025-03-07_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 suspectscore=0 clxscore=1015 bulkscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 impostorscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2503110042 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 will be embedded into NL message as below: For MLO: cmd -> NL80211_ATTR_IFINDEX NL80211_ATTR_MAC NL80211_ATTR_GENERATION ......etc NL80211_ATTR_STA_INFO | nested 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 | nested 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 will 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 0874b0c54ef4..6eed887a93b1 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 522bcad71874..58ef0c5df670 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 Tue Mar 11 06:26:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 14011202 X-Patchwork-Delegate: johannes@sipsolutions.net 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 513001EF38D for ; Tue, 11 Mar 2025 06:27: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=1741674463; cv=none; b=ECBGpNZonFQSUk4w2/J9ZvOKA+o5fzHyVr3fkKRk/1qJLT4FX0mVD96UFmfXflDjn47RCb3iRqYyBADQ6K9iMMkh3bxu4Sd08WO1piSv7xywvvYh6tpczkiZslxR18aUriiqWBAVoLKLLGZ+TrAqr0lgmtwGyWq+nNksBr9clLQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741674463; c=relaxed/simple; bh=xINOSLjwzbvwyFApHYN0zH2ocMBG6pfAtRFzEZYJACM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Jqqj+gekwZESMwpk5b2IpBDw+3fnZZydFpcQkdTA7KPtVu0IJ34x02TVt5ISqZvw7qzNBiaTS/LqouSaJ0A4aJilrafScQbFxZZY/blS7uhLC+xriHmV16i8N8Le0fxI6Lop0lDYLMNQTnDKY3kT/r3HUQlBK0uJE5lvJqG/wuc= 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=pp5XKo2r; 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="pp5XKo2r" 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 52AJh71W016124; Tue, 11 Mar 2025 06:27: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= m41POWFYuA4px238zu/pS+bKPDD05rNGr66GOkXX+nQ=; b=pp5XKo2rtBtTxjxX 4Wf+tVUw5LCSVawxrcPFGaVj8NFXZPfykgSkI8N5CQueio66nM40S+1RcxOqHWWA k/H2g//0q9vXyG6s20prohNhmR5H1jysH3/i6+0LKv1wrfIQkwvaczV6OdaXfB65 iXgA3ZpUB6UM5LUb9vYe2EyfLtowcUX3QdBM9reO+MU81Y5CfpLMdwOxzBptz+Te hsQDkkPEkol4iHP3GIRFpUwzAM2NsHIccEYIfoynryKdYooh7BfDGXRaqJ9JCN2I 2SASYw4qQN4j/K1i3yhBWoNDABTQtvLh36rhj/5T2N5Yjx+RKq12eWRBz3IGNgsY 48nKvg== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 458ex6ycbf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:28 +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 52B6RREO027120 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27: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; Mon, 10 Mar 2025 23:27:26 -0700 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH wireless-next v4 08/11] wifi: cfg80211: add additional MLO statistics Date: Tue, 11 Mar 2025 11:56:51 +0530 Message-ID: <20250311062654.1407532-9-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250311062654.1407532-1-quic_sarishar@quicinc.com> References: <20250311062654.1407532-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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-Authority-Analysis: v=2.4 cv=G8bmE8k5 c=1 sm=1 tr=0 ts=67cfd7d0 cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=Efb2vwePRXhTg_DV7VoA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: fhJXZ6fbI0KVRRsIiaAZUhxB2NhEbcT9 X-Proofpoint-ORIG-GUID: fhJXZ6fbI0KVRRsIiaAZUhxB2NhEbcT9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-11_01,2025-03-07_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 suspectscore=0 clxscore=1015 bulkscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 impostorscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2503110042 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, rates, inactive time, dtim_period and beacon_interval 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. The inactive time, dtim_period and beacon_interval can be taken as the least value of field from link level. Signed-off-by: Sarika Sharma --- include/net/cfg80211.h | 11 +++++ net/wireless/nl80211.c | 101 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 109 insertions(+), 3 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 6eed887a93b1..46f24b0c058e 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2180,6 +2180,12 @@ 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) + * @inactive_time: time since last station activity (tx/rx) in milliseconds + * @bss_param: current BSS parameters + * @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 +2228,11 @@ struct station_info { u64 tx_bytes; u32 tx_retries; u32 tx_failed; + u32 inactive_time; + struct sta_bss_parameters bss_param; + 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 58ef0c5df670..2be3318ac17c 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6861,8 +6861,11 @@ 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) { + struct nlattr *bss_param; + PUT_SINFO(RX_PACKETS, rx_packets, u32); PUT_SINFO(TX_PACKETS, tx_packets, u32); PUT_SINFO_U64(RX_BYTES, rx_bytes); @@ -6870,6 +6873,41 @@ 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; + } + + PUT_SINFO(INACTIVE_TIME, inactive_time, u32); + + if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE) && + !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) && + !nl80211_put_sta_rate(msg, &sinfo->rxrate, + NL80211_STA_INFO_RX_BITRATE)) + goto nla_put_failure; + + if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_BSS_PARAM)) { + bss_param = nla_nest_start_noflag(msg, + NL80211_STA_INFO_BSS_PARAM); + if (!bss_param) + goto nla_put_failure; + + if (nla_put_u8(msg, NL80211_STA_BSS_PARAM_DTIM_PERIOD, + sinfo->bss_param.dtim_period) || + nla_put_u16(msg, NL80211_STA_BSS_PARAM_BEACON_INTERVAL, + sinfo->bss_param.beacon_interval)) + goto nla_put_failure; + + nla_nest_end(msg, bss_param); + } + return 0; nla_put_failure: @@ -6923,7 +6961,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 +7039,29 @@ 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) +{ + sinfo_rate->flags = link_sinfo_rate->flags; + sinfo_rate->legacy = link_sinfo_rate->legacy; + sinfo_rate->mcs = link_sinfo_rate->mcs; + sinfo_rate->nss = link_sinfo_rate->nss; + sinfo_rate->bw = link_sinfo_rate->bw; + sinfo_rate->he_gi = link_sinfo_rate->he_gi; + sinfo_rate->he_dcm = link_sinfo_rate->he_dcm; + sinfo_rate->he_ru_alloc = link_sinfo_rate->he_ru_alloc; + sinfo_rate->n_bonded_ch = link_sinfo_rate->n_bonded_ch; + sinfo_rate->eht_gi = link_sinfo_rate->eht_gi; + 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 +7099,44 @@ 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 inactive_time, bss_param based on least + * value for corresponding field of link. + */ + if ((link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME)) && + (!init || link_inactive_time > link_sinfo->inactive_time)) { + link_inactive_time = link_sinfo->inactive_time; + sinfo->inactive_time = link_sinfo->inactive_time; + sinfo->filled |= NL80211_STA_INFO_INACTIVE_TIME; + } + + if (link_sinfo->filled & BIT_ULL(NL80211_STA_INFO_BSS_PARAM) && + (!init || sinfo->bss_param.dtim_period > link_sinfo->bss_param.dtim_period)) { + sinfo->bss_param.dtim_period = link_sinfo->bss_param.dtim_period; + sinfo->filled |= NL80211_STA_BSS_PARAM_DTIM_PERIOD; + sinfo->bss_param.beacon_interval = link_sinfo->bss_param.beacon_interval; + sinfo->filled |= NL80211_STA_BSS_PARAM_BEACON_INTERVAL; + } + + /* 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)) { + 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)) { + cfg80211_sta_set_mld_rate_info(&sinfo->rxrate, &link_sinfo->rxrate); + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); + } + init++; } } From patchwork Tue Mar 11 06:26: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: 14011203 X-Patchwork-Delegate: johannes@sipsolutions.net 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 7684C20B208 for ; Tue, 11 Mar 2025 06:27:43 +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=1741674467; cv=none; b=XFJzWsEFxi0mHvpiS8ln4SWfyugOU01kQ4u4HJ+vzRCq5EW5o6pp0rUhaMXKpMvD1jMxe+2ZzQi8aqiZQItdzXehYwzPxq6UgDWHOwqRa2yzi8lApnV0er5Nsai6KvZmUHgadDC97MbqzPOipfvmgHBP6IOaC+Xj+C4S3n8DfK4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741674467; c=relaxed/simple; bh=7xmG2B9HfH/PfJ8OuUtblf5k5EE+hcRlP9Nqhylnraw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=m+X+dgp2hLNYZ4DjDxuMdNcKQcbQyJsBo1JTcU7hwQ1v9Z/wh7+q7eKvUxF5T8cz9ZwxPLjhQUJUxXwhMQtIT+L0Lg5sUozG/ximyiinG/JbJBLde2I+fT4/ct0wmU0gyu56mv1kNHaKq5qzkobvpCwl3IPpBLsFh8+SShqBBaQ= 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=NVpdqGgE; 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="NVpdqGgE" 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 52AJBp2V020316; Tue, 11 Mar 2025 06:27: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= v7+C0FLk9pA0goCoMnnEm4QgEkmaBNbVNulQBmCMeuQ=; b=NVpdqGgE0OggMh6G Y4EG1h5Wfu15CVmfIeyODKApS4GqJqccp/SoBxXsMGk7pfBE83S3YTlKBsXN7cAc VIaaUXVf1SC9T2sWfmxlDLBcZPoBH5++T6C5FdWhA4huuEVRIlOVbHkiqKCXImkv MUu1mAbXkm6uzIMYPdkUgPHVystES3JM5s2JQ2ncK3HaZzhr7xRUshsi5ym2mYxE UfDoAa0HSHulcgtFdqwYwVS/GCCpoWmNucHfyqYwz+omcaXaTbVwZmFMf27zFzxw crKfUYBnjqSAVH1zyLEqbJW20FGnXjiuw2ONzc4lPpHbuLy+lpRBwjG2vn2T30bj yYZrzA== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 458ex6ycbk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:30 +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 52B6RTcO017962 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27: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; Mon, 10 Mar 2025 23:27:27 -0700 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH wireless-next v4 09/11] wifi: mac80211: extend support to fill link level sinfo structure Date: Tue, 11 Mar 2025 11:56:52 +0530 Message-ID: <20250311062654.1407532-10-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250311062654.1407532-1-quic_sarishar@quicinc.com> References: <20250311062654.1407532-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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-Authority-Analysis: v=2.4 cv=G8bmE8k5 c=1 sm=1 tr=0 ts=67cfd7d2 cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=X_n8wxKkR8uZPODnql0A:9 a=-xfCAL3FBaT3DXZhEJRK:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: 49m-pxbAq2C93Kk4CsjVe07GgDFgNFSD X-Proofpoint-ORIG-GUID: 49m-pxbAq2C93Kk4CsjVe07GgDFgNFSD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-11_01,2025-03-07_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 suspectscore=0 clxscore=1015 bulkscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 impostorscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2503110042 Currently, sinfo structure is supported to fill information at deflink( or one of the links) level for station. This has problems when applied to fetch multi-link(ML) station information. Hence, add changes to verify if driver supports link level statistics and if valid_links are present and if so, support filling link_sinfo structure. This will be helpful to check the link related statistics during MLO. Signed-off-by: Sarika Sharma --- net/mac80211/sta_info.c | 68 +++++++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 16 deletions(-) diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 195eacaca492..9a3daf0a6205 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2637,14 +2637,22 @@ 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; + + + link_id = sinfo->link_id; + last_rxstats = sta_get_last_rx_stats(sta, link_id); - last_rxstats = sta_get_last_rx_stats(sta, -1); + if (link_id < 0) + link_sta_info = &sta->deflink; + else + link_sta_info = wiphy_dereference(sta->local->hw.wiphy, + sta->link[link_id]); /* do before driver, so beacon filtering drivers have a * chance to e.g. just add the number of filtered beacons @@ -2653,6 +2661,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) | @@ -2665,7 +2675,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)))) { @@ -2754,7 +2764,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) || @@ -2794,22 +2804,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; @@ -2849,10 +2857,15 @@ 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->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) | @@ -2889,11 +2902,34 @@ 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->is_per_link_stats_support && sinfo->valid_links) { + memcpy(sinfo->mld_addr, sta->addr, ETH_ALEN); + + for_each_valid_link(sinfo, link_id) { + link_sta = wiphy_dereference(sta->local->hw.wiphy, + sta->link[link_id]); + 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 = wiphy_dereference(sdata->local->hw.wiphy, + sdata->link[link_id]); + 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) From patchwork Tue Mar 11 06:26:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarika Sharma X-Patchwork-Id: 14011204 X-Patchwork-Delegate: johannes@sipsolutions.net 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 9B50C21D59F for ; Tue, 11 Mar 2025 06:27:44 +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=1741674467; cv=none; b=ejqx1bCWGbRUMPsBw0pmWOqlv0a1PNdXGtmsPw49AoRFgXrcWg98fQo9/0dH7SeGXbHENtY0HcuNybrbktkDGqNkBQTyZx7fZ4S3bHm0oF1tsjiHF6kPaYuv3cQ2wljhwlgcsgegE13EHAAJzo7kcZxkDuDE0FA5m5Fgf9dnhqo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741674467; c=relaxed/simple; bh=yLty/p777b18fZ2U24bqVdeVAntr6OJOMlvBfH6bhOE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KUMfzzxXFzSTD18r6z5iU59whhOVjtXspvOYDK8f2DEVw1LFjgqG+nUJHrjq88o+6OkntoQadwFU0ediTNJzvNnWhF+LgOVQIfcA9iNRIMYth9O4eqBvYwfJ8mOGwV1LZOcs6lVIdc2oT1Pto/BGr9l8yX+D/IHm88XiDaE0r6U= 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=m+cSJPUa; 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="m+cSJPUa" 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 52AK0C8K013903; Tue, 11 Mar 2025 06:27:32 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= iArcYGXz9UdbqmH9FHjqqYpNDSLBG/i6RxTDdFl/r2s=; b=m+cSJPUawp+heyRC EpMZ9N47L6JGZzMz5R9dblMk/AW18ZLqTLBjaXtT30ae3ULj+kgYgKS4yeLpk02q zM2kysiEskxCOm5itYOK6s0uoeS4L0zLi8FtXUytDNUyzlfMsNdCoIRPOUKMiYhs MF2qizJrGQg0IZ488jxHfw1BWvJYTojOLDesYdu1r6VFsYZDCQV25n7NBx/usDnx 3CNMEqOaQFjWUaGM5mLxHTb+zOiFZpfKlv4HwhUFs46G1SDiJU6wt2I8v0XxyYjO Bo8PppygxCXktxbjLo26sbThtbyNycYCWBK2B35iTK+q3r6mYtmv+aheO8QzBVYF OJDHAQ== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 458ewk7bme-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:32 +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 52B6RVIj002120 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27: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; Mon, 10 Mar 2025 23:27:29 -0700 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH wireless-next v4 10/11] wifi: mac80211: add support to accumulate removed link statistics Date: Tue, 11 Mar 2025 11:56:53 +0530 Message-ID: <20250311062654.1407532-11-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250311062654.1407532-1-quic_sarishar@quicinc.com> References: <20250311062654.1407532-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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-Authority-Analysis: v=2.4 cv=Tr8chCXh c=1 sm=1 tr=0 ts=67cfd7d4 cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=WJ3WS-W4AXyLPryFm8oA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: OtSsPhviw0Ol3EY1R8-KBEbvhVfWGOc6 X-Proofpoint-ORIG-GUID: OtSsPhviw0Ol3EY1R8-KBEbvhVfWGOc6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-11_01,2025-03-07_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 mlxlogscore=999 spamscore=0 lowpriorityscore=0 mlxscore=0 clxscore=1015 phishscore=0 malwarescore=0 impostorscore=0 bulkscore=0 adultscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2503110042 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 | 35 +++++++++++++++++++++++++++++++++++ net/mac80211/sta_info.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 9a3daf0a6205..478761438e2f 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -356,6 +356,23 @@ 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 = wiphy_dereference(sta->local->hw.wiphy, + sta->link[link_id]); + 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 +395,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) { @@ -2853,6 +2874,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) { @@ -2921,6 +2953,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 Tue Mar 11 06:26: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: 14011205 X-Patchwork-Delegate: johannes@sipsolutions.net 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 C34DB21421F for ; Tue, 11 Mar 2025 06:27: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=1741674468; cv=none; b=hpVaw351SNbs2CaPLe16HwFxkDiD2+WEfVch/NA8bAPUyRN4AXd6AKS6dUSbpTVAg7cuthzy0hHDhmKy5N+Ukgx6WEWQDbO0vqHUD9cXDK/OzYRIVXweaUBk8S1El1l2kLwYX5VWe1PqsCHmcuL/svNNOxVNXxkGcxEQg8waWag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741674468; c=relaxed/simple; bh=MAIoVozCuQp4oaKQWW9H9Yde1LiLxsfO+ytvOrPRrlM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OJG/+8JXkDCbUeAXtWGIJpC9bAuFNOtW7hcrJzgeYNT174I+sIZ5w93P/nDJ81qtKLlvIp0MPfCYusUbiYGB/YNtjG9lDPRoecXKWUZJ2F0fc1dPKnSAuXYbUE26k8HbQFjEZMyTALi853/q7OvnwFmjGe6Qo3bhLH6VV+kh+60= 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=OtvTP6Y6; 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="OtvTP6Y6" 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 52AJHXNN028422; Tue, 11 Mar 2025 06:27:34 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= QtOJiBRZyeoVQvmn25VkNhBTqiVDVStAs0J5FRCqnnc=; b=OtvTP6Y6hSoN23rS U0GfIznjFBGma70+HjbfWRCgBVzV2eXdBxFfzDemEX04WVrXJF0Mh5Mn4TXpjJ5f ez7HZHtX4wP2rx+74K4GIzHV1HoIb/pDtXNG24poZVZw2fzgUK1LNmDraHugUTe7 M/tDZ39FM0myaGqnLKgua6oTBUhqndcsRsLl4/CDvyx7wDTULfUtEtzSJ0VvhwCF rhQwgHjftBPGlugwWs+Pa32AMd5ObQjSdkF6SwnecYM83K81iB36yIQDX22WeCW6 97/bOuP2maBpdq9lDsK1Y/9rGQ89NnBHN0Cbg5rrfWHLPtrIo4J13kzkkQmQ427G GYUFOw== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 458f6afej8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27: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 52B6RX5d027327 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Mar 2025 06:27:33 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; Mon, 10 Mar 2025 23:27:31 -0700 From: Sarika Sharma To: CC: , Sarika Sharma Subject: [PATCH wireless-next v4 11/11] wifi: mac80211: correct RX stats packet increment for multi-link Date: Tue, 11 Mar 2025 11:56:54 +0530 Message-ID: <20250311062654.1407532-12-quic_sarishar@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250311062654.1407532-1-quic_sarishar@quicinc.com> References: <20250311062654.1407532-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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-Authority-Analysis: v=2.4 cv=WsDRMcfv c=1 sm=1 tr=0 ts=67cfd7d5 cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=DHE891H7Gske2VlohvUA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: 7plu3G_zYrlh_jdARKlgM5bHbckbVsh4 X-Proofpoint-ORIG-GUID: 7plu3G_zYrlh_jdARKlgM5bHbckbVsh4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-11_01,2025-03-07_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 adultscore=0 impostorscore=0 phishscore=0 mlxscore=0 mlxlogscore=984 clxscore=1015 spamscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502100000 definitions=main-2503110042 Currently, RX stats packets are incremented for deflink member for non-ML and multi-link(ML) station case. However, for ML station, packets should be incremented based on the specific link. Therefore, if a valid link_id is present, fetch the corresponding link station information and increment the RX packets for that link. For non-MLO stations, the deflink will still be used. Signed-off-by: Sarika Sharma --- net/mac80211/rx.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index f40e2ea1b09a..c9a6a94e254b 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -231,8 +231,19 @@ static void __ieee80211_queue_skb_to_iface(struct ieee80211_sub_if_data *sdata, skb_queue_tail(&sdata->skb_queue, skb); wiphy_work_queue(sdata->local->hw.wiphy, &sdata->work); - if (sta) - sta->deflink.rx_stats.packets++; + if (sta) { + struct link_sta_info *link_sta_info; + + if (link_id >= 0) { + link_sta_info = rcu_dereference(sta->link[link_id]); + if (!link_sta_info) + return; + } else { + link_sta_info = &sta->deflink; + } + + link_sta_info->rx_stats.packets++; + } } static void ieee80211_queue_skb_to_iface(struct ieee80211_sub_if_data *sdata,