]> git.baikalelectronics.ru Git - kernel.git/commitdiff
wifi: mac80211: use the corresponding link for stats update
authorVasanthakumar Thiagarajan <quic_vthiagar@quicinc.com>
Wed, 17 Aug 2022 10:42:13 +0000 (16:12 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 25 Aug 2022 08:41:16 +0000 (10:41 +0200)
With link_id reported in rx_status for MLO connection, do the
stats update on the appropriate link instead of always deflink.

Signed-off-by: Vasanthakumar Thiagarajan <quic_vthiagar@quicinc.com>
Link: https://lore.kernel.org/r/20220817104213.2531-3-quic_vthiagar@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/rx.c

index 3af0c4200e0be9fbc67ca9a6f6378a0a52fc5a69..d4df2dc5844fa72974f8e76a963aac3baaebb398 100644 (file)
@@ -4522,19 +4522,30 @@ static void ieee80211_rx_8023(struct ieee80211_rx_data *rx,
        struct ieee80211_sta_rx_stats *stats;
        struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb);
        struct sta_info *sta = rx->sta;
+       struct link_sta_info *link_sta;
        struct sk_buff *skb = rx->skb;
        void *sa = skb->data + ETH_ALEN;
        void *da = skb->data;
 
-       stats = &sta->deflink.rx_stats;
+       if (rx->link_id >= 0) {
+               link_sta = rcu_dereference(sta->link[rx->link_id]);
+               if (WARN_ON_ONCE(!link_sta)) {
+                       dev_kfree_skb(rx->skb);
+                       return;
+               }
+       } else {
+               link_sta = &sta->deflink;
+       }
+
+       stats = &link_sta->rx_stats;
        if (fast_rx->uses_rss)
-               stats = this_cpu_ptr(sta->deflink.pcpu_rx_stats);
+               stats = this_cpu_ptr(link_sta->pcpu_rx_stats);
 
        /* statistics part of ieee80211_rx_h_sta_process() */
        if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) {
                stats->last_signal = status->signal;
                if (!fast_rx->uses_rss)
-                       ewma_signal_add(&sta->deflink.rx_stats_avg.signal,
+                       ewma_signal_add(&link_sta->rx_stats_avg.signal,
                                        -status->signal);
        }
 
@@ -4550,7 +4561,7 @@ static void ieee80211_rx_8023(struct ieee80211_rx_data *rx,
 
                        stats->chain_signal_last[i] = signal;
                        if (!fast_rx->uses_rss)
-                               ewma_signal_add(&sta->deflink.rx_stats_avg.chain_signal[i],
+                               ewma_signal_add(&link_sta->rx_stats_avg.chain_signal[i],
                                                -signal);
                }
        }
@@ -4626,7 +4637,8 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx,
                u8 da[ETH_ALEN];
                u8 sa[ETH_ALEN];
        } addrs __aligned(2);
-       struct ieee80211_sta_rx_stats *stats = &sta->deflink.rx_stats;
+       struct link_sta_info *link_sta;
+       struct ieee80211_sta_rx_stats *stats;
 
        /* for parallel-rx, we need to have DUP_VALIDATED, otherwise we write
         * to a common data structure; drivers can implement that per queue
@@ -4727,8 +4739,19 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx,
        return true;
  drop:
        dev_kfree_skb(skb);
+
+       if (rx->link_id >= 0) {
+               link_sta = rcu_dereference(sta->link[rx->link_id]);
+               if (!link_sta)
+                       return true;
+       } else {
+               link_sta = &sta->deflink;
+       }
+
        if (fast_rx->uses_rss)
-               stats = this_cpu_ptr(sta->deflink.pcpu_rx_stats);
+               stats = this_cpu_ptr(link_sta->pcpu_rx_stats);
+       else
+               stats = &link_sta->rx_stats;
 
        stats->dropped++;
        return true;