dpseci_cmd.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
  2. /*
  3. * Copyright 2013-2016 Freescale Semiconductor Inc.
  4. * Copyright 2017-2018 NXP
  5. */
  6. #ifndef _DPSECI_CMD_H_
  7. #define _DPSECI_CMD_H_
  8. /* DPSECI Version */
  9. #define DPSECI_VER_MAJOR 5
  10. #define DPSECI_VER_MINOR 3
  11. #define DPSECI_VER(maj, min) (((maj) << 16) | (min))
  12. #define DPSECI_VERSION DPSECI_VER(DPSECI_VER_MAJOR, DPSECI_VER_MINOR)
  13. /* Command versioning */
  14. #define DPSECI_CMD_BASE_VERSION 1
  15. #define DPSECI_CMD_BASE_VERSION_V2 2
  16. #define DPSECI_CMD_ID_OFFSET 4
  17. #define DPSECI_CMD_V1(id) (((id) << DPSECI_CMD_ID_OFFSET) | \
  18. DPSECI_CMD_BASE_VERSION)
  19. #define DPSECI_CMD_V2(id) (((id) << DPSECI_CMD_ID_OFFSET) | \
  20. DPSECI_CMD_BASE_VERSION_V2)
  21. /* Command IDs */
  22. #define DPSECI_CMDID_CLOSE DPSECI_CMD_V1(0x800)
  23. #define DPSECI_CMDID_OPEN DPSECI_CMD_V1(0x809)
  24. #define DPSECI_CMDID_GET_API_VERSION DPSECI_CMD_V1(0xa09)
  25. #define DPSECI_CMDID_ENABLE DPSECI_CMD_V1(0x002)
  26. #define DPSECI_CMDID_DISABLE DPSECI_CMD_V1(0x003)
  27. #define DPSECI_CMDID_GET_ATTR DPSECI_CMD_V1(0x004)
  28. #define DPSECI_CMDID_RESET DPSECI_CMD_V1(0x005)
  29. #define DPSECI_CMDID_IS_ENABLED DPSECI_CMD_V1(0x006)
  30. #define DPSECI_CMDID_SET_RX_QUEUE DPSECI_CMD_V1(0x194)
  31. #define DPSECI_CMDID_GET_RX_QUEUE DPSECI_CMD_V1(0x196)
  32. #define DPSECI_CMDID_GET_TX_QUEUE DPSECI_CMD_V1(0x197)
  33. #define DPSECI_CMDID_GET_SEC_ATTR DPSECI_CMD_V2(0x198)
  34. #define DPSECI_CMDID_SET_CONGESTION_NOTIFICATION DPSECI_CMD_V1(0x170)
  35. #define DPSECI_CMDID_GET_CONGESTION_NOTIFICATION DPSECI_CMD_V1(0x171)
  36. /* Macros for accessing command fields smaller than 1 byte */
  37. #define DPSECI_MASK(field) \
  38. GENMASK(DPSECI_##field##_SHIFT + DPSECI_##field##_SIZE - 1, \
  39. DPSECI_##field##_SHIFT)
  40. #define dpseci_set_field(var, field, val) \
  41. ((var) |= (((val) << DPSECI_##field##_SHIFT) & DPSECI_MASK(field)))
  42. #define dpseci_get_field(var, field) \
  43. (((var) & DPSECI_MASK(field)) >> DPSECI_##field##_SHIFT)
  44. struct dpseci_cmd_open {
  45. __le32 dpseci_id;
  46. };
  47. #define DPSECI_ENABLE_SHIFT 0
  48. #define DPSECI_ENABLE_SIZE 1
  49. struct dpseci_rsp_is_enabled {
  50. u8 is_enabled;
  51. };
  52. struct dpseci_rsp_get_attributes {
  53. __le32 id;
  54. __le32 pad0;
  55. u8 num_tx_queues;
  56. u8 num_rx_queues;
  57. u8 pad1[6];
  58. __le32 options;
  59. };
  60. #define DPSECI_DEST_TYPE_SHIFT 0
  61. #define DPSECI_DEST_TYPE_SIZE 4
  62. #define DPSECI_ORDER_PRESERVATION_SHIFT 0
  63. #define DPSECI_ORDER_PRESERVATION_SIZE 1
  64. struct dpseci_cmd_queue {
  65. __le32 dest_id;
  66. u8 priority;
  67. u8 queue;
  68. u8 dest_type;
  69. u8 pad;
  70. __le64 user_ctx;
  71. union {
  72. __le32 options;
  73. __le32 fqid;
  74. };
  75. u8 order_preservation_en;
  76. };
  77. struct dpseci_rsp_get_tx_queue {
  78. __le32 pad;
  79. __le32 fqid;
  80. u8 priority;
  81. };
  82. struct dpseci_rsp_get_sec_attr {
  83. __le16 ip_id;
  84. u8 major_rev;
  85. u8 minor_rev;
  86. u8 era;
  87. u8 pad0[3];
  88. u8 deco_num;
  89. u8 zuc_auth_acc_num;
  90. u8 zuc_enc_acc_num;
  91. u8 pad1;
  92. u8 snow_f8_acc_num;
  93. u8 snow_f9_acc_num;
  94. u8 crc_acc_num;
  95. u8 pad2;
  96. u8 pk_acc_num;
  97. u8 kasumi_acc_num;
  98. u8 rng_acc_num;
  99. u8 pad3;
  100. u8 md_acc_num;
  101. u8 arc4_acc_num;
  102. u8 des_acc_num;
  103. u8 aes_acc_num;
  104. u8 ccha_acc_num;
  105. u8 ptha_acc_num;
  106. };
  107. struct dpseci_rsp_get_api_version {
  108. __le16 major;
  109. __le16 minor;
  110. };
  111. #define DPSECI_CGN_DEST_TYPE_SHIFT 0
  112. #define DPSECI_CGN_DEST_TYPE_SIZE 4
  113. #define DPSECI_CGN_UNITS_SHIFT 4
  114. #define DPSECI_CGN_UNITS_SIZE 2
  115. struct dpseci_cmd_congestion_notification {
  116. __le32 dest_id;
  117. __le16 notification_mode;
  118. u8 priority;
  119. u8 options;
  120. __le64 message_iova;
  121. __le64 message_ctx;
  122. __le32 threshold_entry;
  123. __le32 threshold_exit;
  124. };
  125. #endif /* _DPSECI_CMD_H_ */