Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #ifndef _IPXE_IB_MI_H
  2. #define _IPXE_IB_MI_H
  3. /** @file
  4. *
  5. * Infiniband management interfaces
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <ipxe/list.h>
  10. #include <ipxe/retry.h>
  11. #include <ipxe/tables.h>
  12. #include <ipxe/infiniband.h>
  13. struct ib_mad_interface;
  14. struct ib_mad_transaction;
  15. /** An Infiniband management agent */
  16. struct ib_mad_agent {
  17. /** Management class */
  18. uint8_t mgmt_class;
  19. /** Class version */
  20. uint8_t class_version;
  21. /** Attribute (in network byte order) */
  22. uint16_t attr_id;
  23. /** Handle MAD
  24. *
  25. * @v ibdev Infiniband device
  26. * @v mi Management interface
  27. * @v mad Received MAD
  28. * @v av Source address vector
  29. * @ret rc Return status code
  30. */
  31. void ( * handle ) ( struct ib_device *ibdev,
  32. struct ib_mad_interface *mi,
  33. union ib_mad *mad,
  34. struct ib_address_vector *av );
  35. };
  36. /** Infiniband management agents */
  37. #define IB_MAD_AGENTS __table ( struct ib_mad_agent, "ib_mad_agents" )
  38. /** Declare an Infiniband management agent */
  39. #define __ib_mad_agent __table_entry ( IB_MAD_AGENTS, 01 )
  40. /** Infiniband management transaction operations */
  41. struct ib_mad_transaction_operations {
  42. /** Handle transaction completion
  43. *
  44. * @v ibdev Infiniband device
  45. * @v mi Management interface
  46. * @v madx Management transaction
  47. * @v rc Status code
  48. * @v mad Received MAD (or NULL on error)
  49. * @v av Source address vector (or NULL on error)
  50. *
  51. * The completion handler should in most cases call
  52. * ib_destroy_madx() to free up the completed transaction.
  53. */
  54. void ( * complete ) ( struct ib_device *ibdev,
  55. struct ib_mad_interface *mi,
  56. struct ib_mad_transaction *madx,
  57. int rc, union ib_mad *mad,
  58. struct ib_address_vector *av );
  59. };
  60. /** An Infiniband management transaction */
  61. struct ib_mad_transaction {
  62. /** Associated management interface */
  63. struct ib_mad_interface *mi;
  64. /** List of transactions */
  65. struct list_head list;
  66. /** Retry timer */
  67. struct retry_timer timer;
  68. /** Destination address vector */
  69. struct ib_address_vector av;
  70. /** MAD being sent */
  71. union ib_mad mad;
  72. /** Transaction operations */
  73. struct ib_mad_transaction_operations *op;
  74. /** Owner private data */
  75. void *owner_priv;
  76. };
  77. /** An Infiniband management interface */
  78. struct ib_mad_interface {
  79. /** Infiniband device */
  80. struct ib_device *ibdev;
  81. /** Completion queue */
  82. struct ib_completion_queue *cq;
  83. /** Queue pair */
  84. struct ib_queue_pair *qp;
  85. /** List of management transactions */
  86. struct list_head madx;
  87. };
  88. /**
  89. * Set Infiniband management transaction owner-private data
  90. *
  91. * @v madx Management transaction
  92. * @v priv Private data
  93. */
  94. static inline __always_inline void
  95. ib_madx_set_ownerdata ( struct ib_mad_transaction *madx, void *priv ) {
  96. madx->owner_priv = priv;
  97. }
  98. /**
  99. * Get Infiniband management transaction owner-private data
  100. *
  101. * @v madx Management transaction
  102. * @ret priv Private data
  103. */
  104. static inline __always_inline void *
  105. ib_madx_get_ownerdata ( struct ib_mad_transaction *madx ) {
  106. return madx->owner_priv;
  107. }
  108. extern int ib_mi_send ( struct ib_device *ibdev, struct ib_mad_interface *mi,
  109. union ib_mad *mad, struct ib_address_vector *av );
  110. extern struct ib_mad_transaction *
  111. ib_create_madx ( struct ib_device *ibdev, struct ib_mad_interface *mi,
  112. union ib_mad *mad, struct ib_address_vector *av,
  113. struct ib_mad_transaction_operations *op );
  114. extern void ib_destroy_madx ( struct ib_device *ibdev,
  115. struct ib_mad_interface *mi,
  116. struct ib_mad_transaction *madx );
  117. extern int ib_create_mi ( struct ib_device *ibdev,
  118. enum ib_queue_pair_type type,
  119. struct ib_mad_interface **new_mi );
  120. extern void ib_destroy_mi ( struct ib_device *ibdev,
  121. struct ib_mad_interface *mi );
  122. #endif /* _IPXE_IB_MI_H */