rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2016 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /******************************************************************************* |
| 37 | * Filename: |
| 38 | * --------- |
| 39 | * lwa_shm_def.h |
| 40 | * |
| 41 | * Project: |
| 42 | * -------- |
| 43 | * UMOLY |
| 44 | * |
| 45 | * Description: |
| 46 | * ------------ |
| 47 | * The share memory definitions of LWA (LTE-WLAN Aggregation) |
| 48 | * |
| 49 | * Author: |
| 50 | * ------- |
| 51 | * ------- |
| 52 | * |
| 53 | *============================================================================== |
| 54 | * HISTORY |
| 55 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 56 | *------------------------------------------------------------------------------ |
| 57 | * removed! |
| 58 | * |
| 59 | *------------------------------------------------------------------------------ |
| 60 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 61 | *============================================================================== |
| 62 | *******************************************************************************/ |
| 63 | |
| 64 | #ifndef LWA_SHM_DEF_H |
| 65 | #define LWA_SHM_DEF_H |
| 66 | |
| 67 | #define LWA_ALIGN_SIZE (4) |
| 68 | #define LWA_FOUR_BYTE_ALIGN_MASK (LWA_ALIGN_SIZE - 1) |
| 69 | #define LWA_SIZE_FOUR_BYTE_ALIGN(_sz) (((_sz) + LWA_ALIGN_SIZE - 1) & ~LWA_FOUR_BYTE_ALIGN_MASK) |
| 70 | |
| 71 | /**************************************************************************** |
| 72 | * LWA Share Memory Layout version 1 |
| 73 | * |
| 74 | * shm_start_addr |
| 75 | * |<-------------------------shm_total_size---------------------->| |
| 76 | * | | | |
| 77 | * |<-----desc_ring------>|<----------data_ring------------->|<-r->| |
| 78 | * | | | | |
| 79 | * | lwa_dl_desc[N] | lwa_dl_buff_t[N] | | |
| 80 | * | | | | |
| 81 | * |
| 82 | * 1) N = floor(shm_total_size / (sizeof(lwa_dl_desc)+size(lwa_dl_buff_t))) |
| 83 | * 2) lwa_dl_desc is 4-byte-aligned |
| 84 | * 3) lwa_dl_buff_struct is 4-byte-aligned |
| 85 | * 4) Each element from desc_ring and data_ring is 1-to-1 mapping |
| 86 | * ex. lwa_dl_desc[100] decribes lwa_dl_buff_t[100] |
| 87 | * 5) r is remainder tail from floor() |
| 88 | * |
| 89 | ****************************************************************************/ |
| 90 | #define LWA_SHM_LAYOUT_VER (1) //rel-13, wifi downlink only |
| 91 | |
| 92 | |
| 93 | /**************************************************************************** |
| 94 | * Type Definitions |
| 95 | ****************************************************************************/ |
| 96 | typedef struct _lwa_dl_desc lwa_dl_desc; |
| 97 | |
| 98 | |
| 99 | /**************************************************************************** |
| 100 | * LWA downlink decriptor, complies with |
| 101 | * 1) l2ce_sod_desc |
| 102 | * 2) qbm_gpd |
| 103 | * 3) wifi usage |
| 104 | ****************************************************************************/ |
| 105 | struct _lwa_dl_desc |
| 106 | { |
| 107 | kal_uint8 flag; |
| 108 | kal_uint8 cksum; |
| 109 | kal_uint16 desc_index; |
| 110 | lwa_dl_desc *next_ptr; |
| 111 | lwa_dl_desc *data_ptr; |
| 112 | kal_uint16 data_len; |
| 113 | kal_uint16 payload_offset; |
| 114 | kal_uint8 pad0; |
| 115 | kal_uint8 bearer; |
| 116 | kal_uint8 key_index; |
| 117 | kal_uint8 sec_func; |
| 118 | kal_uint32 count; |
| 119 | kal_uint8 *out_ptr; |
| 120 | }; |
| 121 | |
| 122 | |
| 123 | /**************************************************************************** |
| 124 | * WIFI downlink buffer reserved, including |
| 125 | * 1) HW_MAC_RX_DESC_T: 32 bytes |
| 126 | * 2) HW_MAC_RX_STS_GROUP_4_T: 32 bytes |
| 127 | * 3) Ether frame fields: 18 bytes = dst(6)+src(6)+type(2)+fcs(4) |
| 128 | ****************************************************************************/ |
| 129 | #define LWA_WIFI_DL_RSV_LEN (82) |
| 130 | |
| 131 | |
| 132 | /**************************************************************************** |
| 133 | * WIFI downlink MTU |
| 134 | ****************************************************************************/ |
| 135 | #define LWA_WIFI_DL_IP_MTU (1500) |
| 136 | #define LWA_MAX_HDR_LEN (4) //3gpp r13: 1 |
| 137 | #define LTE_PDCP_MAX_HDR_LEN (4) //3gpp r13: 1~3 |
| 138 | #define LWA_WIFI_DL_PAYLOAD_MTU (LWA_WIFI_DL_IP_MTU + LWA_MAX_HDR_LEN + LTE_PDCP_MAX_HDR_LEN) |
| 139 | |
| 140 | |
| 141 | /**************************************************************************** |
| 142 | * LWA downlink buffer |
| 143 | ****************************************************************************/ |
| 144 | #define LWA_DL_BUFF_LEN (2352) // state of art value of WDRV |
| 145 | #define LWA_DL_BUFF_LEN_IDEAL (LWA_SIZE_FOUR_BYTE_ALIGN(LWA_WIFI_DL_RSV_LEN + LWA_WIFI_DL_PAYLOAD_MTU)) // ideal value |
| 146 | |
| 147 | #if (LWA_DL_BUFF_LEN < (LWA_WIFI_DL_RSV_LEN + LWA_WIFI_DL_MTU)) |
| 148 | #error LWA_DL_BUFF_LEN |
| 149 | #endif |
| 150 | |
| 151 | typedef struct |
| 152 | { |
| 153 | kal_uint8 buff[LWA_DL_BUFF_LEN]; |
| 154 | } lwa_dl_buff_t; |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | /**************************************************************************** |
| 160 | * LWA WLAN/EPDCP U-plane Control Message |
| 161 | * 1. any message change shall keep backward compatibility |
| 162 | * 2. message length is fixed in 4 bytes |
| 163 | * 3. the higher 2 bytes are 'command' and the lower 2 bytes are 'value' |
| 164 | * |
| 165 | ****************************************************************************/ |
| 166 | #define LWA_UP_CTRL_MSG_CMD_MAX (0xFFFF) |
| 167 | #define LWA_UP_CTRL_MSG_VALUE_MAX (0xFFFF) |
| 168 | |
| 169 | typedef enum |
| 170 | { |
| 171 | // [Command enumeration] [Direction] [Value] |
| 172 | LWA_UP_CTRL_CMD_DL_SHM_LAYOUT_SUPPORT_LIST = 0, //WLAN -> PDCP, 16-bit bitmap: each bit represents 1 layout version |
| 173 | LWA_UP_CTRL_CMD_DL_SHM_LAYOUT_DESICION = 1, //WLAN <- PDCP, 16-bit bitmap: toggle only 1 bit for runtime layout version |
| 174 | LWA_UP_CTRL_CMD_DL_SHM_FULL = 2, //WLAN -> PDCP, value reserved |
| 175 | LWA_UP_CTRL_CMD_DL_SHN_NOT_FULL = 3, //WLAN <- PDCP, value reserved |
| 176 | LWA_UP_CTRL_CMD_WLAN_DL_PKT_READY_NOTIFY_SETTING = 4, //WLAN <- PDCP, 0 means setting 'OFF'; 1 means setting 'ON'; others reserved |
| 177 | LWA_UP_CTRL_CMD_WLAN_DL_PKT_READY_NOTIFY = 5, //WLAN -> PDCP, if setting is on, WLAN send it after every packet write to SHM; value is reserved |
| 178 | LWA_UP_CTRL_CMD_DL_HDR_LOOK_AHEAD_SETTING = 6, //WLAN <- PDCP, value enum: lwa_dl_hdr_look_ahead_setting_enum |
| 179 | |
| 180 | // add new command from here |
| 181 | LWA_UP_CTRL_CMD_INVALID = LWA_UP_CTRL_MSG_CMD_MAX |
| 182 | } lwa_up_ctrl_cmd_enum; |
| 183 | |
| 184 | /**************************************************************************** |
| 185 | * LWA downlink header look ahead setting: |
| 186 | * |
| 187 | * [usage] LTE send to WIFI at LWA init time, to configure WIFI driver |
| 188 | * pre-read payload into descriptor for performance optimization |
| 189 | * |
| 190 | ****************************************************************************/ |
| 191 | typedef enum |
| 192 | { |
| 193 | LWA_DL_HDR_LOOK_AHEAD_0BYTE = 0, |
| 194 | //look ahead off |
| 195 | |
| 196 | LWA_DL_HDR_LOOK_AHEAD_1BYTE = 1, |
| 197 | //look ahead the first 1 byte of ether frame's payload: |
| 198 | // lwa_dl_desc.bearer = (unsigned char) <payload_1st_byte> |
| 199 | |
| 200 | LWA_DL_HDR_LOOK_AHEAD_3BYTE = 2, |
| 201 | //look ahead first 3 bytes of ether frame's payload: |
| 202 | // lwa_dl_desc.bearer = (unsigned char) <payload_1st_byte> |
| 203 | // lwa_dl_desc.count = (unsigned char) (<payload_2nd_byte> << 8) + (unsigned char) <payload_3rd_byte> |
| 204 | //default value for 91/92 LWA |
| 205 | |
| 206 | LWA_DL_HDR_LOOK_AHEAD_INVALID = LWA_UP_CTRL_MSG_VALUE_MAX |
| 207 | } lwa_dl_hdr_look_ahead_setting_enum; |
| 208 | |
| 209 | typedef enum |
| 210 | { |
| 211 | LWA_WIFI_DL_PKT_READY_NOTIFY_OFF, |
| 212 | LWA_WIFI_DL_PKT_READY_NOTIFY_ON, |
| 213 | LWA_WIFI_DL_PKT_READY_NOTIFY_INVALID = LWA_UP_CTRL_MSG_VALUE_MAX |
| 214 | } lwa_wifi_dl_pkt_ready_notify_setting_enum; |
| 215 | |
| 216 | |
| 217 | |
| 218 | #endif /* LWA_SHM_DEF_H */ |