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