1 /*- 2 * Copyright (c) 2020-2025 The FreeBSD Foundation 3 * 4 * This software was developed by Björn Zeeb under sponsorship from 5 * the FreeBSD Foundation. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 31 /* 32 * XXX-BZ: 33 * This file is left as a wrapper to make mvm compile and we will only 34 * deal with it on a need basis. Most newer chipsets do this in firmware. 35 */ 36 37 #ifndef _IWLWIFI_MVM_RS_H 38 #define _IWLWIFI_MVM_RS_H 39 40 #include <net/mac80211.h> 41 42 #include "iwl-trans.h" 43 #include "fw-api.h" 44 45 #define RS_NAME "XXX_unknown" 46 47 #define LINK_QUAL_AGG_FRAME_LIMIT_DEF (64-1) 48 #define LINK_QUAL_AGG_FRAME_LIMIT_GEN2_DEF (256-1) 49 50 struct iwl_mvm; 51 52 struct iwl_lq_sta_rs_fw { 53 int last_rate_n_flags; 54 struct { 55 struct iwl_mvm *drv; 56 uint8_t sta_id; 57 uint8_t chains; 58 uint8_t chain_signal[IEEE80211_MAX_CHAINS]; 59 uint8_t last_rssi; 60 #ifdef CONFIG_MAC80211_DEBUGFS 61 uint32_t dbg_fixed_rate; 62 uint32_t dbg_agg_frame_count_lim; 63 #endif 64 } pers; 65 }; 66 67 struct iwl_lq_sta { 68 struct iwl_lq_cmd lq; 69 struct { 70 spinlock_t lock; 71 uint16_t max_agg_bufsize; 72 /* 73 * Based on the assumption that these are in "FW" too and 74 * there is a f() to set last_rssi add them here too. 75 */ 76 uint8_t chains; 77 uint8_t chain_signal[IEEE80211_MAX_CHAINS]; 78 uint8_t last_rssi; 79 } pers; 80 }; 81 82 #define RS_DRV_DATA_PACK(_c, _f) ((void *)(uintptr_t)(_c | (uintptr_t)(_f) << sizeof(_c))) /* XXX TODO | ? */ 83 84 struct iwl_mvm_sta; 85 struct iwl_mvm_link_sta; 86 87 #ifdef CONFIG_IWLWIFI_DEBUGFS 88 void iwl_mvm_reset_frame_stats(struct iwl_mvm *); 89 #endif 90 91 void iwl_mvm_rs_add_sta(struct iwl_mvm *, struct iwl_mvm_sta *); 92 void iwl_mvm_tlc_update_notif(struct iwl_mvm *, struct iwl_rx_cmd_buffer *); 93 u16 rs_fw_get_max_amsdu_len(struct ieee80211_sta *, 94 struct ieee80211_bss_conf *, struct ieee80211_link_sta *); 95 void rs_fw_rate_init(struct iwl_mvm *, struct ieee80211_sta *, 96 enum nl80211_band, bool); 97 int rs_fw_tx_protection(struct iwl_mvm *, struct iwl_mvm_sta *, bool); 98 int iwl_mvm_tx_protection(struct iwl_mvm *, struct iwl_mvm_sta *, bool); 99 100 int iwl_mvm_rate_control_register(void); 101 void iwl_mvm_rate_control_unregister(void); 102 void iwl_mvm_rs_rate_init(struct iwl_mvm *, struct ieee80211_vif *, 103 struct ieee80211_sta *, struct ieee80211_bss_conf *, 104 struct ieee80211_link_sta *, enum nl80211_band); 105 void iwl_mvm_rs_fw_rate_init(struct iwl_mvm *, struct ieee80211_vif *, 106 struct ieee80211_sta *, struct ieee80211_bss_conf *, 107 struct ieee80211_link_sta *, enum nl80211_band); 108 void iwl_mvm_rs_tx_status(struct iwl_mvm *, struct ieee80211_sta *, 109 int, struct ieee80211_tx_info *, bool); 110 void iwl_mvm_rs_add_sta_link(struct iwl_mvm *, struct iwl_mvm_link_sta *); 111 112 #endif /* _IWLWIFI_MVM_RS_H */ 113