1 /*- 2 * Copyright (c) 2020-2021 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 } pers; 73 }; 74 75 #define RS_DRV_DATA_PACK(_c, _f) ((void *)(uintptr_t)(_c | (uintptr_t)(_f) << sizeof(_c))) /* XXX TODO | ? */ 76 77 struct iwl_mvm_sta; 78 struct iwl_mvm_link_sta; 79 80 #ifdef CONFIG_IWLWIFI_DEBUGFS 81 void iwl_mvm_reset_frame_stats(struct iwl_mvm *); 82 #endif 83 84 void iwl_mvm_rs_add_sta(struct iwl_mvm *, struct iwl_mvm_sta *); 85 void iwl_mvm_tlc_update_notif(struct iwl_mvm *, struct iwl_rx_cmd_buffer *); 86 u16 rs_fw_get_max_amsdu_len(struct ieee80211_sta *, 87 struct ieee80211_bss_conf *, struct ieee80211_link_sta *); 88 void rs_fw_rate_init(struct iwl_mvm *, struct ieee80211_sta *, 89 enum nl80211_band, bool); 90 int rs_fw_tx_protection(struct iwl_mvm *, struct iwl_mvm_sta *, bool); 91 int iwl_mvm_tx_protection(struct iwl_mvm *, struct iwl_mvm_sta *, bool); 92 93 int iwl_mvm_rate_control_register(void); 94 void iwl_mvm_rate_control_unregister(void); 95 void iwl_mvm_rs_rate_init(struct iwl_mvm *, struct ieee80211_vif *, 96 struct ieee80211_sta *, struct ieee80211_bss_conf *, 97 struct ieee80211_link_sta *, enum nl80211_band); 98 void iwl_mvm_rs_fw_rate_init(struct iwl_mvm *, struct ieee80211_vif *, 99 struct ieee80211_sta *, struct ieee80211_bss_conf *, 100 struct ieee80211_link_sta *, enum nl80211_band); 101 void iwl_mvm_rs_tx_status(struct iwl_mvm *, struct ieee80211_sta *, 102 int, struct ieee80211_tx_info *, bool); 103 void iwl_mvm_rs_add_sta_link(struct iwl_mvm *, struct iwl_mvm_link_sta *); 104 105 #endif /* _IWLWIFI_MVM_RS_H */ 106