sta.c (011b1134b82c2750d83a299a1369c678845de45a) | sta.c (6958c4becdf89c2877edd901458ae18ecd06169f) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2/* 3 * Copyright (C) 2012-2015, 2018-2024 Intel Corporation 4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 5 * Copyright (C) 2016-2017 Intel Deutschland GmbH 6 */ 7#include <net/mac80211.h> 8 --- 2834 unchanged lines hidden (view full) --- 2843 struct ieee80211_sta *sta, 2844 bool start, int tid, u16 ssn, 2845 u16 buf_size, int baid) 2846{ 2847 struct iwl_rx_baid_cfg_cmd cmd = { 2848 .action = start ? cpu_to_le32(IWL_RX_BAID_ACTION_ADD) : 2849 cpu_to_le32(IWL_RX_BAID_ACTION_REMOVE), 2850 }; | 1// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2/* 3 * Copyright (C) 2012-2015, 2018-2024 Intel Corporation 4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 5 * Copyright (C) 2016-2017 Intel Deutschland GmbH 6 */ 7#include <net/mac80211.h> 8 --- 2834 unchanged lines hidden (view full) --- 2843 struct ieee80211_sta *sta, 2844 bool start, int tid, u16 ssn, 2845 u16 buf_size, int baid) 2846{ 2847 struct iwl_rx_baid_cfg_cmd cmd = { 2848 .action = start ? cpu_to_le32(IWL_RX_BAID_ACTION_ADD) : 2849 cpu_to_le32(IWL_RX_BAID_ACTION_REMOVE), 2850 }; |
2851 struct iwl_host_cmd hcmd = { 2852 .id = WIDE_ID(DATA_PATH_GROUP, RX_BAID_ALLOCATION_CONFIG_CMD), 2853 .flags = CMD_SEND_IN_RFKILL, 2854 .len[0] = sizeof(cmd), 2855 .data[0] = &cmd, 2856 }; | 2851 u32 cmd_id = WIDE_ID(DATA_PATH_GROUP, RX_BAID_ALLOCATION_CONFIG_CMD); |
2857 int ret; 2858 2859 BUILD_BUG_ON(sizeof(struct iwl_rx_baid_cfg_resp) != sizeof(baid)); 2860 2861 if (start) { 2862 cmd.alloc.sta_id_mask = 2863 cpu_to_le32(iwl_mvm_sta_fw_id_mask(mvm, sta, -1)); 2864 cmd.alloc.tid = tid; 2865 cmd.alloc.ssn = cpu_to_le16(ssn); 2866 cmd.alloc.win_size = cpu_to_le16(buf_size); 2867 baid = -EIO; | 2852 int ret; 2853 2854 BUILD_BUG_ON(sizeof(struct iwl_rx_baid_cfg_resp) != sizeof(baid)); 2855 2856 if (start) { 2857 cmd.alloc.sta_id_mask = 2858 cpu_to_le32(iwl_mvm_sta_fw_id_mask(mvm, sta, -1)); 2859 cmd.alloc.tid = tid; 2860 cmd.alloc.ssn = cpu_to_le16(ssn); 2861 cmd.alloc.win_size = cpu_to_le16(buf_size); 2862 baid = -EIO; |
2868 } else if (iwl_fw_lookup_cmd_ver(mvm->fw, hcmd.id, 1) == 1) { | 2863 } else if (iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 1) == 1) { |
2869 cmd.remove_v1.baid = cpu_to_le32(baid); 2870 BUILD_BUG_ON(sizeof(cmd.remove_v1) > sizeof(cmd.remove)); 2871 } else { 2872 cmd.remove.sta_id_mask = 2873 cpu_to_le32(iwl_mvm_sta_fw_id_mask(mvm, sta, -1)); 2874 cmd.remove.tid = cpu_to_le32(tid); 2875 } 2876 | 2864 cmd.remove_v1.baid = cpu_to_le32(baid); 2865 BUILD_BUG_ON(sizeof(cmd.remove_v1) > sizeof(cmd.remove)); 2866 } else { 2867 cmd.remove.sta_id_mask = 2868 cpu_to_le32(iwl_mvm_sta_fw_id_mask(mvm, sta, -1)); 2869 cmd.remove.tid = cpu_to_le32(tid); 2870 } 2871 |
2877 ret = iwl_mvm_send_cmd_status(mvm, &hcmd, &baid); | 2872 ret = iwl_mvm_send_cmd_pdu_status(mvm, cmd_id, sizeof(cmd), 2873 &cmd, &baid); |
2878 if (ret) 2879 return ret; 2880 2881 if (!start) { 2882 /* ignore firmware baid on remove */ 2883 baid = 0; 2884 } 2885 --- 1542 unchanged lines hidden (view full) --- 4428} 4429 4430#define IWL_MVM_TPT_COUNT_WINDOW (IWL_MVM_TPT_COUNT_WINDOW_SEC * HZ) 4431 4432void iwl_mvm_count_mpdu(struct iwl_mvm_sta *mvm_sta, u8 fw_sta_id, u32 count, 4433 bool tx, int queue) 4434{ 4435 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(mvm_sta->vif); | 2874 if (ret) 2875 return ret; 2876 2877 if (!start) { 2878 /* ignore firmware baid on remove */ 2879 baid = 0; 2880 } 2881 --- 1542 unchanged lines hidden (view full) --- 4424} 4425 4426#define IWL_MVM_TPT_COUNT_WINDOW (IWL_MVM_TPT_COUNT_WINDOW_SEC * HZ) 4427 4428void iwl_mvm_count_mpdu(struct iwl_mvm_sta *mvm_sta, u8 fw_sta_id, u32 count, 4429 bool tx, int queue) 4430{ 4431 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(mvm_sta->vif); |
4432 struct iwl_mvm *mvm = mvmvif->mvm; |
|
4436 struct iwl_mvm_tpt_counter *queue_counter; 4437 struct iwl_mvm_mpdu_counter *link_counter; 4438 u32 total_mpdus = 0; 4439 int fw_link_id; 4440 4441 /* Count only for a BSS sta, and only when EMLSR is possible */ 4442 if (!mvm_sta->mpdu_counters) 4443 return; --- 20 unchanged lines hidden (view full) --- 4464 if (mvmvif->esr_active) 4465 goto out; 4466 4467 if (time_is_before_jiffies(queue_counter->window_start + 4468 IWL_MVM_TPT_COUNT_WINDOW)) { 4469 memset(queue_counter->per_link, 0, 4470 sizeof(queue_counter->per_link)); 4471 queue_counter->window_start = jiffies; | 4433 struct iwl_mvm_tpt_counter *queue_counter; 4434 struct iwl_mvm_mpdu_counter *link_counter; 4435 u32 total_mpdus = 0; 4436 int fw_link_id; 4437 4438 /* Count only for a BSS sta, and only when EMLSR is possible */ 4439 if (!mvm_sta->mpdu_counters) 4440 return; --- 20 unchanged lines hidden (view full) --- 4461 if (mvmvif->esr_active) 4462 goto out; 4463 4464 if (time_is_before_jiffies(queue_counter->window_start + 4465 IWL_MVM_TPT_COUNT_WINDOW)) { 4466 memset(queue_counter->per_link, 0, 4467 sizeof(queue_counter->per_link)); 4468 queue_counter->window_start = jiffies; |
4469 4470 IWL_DEBUG_STATS(mvm, "MPDU counters are cleared\n"); |
|
4472 } 4473 4474 for (int i = 0; i < IWL_MVM_FW_MAX_LINK_ID; i++) 4475 total_mpdus += tx ? queue_counter->per_link[i].tx : 4476 queue_counter->per_link[i].rx; 4477 4478 if (total_mpdus > IWL_MVM_ENTER_ESR_TPT_THRESH) 4479 wiphy_work_queue(mvmvif->mvm->hw->wiphy, 4480 &mvmvif->unblock_esr_tpt_wk); 4481 4482out: 4483 spin_unlock_bh(&queue_counter->lock); 4484} | 4471 } 4472 4473 for (int i = 0; i < IWL_MVM_FW_MAX_LINK_ID; i++) 4474 total_mpdus += tx ? queue_counter->per_link[i].tx : 4475 queue_counter->per_link[i].rx; 4476 4477 if (total_mpdus > IWL_MVM_ENTER_ESR_TPT_THRESH) 4478 wiphy_work_queue(mvmvif->mvm->hw->wiphy, 4479 &mvmvif->unblock_esr_tpt_wk); 4480 4481out: 4482 spin_unlock_bh(&queue_counter->lock); 4483} |