wifi: iwlwifi: mvm: move max_agg_bufsize into host TLC lq_sta
authorGregory Greenman <gregory.greenman@intel.com>
Wed, 29 Mar 2023 07:05:36 +0000 (10:05 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 30 Mar 2023 10:08:43 +0000 (12:08 +0200)
This field is used only for host TLC, so it can reside inside
the corresponding lq_sta struct. Also, TLC lq_sta is cleared
in iwl_mvm_rs_rate_init() upon association, but max_agg_bufsize
is set earlier in iwl_mvm_sta_init(). Thus, place this field
in the persistent part of lq_sta to retain its value.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100040.d55361064e39.Ib79d30f27d94607d097f0192af2aacd455a17958@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/rs.c
drivers/net/wireless/intel/iwlwifi/mvm/rs.h
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
drivers/net/wireless/intel/iwlwifi/mvm/sta.h

index 161a329..ab82965 100644 (file)
@@ -3607,7 +3607,7 @@ static void rs_fill_lq_cmd(struct iwl_mvm *mvm,
            num_of_ant(initial_rate->ant) == 1)
                lq_cmd->single_stream_ant_msk = initial_rate->ant;
 
-       lq_cmd->agg_frame_cnt_limit = mvmsta->max_agg_bufsize;
+       lq_cmd->agg_frame_cnt_limit = lq_sta->pers.max_agg_bufsize;
 
        /*
         * In case of low latency, tell the firmware to leave a frame in the
index c3145cb..f99603b 100644 (file)
@@ -1,10 +1,9 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2017 Intel Deutschland GmbH
- * Copyright(c) 2018 - 2019 Intel Corporation
+ * Copyright (C) 2003 - 2014, 2018 - 2022 Intel Corporation
  *****************************************************************************/
 
 #ifndef __rs_h__
@@ -204,6 +203,7 @@ struct rs_rate {
 /**
  * struct iwl_lq_sta_rs_fw - rate and related statistics for RS in FW
  * @last_rate_n_flags: last rate reported by FW
+ * @max_agg_bufsize: the maximal size of the AGG buffer for this station
  * @sta_id: the id of the station
 #ifdef CONFIG_MAC80211_DEBUGFS
  * @dbg_fixed_rate: for debug, use fixed rate if not 0
@@ -353,6 +353,7 @@ struct iwl_lq_sta {
 
        /* last tx rate_n_flags */
        u32 last_rate_n_flags;
+
        /* packets destined for this STA are aggregated */
        u8 is_agg;
 
@@ -371,6 +372,7 @@ struct iwl_lq_sta {
                u8 chains;
                s8 chain_signal[IEEE80211_MAX_CHAINS];
                s8 last_rssi;
+               u16 max_agg_bufsize;
                struct rs_rate_stats tx_stats[RS_COLUMN_COUNT][IWL_RATE_COUNT];
                struct iwl_mvm *drv;
                spinlock_t lock; /* for races in reinit/update table */
index 9a3a7ea..db6a341 100644 (file)
@@ -1719,10 +1719,10 @@ int iwl_mvm_sta_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
                rcu_assign_pointer(mvm_sta->link[0], &mvm_sta->deflink);
 
                if (!mvm->trans->trans_cfg->gen2)
-                       mvm_sta->max_agg_bufsize =
+                       mvm_sta->deflink.lq_sta.rs_drv.pers.max_agg_bufsize =
                                LINK_QUAL_AGG_FRAME_LIMIT_DEF;
                else
-                       mvm_sta->max_agg_bufsize =
+                       mvm_sta->deflink.lq_sta.rs_drv.pers.max_agg_bufsize =
                                LINK_QUAL_AGG_FRAME_LIMIT_GEN2_DEF;
        }
 
@@ -3258,10 +3258,11 @@ out:
         * for each station. Therefore, use the minimum of all the
         * aggregation sessions and our default value.
         */
-       mvmsta->max_agg_bufsize =
-               min(mvmsta->max_agg_bufsize, buf_size);
+       mvmsta->deflink.lq_sta.rs_drv.pers.max_agg_bufsize =
+               min(mvmsta->deflink.lq_sta.rs_drv.pers.max_agg_bufsize,
+                   buf_size);
        mvmsta->deflink.lq_sta.rs_drv.lq.agg_frame_cnt_limit =
-               mvmsta->max_agg_bufsize;
+               mvmsta->deflink.lq_sta.rs_drv.pers.max_agg_bufsize;
 
        IWL_DEBUG_HT(mvm, "Tx aggregation enabled on ra = %pM tid = %d\n",
                     sta->addr, tid);
index 824d120..625e1df 100644 (file)
@@ -355,7 +355,6 @@ struct iwl_mvm_link_sta {
  * @mac_id_n_color: the MAC context this station is linked to
  * @tid_disable_agg: bitmap: if bit(tid) is set, the fw won't send ampdus for
  *     tid.
- * @max_agg_bufsize: the maximal size of the AGG buffer for this station
  * @sta_type: station type
  * @sta_state: station state according to enum %ieee80211_sta_state
  * @bt_reduced_txpower: is reduced tx power enabled for this station
@@ -406,7 +405,6 @@ struct iwl_mvm_sta {
        u32 tfd_queue_msk;
        u32 mac_id_n_color;
        u16 tid_disable_agg;
-       u16 max_agg_bufsize;
        u8 sta_type;
        enum ieee80211_sta_state sta_state;
        bool bt_reduced_txpower;