wal_rx_desc.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * Copyright (c) 2011-2012, 2014 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. #ifndef _WAL_RX_DESC__H_
  27. #define _WAL_RX_DESC__H_
  28. #if defined(ATH_TARGET)
  29. #include <athdefs.h> /* A_UINT8 */
  30. #else
  31. #include <a_types.h> /* A_UINT8 */
  32. #endif
  33. /*
  34. * As this header is used by host also,
  35. * and host will access target registers by target reg tbl,
  36. * so disable direct-reference here for host.
  37. *
  38. */
  39. #if !defined(ATH_PERF_PWR_OFFLOAD)
  40. /* HW rx descriptor definitions */
  41. #include <hw/mac_descriptors/rx_attention.h>
  42. #include <hw/mac_descriptors/rx_frag_info.h>
  43. #include <hw/mac_descriptors/rx_msdu_start.h>
  44. #include <hw/mac_descriptors/rx_msdu_end.h>
  45. #include <hw/mac_descriptors/rx_mpdu_start.h>
  46. #include <hw/mac_descriptors/rx_mpdu_end.h>
  47. #include <hw/mac_descriptors/rx_ppdu_start.h>
  48. #include <hw/mac_descriptors/rx_ppdu_end.h>
  49. /*
  50. * This struct defines the basic descriptor information, which is
  51. * written by the 11ac HW MAC into the WAL's rx status descriptor
  52. * ring.
  53. */
  54. struct hw_rx_desc_base {
  55. struct rx_attention attention;
  56. struct rx_frag_info frag_info;
  57. struct rx_mpdu_start mpdu_start;
  58. struct rx_msdu_start msdu_start;
  59. struct rx_msdu_end msdu_end;
  60. struct rx_mpdu_end mpdu_end;
  61. struct rx_ppdu_start ppdu_start;
  62. struct rx_ppdu_end ppdu_end;
  63. };
  64. #endif
  65. /*
  66. * This struct defines the basic MSDU rx descriptor created by FW.
  67. */
  68. struct fw_rx_desc_base {
  69. union {
  70. struct {
  71. A_UINT8 discard : 1,
  72. forward : 1,
  73. any_err : 1,
  74. dup_err : 1, reserved : 1, inspect : 1, extension : 2;
  75. } bits;
  76. A_UINT8 val;
  77. } u;
  78. };
  79. #define FW_RX_DESC_DISCARD_M 0x1
  80. #define FW_RX_DESC_DISCARD_S 0
  81. #define FW_RX_DESC_FORWARD_M 0x2
  82. #define FW_RX_DESC_FORWARD_S 1
  83. #define FW_RX_DESC_MIC_ERR_M 0x4
  84. #define FW_RX_DESC_MIC_ERR_S 2
  85. #define FW_RX_DESC_DUP_ERR_M 0x8
  86. #define FW_RX_DESC_DUP_ERR_S 3
  87. #define FW_RX_DESC_INSPECT_M 0x20
  88. #define FW_RX_DESC_INSPECT_S 5
  89. #define FW_RX_DESC_EXT_M 0xc0
  90. #define FW_RX_DESC_EXT_S 6
  91. #define FW_RX_DESC_CNT_2_BYTES(_fw_desc_cnt) (_fw_desc_cnt)
  92. enum {
  93. FW_RX_DESC_EXT_NONE = 0,
  94. FW_RX_DESC_EXT_LRO_ONLY,
  95. FW_RX_DESC_EXT_LRO_AND_OTHER,
  96. FW_RX_DESC_EXT_OTHER
  97. };
  98. #define FW_RX_DESC_DISCARD_GET(_var) \
  99. (((_var) & FW_RX_DESC_DISCARD_M) >> FW_RX_DESC_DISCARD_S)
  100. #define FW_RX_DESC_DISCARD_SET(_var, _val) \
  101. ((_var) |= ((_val) << FW_RX_DESC_DISCARD_S))
  102. #define FW_RX_DESC_FORWARD_GET(_var) \
  103. (((_var) & FW_RX_DESC_FORWARD_M) >> FW_RX_DESC_FORWARD_S)
  104. #define FW_RX_DESC_FORWARD_SET(_var, _val) \
  105. ((_var) |= ((_val) << FW_RX_DESC_FORWARD_S))
  106. #define FW_RX_DESC_INSPECT_GET(_var) \
  107. (((_var) & FW_RX_DESC_INSPECT_M) >> FW_RX_DESC_INSPECT_S)
  108. #define FW_RX_DESC_INSPECT_SET(_var, _val) \
  109. ((_var) |= ((_val) << FW_RX_DESC_INSPECT_S))
  110. #define FW_RX_DESC_EXT_GET(_var) \
  111. (((_var) & FW_RX_DESC_EXT_M) >> FW_RX_DESC_EXT_S)
  112. #define FW_RX_DESC_EXT_SET(_var, _val) \
  113. ((_var) |= ((_val) << FW_RX_DESC_EXT_S))
  114. #endif /* _WAL_RX_DESC__H_ */