You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

eoib.h 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #ifndef _IPXE_EOIB_H
  2. #define _IPXE_EOIB_H
  3. /** @file
  4. *
  5. * Ethernet over Infiniband
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <stdint.h>
  10. #include <byteswap.h>
  11. #include <ipxe/netdevice.h>
  12. #include <ipxe/infiniband.h>
  13. #include <ipxe/ib_mcast.h>
  14. /** An EoIB header */
  15. struct eoib_header {
  16. /** Signature */
  17. uint16_t magic;
  18. /** Reserved */
  19. uint16_t reserved;
  20. } __attribute__ (( packed ));
  21. /** EoIB magic signature */
  22. #define EOIB_MAGIC 0x8919
  23. /** An EoIB device */
  24. struct eoib_device {
  25. /** Name */
  26. const char *name;
  27. /** Network device */
  28. struct net_device *netdev;
  29. /** Underlying Infiniband device */
  30. struct ib_device *ibdev;
  31. /** List of EoIB devices */
  32. struct list_head list;
  33. /** Broadcast address */
  34. struct ib_address_vector broadcast;
  35. /** Completion queue */
  36. struct ib_completion_queue *cq;
  37. /** Queue pair */
  38. struct ib_queue_pair *qp;
  39. /** Broadcast group membership */
  40. struct ib_mc_membership membership;
  41. /** Peer cache */
  42. struct list_head peers;
  43. /** Send duplicate packet to gateway (or NULL)
  44. *
  45. * @v eoib EoIB device
  46. * @v original Original I/O buffer
  47. */
  48. void ( * duplicate ) ( struct eoib_device *eoib,
  49. struct io_buffer *original );
  50. /** Gateway (if any) */
  51. struct ib_address_vector gateway;
  52. /** Multicast group additional component mask */
  53. unsigned int mask;
  54. };
  55. /**
  56. * Check if EoIB device uses a gateway
  57. *
  58. * @v eoib EoIB device
  59. * @v has_gw EoIB device uses a gateway
  60. */
  61. static inline int eoib_has_gateway ( struct eoib_device *eoib ) {
  62. return ( eoib->duplicate != NULL );
  63. }
  64. /**
  65. * Force creation of multicast group
  66. *
  67. * @v eoib EoIB device
  68. */
  69. static inline void eoib_force_group_creation ( struct eoib_device *eoib ) {
  70. /* Some dubious EoIB implementations require each endpoint to
  71. * force the creation of the multicast group. Yes, this makes
  72. * it impossible for the group parameters (e.g. SL) to ever be
  73. * modified without breaking backwards compatiblity with every
  74. * existing driver.
  75. */
  76. eoib->mask = ( IB_SA_MCMEMBER_REC_PKEY | IB_SA_MCMEMBER_REC_QKEY |
  77. IB_SA_MCMEMBER_REC_SL | IB_SA_MCMEMBER_REC_FLOW_LABEL |
  78. IB_SA_MCMEMBER_REC_TRAFFIC_CLASS );
  79. }
  80. extern int eoib_create ( struct ib_device *ibdev, const uint8_t *hw_addr,
  81. struct ib_address_vector *broadcast,
  82. const char *name );
  83. extern struct eoib_device * eoib_find ( struct ib_device *ibdev,
  84. const uint8_t *hw_addr );
  85. extern void eoib_destroy ( struct eoib_device *eoib );
  86. extern void eoib_set_gateway ( struct eoib_device *eoib,
  87. struct ib_address_vector *av );
  88. #endif /* _IPXE_EOIB_H */