1  /*
2   * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
3   * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4   *
5   * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
6   *
7   *
8   * Permission to use, copy, modify, and/or distribute this software for
9   * any purpose with or without fee is hereby granted, provided that the
10   * above copyright notice and this permission notice appear in all
11   * copies.
12   *
13   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
14   * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
15   * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
16   * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
17   * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
18   * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19   * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20   * PERFORMANCE OF THIS SOFTWARE.
21   */
22  
23  /*
24   * This file was originally distributed by Qualcomm Atheros, Inc.
25   * under proprietary terms before Copyright ownership was assigned
26   * to the Linux Foundation.
27   */
28  
29  /**
30   * @file htt_isoc.h
31   *
32   * @details
33   *  This file defines the target --> host messages that configure the
34   *  host data-path SW with the information required for data transfers
35   *  to and from the target.
36   */
37  
38  #ifndef _HTT_ISOC_H_
39  #define _HTT_ISOC_H_
40  
41  #include <a_types.h>    /* A_UINT32, A_UINT8 */
42  #include <a_osapi.h>          /* A_COMPILE_TIME_ASSERT */
43  
44  #ifdef ATHR_WIN_NWF
45  #pragma warning( disable:4214 ) //bit field types other than int
46  #endif
47  
48  #include "htt_common.h"
49  
50  /*=== definitions that apply to all messages ================================*/
51  
52  typedef enum htt_isoc_t2h_msg_type {
53      /* 0x0 reserved for VERSION message (probably not needed) */
54  
55      /* PEER_INFO - specify ID and parameters of a new peer */
56      HTT_ISOC_T2H_MSG_TYPE_PEER_INFO     = 0x1,
57  
58      /* PEER_UNMAP - deallocate the ID that refers to a peer */
59      HTT_ISOC_T2H_MSG_TYPE_PEER_UNMAP    = 0x2,
60  
61      /* ADDBA - start rx aggregation for the specified peer-TID */
62      HTT_ISOC_T2H_MSG_TYPE_RX_ADDBA      = 0x3,
63  
64      /* DELBA - stop rx aggregation for the specified peer-TID */
65      HTT_ISOC_T2H_MSG_TYPE_RX_DELBA      = 0x4,
66  
67      /* TX_COMPL_IND - over-the-air tx completion notification for a tx frame */
68      HTT_ISOC_T2H_MSG_TYPE_TX_COMPL_IND  = 0x5,
69  
70      /* SEC_IND - notification of the type of security used for a new peer */
71      HTT_ISOC_T2H_MSG_TYPE_SEC_IND       = 0x6,
72  
73      /* PEER_TX_READY - the target is ready to transmit to a new peer */
74      HTT_ISOC_T2H_MSG_TYPE_PEER_TX_READY = 0x7,
75  
76      /* RX_ERR - notification that an rx frame was discarded due to errors */
77      HTT_ISOC_T2H_MSG_TYPE_RX_ERR        = 0x8,
78  
79      /*NLO_MATCH - notification that target found NLO match */
80      HTT_ISOC_T2H_MSG_TYPE_NLO_MATCH     = 0x9,
81  
82      /*NLO_SCAN_END - notification that target NLO SCAN END 1:1 map with  NLO_MATCH*/
83      HTT_ISOC_T2H_MSG_TYPE_NLO_SCAN_END  = 0xA,
84  
85      /* keep this last */
86      HTT_ISOC_T2H_NUM_MSGS
87  } htt_isoc_t2h_msg_type;
88  
89  /*
90   * HTT ISOC target to host message type -
91   * stored in bits 7:0 of the first word of the message
92   */
93  #define HTT_ISOC_T2H_MSG_TYPE_M      0xff
94  #define HTT_ISOC_T2H_MSG_TYPE_S      0
95  
96  #define HTT_ISOC_T2H_MSG_TYPE_SET(msg_addr, msg_type) \
97      (*((A_UINT8 *) msg_addr) = (msg_type))
98  #define HTT_ISOC_T2H_MSG_TYPE_GET(msg_addr) \
99      (*((A_UINT8 *) msg_addr))
100  
101  #ifndef INLINE
102  #ifdef QCA_SUPPORT_INTEGRATED_SOC
103  /* host SW */
104  #define INLINE inline
105  #else
106  /* target FW */
107  #define INLINE __inline
108  #endif
109  #define HTT_ISOC_INLINE_DEF
110  #endif /* INLINE */
111  
112  static INLINE void
htt_isoc_t2h_field_set(A_UINT32 * msg_addr32,unsigned offset32,unsigned mask,unsigned shift,unsigned value)113  htt_isoc_t2h_field_set(
114      A_UINT32 *msg_addr32,
115      unsigned offset32,
116      unsigned mask,
117      unsigned shift,
118      unsigned value)
119  {
120      /* sanity check: make sure the value fits within the field */
121      //adf_os_assert(value << shift == (value << shift) | mask);
122  
123      msg_addr32 += offset32;
124      /* clear the field */
125      *msg_addr32 &= ~mask;
126      /* write the new value */
127      *msg_addr32 |= (value << shift);
128  }
129  
130  #ifdef HTT_ISOC_INLINE_DEF
131  #undef HTT_ISOC_INLINE_DEF
132  #undef INLINE
133  #endif
134  
135  #define HTT_ISOC_T2H_FIELD_GET(msg_addr32, offset32, mask, shift) \
136      (((*(msg_addr32 + offset32)) & mask) >> shift)
137  
138  typedef enum {
139      /* ASSOC - "real" peer from STA-AP association */
140      HTT_ISOC_T2H_PEER_TYPE_ASSOC = 0x0,
141  
142      /* SELF - self-peer for unicast tx to unassociated peer */
143      HTT_ISOC_T2H_PEER_TYPE_SELF  = 0x1,
144  
145      /* BSSID - reserved for FW use for BT-AMP+IBSS */
146      HTT_ISOC_T2H_PEER_TYPE_BSSID = 0x2,
147  
148      /* BCAST - self-peer for multicast / broadcast tx */
149      HTT_ISOC_T2H_PEER_TYPE_BCAST = 0x3
150  } HTT_ISOC_T2H_PEER_TYPE_ENUM;
151  
152  enum {
153      HTT_ISOC_NON_QOS = 0,
154      HTT_ISOC_QOS     = 1
155  };
156  
157  enum {
158      HTT_ISOC_RMF_DISABLED = 0,
159      HTT_ISOC_RMF_ENABLED  = 1
160  };
161  
162  enum {
163      HTT_ISOC_TID_MGMT = 7
164  };
165  
166  
167  /*=== definitions for specific messages =====================================*/
168  
169  /*=== PEER_INFO message ===*/
170  
171  /**
172   * @brief target -> host peer info message definition
173   *
174   * @details
175   * The following diagram shows the format of the peer info message sent
176   * from the target to the host.  This layout assumes the target operates
177   * as little-endian.
178   *
179   * |31          25|24|23       18|17|16|15      11|10|9|8|7|6|            0|
180   * |-----------------------------------------------------------------------|
181   * |   mgmt DPU idx  |  bcast DPU idx  |     DPU idx     |     msg type    |
182   * |-----------------------------------------------------------------------|
183   * | mgmt DPU sig |bcast DPU sig |     DPU sig    |       peer ID          |
184   * |-----------------------------------------------------------------------|
185   * |    MAC addr 1   |    MAC addr 0   |     vdev ID     | |R|  peer type  |
186   * |-----------------------------------------------------------------------|
187   * |    MAC addr 5   |    MAC addr 4   |    MAC addr 3   |    MAC addr 2   |
188   * |-----------------------------------------------------------------------|
189   *
190   *
191   * The following field definitions describe the format of the peer info
192   * message sent from the target to the host.
193   *
194   * WORD 0:
195   *   - MSG_TYPE
196   *     Bits 7:0
197   *     Purpose: identifies this as peer info message
198   *     Value: 0x1
199   *   - DPU_IDX
200   *     Bits 15:8
201   *     Purpose: specify the DPU index (a.k.a. security key ID) to use for
202   *         unicast data frames sent to this peer
203   *     Value: key ID
204   *   - BCAST_DPU_IDX
205   *     Bits 23:16
206   *     Purpose: specify the DPU index (a.k.a. security key ID) to use for
207   *         broadcast data frames sent by this (self) peer
208   *     Value: key ID
209   *   - MGMT_DPU_IDX
210   *     Bits 31:24
211   *     Purpose: specify the DPU index (a.k.a. security key ID) to use for
212   *         unicast management frames sent by this (self) peer
213   *     Value: key ID
214   * WORD 1:
215   *   - PEER_ID
216   *     Bits 10:0
217   *     Purpose: The ID that the target has allocated to refer to the peer
218   *   - DPU_SIG
219   *     Bits 17:11
220   *     Purpose: specify the DPU signature (a.k.a. security key validity
221   *         magic number) to specify for unicast data frames sent to this peer
222   *   - BCAST_DPU_SIG
223   *     Bits 24:18
224   *     Purpose: specify the DPU signature (a.k.a. security key validity
225   *         magic number) to specify for broadcast data frames sent by this
226   *         (self) peer
227   *   - MGMT_DPU_SIG
228   *     Bits 31:25
229   *     Purpose: specify the DPU signature (a.k.a. security key validity
230   *         magic number) to specify for unicast management frames sent by this
231   *         (self) peer
232   * WORD 2:
233   *   - PEER_TYPE
234   *     Bits 5:0
235   *     Purpose: specify whether the peer in question is a real peer or
236   *         one of the types of "self-peer" created for the vdev
237   *     Value: HTT_ISOC_T2H_PEER_TYPE enum
238   *   - RMF_ENABLED (R)
239   *     Bit 6
240   *     Purpose: specify whether the peer in question has enable robust
241   *         management frames, to encrypt certain management frames
242   *     Value: HTT_ISOC_RMF enum
243   *     Value: HTT_ISOC_NON_QOS or HTT_ISOC_QOS
244   *   - VDEV_ID
245   *     Bits 15:8
246   *     Purpose: For a real peer, the vdev ID indicates which virtual device
247   *         the peer is associated with.  For a self-peer, the vdev ID shows
248   *         which virtual device the self-peer represents.
249   *   - MAC_ADDR_L16
250   *     Bits 31:16
251   *     Purpose: Identifies which peer the peer ID is for.
252   *     Value: lower 2 bytes of the peer's MAC address
253   *         For a self-peer, the peer's MAC address is the MAC address of the
254   *         vdev the self-peer represents.
255   * WORD 3:
256   *   - MAC_ADDR_U32
257   *     Bits 31:0
258   *     Purpose: Identifies which peer the peer ID is for.
259   *     Value: upper 4 bytes of the peer's MAC address
260   *         For a self-peer, the peer's MAC address is the MAC address of the
261   *         vdev the self-peer represents.
262   */
263  typedef struct htt_isoc_t2h_peer_info_s {
264      /* word 0 */
265      A_UINT32
266          msg_type:      8, /* HTT_ISOC_T2H_MSG_TYPE_PEER_INFO */
267          dpu_idx:       8,
268          bcast_dpu_idx: 8,
269          mgmt_dpu_idx:  8;
270      /* word 1 */
271      A_UINT32
272          peer_id:      11,
273          dpu_sig:       7,
274          bcast_dpu_sig: 7,
275          mgmt_dpu_sig:  7;
276      /* word 2 */
277      A_UINT32
278          peer_type:     6,
279          rmf_enabled:   1,
280          reserved0:     1,
281          vdev_id:       8,
282          mac_addr_l16: 16;
283      /* word 3 */
284      A_UINT32 mac_addr_u32;
285  } htt_isoc_t2h_peer_info_t;
286  
287  /* word 0 */
288  #define HTT_ISOC_T2H_PEER_INFO_DPU_IDX_OFFSET32        0
289  #define HTT_ISOC_T2H_PEER_INFO_DPU_IDX_M               0x0000ff00
290  #define HTT_ISOC_T2H_PEER_INFO_DPU_IDX_S               8
291  
292  #define HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_IDX_OFFSET32  0
293  #define HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_IDX_M         0x00ff0000
294  #define HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_IDX_S         16
295  
296  #define HTT_ISOC_T2H_PEER_INFO_MGMT_DPU_IDX_OFFSET32   0
297  #define HTT_ISOC_T2H_PEER_INFO_MGMT_DPU_IDX_M          0xff000000
298  #define HTT_ISOC_T2H_PEER_INFO_MGMT_DPU_IDX_S          24
299  
300  /* word 1 */
301  #define HTT_ISOC_T2H_PEER_INFO_PEER_ID_OFFSET32        1
302  #define HTT_ISOC_T2H_PEER_INFO_PEER_ID_M               0x000007ff
303  #define HTT_ISOC_T2H_PEER_INFO_PEER_ID_S               0
304  
305  #define HTT_ISOC_T2H_PEER_INFO_DPU_SIG_OFFSET32        1
306  #define HTT_ISOC_T2H_PEER_INFO_DPU_SIG_M               0x0003f800
307  #define HTT_ISOC_T2H_PEER_INFO_DPU_SIG_S               11
308  
309  #define HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_SIG_OFFSET32  1
310  #define HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_SIG_M         0x01fc0000
311  #define HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_SIG_S         18
312  
313  #define HTT_ISOC_T2H_PEER_INFO_MGMT_DPU_SIG_OFFSET32   1
314  #define HTT_ISOC_T2H_PEER_INFO_MGMT_DPU_SIG_M          0xfe000000
315  #define HTT_ISOC_T2H_PEER_INFO_MGMT_DPU_SIG_S          25
316  
317  /* word 2 */
318  #define HTT_ISOC_T2H_PEER_INFO_PEER_TYPE_OFFSET32      2
319  #define HTT_ISOC_T2H_PEER_INFO_PEER_TYPE_M             0x0000003f
320  #define HTT_ISOC_T2H_PEER_INFO_PEER_TYPE_S             0
321  
322  #define HTT_ISOC_T2H_PEER_INFO_RMF_ENABLED_OFFSET32    2
323  #define HTT_ISOC_T2H_PEER_INFO_RMF_ENABLED_M           0x00000040
324  #define HTT_ISOC_T2H_PEER_INFO_RMF_ENABLED_S           6
325  
326  #define HTT_ISOC_T2H_PEER_INFO_VDEV_ID_OFFSET32        2
327  #define HTT_ISOC_T2H_PEER_INFO_VDEV_ID_M               0x0000ff00
328  #define HTT_ISOC_T2H_PEER_INFO_VDEV_ID_S               8
329  
330  #define HTT_ISOC_T2H_PEER_INFO_MAC_ADDR_L16_OFFSET32   2
331  #define HTT_ISOC_T2H_PEER_INFO_MAC_ADDR_L16_M          0xffff0000
332  #define HTT_ISOC_T2H_PEER_INFO_MAC_ADDR_L16_S          16
333  
334  /* word 3 */
335  #define HTT_ISOC_T2H_PEER_INFO_MAC_ADDR_U32_OFFSET32   3
336  #define HTT_ISOC_T2H_PEER_INFO_MAC_ADDR_U32_M          0xffffffff
337  #define HTT_ISOC_T2H_PEER_INFO_MAC_ADDR_U32_S          0
338  
339  
340  /* general field access macros */
341  
342  #define HTT_ISOC_T2H_PEER_INFO_FIELD_SET(field, msg_addr, value) \
343      htt_isoc_t2h_field_set(                                      \
344          ((A_UINT32 *) msg_addr),                                 \
345          HTT_ISOC_T2H_PEER_INFO_ ## field ## _OFFSET32,           \
346          HTT_ISOC_T2H_PEER_INFO_ ## field ## _M,                  \
347          HTT_ISOC_T2H_PEER_INFO_ ## field ## _S,                  \
348          value)
349  
350  #define HTT_ISOC_T2H_PEER_INFO_FIELD_GET(field, msg_addr) \
351      HTT_ISOC_T2H_FIELD_GET(                               \
352          ((A_UINT32 *) msg_addr),                          \
353          HTT_ISOC_T2H_PEER_INFO_ ## field ## _OFFSET32,    \
354          HTT_ISOC_T2H_PEER_INFO_ ## field ## _M,           \
355          HTT_ISOC_T2H_PEER_INFO_ ## field ## _S)
356  
357  /* access macros for specific fields */
358  
359  #define HTT_ISOC_T2H_PEER_INFO_DPU_IDX_SET(msg_addr, value) \
360      HTT_ISOC_T2H_PEER_INFO_FIELD_SET(DPU_IDX, msg_addr, value)
361  #define HTT_ISOC_T2H_PEER_INFO_DPU_IDX_GET(msg_addr) \
362      HTT_ISOC_T2H_PEER_INFO_FIELD_GET(DPU_IDX, msg_addr)
363  
364  A_COMPILE_TIME_ASSERT(HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_IDX_M_Size_Check, \
365      (HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_IDX_M >> HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_IDX_S)\
366      <= ((A_UINT8)~((A_UINT8)0)));
367  #define HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_IDX_SET(msg_addr, value) \
368      HTT_ISOC_T2H_PEER_INFO_FIELD_SET(BCAST_DPU_IDX, msg_addr, value)
369  #define HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_IDX_GET(msg_addr) \
370      (A_UINT8)(HTT_ISOC_T2H_PEER_INFO_FIELD_GET(BCAST_DPU_IDX, msg_addr))
371  
372  A_COMPILE_TIME_ASSERT(HTT_ISOC_T2H_PEER_INFO_MGMT_DPU_IDX_M_Size_Check,\
373     (HTT_ISOC_T2H_PEER_INFO_MGMT_DPU_IDX_M >> HTT_ISOC_T2H_PEER_INFO_MGMT_DPU_IDX_S) \
374                        <= ((A_UINT8)~((A_UINT8)0)));
375  #define HTT_ISOC_T2H_PEER_INFO_MGMT_DPU_IDX_SET(msg_addr, value) \
376      HTT_ISOC_T2H_PEER_INFO_FIELD_SET(MGMT_DPU_IDX, msg_addr, value)
377  #define HTT_ISOC_T2H_PEER_INFO_MGMT_DPU_IDX_GET(msg_addr) \
378      (A_UINT8)(HTT_ISOC_T2H_PEER_INFO_FIELD_GET(MGMT_DPU_IDX, msg_addr))
379  
380  #define HTT_ISOC_T2H_PEER_INFO_PEER_ID_SET(msg_addr, value) \
381      HTT_ISOC_T2H_PEER_INFO_FIELD_SET(PEER_ID, msg_addr, value)
382  #define HTT_ISOC_T2H_PEER_INFO_PEER_ID_GET(msg_addr) \
383      HTT_ISOC_T2H_PEER_INFO_FIELD_GET(PEER_ID, msg_addr)
384  
385  A_COMPILE_TIME_ASSERT(HTT_ISOC_T2H_PEER_INFO_DPU_SIG_M_Size_Check,\
386    (HTT_ISOC_T2H_PEER_INFO_DPU_SIG_M >> HTT_ISOC_T2H_PEER_INFO_DPU_SIG_S)\
387                 <= ((A_UINT8)~((A_UINT8)0)));
388  #define HTT_ISOC_T2H_PEER_INFO_DPU_SIG_SET(msg_addr, value) \
389      HTT_ISOC_T2H_PEER_INFO_FIELD_SET(DPU_SIG, msg_addr, value)
390  #define HTT_ISOC_T2H_PEER_INFO_DPU_SIG_GET(msg_addr) \
391      (A_UINT8)(HTT_ISOC_T2H_PEER_INFO_FIELD_GET(DPU_SIG, msg_addr))
392  
393  A_COMPILE_TIME_ASSERT(HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_SIG_M_Size_Check,\
394    (HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_SIG_M >> HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_SIG_S)\
395    <= ((A_UINT8)~((A_UINT8)0)));
396  #define HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_SIG_SET(msg_addr, value) \
397      HTT_ISOC_T2H_PEER_INFO_FIELD_SET(BCAST_DPU_SIG, msg_addr, value)
398  #define HTT_ISOC_T2H_PEER_INFO_BCAST_DPU_SIG_GET(msg_addr) \
399      (A_UINT8)(HTT_ISOC_T2H_PEER_INFO_FIELD_GET(BCAST_DPU_SIG, msg_addr))
400  
401  #define HTT_ISOC_T2H_PEER_INFO_MGMT_DPU_SIG_SET(msg_addr, value) \
402      HTT_ISOC_T2H_PEER_INFO_FIELD_SET(MGMT_DPU_SIG, msg_addr, value)
403  #define HTT_ISOC_T2H_PEER_INFO_MGMT_DPU_SIG_GET(msg_addr) \
404      HTT_ISOC_T2H_PEER_INFO_FIELD_GET(MGMT_DPU_SIG, msg_addr)
405  
406  #define HTT_ISOC_T2H_PEER_INFO_PEER_TYPE_SET(msg_addr, value) \
407      HTT_ISOC_T2H_PEER_INFO_FIELD_SET(PEER_TYPE, msg_addr, value)
408  #define HTT_ISOC_T2H_PEER_INFO_PEER_TYPE_GET(msg_addr) \
409      HTT_ISOC_T2H_PEER_INFO_FIELD_GET(PEER_TYPE, msg_addr)
410  
411  #define HTT_ISOC_T2H_PEER_INFO_QOS_CAPABLE_SET(msg_addr, value) \
412      HTT_ISOC_T2H_PEER_INFO_FIELD_SET(QOS_CAPABLE, msg_addr, value)
413  #define HTT_ISOC_T2H_PEER_INFO_QOS_CAPABLE_GET(msg_addr) \
414      HTT_ISOC_T2H_PEER_INFO_FIELD_GET(QOS_CAPABLE, msg_addr)
415  
416  #define HTT_ISOC_T2H_PEER_INFO_RMF_ENABLED_SET(msg_addr, value) \
417      HTT_ISOC_T2H_PEER_INFO_FIELD_SET(RMF_ENABLED, msg_addr, value)
418  #define HTT_ISOC_T2H_PEER_INFO_RMF_ENABLED_GET(msg_addr) \
419      HTT_ISOC_T2H_PEER_INFO_FIELD_GET(RMF_ENABLED, msg_addr)
420  
421  #define HTT_ISOC_T2H_PEER_INFO_VDEV_ID_SET(msg_addr, value) \
422      HTT_ISOC_T2H_PEER_INFO_FIELD_SET(VDEV_ID, msg_addr, value)
423  #define HTT_ISOC_T2H_PEER_INFO_VDEV_ID_GET(msg_addr) \
424      HTT_ISOC_T2H_PEER_INFO_FIELD_GET(VDEV_ID, msg_addr)
425  
426  #define HTT_ISOC_T2H_PEER_INFO_MAC_ADDR_L16_SET(msg_addr, value) \
427      HTT_ISOC_T2H_PEER_INFO_FIELD_SET(MAC_ADDR_L16, msg_addr, value)
428  #define HTT_ISOC_T2H_PEER_INFO_MAC_ADDR_L16_GET(msg_addr) \
429      HTT_ISOC_T2H_PEER_INFO_FIELD_GET(MAC_ADDR_L16, msg_addr)
430  
431  #define HTT_ISOC_T2H_PEER_INFO_MAC_ADDR_U32_SET(msg_addr, value) \
432      HTT_ISOC_T2H_PEER_INFO_FIELD_SET(MAC_ADDR_U32, msg_addr, value)
433  #define HTT_ISOC_T2H_PEER_INFO_MAC_ADDR_U32_GET(msg_addr) \
434      HTT_ISOC_T2H_PEER_INFO_FIELD_GET(MAC_ADDR_U32, msg_addr)
435  
436  /*=== PEER_UNMAP message ===*/
437  
438  /**
439   * @brief target -> host peer unmap message definition
440   *
441   * @details
442   * The following diagram shows the format of the peer unmap message sent
443   * from the target to the host.  This layout assumes the target operates
444   * as little-endian.
445   *
446   * |31                      19|18                       8|7               0|
447   * |-----------------------------------------------------------------------|
448   * |         reserved         |          peer ID         |     msg type    |
449   * |-----------------------------------------------------------------------|
450   *
451   *
452   * The following field definitions describe the format of the peer info
453   * message sent from the target to the host.
454   *
455   * WORD 0:
456   *   - MSG_TYPE
457   *     Bits 7:0
458   *     Purpose: identifies this as peer unmap message
459   *     Value: 0x2
460   *   - PEER_ID
461   *     Bits 18:8
462   *     Purpose: The ID that the target has allocated to refer to the peer
463   */
464  typedef struct htt_isoc_t2h_peer_unmap_s {
465      /* word 0 */
466      A_UINT32
467          msg_type:      8, /* HTT_ISOC_T2H_MSG_TYPE_PEER_UNMAP */
468          peer_id:      11,
469          reserved0:    13;
470  } htt_isoc_t2h_peer_unmap_t;
471  
472  /* word 0 */
473  #define HTT_ISOC_T2H_PEER_UNMAP_PEER_ID_OFFSET32        0
474  #define HTT_ISOC_T2H_PEER_UNMAP_PEER_ID_M               0x0007ff00
475  #define HTT_ISOC_T2H_PEER_UNMAP_PEER_ID_S               8
476  
477  
478  /* general field access macros */
479  
480  #define HTT_ISOC_T2H_PEER_UNMAP_FIELD_SET(field, msg_addr, value) \
481      htt_isoc_t2h_field_set(                                       \
482          ((A_UINT32 *) msg_addr),                                  \
483          HTT_ISOC_T2H_PEER_UNMAP_ ## field ## _OFFSET32,           \
484          HTT_ISOC_T2H_PEER_UNMAP_ ## field ## _M,                  \
485          HTT_ISOC_T2H_PEER_UNMAP_ ## field ## _S,                  \
486          value)
487  
488  #define HTT_ISOC_T2H_PEER_UNMAP_FIELD_GET(field, msg_addr) \
489      HTT_ISOC_T2H_FIELD_GET(                                \
490          ((A_UINT32 *) msg_addr),                           \
491          HTT_ISOC_T2H_PEER_UNMAP_ ## field ## _OFFSET32,    \
492          HTT_ISOC_T2H_PEER_UNMAP_ ## field ## _M,           \
493          HTT_ISOC_T2H_PEER_UNMAP_ ## field ## _S)
494  
495  /* access macros for specific fields */
496  
497  A_COMPILE_TIME_ASSERT(HTT_ISOC_T2H_PEER_UNMAP_PEER_ID_M_Size_Check,\
498    (HTT_ISOC_T2H_PEER_UNMAP_PEER_ID_M >> HTT_ISOC_T2H_PEER_UNMAP_PEER_ID_S)\
499    < ((A_UINT16)~((A_UINT16)0)));
500  #define HTT_ISOC_T2H_PEER_UNMAP_PEER_ID_SET(msg_addr, value) \
501      HTT_ISOC_T2H_PEER_UNMAP_FIELD_SET(PEER_ID, msg_addr, value)
502  #define HTT_ISOC_T2H_PEER_UNMAP_PEER_ID_GET(msg_addr) \
503      (A_UINT16)(HTT_ISOC_T2H_PEER_UNMAP_FIELD_GET(PEER_ID, msg_addr))
504  
505  /*=== ADDBA message ===*/
506  enum {
507      htt_isoc_addba_success = 0,
508      /* TBD: use different failure values to specify failure causes? */
509      htt_isoc_addba_fail = 1,
510  };
511  
512  /**
513   * @brief target -> host ADDBA message definition
514   *
515   * @details
516   * The following diagram shows the format of the rx ADDBA message sent
517   * from the target to the host:
518   *
519   * |31                      20|19  16|15     12|11    8|7               0|
520   * |---------------------------------------------------------------------|
521   * |          peer ID         |  TID |   window size   |     msg type    |
522   * |---------------------------------------------------------------------|
523   * |                  reserved                |S|      start seq num     |
524   * |---------------------------------------------------------------------|
525   *
526   * The following field definitions describe the format of the ADDBA
527   * message sent from the target to the host.
528   *
529   * WORD 0:
530   *   - MSG_TYPE
531   *     Bits 7:0
532   *     Purpose: identifies this as an ADDBA message
533   *     Value: 0x3
534   *   - WIN_SIZE
535   *     Bits 15:8
536   *     Purpose: Specifies the length of the block ack window (max = 64).
537   *     Value:
538   *         block ack window length specified by the received ADDBA
539   *         management message.
540   *   - TID
541   *     Bits 19:16
542   *     Purpose: Specifies which traffic identifier the ADDBA is for.
543   *     Value:
544   *         TID specified by the received ADDBA management message.
545   *   - PEER_ID
546   *     Bits 31:20
547   *     Purpose: Identifies which peer sent the ADDBA.
548   *     Value:
549   *         ID (hash value) used by the host for fast, direct lookup of
550   *         host SW peer info, including rx reorder states.
551   *   - START_SEQ_NUM
552   *     Bits 11:0
553   *     Purpose: Specifies the initial location of the block ack window
554   *     Value: start sequence value specified by the ADDBA-request message
555   *   - STATUS
556   *     Bit 12
557   *     Purpose: status of the WMI ADDBA request
558   *     Value: 0 - SUCCESS, 1 - FAILURE
559   */
560  typedef struct htt_isoc_t2h_addba_s {
561      /* word 0 */
562      A_UINT32 msg_type:       8, /* HTT_ISOC_T2H_MSG_TYPE_ADDBA */
563               win_size:       8,
564               tid:            4,
565               peer_id:       12;
566      /* word 1 */
567      A_UINT32 start_seq_num: 12,
568               status:         1,
569               reserved0:     19;
570  } htt_isoc_t2h_addba_t;
571  
572  /* word 0 */
573  #define HTT_ISOC_T2H_ADDBA_WIN_SIZE_OFFSET32       0
574  #define HTT_ISOC_T2H_ADDBA_WIN_SIZE_M              0x0000ff00
575  #define HTT_ISOC_T2H_ADDBA_WIN_SIZE_S              8
576  
577  #define HTT_ISOC_T2H_ADDBA_TID_OFFSET32            0
578  #define HTT_ISOC_T2H_ADDBA_TID_M                   0x000f0000
579  #define HTT_ISOC_T2H_ADDBA_TID_S                   16
580  
581  #define HTT_ISOC_T2H_ADDBA_PEER_ID_OFFSET32        0
582  #define HTT_ISOC_T2H_ADDBA_PEER_ID_M               0xfff00000
583  #define HTT_ISOC_T2H_ADDBA_PEER_ID_S               20
584  
585  /* word 1 */
586  #define HTT_ISOC_T2H_ADDBA_START_SEQ_NUM_OFFSET32  1
587  #define HTT_ISOC_T2H_ADDBA_START_SEQ_NUM_M         0x00000fff
588  #define HTT_ISOC_T2H_ADDBA_START_SEQ_NUM_S         0
589  
590  #define HTT_ISOC_T2H_ADDBA_STATUS_OFFSET32         1
591  #define HTT_ISOC_T2H_ADDBA_STATUS_M                0x00001000
592  #define HTT_ISOC_T2H_ADDBA_STATUS_S                12
593  
594  /* general field access macros */
595  #define HTT_ISOC_T2H_ADDBA_FIELD_SET(field, msg_addr, value) \
596      htt_isoc_t2h_field_set(                                       \
597          ((A_UINT32 *) msg_addr),                                  \
598          HTT_ISOC_T2H_ADDBA_ ## field ## _OFFSET32,           \
599          HTT_ISOC_T2H_ADDBA_ ## field ## _M,                  \
600          HTT_ISOC_T2H_ADDBA_ ## field ## _S,                  \
601          value)
602  
603  #define HTT_ISOC_T2H_ADDBA_FIELD_GET(field, msg_addr) \
604      HTT_ISOC_T2H_FIELD_GET(                                \
605          ((A_UINT32 *) msg_addr),                           \
606          HTT_ISOC_T2H_ADDBA_ ## field ## _OFFSET32,    \
607          HTT_ISOC_T2H_ADDBA_ ## field ## _M,           \
608          HTT_ISOC_T2H_ADDBA_ ## field ## _S)
609  
610  /* access macros for specific fields */
611  
612  #define HTT_ISOC_T2H_ADDBA_WIN_SIZE_SET(msg_addr, value) \
613      HTT_ISOC_T2H_ADDBA_FIELD_SET(WIN_SIZE, msg_addr, value)
614  #define HTT_ISOC_T2H_ADDBA_WIN_SIZE_GET(msg_addr) \
615      HTT_ISOC_T2H_ADDBA_FIELD_GET(WIN_SIZE, msg_addr)
616  
617  A_COMPILE_TIME_ASSERT(HTT_ISOC_T2H_ADDBA_TID_M_Size_Check,\
618    (HTT_ISOC_T2H_ADDBA_TID_M >> HTT_ISOC_T2H_ADDBA_TID_S) \
619    < ((A_UINT8)~((A_UINT8)0)));
620  #define HTT_ISOC_T2H_ADDBA_TID_SET(msg_addr, value) \
621      HTT_ISOC_T2H_ADDBA_FIELD_SET(TID, msg_addr, value)
622  #define HTT_ISOC_T2H_ADDBA_TID_GET(msg_addr) \
623      (A_UINT8)(HTT_ISOC_T2H_ADDBA_FIELD_GET(TID, msg_addr))
624  
625  #define HTT_ISOC_T2H_ADDBA_PEER_ID_SET(msg_addr, value) \
626      HTT_ISOC_T2H_ADDBA_FIELD_SET(PEER_ID, msg_addr, value)
627  #define HTT_ISOC_T2H_ADDBA_PEER_ID_GET(msg_addr) \
628      HTT_ISOC_T2H_ADDBA_FIELD_GET(PEER_ID, msg_addr)
629  
630  #define HTT_ISOC_T2H_ADDBA_START_SEQ_NUM_SET(msg_addr, value) \
631      HTT_ISOC_T2H_ADDBA_FIELD_SET(START_SEQ_NUM, msg_addr, value)
632  #define HTT_ISOC_T2H_ADDBA_START_SEQ_NUM_GET(msg_addr) \
633      HTT_ISOC_T2H_ADDBA_FIELD_GET(START_SEQ_NUM, msg_addr)
634  
635  #define HTT_ISOC_T2H_ADDBA_STATUS_SET(msg_addr, value) \
636      HTT_ISOC_T2H_ADDBA_FIELD_SET(STATUS, msg_addr, value)
637  #define HTT_ISOC_T2H_ADDBA_STATUS_GET(msg_addr) \
638      HTT_ISOC_T2H_ADDBA_FIELD_GET(STATUS, msg_addr)
639  
640  /*=== DELBA message ===*/
641  
642  /**
643   * @brief target -> host DELBA message definition
644   *
645   * @details
646   * The following diagram shows the format of the rx DELBA message sent
647   * from the target to the host:
648   *
649   * |31                      20|19  16|15     12|11    8|7               0|
650   * |---------------------------------------------------------------------|
651   * |          peer ID         |  TID |    reserved   |S|     msg type    |
652   * |---------------------------------------------------------------------|
653   *
654   * The following field definitions describe the format of the ADDBA
655   * message sent from the target to the host.
656   *
657   * WORD 0:
658   *   - MSG_TYPE
659   *     Bits 7:0
660   *     Purpose: identifies this as an DELBA message
661   *     Value: 0x4
662   *   - TID
663   *     Bits 19:16
664   *     Purpose: Specifies which traffic identifier the DELBA is for.
665   *     Value:
666   *         TID specified by the received DELBA management message.
667   *   - PEER_ID
668   *     Bits 31:20
669   *     Purpose: Identifies which peer sent the DELBA.
670   *     Value:
671   *         ID (hash value) used by the host for fast, direct lookup of
672   *         host SW peer info, including rx reorder states.
673   *   - STATUS
674   *     Bit 8
675   *     Purpose: status of the WMI DELBA request
676   *     Value: 0 - SUCCESS, 1 - FAILURE
677   */
678  typedef struct htt_isoc_t2h_delba_s {
679      /* word 0 */
680      A_UINT32
681          msg_type:       8, /* HTT_ISOC_T2H_MSG_TYPE_DELBA */
682          status:         1,
683          reserved0:      7,
684          tid:            4,
685          peer_id:       12;
686  } htt_isoc_t2h_delba_t;
687  
688  /* word 0 */
689  #define HTT_ISOC_T2H_DELBA_TID_OFFSET32            0
690  #define HTT_ISOC_T2H_DELBA_TID_M                   0x000f0000
691  #define HTT_ISOC_T2H_DELBA_TID_S                   16
692  
693  #define HTT_ISOC_T2H_DELBA_PEER_ID_OFFSET32        0
694  #define HTT_ISOC_T2H_DELBA_PEER_ID_M               0xfff00000
695  #define HTT_ISOC_T2H_DELBA_PEER_ID_S               20
696  
697  #define HTT_ISOC_T2H_DELBA_STATUS_OFFSET32         0
698  #define HTT_ISOC_T2H_DELBA_STATUS_M                0x00000100
699  #define HTT_ISOC_T2H_DELBA_STATUS_S                8
700  
701  /* general field access macros */
702  
703  #define HTT_ISOC_T2H_DELBA_FIELD_SET(field, msg_addr, value) \
704      htt_isoc_t2h_field_set(                                       \
705          ((A_UINT32 *) msg_addr),                                  \
706          HTT_ISOC_T2H_DELBA_ ## field ## _OFFSET32,           \
707          HTT_ISOC_T2H_DELBA_ ## field ## _M,                  \
708          HTT_ISOC_T2H_DELBA_ ## field ## _S,                  \
709          value)
710  
711  #define HTT_ISOC_T2H_DELBA_FIELD_GET(field, msg_addr) \
712      HTT_ISOC_T2H_FIELD_GET(                                \
713          ((A_UINT32 *) msg_addr),                           \
714          HTT_ISOC_T2H_DELBA_ ## field ## _OFFSET32,    \
715          HTT_ISOC_T2H_DELBA_ ## field ## _M,           \
716          HTT_ISOC_T2H_DELBA_ ## field ## _S)
717  
718  /* access macros for specific fields */
719  
720  A_COMPILE_TIME_ASSERT(HTT_ISOC_T2H_DELBA_TID_M_Size_Check,\
721    (HTT_ISOC_T2H_DELBA_TID_M >> HTT_ISOC_T2H_DELBA_TID_S) \
722    < ((A_UINT8)~((A_UINT8)0)));
723  #define HTT_ISOC_T2H_DELBA_TID_SET(msg_addr, value) \
724      HTT_ISOC_T2H_DELBA_FIELD_SET(TID, msg_addr, value)
725  #define HTT_ISOC_T2H_DELBA_TID_GET(msg_addr) \
726      (A_UINT8)HTT_ISOC_T2H_DELBA_FIELD_GET(TID, msg_addr)
727  
728  #define HTT_ISOC_T2H_DELBA_PEER_ID_SET(msg_addr, value) \
729      HTT_ISOC_T2H_DELBA_FIELD_SET(PEER_ID, msg_addr, value)
730  #define HTT_ISOC_T2H_DELBA_PEER_ID_GET(msg_addr) \
731      HTT_ISOC_T2H_DELBA_FIELD_GET(PEER_ID, msg_addr)
732  
733  #define HTT_ISOC_T2H_DELBA_STATUS_SET(msg_addr, value) \
734      HTT_ISOC_T2H_DELBA_FIELD_SET(STATUS, msg_addr, value)
735  #define HTT_ISOC_T2H_DELBA_STATUS_GET(msg_addr) \
736      HTT_ISOC_T2H_DELBA_FIELD_GET(STATUS, msg_addr)
737  
738  /*=== SEC_IND message ===*/
739  
740  /**
741   * @brief target -> host Security indication message definition
742   *
743   * @details
744   * The following diagram shows the format of the SEC_IND message sent
745   * from the target to the host.  This layout assumes the target operates
746   * as little-endian.
747   *
748   * |31          25|24|23       18|17|16|15      11|10|9|8|7|6|            0|
749   * |-----------------------------------------------------------------------|
750   * |   is unicast    |  sec type       |     Peer id     |     msg type    |
751   * |-----------------------------------------------------------------------|
752   * |                    mic key1                                           |
753   * |-----------------------------------------------------------------------|
754   * |                    mic key2                                           |
755   * |-----------------------------------------------------------------------|
756   *
757   *
758   * The following field definitions describe the format of the peer info
759   * message sent from the target to the host.
760   *
761   * WORD 0:
762   *   - MSG_TYPE
763   *     Bits 7:0
764   *     Purpose: identifies this as SEC_IND message
765   *     Value: 0x6
766   *   - PEER_ID
767   *     Bits 15:8
768   *     Purpose: The ID that the target has allocated to refer to the peer
769   *     Value: Peer ID
770   *   - SEC_TYPE
771   *     Bits 23:16
772   *     Purpose: specify the security encryption type
773   *     Value: htt_sec_type
774   *   - is unicast
775   *     Bits 31:24
776   *     Purpose: specify unicast/bcast
777   *     Value: 1-unicast/0-bcast
778   * WORD 1:
779   *   - MIC1
780   *     Bits 31:0
781   *     Purpose: Mickey1
782   * WORD 2:
783   *   - MIC2
784   *     Bits 31:0
785   *     Purpose: Mickey2
786   */
787  typedef struct htt_isoc_t2h_sec_ind_s {
788      /* word 0 */
789      A_UINT32
790          msg_type:      8, /* HTT_ISOC_T2H_MSG_TYPE_SEC_IND */
791          peer_id:       8,
792          sec_type:      8,
793          is_unicast:    8;
794      /* word 1 */
795      A_UINT32 mic_key1;
796      /* word 2 */
797      A_UINT32 mic_key2;
798      /* word 3 */
799      A_UINT32 status;
800  } htt_isoc_t2h_sec_ind_t;
801  
802  /* word 0 */
803  #define HTT_ISOC_T2H_SEC_IND_PEER_ID_OFFSET32        0
804  #define HTT_ISOC_T2H_SEC_IND_PEER_ID_M               0x0000ff00
805  #define HTT_ISOC_T2H_SEC_IND_PEER_ID_S               8
806  
807  #define HTT_ISOC_T2H_SEC_IND_SEC_TYPE_OFFSET32       0
808  #define HTT_ISOC_T2H_SEC_IND_SEC_TYPE_M              0x00ff0000
809  #define HTT_ISOC_T2H_SEC_IND_SEC_TYPE_S              16
810  
811  #define HTT_ISOC_T2H_SEC_IND_IS_UNICAST_OFFSET32     0
812  #define HTT_ISOC_T2H_SEC_IND_IS_UNICAST_M            0xff000000
813  #define HTT_ISOC_T2H_SEC_IND_IS_UNICAST_S            24
814  
815  /* word 1 */
816  #define HTT_ISOC_T2H_SEC_IND_MIC1_OFFSET32           1
817  #define HTT_ISOC_T2H_SEC_IND_MIC1_M                  0xffffffff
818  #define HTT_ISOC_T2H_SEC_IND_MIC1_S                  0
819  
820  /* word 2 */
821  #define HTT_ISOC_T2H_SEC_IND_MIC2_OFFSET32           2
822  #define HTT_ISOC_T2H_SEC_IND_MIC2_M                  0xffffffff
823  #define HTT_ISOC_T2H_SEC_IND_MIC2_S                  0
824  
825  
826  /* general field access macros */
827  #define HTT_ISOC_T2H_SEC_IND_FIELD_SET(field, msg_addr, value) \
828      htt_isoc_t2h_field_set(                                      \
829          ((A_UINT32 *) msg_addr),                                 \
830          HTT_ISOC_T2H_SEC_IND_ ## field ## _OFFSET32,           \
831          HTT_ISOC_T2H_SEC_IND_ ## field ## _M,                  \
832          HTT_ISOC_T2H_SEC_IND_ ## field ## _S,                  \
833          value)
834  
835  #define HTT_ISOC_T2H_SEC_IND_FIELD_GET(field, msg_addr) \
836      HTT_ISOC_T2H_FIELD_GET(                               \
837          ((A_UINT32 *) msg_addr),                          \
838          HTT_ISOC_T2H_SEC_IND_ ## field ## _OFFSET32,    \
839          HTT_ISOC_T2H_SEC_IND_ ## field ## _M,           \
840          HTT_ISOC_T2H_SEC_IND_ ## field ## _S)
841  
842  /* access macros for specific fields */
843  #define HTT_ISOC_T2H_SEC_IND_PEER_ID_SET(msg_addr, value) \
844      HTT_ISOC_T2H_SEC_IND_FIELD_SET(PEER_ID, msg_addr, value)
845  #define HTT_ISOC_T2H_SEC_IND_PEER_ID_GET(msg_addr) \
846      HTT_ISOC_T2H_SEC_IND_FIELD_GET(PEER_ID, msg_addr)
847  
848  #define HTT_ISOC_T2H_SEC_IND_SEC_TYPE_SET(msg_addr, value) \
849      HTT_ISOC_T2H_SEC_IND_FIELD_SET(SEC_TYPE, msg_addr, value)
850  #define HTT_ISOC_T2H_SEC_IND_SEC_TYPE_GET(msg_addr) \
851      HTT_ISOC_T2H_SEC_IND_FIELD_GET(SEC_TYPE, msg_addr)
852  
853  #define HTT_ISOC_T2H_SEC_IND_IS_UNICAST_SET(msg_addr, value) \
854      HTT_ISOC_T2H_SEC_IND_FIELD_SET(IS_UNICAST, msg_addr, value)
855  #define HTT_ISOC_T2H_SEC_IND_IS_UNICAST_GET(msg_addr) \
856      HTT_ISOC_T2H_SEC_IND_FIELD_GET(IS_UNICAST, msg_addr)
857  
858  #define HTT_ISOC_T2H_SEC_IND_MIC1_SET(msg_addr, value) \
859      HTT_ISOC_T2H_SEC_IND_FIELD_SET(MIC1, msg_addr, value)
860  #define HTT_ISOC_T2H_SEC_IND_MIC1_GET(msg_addr) \
861      HTT_ISOC_T2H_SEC_IND_FIELD_GET(MIC1, msg_addr)
862  
863  #define HTT_ISOC_T2H_SEC_IND_MIC2_SET(msg_addr, value) \
864      HTT_ISOC_T2H_SEC_IND_FIELD_SET(MIC2, msg_addr, value)
865  #define HTT_ISOC_T2H_SEC_IND_MIC2_GET(msg_addr) \
866      HTT_ISOC_T2H_SEC_IND_FIELD_GET(MIC2, msg_addr)
867  
868  /*=== PEER_TX_READY message ===*/
869  
870  /**
871   * @brief target -> host peer tx ready message definition
872   *
873   * @details
874   * The following diagram shows the format of the peer tx ready message sent
875   * from the target to the host.  This layout assumes the target operates
876   * as little-endian.
877   *
878   * |31                      19|18                       8|7               0|
879   * |-----------------------------------------------------------------------|
880   * |         reserved         |          peer ID         |     msg type    |
881   * |-----------------------------------------------------------------------|
882   *
883   *
884   * The following field definitions describe the format of the peer info
885   * message sent from the target to the host.
886   *
887   * WORD 0:
888   *   - MSG_TYPE
889   *     Bits 7:0
890   *     Purpose: identifies this as peer tx ready message
891   *     Value: 0x7
892   *   - PEER_ID
893   *     Bits 18:8
894   *     Purpose: The ID assigned to the peer by the PEER_INFO message
895   */
896  typedef struct htt_isoc_t2h_peer_tx_ready_s {
897      /* word 0 */
898      A_UINT32
899          msg_type:      8, /* HTT_ISOC_T2H_MSG_TYPE_PEER_TX_READY */
900          peer_id:      11,
901          reserved0:    13;
902  } htt_isoc_t2h_peer_tx_ready_t;
903  
904  /* word 0 */
905  #define HTT_ISOC_T2H_PEER_TX_READY_PEER_ID_OFFSET32        0
906  #define HTT_ISOC_T2H_PEER_TX_READY_PEER_ID_M               0x0007ff00
907  #define HTT_ISOC_T2H_PEER_TX_READY_PEER_ID_S               8
908  
909  
910  /* general field access macros */
911  
912  #define HTT_ISOC_T2H_PEER_TX_READY_FIELD_SET(field, msg_addr, value) \
913      htt_isoc_t2h_field_set(                                       \
914          ((A_UINT32 *) msg_addr),                                  \
915          HTT_ISOC_T2H_PEER_TX_READY_ ## field ## _OFFSET32,           \
916          HTT_ISOC_T2H_PEER_TX_READY_ ## field ## _M,                  \
917          HTT_ISOC_T2H_PEER_TX_READY_ ## field ## _S,                  \
918          value)
919  
920  #define HTT_ISOC_T2H_PEER_TX_READY_FIELD_GET(field, msg_addr) \
921      HTT_ISOC_T2H_FIELD_GET(                                \
922          ((A_UINT32 *) msg_addr),                           \
923          HTT_ISOC_T2H_PEER_TX_READY_ ## field ## _OFFSET32,    \
924          HTT_ISOC_T2H_PEER_TX_READY_ ## field ## _M,           \
925          HTT_ISOC_T2H_PEER_TX_READY_ ## field ## _S)
926  
927  /* access macros for specific fields */
928  
929  A_COMPILE_TIME_ASSERT(HTT_ISOC_T2H_PEER_TX_READY_PEER_ID_M_Size_Check, (HTT_ISOC_T2H_PEER_TX_READY_PEER_ID_M >> HTT_ISOC_T2H_PEER_TX_READY_PEER_ID_S) < ((A_UINT16)~((A_UINT16)0)));
930  
931  #define HTT_ISOC_T2H_PEER_TX_READY_PEER_ID_SET(msg_addr, value) \
932      HTT_ISOC_T2H_PEER_TX_READY_FIELD_SET(PEER_ID, msg_addr, value)
933  #define HTT_ISOC_T2H_PEER_TX_READY_PEER_ID_GET(msg_addr) \
934      ((A_UINT16)(HTT_ISOC_T2H_PEER_TX_READY_FIELD_GET(PEER_ID, msg_addr)))
935  
936  
937  /*=== RX_ERR message ===*/
938  
939  /**
940   * @brief target -> host rx error notification message definition
941   *
942   * @details
943   * The following diagram shows the format of the rx err message sent
944   * from the target to the host.  This layout assumes the target operates
945   * as little-endian.
946   *
947   * |31                               16|15              8|7|6|5|4       0|
948   * |---------------------------------------------------------------------|
949   * |               peer ID             |   rx err type   |    msg type   |
950   * |---------------------------------------------------------------------|
951   * |               reserved            |   rx err count  |M| r | ext TID |
952   * |---------------------------------------------------------------------|
953   * M = multicast
954   * r = reserved
955   *
956   * The following field definitions describe the format of the peer info
957   * message sent from the target to the host.
958   *
959   * WORD 0:
960   *   - MSG_TYPE
961   *     Bits 7:0
962   *     Purpose: identifies this as an rx err message
963   *     Value: 0x8
964   *   - RX_ERR_TYPE
965   *     Bits 15:8
966   *     Purpose: specifies which type of rx error is being reported
967   *     Value: htt_rx_ind_mpdu_status enum
968   *   - PEER_ID
969   *     Bits 31:16
970   *     Purpose: specify which peer sent the frame that resulted in an error
971   * WORD 1:
972   *   - EXT_TID
973   *     Bits 4:0
974   *     Purpose: specifies which traffic type had the rx error
975   *     Value: 0-15 for a real TID value, 16 for non-QoS data, 31 for unknown
976   *   - MCAST
977   *     Bit 6
978   *     Purpose: specify whether the rx error frame was unicast or multicast
979   *     Value: 0 -> unicast, 1 -> multicast
980   *   - L2_HDR_IS_80211
981   *     Bit 7
982   *     Purpose: specifies whether the included L2 header (if present) is in
983   *         802.3 or 802.11 format
984   *     Value: 0 -> 802.3, 1 -> 802.11
985   *   - L2_HDR_BYTES
986   *     Bits 15:8
987   *     Purpose: Specify the size of the L2 header in this rx error report.
988   *     Value:
989   *         If no L2 header is included, this field shall be 0.
990   *         If a 802.3 + LLC/SNAP header is included, this field shall be
991   *         14 (ethernet header) + 8 (LLC/SNAP).
992   *         If a 802.11 header is included, this field shall be 24 bytes for
993   *         a basic header, or 26 bytes if a QoS control field is included,
994   *         or 30 bytes if a 4th address is included, or 32 bytes if a 4th
995   *         address and a QoS control field are included, etc.
996   *         Though the L2 header included in the message needs to include
997   *         padding up to a 4-byte boundary, this L2 header size field need
998   *         not account for the padding following the L2 header.
999   *   - SEC_HDR_BYTES
1000   *     Bits 23:16
1001   *     Purpose: Specify the size of the security encapsulation header in
1002   *         this rx error report.
1003   *     Value:
1004   *         If no security header is included, this field shall be 0.
1005   *         If a security header is included, this field depends on the
1006   *         security type, which can be inferred from the rx error type.
1007   *         For TKIP MIC errors, the security header could be any of:
1008   *             8  - if IV / KeyID and Extended IV are included
1009   *             16 - if MIC is also included
1010   *             20 - if ICV is also included
1011   *   - RX_ERR_CNT
1012   *     Bits 31:24
1013   *     Purpose: specifies how many rx errors are reported in this message
1014   *     Value:
1015   *         Rx error reports that include a L2 header and/or security header
1016   *         will set this field to 1, to indicate that the error notification
1017   *         is for a single frame.
1018   *         Rx error reports that don't include a L2 header or security header
1019   *         can use this field to send a single message to report multiple
1020   *         erroneous rx frames.
1021   */
1022  typedef struct htt_isoc_t2h_rx_err_s {
1023      /* word 0 */
1024      A_UINT32
1025          msg_type:        8, /* HTT_ISOC_T2H_MSG_TYPE_RX_ERR */
1026          rx_err_type:     8,
1027          peer_id:        16;
1028      /* word 1 */
1029      A_UINT32
1030          ext_tid:         5,
1031          reserved1:       1,
1032          mcast:           1,
1033          l2_hdr_is_80211: 1,
1034          l2_hdr_bytes:    8,
1035          sec_hdr_bytes:   8,
1036          rx_err_cnt:      8;
1037      /* words 2 - M-1: L2 header */
1038      /* words M - N: security header */
1039  } htt_isoc_t2h_rx_err_t;
1040  
1041  /* This needs to be exact bytes for structure htt_isoc_t2h_rx_err_t
1042   *  * Since it is shared between host and FW, sizeof may not be used.
1043   *  * */
1044  #define HTT_ISOC_T2H_RX_ERR_BASE_BYTES                20
1045  
1046  /* word 0 */
1047  #define HTT_ISOC_T2H_RX_ERR_TYPE_OFFSET32             0
1048  #define HTT_ISOC_T2H_RX_ERR_TYPE_M                    0x0000ff00
1049  #define HTT_ISOC_T2H_RX_ERR_TYPE_S                    8
1050  
1051  #define HTT_ISOC_T2H_RX_ERR_PEER_ID_OFFSET32          0
1052  #define HTT_ISOC_T2H_RX_ERR_PEER_ID_M                 0xffff0000
1053  #define HTT_ISOC_T2H_RX_ERR_PEER_ID_S                 16
1054  
1055  /* word 1 */
1056  #define HTT_ISOC_T2H_RX_ERR_EXT_TID_OFFSET32          1
1057  #define HTT_ISOC_T2H_RX_ERR_EXT_TID_M                 0x0000001f
1058  #define HTT_ISOC_T2H_RX_ERR_EXT_TID_S                 0
1059  
1060  #define HTT_ISOC_T2H_RX_ERR_MCAST_OFFSET32            1
1061  #define HTT_ISOC_T2H_RX_ERR_MCAST_M                   0x00000040
1062  #define HTT_ISOC_T2H_RX_ERR_MCAST_S                   6
1063  
1064  #define HTT_ISOC_T2H_RX_ERR_L2_HDR_IS_80211_OFFSET32  1
1065  #define HTT_ISOC_T2H_RX_ERR_L2_HDR_IS_80211_M         0x00000080
1066  #define HTT_ISOC_T2H_RX_ERR_L2_HDR_IS_80211_S         7
1067  
1068  #define HTT_ISOC_T2H_RX_ERR_L2_HDR_BYTES_OFFSET32     1
1069  #define HTT_ISOC_T2H_RX_ERR_L2_HDR_BYTES_M            0x0000ff00
1070  #define HTT_ISOC_T2H_RX_ERR_L2_HDR_BYTES_S            8
1071  
1072  #define HTT_ISOC_T2H_RX_ERR_SEC_HDR_BYTES_OFFSET32    1
1073  #define HTT_ISOC_T2H_RX_ERR_SEC_HDR_BYTES_M           0x00ff0000
1074  #define HTT_ISOC_T2H_RX_ERR_SEC_HDR_BYTES_S           16
1075  
1076  #define HTT_ISOC_T2H_RX_ERR_CNT_OFFSET32              1
1077  #define HTT_ISOC_T2H_RX_ERR_CNT_M                     0xff000000
1078  #define HTT_ISOC_T2H_RX_ERR_CNT_S                     24
1079  
1080  
1081  /* general field access macros */
1082  
1083  #define HTT_ISOC_T2H_RX_ERR_FIELD_SET(field, msg_addr, value) \
1084      htt_isoc_t2h_field_set(                                       \
1085          ((A_UINT32 *) msg_addr),                                  \
1086          HTT_ISOC_T2H_RX_ERR_ ## field ## _OFFSET32,           \
1087          HTT_ISOC_T2H_RX_ERR_ ## field ## _M,                  \
1088          HTT_ISOC_T2H_RX_ERR_ ## field ## _S,                  \
1089          value)
1090  
1091  #define HTT_ISOC_T2H_RX_ERR_FIELD_GET(field, msg_addr) \
1092      HTT_ISOC_T2H_FIELD_GET(                                \
1093          ((A_UINT32 *) msg_addr),                           \
1094          HTT_ISOC_T2H_RX_ERR_ ## field ## _OFFSET32,    \
1095          HTT_ISOC_T2H_RX_ERR_ ## field ## _M,           \
1096          HTT_ISOC_T2H_RX_ERR_ ## field ## _S)
1097  
1098  /* access macros for specific fields */
1099  
1100  #define HTT_ISOC_T2H_RX_ERR_TYPE_SET(msg_addr, value) \
1101      HTT_ISOC_T2H_RX_ERR_FIELD_SET(TYPE, msg_addr, value)
1102  #define HTT_ISOC_T2H_RX_ERR_TYPE_GET(msg_addr) \
1103      HTT_ISOC_T2H_RX_ERR_FIELD_GET(TYPE, msg_addr)
1104  
1105  A_COMPILE_TIME_ASSERT(HTT_ISOC_T2H_RX_ERR_PEER_ID_M_Size_Check, (HTT_ISOC_T2H_RX_ERR_PEER_ID_M >> HTT_ISOC_T2H_RX_ERR_PEER_ID_S) <= ((A_UINT16)~((A_UINT16)0)));
1106  #define HTT_ISOC_T2H_RX_ERR_PEER_ID_SET(msg_addr, value) \
1107      HTT_ISOC_T2H_RX_ERR_FIELD_SET(PEER_ID, msg_addr, value)
1108  #define HTT_ISOC_T2H_RX_ERR_PEER_ID_GET(msg_addr) \
1109      ((A_UINT16)HTT_ISOC_T2H_RX_ERR_FIELD_GET(PEER_ID, msg_addr))
1110  
1111  #define HTT_ISOC_T2H_RX_ERR_EXT_TID_SET(msg_addr, value) \
1112      HTT_ISOC_T2H_RX_ERR_FIELD_SET(EXT_TID, msg_addr, value)
1113  #define HTT_ISOC_T2H_RX_ERR_EXT_TID_GET(msg_addr) \
1114      HTT_ISOC_T2H_RX_ERR_FIELD_GET(EXT_TID, msg_addr)
1115  
1116  #define HTT_ISOC_T2H_RX_ERR_MCAST_SET(msg_addr, value) \
1117      HTT_ISOC_T2H_RX_ERR_FIELD_SET(MCAST, msg_addr, value)
1118  #define HTT_ISOC_T2H_RX_ERR_MCAST_GET(msg_addr) \
1119      HTT_ISOC_T2H_RX_ERR_FIELD_GET(MCAST, msg_addr)
1120  
1121  #define HTT_ISOC_T2H_RX_ERR_L2_HDR_IS_80211_SET(msg_addr, value) \
1122      HTT_ISOC_T2H_RX_ERR_FIELD_SET(L2_HDR_IS_80211, msg_addr, value)
1123  #define HTT_ISOC_T2H_RX_ERR_L2_HDR_IS_80211_GET(msg_addr) \
1124      HTT_ISOC_T2H_RX_ERR_FIELD_GET(L2_HDR_IS_80211, msg_addr)
1125  
1126  #define HTT_ISOC_T2H_RX_ERR_L2_HDR_BYTES_SET(msg_addr, value) \
1127      HTT_ISOC_T2H_RX_ERR_FIELD_SET(L2_HDR_BYTES, msg_addr, value)
1128  #define HTT_ISOC_T2H_RX_ERR_L2_HDR_BYTES_GET(msg_addr) \
1129      HTT_ISOC_T2H_RX_ERR_FIELD_GET(L2_HDR_BYTES, msg_addr)
1130  
1131  #define HTT_ISOC_T2H_RX_ERR_SEC_HDR_BYTES_SET(msg_addr, value) \
1132      HTT_ISOC_T2H_RX_ERR_FIELD_SET(SEC_HDR_BYTES, msg_addr, value)
1133  #define HTT_ISOC_T2H_RX_ERR_SEC_HDR_BYTES_GET(msg_addr) \
1134      HTT_ISOC_T2H_RX_ERR_FIELD_GET(SEC_HDR_BYTES, msg_addr)
1135  
1136  #define HTT_ISOC_T2H_RX_ERR_CNT_SET(msg_addr, value) \
1137      HTT_ISOC_T2H_RX_ERR_FIELD_SET(CNT, msg_addr, value)
1138  #define HTT_ISOC_T2H_RX_ERR_CNT_GET(msg_addr) \
1139      HTT_ISOC_T2H_RX_ERR_FIELD_GET(CNT, msg_addr)
1140  
1141  /*=== TX OTA complete indication message ===*/
1142  
1143  /**
1144   * @brief target -> tx complete indicate message
1145   *
1146   * @details
1147   * The following diagram shows the format of the tx complete indication message sent
1148   * from the target to the host.  This layout assumes the target operates
1149   * as little-endian.
1150   *
1151   * |31                      19|18                       8|7               0|
1152   * |-----------------------------------------------------------------------|
1153   * |         reserved         |          status          |     msg type    |
1154   * |-----------------------------------------------------------------------|
1155   *
1156   *
1157   * The following field definitions describe the format of the peer info
1158   * message sent from the target to the host.
1159   *
1160   * WORD 0:
1161   *   - MSG_TYPE
1162   *     Bits 7:0
1163   *     Purpose: identifies this as tx complete indication message
1164   *     Value: 0x7
1165   *   - status
1166   *     Bits 18:8
1167   *     Purpose: TX completion status
1168   */
1169  typedef struct htt_isoc_t2h_tx_compl_s {
1170      /* word 0 */
1171      A_UINT32
1172          msg_type:      8, /* HTT_ISOC_T2H_MSG_TYPE_TX_COMPL_IND */
1173          status:       11,
1174          reserved0:    13;
1175  } htt_isoc_t2h_tx_compl_t;
1176  
1177  /* word 0 */
1178  #define HTT_ISOC_T2H_TX_COMPL_IND_STATUS_OFFSET32        0
1179  #define HTT_ISOC_T2H_TX_COMPL_IND_STATUS_M               0x0007ff00
1180  #define HTT_ISOC_T2H_TX_COMPL_IND_STATUS_S               8
1181  
1182  
1183  /* general field access macros */
1184  
1185  #define HTT_ISOC_T2H_TX_COMPL_IND_FIELD_SET(field, msg_addr, value) \
1186      htt_isoc_t2h_field_set(                                       \
1187          ((A_UINT32 *) msg_addr),                                  \
1188          HTT_ISOC_T2H_TX_COMPL_IND_ ## field ## _OFFSET32,           \
1189          HTT_ISOC_T2H_TX_COMPL_IND_ ## field ## _M,                  \
1190          HTT_ISOC_T2H_TX_COMPL_IND_ ## field ## _S,                  \
1191          value)
1192  
1193  #define HTT_ISOC_T2H_TX_COMPL_IND_FIELD_GET(field, msg_addr) \
1194      HTT_ISOC_T2H_FIELD_GET(                                \
1195          ((A_UINT32 *) msg_addr),                           \
1196          HTT_ISOC_T2H_TX_COMPL_IND_ ## field ## _OFFSET32,    \
1197          HTT_ISOC_T2H_TX_COMPL_IND_ ## field ## _M,           \
1198          HTT_ISOC_T2H_TX_COMPL_IND_ ## field ## _S)
1199  
1200  /* access macros for specific fields */
1201  
1202  #define HTT_ISOC_T2H_TX_COMPL_IND_STATUS_SET(msg_addr, value) \
1203      HTT_ISOC_T2H_TX_COMPL_IND_FIELD_SET(STATUS, msg_addr, value)
1204  #define HTT_ISOC_T2H_TX_COMPL_IND_STATUS_GET(msg_addr) \
1205      HTT_ISOC_T2H_TX_COMPL_IND_FIELD_GET(STATUS, msg_addr)
1206  
1207  #define HTT_TX_COMPL_IND_STAT_OK          0
1208  #define HTT_TX_COMPL_IND_STAT_DISCARD     1
1209  #define HTT_TX_COMPL_IND_STAT_NO_ACK      2
1210  #define HTT_TX_COMPL_IND_STAT_POSTPONE    3
1211  
1212  /*=== NLO indication message ===*/
1213  
1214  /**
1215  * @brief target -> NLO indicate message
1216  *
1217  * @details
1218  * The following diagram shows the format of the NLO indication message sent
1219  * from the target to the host.  This layout assumes the target operates
1220  * as little-endian.
1221  *
1222  * |31                                                  8|7               0|
1223  * |-----------------------------------------------------------------------|
1224  * |                      reserved                       |     msg type    |
1225  * |-----------------------------------------------------------------------|
1226  *
1227   *
1228   * The following field definitions describe the format of NLO MATCH indication
1229  * message sent from the target to the host.
1230  *
1231  * WORD 0:
1232  *   - MSG_TYPE
1233  *     Bits 7:0
1234  *     Purpose: identifies this as NLO indication message
1235  *     Value: 0x9 - HTT_ISOC_T2H_MSG_TYPE_NLO_MATCH
1236  *     Value: 0xA - HTT_ISOC_T2H_MSG_TYPE_NLO_SCAN_END
1237  */
1238  typedef struct htt_isoc_t2h_nlo_ind_s {
1239      /* word 0 */
1240      A_UINT32
1241          msg_type:      8,
1242          vdev_id:       8,
1243          reserved0:    16;
1244  } htt_isoc_t2h_nlo_ind_t;
1245  
1246  /* word 0 */
1247  #define HTT_ISOC_T2H_NLO_IND_VDEVID_OFFSET32            0
1248  #define HTT_ISOC_T2H_NLO_IND_VDEVID_M                   0x0000ff00
1249  #define HTT_ISOC_T2H_NLO_IND_VDEVID_S                   8
1250  
1251  
1252  /* general field access macros */
1253  
1254  #define HTT_ISOC_T2H_NLO_IND_FIELD_SET(field, msg_addr, value)  \
1255      htt_isoc_t2h_field_set(                                     \
1256          ((A_UINT32 *) msg_addr),                                \
1257          HTT_ISOC_T2H_NLO_IND_ ## field ## _OFFSET32,            \
1258          HTT_ISOC_T2H_NLO_IND_ ## field ## _M,                   \
1259          HTT_ISOC_T2H_NLO_IND_ ## field ## _S,                   \
1260          value)
1261  
1262  #define HTT_ISOC_T2H_NLO_IND_FIELD_GET(field, msg_addr)     \
1263      HTT_ISOC_T2H_FIELD_GET(                                 \
1264          ((A_UINT32 *) msg_addr),                            \
1265          HTT_ISOC_T2H_NLO_IND_ ## field ## _OFFSET32,        \
1266          HTT_ISOC_T2H_NLO_IND_ ## field ## _M,               \
1267          HTT_ISOC_T2H_NLO_IND_ ## field ## _S)
1268  
1269  /* access macros for specific fields */
1270  
1271  #define HTT_ISOC_T2H_NLO_IND_VDEVID_SET(msg_addr, value) \
1272      HTT_ISOC_T2H_NLO_IND_FIELD_SET(VDEVID, msg_addr, value)
1273  #define HTT_ISOC_T2H_NLO_IND_VDEVID_GET(msg_addr) \
1274      HTT_ISOC_T2H_NLO_IND_FIELD_GET(VDEVID, msg_addr)
1275  
1276  
1277  #endif /* _HTT_ISOC_H_ */
1278