ib_user_mad.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. * Copyright (c) 2004 Topspin Communications. All rights reserved.
  3. * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
  4. *
  5. * This software is available to you under a choice of one of two
  6. * licenses. You may choose to be licensed under the terms of the GNU
  7. * General Public License (GPL) Version 2, available from the file
  8. * COPYING in the main directory of this source tree, or the
  9. * OpenIB.org BSD license below:
  10. *
  11. * Redistribution and use in source and binary forms, with or
  12. * without modification, are permitted provided that the following
  13. * conditions are met:
  14. *
  15. * - Redistributions of source code must retain the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer.
  18. *
  19. * - Redistributions in binary form must reproduce the above
  20. * copyright notice, this list of conditions and the following
  21. * disclaimer in the documentation and/or other materials
  22. * provided with the distribution.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  28. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  29. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  30. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  31. * SOFTWARE.
  32. *
  33. * $Id: ib_user_mad.h,v 1.1.1.1 2007/06/12 07:27:15 eyryu Exp $
  34. */
  35. #ifndef IB_USER_MAD_H
  36. #define IB_USER_MAD_H
  37. #include <linux/types.h>
  38. #include <linux/ioctl.h>
  39. /*
  40. * Increment this value if any changes that break userspace ABI
  41. * compatibility are made.
  42. */
  43. #define IB_USER_MAD_ABI_VERSION 5
  44. /*
  45. * Make sure that all structs defined in this file remain laid out so
  46. * that they pack the same way on 32-bit and 64-bit architectures (to
  47. * avoid incompatibility between 32-bit userspace and 64-bit kernels).
  48. */
  49. /**
  50. * ib_user_mad_hdr - MAD packet header
  51. * @id - ID of agent MAD received with/to be sent with
  52. * @status - 0 on successful receive, ETIMEDOUT if no response
  53. * received (transaction ID in data[] will be set to TID of original
  54. * request) (ignored on send)
  55. * @timeout_ms - Milliseconds to wait for response (unset on receive)
  56. * @retries - Number of automatic retries to attempt
  57. * @qpn - Remote QP number received from/to be sent to
  58. * @qkey - Remote Q_Key to be sent with (unset on receive)
  59. * @lid - Remote lid received from/to be sent to
  60. * @sl - Service level received with/to be sent with
  61. * @path_bits - Local path bits received with/to be sent with
  62. * @grh_present - If set, GRH was received/should be sent
  63. * @gid_index - Local GID index to send with (unset on receive)
  64. * @hop_limit - Hop limit in GRH
  65. * @traffic_class - Traffic class in GRH
  66. * @gid - Remote GID in GRH
  67. * @flow_label - Flow label in GRH
  68. */
  69. struct ib_user_mad_hdr {
  70. __u32 id;
  71. __u32 status;
  72. __u32 timeout_ms;
  73. __u32 retries;
  74. __u32 length;
  75. __be32 qpn;
  76. __be32 qkey;
  77. __be16 lid;
  78. __u8 sl;
  79. __u8 path_bits;
  80. __u8 grh_present;
  81. __u8 gid_index;
  82. __u8 hop_limit;
  83. __u8 traffic_class;
  84. __u8 gid[16];
  85. __be32 flow_label;
  86. };
  87. /**
  88. * ib_user_mad - MAD packet
  89. * @hdr - MAD packet header
  90. * @data - Contents of MAD
  91. *
  92. */
  93. struct ib_user_mad {
  94. struct ib_user_mad_hdr hdr;
  95. __u64 data[0];
  96. };
  97. /**
  98. * ib_user_mad_reg_req - MAD registration request
  99. * @id - Set by the kernel; used to identify agent in future requests.
  100. * @qpn - Queue pair number; must be 0 or 1.
  101. * @method_mask - The caller will receive unsolicited MADs for any method
  102. * where @method_mask = 1.
  103. * @mgmt_class - Indicates which management class of MADs should be receive
  104. * by the caller. This field is only required if the user wishes to
  105. * receive unsolicited MADs, otherwise it should be 0.
  106. * @mgmt_class_version - Indicates which version of MADs for the given
  107. * management class to receive.
  108. * @oui: Indicates IEEE OUI when mgmt_class is a vendor class
  109. * in the range from 0x30 to 0x4f. Otherwise not used.
  110. * @rmpp_version: If set, indicates the RMPP version used.
  111. *
  112. */
  113. struct ib_user_mad_reg_req {
  114. __u32 id;
  115. __u32 method_mask[4];
  116. __u8 qpn;
  117. __u8 mgmt_class;
  118. __u8 mgmt_class_version;
  119. __u8 oui[3];
  120. __u8 rmpp_version;
  121. };
  122. #define IB_IOCTL_MAGIC 0x1b
  123. #define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \
  124. struct ib_user_mad_reg_req)
  125. #define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, __u32)
  126. #endif /* IB_USER_MAD_H */