Search Linux Wireless

Re: [PATCH wireless-next v8 06/10] wifi: mac80211: add support to accumulate removed link statistics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/15/2025 11:08 PM, Ben Greear wrote:
On 5/15/25 10:35, Sarika Sharma wrote:
On 5/15/2025 5:00 PM, Johannes Berg wrote:
On Thu, 2025-05-15 at 11:19 +0530, Sarika Sharma wrote:

+void sta_set_accumulated_removed_links_sinfo(struct sta_info *sta,
+                         struct station_info *sinfo)
+{
+    /* Resetting the MLO statistics for accumulated fields, to
+     * avoid duplication.
+     */
+    sinfo->tx_packets = 0;
+    sinfo->rx_packets = 0;
+    sinfo->tx_bytes = 0;
+    sinfo->rx_bytes = 0;
+    sinfo->tx_retries = 0;
+    sinfo->tx_failed = 0;
+    sinfo->rx_dropped_misc = 0;
+    sinfo->beacon_loss_count = 0;
+    sinfo->expected_throughput = 0;
+    sinfo->rx_mpdu_count = 0;
+    sinfo->fcs_err_count = 0;
+    sinfo->rx_beacon = 0;
+    sinfo->rx_duration = 0;
+    sinfo->tx_duration = 0;
+
+    /* Accumulating the removed link statistics. */
+    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;
+    sinfo->rx_dropped_misc += sta->rem_link_stats.rx_dropped_misc;

Setting something to 0 just to += it seems silly?

However I think it also needs a bit more explanation - it's sinfo, so
it's zeroed at allocation, where would non-zero numbers come from?

Currently, the station information for MLO is populated with some values from sta->deflink, as the sta_set_sinfo() call is common for both non-MLO and MLO.

When updating the station_info structure in cfg80211_sta_set_mld_sinfo(), the accumulated fields (such as packets, bytes, etc.) will already contain values set by mac80211 (from the deflink fields).

Therefore, directly adding to these fields would be incorrect, so they should be reset to zero.

May be this, resetting can be done directly in cfg80211 during cfg80211_sta_set_mld_sinfo(), will correct this.

If nothing else, you could just do assignment instead of setting to zero and then
incrementing?

I did not actually review the over-all logic, so perhaps there are bigger
issues I'm not aware of.

Yes, here I can directly use assignment.
But some of fields I need to reset to 0 in cfg80211.
Will check and update this in next version.


Thanks,
Ben







[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux