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.

ipoib.h 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef _GPXE_IPOIB_H
  2. #define _GPXE_IPOIB_H
  3. /** @file
  4. *
  5. * IP over Infiniband
  6. */
  7. #include <gpxe/infiniband.h>
  8. /** IPoIB packet length */
  9. #define IPOIB_PKT_LEN 2048
  10. /** IPoIB MAC address length */
  11. #define IPOIB_ALEN 20
  12. /** An IPoIB MAC address */
  13. struct ipoib_mac {
  14. /** Queue pair number
  15. *
  16. * MSB must be zero; QPNs are only 24-bit.
  17. */
  18. uint32_t qpn;
  19. /** Port GID */
  20. struct ib_gid gid;
  21. } __attribute__ (( packed ));
  22. /** IPoIB link-layer header length */
  23. #define IPOIB_HLEN 4
  24. /** IPoIB link-layer header */
  25. struct ipoib_hdr {
  26. /** Network-layer protocol */
  27. uint16_t proto;
  28. /** Reserved, must be zero */
  29. union {
  30. /** Reserved, must be zero */
  31. uint16_t reserved;
  32. /** Peer addresses
  33. *
  34. * We use these fields internally to represent the
  35. * peer addresses using a lookup key. There simply
  36. * isn't enough room in the IPoIB header to store
  37. * literal source or destination MAC addresses.
  38. */
  39. struct {
  40. /** Destination address key */
  41. uint8_t dest;
  42. /** Source address key */
  43. uint8_t src;
  44. } __attribute__ (( packed )) peer;
  45. } __attribute__ (( packed )) u;
  46. } __attribute__ (( packed ));
  47. extern struct ll_protocol ipoib_protocol;
  48. extern const char * ipoib_ntoa ( const void *ll_addr );
  49. /**
  50. * Allocate IPoIB device
  51. *
  52. * @v priv_size Size of driver private data
  53. * @ret netdev Network device, or NULL
  54. */
  55. static inline struct net_device * alloc_ipoibdev ( size_t priv_size ) {
  56. struct net_device *netdev;
  57. netdev = alloc_netdev ( priv_size );
  58. if ( netdev ) {
  59. netdev->ll_protocol = &ipoib_protocol;
  60. netdev->max_pkt_len = IPOIB_PKT_LEN;
  61. }
  62. return netdev;
  63. }
  64. extern void ipoib_link_state_changed ( struct ib_device *ibdev );
  65. extern int ipoib_probe ( struct ib_device *ibdev );
  66. extern void ipoib_remove ( struct ib_device *ibdev );
  67. #endif /* _GPXE_IPOIB_H */