ib_cache.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. * Copyright (c) 2004 Topspin Communications. All rights reserved.
  3. * Copyright (c) 2005 Intel Corporation. All rights reserved.
  4. * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
  5. *
  6. * This software is available to you under a choice of one of two
  7. * licenses. You may choose to be licensed under the terms of the GNU
  8. * General Public License (GPL) Version 2, available from the file
  9. * COPYING in the main directory of this source tree, or the
  10. * OpenIB.org BSD license below:
  11. *
  12. * Redistribution and use in source and binary forms, with or
  13. * without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above
  17. * copyright notice, this list of conditions and the following
  18. * disclaimer.
  19. *
  20. * - Redistributions in binary form must reproduce the above
  21. * copyright notice, this list of conditions and the following
  22. * disclaimer in the documentation and/or other materials
  23. * provided with the distribution.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  29. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  30. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  31. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  32. * SOFTWARE.
  33. */
  34. #ifndef _IB_CACHE_H
  35. #define _IB_CACHE_H
  36. #include <rdma/ib_verbs.h>
  37. /**
  38. * ib_get_cached_gid - Returns a cached GID table entry
  39. * @device: The device to query.
  40. * @port_num: The port number of the device to query.
  41. * @index: The index into the cached GID table to query.
  42. * @gid: The GID value found at the specified index.
  43. * @attr: The GID attribute found at the specified index (only in RoCE).
  44. * NULL means ignore (output parameter).
  45. *
  46. * ib_get_cached_gid() fetches the specified GID table entry stored in
  47. * the local software cache.
  48. */
  49. int ib_get_cached_gid(struct ib_device *device,
  50. u8 port_num,
  51. int index,
  52. union ib_gid *gid,
  53. struct ib_gid_attr *attr);
  54. /**
  55. * ib_find_cached_gid - Returns the port number and GID table index where
  56. * a specified GID value occurs.
  57. * @device: The device to query.
  58. * @gid: The GID value to search for.
  59. * @gid_type: The GID type to search for.
  60. * @ndev: In RoCE, the net device of the device. NULL means ignore.
  61. * @port_num: The port number of the device where the GID value was found.
  62. * @index: The index into the cached GID table where the GID was found. This
  63. * parameter may be NULL.
  64. *
  65. * ib_find_cached_gid() searches for the specified GID value in
  66. * the local software cache.
  67. */
  68. int ib_find_cached_gid(struct ib_device *device,
  69. const union ib_gid *gid,
  70. enum ib_gid_type gid_type,
  71. struct net_device *ndev,
  72. u8 *port_num,
  73. u16 *index);
  74. /**
  75. * ib_find_cached_gid_by_port - Returns the GID table index where a specified
  76. * GID value occurs
  77. * @device: The device to query.
  78. * @gid: The GID value to search for.
  79. * @gid_type: The GID type to search for.
  80. * @port_num: The port number of the device where the GID value sould be
  81. * searched.
  82. * @ndev: In RoCE, the net device of the device. Null means ignore.
  83. * @index: The index into the cached GID table where the GID was found. This
  84. * parameter may be NULL.
  85. *
  86. * ib_find_cached_gid() searches for the specified GID value in
  87. * the local software cache.
  88. */
  89. int ib_find_cached_gid_by_port(struct ib_device *device,
  90. const union ib_gid *gid,
  91. enum ib_gid_type gid_type,
  92. u8 port_num,
  93. struct net_device *ndev,
  94. u16 *index);
  95. int ib_find_gid_by_filter(struct ib_device *device,
  96. const union ib_gid *gid,
  97. u8 port_num,
  98. bool (*filter)(const union ib_gid *gid,
  99. const struct ib_gid_attr *,
  100. void *),
  101. void *context, u16 *index);
  102. /**
  103. * ib_get_cached_pkey - Returns a cached PKey table entry
  104. * @device: The device to query.
  105. * @port_num: The port number of the device to query.
  106. * @index: The index into the cached PKey table to query.
  107. * @pkey: The PKey value found at the specified index.
  108. *
  109. * ib_get_cached_pkey() fetches the specified PKey table entry stored in
  110. * the local software cache.
  111. */
  112. int ib_get_cached_pkey(struct ib_device *device_handle,
  113. u8 port_num,
  114. int index,
  115. u16 *pkey);
  116. /**
  117. * ib_find_cached_pkey - Returns the PKey table index where a specified
  118. * PKey value occurs.
  119. * @device: The device to query.
  120. * @port_num: The port number of the device to search for the PKey.
  121. * @pkey: The PKey value to search for.
  122. * @index: The index into the cached PKey table where the PKey was found.
  123. *
  124. * ib_find_cached_pkey() searches the specified PKey table in
  125. * the local software cache.
  126. */
  127. int ib_find_cached_pkey(struct ib_device *device,
  128. u8 port_num,
  129. u16 pkey,
  130. u16 *index);
  131. /**
  132. * ib_find_exact_cached_pkey - Returns the PKey table index where a specified
  133. * PKey value occurs. Comparison uses the FULL 16 bits (incl membership bit)
  134. * @device: The device to query.
  135. * @port_num: The port number of the device to search for the PKey.
  136. * @pkey: The PKey value to search for.
  137. * @index: The index into the cached PKey table where the PKey was found.
  138. *
  139. * ib_find_exact_cached_pkey() searches the specified PKey table in
  140. * the local software cache.
  141. */
  142. int ib_find_exact_cached_pkey(struct ib_device *device,
  143. u8 port_num,
  144. u16 pkey,
  145. u16 *index);
  146. /**
  147. * ib_get_cached_lmc - Returns a cached lmc table entry
  148. * @device: The device to query.
  149. * @port_num: The port number of the device to query.
  150. * @lmc: The lmc value for the specified port for that device.
  151. *
  152. * ib_get_cached_lmc() fetches the specified lmc table entry stored in
  153. * the local software cache.
  154. */
  155. int ib_get_cached_lmc(struct ib_device *device,
  156. u8 port_num,
  157. u8 *lmc);
  158. #endif /* _IB_CACHE_H */