ib_dm_mad.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * Copyright (c) 2006 - 2009 Mellanox Technology Inc. All rights reserved.
  3. *
  4. * This software is available to you under a choice of one of two
  5. * licenses. You may choose to be licensed under the terms of the GNU
  6. * General Public License (GPL) Version 2, available from the file
  7. * COPYING in the main directory of this source tree, or the
  8. * OpenIB.org BSD license below:
  9. *
  10. * Redistribution and use in source and binary forms, with or
  11. * without modification, are permitted provided that the following
  12. * conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above
  15. * copyright notice, this list of conditions and the following
  16. * disclaimer.
  17. *
  18. * - Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and/or other materials
  21. * provided with the distribution.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. *
  32. */
  33. #ifndef IB_DM_MAD_H
  34. #define IB_DM_MAD_H
  35. #include <linux/types.h>
  36. #include <rdma/ib_mad.h>
  37. enum {
  38. /*
  39. * See also section 13.4.7 Status Field, table 115 MAD Common Status
  40. * Field Bit Values and also section 16.3.1.1 Status Field in the
  41. * InfiniBand Architecture Specification.
  42. */
  43. DM_MAD_STATUS_UNSUP_METHOD = 0x0008,
  44. DM_MAD_STATUS_UNSUP_METHOD_ATTR = 0x000c,
  45. DM_MAD_STATUS_INVALID_FIELD = 0x001c,
  46. DM_MAD_STATUS_NO_IOC = 0x0100,
  47. /*
  48. * See also the Device Management chapter, section 16.3.3 Attributes,
  49. * table 279 Device Management Attributes in the InfiniBand
  50. * Architecture Specification.
  51. */
  52. DM_ATTR_CLASS_PORT_INFO = 0x01,
  53. DM_ATTR_IOU_INFO = 0x10,
  54. DM_ATTR_IOC_PROFILE = 0x11,
  55. DM_ATTR_SVC_ENTRIES = 0x12
  56. };
  57. struct ib_dm_hdr {
  58. u8 reserved[28];
  59. };
  60. /*
  61. * Structure of management datagram sent by the SRP target implementation.
  62. * Contains a management datagram header, reliable multi-packet transaction
  63. * protocol (RMPP) header and ib_dm_hdr. Notes:
  64. * - The SRP target implementation does not use RMPP or ib_dm_hdr when sending
  65. * management datagrams.
  66. * - The header size must be exactly 64 bytes (IB_MGMT_DEVICE_HDR), since this
  67. * is the header size that is passed to ib_create_send_mad() in ib_srpt.c.
  68. * - The maximum supported size for a management datagram when not using RMPP
  69. * is 256 bytes -- 64 bytes header and 192 (IB_MGMT_DEVICE_DATA) bytes data.
  70. */
  71. struct ib_dm_mad {
  72. struct ib_mad_hdr mad_hdr;
  73. struct ib_rmpp_hdr rmpp_hdr;
  74. struct ib_dm_hdr dm_hdr;
  75. u8 data[IB_MGMT_DEVICE_DATA];
  76. };
  77. /*
  78. * IOUnitInfo as defined in section 16.3.3.3 IOUnitInfo of the InfiniBand
  79. * Architecture Specification.
  80. */
  81. struct ib_dm_iou_info {
  82. __be16 change_id;
  83. u8 max_controllers;
  84. u8 op_rom;
  85. u8 controller_list[128];
  86. };
  87. /*
  88. * IOControllerprofile as defined in section 16.3.3.4 IOControllerProfile of
  89. * the InfiniBand Architecture Specification.
  90. */
  91. struct ib_dm_ioc_profile {
  92. __be64 guid;
  93. __be32 vendor_id;
  94. __be32 device_id;
  95. __be16 device_version;
  96. __be16 reserved1;
  97. __be32 subsys_vendor_id;
  98. __be32 subsys_device_id;
  99. __be16 io_class;
  100. __be16 io_subclass;
  101. __be16 protocol;
  102. __be16 protocol_version;
  103. __be16 service_conn;
  104. __be16 initiators_supported;
  105. __be16 send_queue_depth;
  106. u8 reserved2;
  107. u8 rdma_read_depth;
  108. __be32 send_size;
  109. __be32 rdma_size;
  110. u8 op_cap_mask;
  111. u8 svc_cap_mask;
  112. u8 num_svc_entries;
  113. u8 reserved3[9];
  114. u8 id_string[64];
  115. };
  116. struct ib_dm_svc_entry {
  117. u8 name[40];
  118. __be64 id;
  119. };
  120. /*
  121. * See also section 16.3.3.5 ServiceEntries in the InfiniBand Architecture
  122. * Specification. See also section B.7, table B.8 in the T10 SRP r16a document.
  123. */
  124. struct ib_dm_svc_entries {
  125. struct ib_dm_svc_entry service_entries[4];
  126. };
  127. #endif