ib_cache.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
  2. /*
  3. * Copyright (c) 2004 Topspin Communications. All rights reserved.
  4. * Copyright (c) 2005 Intel Corporation. All rights reserved.
  5. * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
  6. */
  7. #ifndef _IB_CACHE_H
  8. #define _IB_CACHE_H
  9. #include <rdma/ib_verbs.h>
  10. int rdma_query_gid(struct ib_device *device, u8 port_num, int index,
  11. union ib_gid *gid);
  12. void *rdma_read_gid_hw_context(const struct ib_gid_attr *attr);
  13. const struct ib_gid_attr *rdma_find_gid(struct ib_device *device,
  14. const union ib_gid *gid,
  15. enum ib_gid_type gid_type,
  16. struct net_device *ndev);
  17. const struct ib_gid_attr *rdma_find_gid_by_port(struct ib_device *ib_dev,
  18. const union ib_gid *gid,
  19. enum ib_gid_type gid_type,
  20. u8 port,
  21. struct net_device *ndev);
  22. const struct ib_gid_attr *rdma_find_gid_by_filter(
  23. struct ib_device *device, const union ib_gid *gid, u8 port_num,
  24. bool (*filter)(const union ib_gid *gid, const struct ib_gid_attr *,
  25. void *),
  26. void *context);
  27. int rdma_read_gid_l2_fields(const struct ib_gid_attr *attr,
  28. u16 *vlan_id, u8 *smac);
  29. struct net_device *rdma_read_gid_attr_ndev_rcu(const struct ib_gid_attr *attr);
  30. /**
  31. * ib_get_cached_pkey - Returns a cached PKey table entry
  32. * @device: The device to query.
  33. * @port_num: The port number of the device to query.
  34. * @index: The index into the cached PKey table to query.
  35. * @pkey: The PKey value found at the specified index.
  36. *
  37. * ib_get_cached_pkey() fetches the specified PKey table entry stored in
  38. * the local software cache.
  39. */
  40. int ib_get_cached_pkey(struct ib_device *device_handle,
  41. u8 port_num,
  42. int index,
  43. u16 *pkey);
  44. /**
  45. * ib_find_cached_pkey - Returns the PKey table index where a specified
  46. * PKey value occurs.
  47. * @device: The device to query.
  48. * @port_num: The port number of the device to search for the PKey.
  49. * @pkey: The PKey value to search for.
  50. * @index: The index into the cached PKey table where the PKey was found.
  51. *
  52. * ib_find_cached_pkey() searches the specified PKey table in
  53. * the local software cache.
  54. */
  55. int ib_find_cached_pkey(struct ib_device *device,
  56. u8 port_num,
  57. u16 pkey,
  58. u16 *index);
  59. /**
  60. * ib_find_exact_cached_pkey - Returns the PKey table index where a specified
  61. * PKey value occurs. Comparison uses the FULL 16 bits (incl membership bit)
  62. * @device: The device to query.
  63. * @port_num: The port number of the device to search for the PKey.
  64. * @pkey: The PKey value to search for.
  65. * @index: The index into the cached PKey table where the PKey was found.
  66. *
  67. * ib_find_exact_cached_pkey() searches the specified PKey table in
  68. * the local software cache.
  69. */
  70. int ib_find_exact_cached_pkey(struct ib_device *device,
  71. u8 port_num,
  72. u16 pkey,
  73. u16 *index);
  74. /**
  75. * ib_get_cached_lmc - Returns a cached lmc table entry
  76. * @device: The device to query.
  77. * @port_num: The port number of the device to query.
  78. * @lmc: The lmc value for the specified port for that device.
  79. *
  80. * ib_get_cached_lmc() fetches the specified lmc table entry stored in
  81. * the local software cache.
  82. */
  83. int ib_get_cached_lmc(struct ib_device *device,
  84. u8 port_num,
  85. u8 *lmc);
  86. /**
  87. * ib_get_cached_port_state - Returns a cached port state table entry
  88. * @device: The device to query.
  89. * @port_num: The port number of the device to query.
  90. * @port_state: port_state for the specified port for that device.
  91. *
  92. * ib_get_cached_port_state() fetches the specified port_state table entry stored in
  93. * the local software cache.
  94. */
  95. int ib_get_cached_port_state(struct ib_device *device,
  96. u8 port_num,
  97. enum ib_port_state *port_active);
  98. bool rdma_is_zero_gid(const union ib_gid *gid);
  99. const struct ib_gid_attr *rdma_get_gid_attr(struct ib_device *device,
  100. u8 port_num, int index);
  101. void rdma_put_gid_attr(const struct ib_gid_attr *attr);
  102. void rdma_hold_gid_attr(const struct ib_gid_attr *attr);
  103. ssize_t rdma_query_gid_table(struct ib_device *device,
  104. struct ib_uverbs_gid_entry *entries,
  105. size_t max_entries);
  106. #endif /* _IB_CACHE_H */