1 /****************************************************************************** 2 * 3 * This file is provided under a dual BSD/GPLv2 license. When using or 4 * redistributing this file, you may do so under either license. 5 * 6 * GPL LICENSE SUMMARY 7 * 8 * Copyright(c) 2012 - 2014, 2020 Intel Corporation. All rights reserved. 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 11 * 12 * This program is free software; you can redistribute it and/or modify 13 * it under the terms of version 2 of the GNU General Public License as 14 * published by the Free Software Foundation. 15 * 16 * This program is distributed in the hope that it will be useful, but 17 * WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * General Public License for more details. 20 * 21 * The full GNU General Public License is included in this distribution 22 * in the file called COPYING. 23 * 24 * Contact Information: 25 * Intel Linux Wireless <linuxwifi@intel.com> 26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 27 * 28 * BSD LICENSE 29 * 30 * Copyright(c) 2012 - 2014, 2020 Intel Corporation. All rights reserved. 31 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * All rights reserved. 34 * 35 * Redistribution and use in source and binary forms, with or without 36 * modification, are permitted provided that the following conditions 37 * are met: 38 * 39 * * Redistributions of source code must retain the above copyright 40 * notice, this list of conditions and the following disclaimer. 41 * * Redistributions in binary form must reproduce the above copyright 42 * notice, this list of conditions and the following disclaimer in 43 * the documentation and/or other materials provided with the 44 * distribution. 45 * * Neither the name Intel Corporation nor the names of its 46 * contributors may be used to endorse or promote products derived 47 * from this software without specific prior written permission. 48 * 49 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 50 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 51 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 52 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 53 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 54 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 55 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 56 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 57 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 58 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 59 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 * 61 *****************************************************************************/ 62 #ifndef __iwl_fw_api_binding_h__ 63 #define __iwl_fw_api_binding_h__ 64 65 #include <fw/file.h> 66 #include <fw/img.h> 67 68 #define MAX_MACS_IN_BINDING (3) 69 #define MAX_BINDINGS (4) 70 71 /** 72 * struct iwl_binding_cmd_v1 - configuring bindings 73 * ( BINDING_CONTEXT_CMD = 0x2b ) 74 * @id_and_color: ID and color of the relevant Binding, 75 * &enum iwl_ctxt_id_and_color 76 * @action: action to perform, one of FW_CTXT_ACTION_* 77 * @macs: array of MAC id and colors which belong to the binding, 78 * &enum iwl_ctxt_id_and_color 79 * @phy: PHY id and color which belongs to the binding, 80 * &enum iwl_ctxt_id_and_color 81 */ 82 struct iwl_binding_cmd_v1 { 83 /* COMMON_INDEX_HDR_API_S_VER_1 */ 84 __le32 id_and_color; 85 __le32 action; 86 /* BINDING_DATA_API_S_VER_1 */ 87 __le32 macs[MAX_MACS_IN_BINDING]; 88 __le32 phy; 89 } __packed; /* BINDING_CMD_API_S_VER_1 */ 90 91 /** 92 * struct iwl_binding_cmd - configuring bindings 93 * ( BINDING_CONTEXT_CMD = 0x2b ) 94 * @id_and_color: ID and color of the relevant Binding, 95 * &enum iwl_ctxt_id_and_color 96 * @action: action to perform, one of FW_CTXT_ACTION_* 97 * @macs: array of MAC id and colors which belong to the binding 98 * &enum iwl_ctxt_id_and_color 99 * @phy: PHY id and color which belongs to the binding 100 * &enum iwl_ctxt_id_and_color 101 * @lmac_id: the lmac id the binding belongs to 102 */ 103 struct iwl_binding_cmd { 104 /* COMMON_INDEX_HDR_API_S_VER_1 */ 105 __le32 id_and_color; 106 __le32 action; 107 /* BINDING_DATA_API_S_VER_1 */ 108 __le32 macs[MAX_MACS_IN_BINDING]; 109 __le32 phy; 110 __le32 lmac_id; 111 } __packed; /* BINDING_CMD_API_S_VER_2 */ 112 113 #define IWL_BINDING_CMD_SIZE_V1 sizeof(struct iwl_binding_cmd_v1) 114 #define IWL_LMAC_24G_INDEX 0 115 #define IWL_LMAC_5G_INDEX 1 116 117 static inline u32 iwl_mvm_get_lmac_id(const struct iwl_fw *fw, 118 enum nl80211_band band){ 119 if (!fw_has_capa(&fw->ucode_capa, IWL_UCODE_TLV_CAPA_CDB_SUPPORT) || 120 band == NL80211_BAND_2GHZ) 121 return IWL_LMAC_24G_INDEX; 122 return IWL_LMAC_5G_INDEX; 123 } 124 125 /* The maximal number of fragments in the FW's schedule session */ 126 #define IWL_MVM_MAX_QUOTA 128 127 128 /** 129 * struct iwl_time_quota_data_v1 - configuration of time quota per binding 130 * @id_and_color: ID and color of the relevant Binding, 131 * &enum iwl_ctxt_id_and_color 132 * @quota: absolute time quota in TU. The scheduler will try to divide the 133 * remainig quota (after Time Events) according to this quota. 134 * @max_duration: max uninterrupted context duration in TU 135 */ 136 struct iwl_time_quota_data_v1 { 137 __le32 id_and_color; 138 __le32 quota; 139 __le32 max_duration; 140 } __packed; /* TIME_QUOTA_DATA_API_S_VER_1 */ 141 142 /** 143 * struct iwl_time_quota_cmd - configuration of time quota between bindings 144 * ( TIME_QUOTA_CMD = 0x2c ) 145 * @quotas: allocations per binding 146 * Note: on non-CDB the fourth one is the auxilary mac and is 147 * essentially zero. 148 * On CDB the fourth one is a regular binding. 149 */ 150 struct iwl_time_quota_cmd_v1 { 151 struct iwl_time_quota_data_v1 quotas[MAX_BINDINGS]; 152 } __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_1 */ 153 154 enum iwl_quota_low_latency { 155 IWL_QUOTA_LOW_LATENCY_NONE = 0, 156 IWL_QUOTA_LOW_LATENCY_TX = BIT(0), 157 IWL_QUOTA_LOW_LATENCY_RX = BIT(1), 158 IWL_QUOTA_LOW_LATENCY_TX_RX = 159 IWL_QUOTA_LOW_LATENCY_TX | IWL_QUOTA_LOW_LATENCY_RX, 160 }; 161 162 /** 163 * struct iwl_time_quota_data - configuration of time quota per binding 164 * @id_and_color: ID and color of the relevant Binding. 165 * @quota: absolute time quota in TU. The scheduler will try to divide the 166 * remainig quota (after Time Events) according to this quota. 167 * @max_duration: max uninterrupted context duration in TU 168 * @low_latency: low latency status, &enum iwl_quota_low_latency 169 */ 170 struct iwl_time_quota_data { 171 __le32 id_and_color; 172 __le32 quota; 173 __le32 max_duration; 174 __le32 low_latency; 175 } __packed; /* TIME_QUOTA_DATA_API_S_VER_2 */ 176 177 /** 178 * struct iwl_time_quota_cmd - configuration of time quota between bindings 179 * ( TIME_QUOTA_CMD = 0x2c ) 180 * Note: on non-CDB the fourth one is the auxilary mac and is essentially zero. 181 * On CDB the fourth one is a regular binding. 182 * 183 * @quotas: allocations per binding 184 */ 185 struct iwl_time_quota_cmd { 186 struct iwl_time_quota_data quotas[MAX_BINDINGS]; 187 } __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_2 */ 188 189 #endif /* __iwl_fw_api_binding_h__ */ 190