sdma_txreq.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
  2. /*
  3. * Copyright(c) 2016 Intel Corporation.
  4. */
  5. #ifndef HFI1_SDMA_TXREQ_H
  6. #define HFI1_SDMA_TXREQ_H
  7. /* increased for AHG */
  8. #define NUM_DESC 6
  9. /*
  10. * struct sdma_desc - canonical fragment descriptor
  11. *
  12. * This is the descriptor carried in the tx request
  13. * corresponding to each fragment.
  14. *
  15. */
  16. struct sdma_desc {
  17. /* private: don't use directly */
  18. u64 qw[2];
  19. void *pinning_ctx;
  20. /* Release reference to @pinning_ctx. May be called in interrupt context. Must not sleep. */
  21. void (*ctx_put)(void *ctx);
  22. };
  23. /**
  24. * struct sdma_txreq - the sdma_txreq structure (one per packet)
  25. * @list: for use by user and by queuing for wait
  26. *
  27. * This is the representation of a packet which consists of some
  28. * number of fragments. Storage is provided to within the structure.
  29. * for all fragments.
  30. *
  31. * The storage for the descriptors are automatically extended as needed
  32. * when the currently allocation is exceeded.
  33. *
  34. * The user (Verbs or PSM) may overload this structure with fields
  35. * specific to their use by putting this struct first in their struct.
  36. * The method of allocation of the overloaded structure is user dependent
  37. *
  38. * The list is the only public field in the structure.
  39. *
  40. */
  41. #define SDMA_TXREQ_S_OK 0
  42. #define SDMA_TXREQ_S_SENDERROR 1
  43. #define SDMA_TXREQ_S_ABORTED 2
  44. #define SDMA_TXREQ_S_SHUTDOWN 3
  45. /* flags bits */
  46. #define SDMA_TXREQ_F_URGENT 0x0001
  47. #define SDMA_TXREQ_F_AHG_COPY 0x0002
  48. #define SDMA_TXREQ_F_USE_AHG 0x0004
  49. #define SDMA_TXREQ_F_VIP 0x0010
  50. struct sdma_txreq;
  51. typedef void (*callback_t)(struct sdma_txreq *, int);
  52. struct iowait;
  53. struct sdma_txreq {
  54. struct list_head list;
  55. /* private: */
  56. struct sdma_desc *descp;
  57. /* private: */
  58. void *coalesce_buf;
  59. /* private: */
  60. struct iowait *wait;
  61. /* private: */
  62. callback_t complete;
  63. #ifdef CONFIG_HFI1_DEBUG_SDMA_ORDER
  64. u64 sn;
  65. #endif
  66. /* private: - used in coalesce/pad processing */
  67. u16 packet_len;
  68. /* private: - down-counted to trigger last */
  69. u16 tlen;
  70. /* private: */
  71. u16 num_desc;
  72. /* private: */
  73. u16 desc_limit;
  74. /* private: */
  75. u16 next_descq_idx;
  76. /* private: */
  77. u16 coalesce_idx;
  78. /* private: flags */
  79. u16 flags;
  80. /* private: */
  81. struct sdma_desc descs[NUM_DESC];
  82. };
  83. static inline int sdma_txreq_built(struct sdma_txreq *tx)
  84. {
  85. return tx->num_desc;
  86. }
  87. #endif /* HFI1_SDMA_TXREQ_H */