IB/core: Add netdev and gid attributes paramteres to cache
[linux-2.6-block.git] / include / rdma / ib_cache.h
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
35 #ifndef _IB_CACHE_H
36 #define _IB_CACHE_H
37
38 #include <rdma/ib_verbs.h>
39
40 /**
41  * ib_get_cached_gid - Returns a cached GID table entry
42  * @device: The device to query.
43  * @port_num: The port number of the device to query.
44  * @index: The index into the cached GID table to query.
45  * @gid: The GID value found at the specified index.
46  * @attr: The GID attribute found at the specified index (only in RoCE).
47  *   NULL means ignore (output parameter).
48  *
49  * ib_get_cached_gid() fetches the specified GID table entry stored in
50  * the local software cache.
51  */
52 int ib_get_cached_gid(struct ib_device    *device,
53                       u8                   port_num,
54                       int                  index,
55                       union ib_gid        *gid,
56                       struct ib_gid_attr  *attr);
57
58 /**
59  * ib_find_cached_gid - Returns the port number and GID table index where
60  *   a specified GID value occurs.
61  * @device: The device to query.
62  * @gid: The GID value to search for.
63  * @ndev: In RoCE, the net device of the device. NULL means ignore.
64  * @port_num: The port number of the device where the GID value was found.
65  * @index: The index into the cached GID table where the GID was found.  This
66  *   parameter may be NULL.
67  *
68  * ib_find_cached_gid() searches for the specified GID value in
69  * the local software cache.
70  */
71 int ib_find_cached_gid(struct ib_device *device,
72                        const union ib_gid *gid,
73                        struct net_device *ndev,
74                        u8               *port_num,
75                        u16              *index);
76
77 /**
78  * ib_get_cached_pkey - Returns a cached PKey table entry
79  * @device: The device to query.
80  * @port_num: The port number of the device to query.
81  * @index: The index into the cached PKey table to query.
82  * @pkey: The PKey value found at the specified index.
83  *
84  * ib_get_cached_pkey() fetches the specified PKey table entry stored in
85  * the local software cache.
86  */
87 int ib_get_cached_pkey(struct ib_device    *device_handle,
88                        u8                   port_num,
89                        int                  index,
90                        u16                 *pkey);
91
92 /**
93  * ib_find_cached_pkey - Returns the PKey table index where a specified
94  *   PKey value occurs.
95  * @device: The device to query.
96  * @port_num: The port number of the device to search for the PKey.
97  * @pkey: The PKey value to search for.
98  * @index: The index into the cached PKey table where the PKey was found.
99  *
100  * ib_find_cached_pkey() searches the specified PKey table in
101  * the local software cache.
102  */
103 int ib_find_cached_pkey(struct ib_device    *device,
104                         u8                   port_num,
105                         u16                  pkey,
106                         u16                 *index);
107
108 /**
109  * ib_find_exact_cached_pkey - Returns the PKey table index where a specified
110  *   PKey value occurs. Comparison uses the FULL 16 bits (incl membership bit)
111  * @device: The device to query.
112  * @port_num: The port number of the device to search for the PKey.
113  * @pkey: The PKey value to search for.
114  * @index: The index into the cached PKey table where the PKey was found.
115  *
116  * ib_find_exact_cached_pkey() searches the specified PKey table in
117  * the local software cache.
118  */
119 int ib_find_exact_cached_pkey(struct ib_device    *device,
120                               u8                   port_num,
121                               u16                  pkey,
122                               u16                 *index);
123
124 /**
125  * ib_get_cached_lmc - Returns a cached lmc table entry
126  * @device: The device to query.
127  * @port_num: The port number of the device to query.
128  * @lmc: The lmc value for the specified port for that device.
129  *
130  * ib_get_cached_lmc() fetches the specified lmc table entry stored in
131  * the local software cache.
132  */
133 int ib_get_cached_lmc(struct ib_device *device,
134                       u8                port_num,
135                       u8                *lmc);
136
137 #endif /* _IB_CACHE_H */