ib_cache.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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, u32 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. u32 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, u32 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. u32 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. u32 port_num,
  57. u16 pkey,
  58. u16 *index);
  59. /**
  60. * ib_get_cached_lmc - Returns a cached lmc table entry
  61. * @device: The device to query.
  62. * @port_num: The port number of the device to query.
  63. * @lmc: The lmc value for the specified port for that device.
  64. *
  65. * ib_get_cached_lmc() fetches the specified lmc table entry stored in
  66. * the local software cache.
  67. */
  68. int ib_get_cached_lmc(struct ib_device *device,
  69. u32 port_num,
  70. u8 *lmc);
  71. /**
  72. * ib_get_cached_port_state - Returns a cached port state table entry
  73. * @device: The device to query.
  74. * @port_num: The port number of the device to query.
  75. * @port_state: port_state for the specified port for that device.
  76. *
  77. * ib_get_cached_port_state() fetches the specified port_state table entry stored in
  78. * the local software cache.
  79. */
  80. int ib_get_cached_port_state(struct ib_device *device,
  81. u32 port_num,
  82. enum ib_port_state *port_active);
  83. bool rdma_is_zero_gid(const union ib_gid *gid);
  84. const struct ib_gid_attr *rdma_get_gid_attr(struct ib_device *device,
  85. u32 port_num, int index);
  86. void rdma_put_gid_attr(const struct ib_gid_attr *attr);
  87. void rdma_hold_gid_attr(const struct ib_gid_attr *attr);
  88. ssize_t rdma_query_gid_table(struct ib_device *device,
  89. struct ib_uverbs_gid_entry *entries,
  90. size_t max_entries);
  91. #endif /* _IB_CACHE_H */