Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
0002 /*
0003  * Copyright (C) 2012-2014, 2020 Intel Corporation
0004  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
0005  * Copyright (C) 2016-2017 Intel Deutschland GmbH
0006  */
0007 #ifndef __iwl_fw_api_binding_h__
0008 #define __iwl_fw_api_binding_h__
0009 
0010 #include <fw/file.h>
0011 #include <fw/img.h>
0012 
0013 #define MAX_MACS_IN_BINDING (3)
0014 #define MAX_BINDINGS        (4)
0015 
0016 /**
0017  * struct iwl_binding_cmd_v1 - configuring bindings
0018  * ( BINDING_CONTEXT_CMD = 0x2b )
0019  * @id_and_color: ID and color of the relevant Binding,
0020  *  &enum iwl_ctxt_id_and_color
0021  * @action: action to perform, one of FW_CTXT_ACTION_*
0022  * @macs: array of MAC id and colors which belong to the binding,
0023  *  &enum iwl_ctxt_id_and_color
0024  * @phy: PHY id and color which belongs to the binding,
0025  *  &enum iwl_ctxt_id_and_color
0026  */
0027 struct iwl_binding_cmd_v1 {
0028     /* COMMON_INDEX_HDR_API_S_VER_1 */
0029     __le32 id_and_color;
0030     __le32 action;
0031     /* BINDING_DATA_API_S_VER_1 */
0032     __le32 macs[MAX_MACS_IN_BINDING];
0033     __le32 phy;
0034 } __packed; /* BINDING_CMD_API_S_VER_1 */
0035 
0036 /**
0037  * struct iwl_binding_cmd - configuring bindings
0038  * ( BINDING_CONTEXT_CMD = 0x2b )
0039  * @id_and_color: ID and color of the relevant Binding,
0040  *  &enum iwl_ctxt_id_and_color
0041  * @action: action to perform, one of FW_CTXT_ACTION_*
0042  * @macs: array of MAC id and colors which belong to the binding
0043  *  &enum iwl_ctxt_id_and_color
0044  * @phy: PHY id and color which belongs to the binding
0045  *  &enum iwl_ctxt_id_and_color
0046  * @lmac_id: the lmac id the binding belongs to
0047  */
0048 struct iwl_binding_cmd {
0049     /* COMMON_INDEX_HDR_API_S_VER_1 */
0050     __le32 id_and_color;
0051     __le32 action;
0052     /* BINDING_DATA_API_S_VER_1 */
0053     __le32 macs[MAX_MACS_IN_BINDING];
0054     __le32 phy;
0055     __le32 lmac_id;
0056 } __packed; /* BINDING_CMD_API_S_VER_2 */
0057 
0058 #define IWL_BINDING_CMD_SIZE_V1 sizeof(struct iwl_binding_cmd_v1)
0059 #define IWL_LMAC_24G_INDEX      0
0060 #define IWL_LMAC_5G_INDEX       1
0061 
0062 static inline u32 iwl_mvm_get_lmac_id(const struct iwl_fw *fw,
0063                       enum nl80211_band band){
0064     if (!fw_has_capa(&fw->ucode_capa, IWL_UCODE_TLV_CAPA_CDB_SUPPORT) ||
0065         band == NL80211_BAND_2GHZ)
0066         return IWL_LMAC_24G_INDEX;
0067     return IWL_LMAC_5G_INDEX;
0068 }
0069 
0070 /* The maximal number of fragments in the FW's schedule session */
0071 #define IWL_MVM_MAX_QUOTA 128
0072 
0073 /**
0074  * struct iwl_time_quota_data_v1 - configuration of time quota per binding
0075  * @id_and_color: ID and color of the relevant Binding,
0076  *  &enum iwl_ctxt_id_and_color
0077  * @quota: absolute time quota in TU. The scheduler will try to divide the
0078  *  remainig quota (after Time Events) according to this quota.
0079  * @max_duration: max uninterrupted context duration in TU
0080  */
0081 struct iwl_time_quota_data_v1 {
0082     __le32 id_and_color;
0083     __le32 quota;
0084     __le32 max_duration;
0085 } __packed; /* TIME_QUOTA_DATA_API_S_VER_1 */
0086 
0087 /**
0088  * struct iwl_time_quota_cmd - configuration of time quota between bindings
0089  * ( TIME_QUOTA_CMD = 0x2c )
0090  * @quotas: allocations per binding
0091  * Note: on non-CDB the fourth one is the auxilary mac and is
0092  *  essentially zero.
0093  *  On CDB the fourth one is a regular binding.
0094  */
0095 struct iwl_time_quota_cmd_v1 {
0096     struct iwl_time_quota_data_v1 quotas[MAX_BINDINGS];
0097 } __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_1 */
0098 
0099 enum iwl_quota_low_latency {
0100     IWL_QUOTA_LOW_LATENCY_NONE = 0,
0101     IWL_QUOTA_LOW_LATENCY_TX = BIT(0),
0102     IWL_QUOTA_LOW_LATENCY_RX = BIT(1),
0103     IWL_QUOTA_LOW_LATENCY_TX_RX =
0104         IWL_QUOTA_LOW_LATENCY_TX | IWL_QUOTA_LOW_LATENCY_RX,
0105 };
0106 
0107 /**
0108  * struct iwl_time_quota_data - configuration of time quota per binding
0109  * @id_and_color: ID and color of the relevant Binding.
0110  * @quota: absolute time quota in TU. The scheduler will try to divide the
0111  *  remainig quota (after Time Events) according to this quota.
0112  * @max_duration: max uninterrupted context duration in TU
0113  * @low_latency: low latency status, &enum iwl_quota_low_latency
0114  */
0115 struct iwl_time_quota_data {
0116     __le32 id_and_color;
0117     __le32 quota;
0118     __le32 max_duration;
0119     __le32 low_latency;
0120 } __packed; /* TIME_QUOTA_DATA_API_S_VER_2 */
0121 
0122 /**
0123  * struct iwl_time_quota_cmd - configuration of time quota between bindings
0124  * ( TIME_QUOTA_CMD = 0x2c )
0125  * Note: on non-CDB the fourth one is the auxilary mac and is essentially zero.
0126  * On CDB the fourth one is a regular binding.
0127  *
0128  * @quotas: allocations per binding
0129  */
0130 struct iwl_time_quota_cmd {
0131     struct iwl_time_quota_data quotas[MAX_BINDINGS];
0132 } __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_2 */
0133 
0134 #endif /* __iwl_fw_api_binding_h__ */