1219820Sjeff/*
2219820Sjeff * Copyright (c) 2004 Topspin Communications.  All rights reserved.
3219820Sjeff * Copyright (c) 2005 Intel Corporation. All rights reserved.
4219820Sjeff * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
5219820Sjeff *
6219820Sjeff * This software is available to you under a choice of one of two
7219820Sjeff * licenses.  You may choose to be licensed under the terms of the GNU
8219820Sjeff * General Public License (GPL) Version 2, available from the file
9219820Sjeff * COPYING in the main directory of this source tree, or the
10219820Sjeff * OpenIB.org BSD license below:
11219820Sjeff *
12219820Sjeff *     Redistribution and use in source and binary forms, with or
13219820Sjeff *     without modification, are permitted provided that the following
14219820Sjeff *     conditions are met:
15219820Sjeff *
16219820Sjeff *      - Redistributions of source code must retain the above
17219820Sjeff *        copyright notice, this list of conditions and the following
18219820Sjeff *        disclaimer.
19219820Sjeff *
20219820Sjeff *      - Redistributions in binary form must reproduce the above
21219820Sjeff *        copyright notice, this list of conditions and the following
22219820Sjeff *        disclaimer in the documentation and/or other materials
23219820Sjeff *        provided with the distribution.
24219820Sjeff *
25219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32219820Sjeff * SOFTWARE.
33219820Sjeff */
34219820Sjeff
35219820Sjeff#ifndef _IB_CACHE_H
36219820Sjeff#define _IB_CACHE_H
37219820Sjeff
38219820Sjeff#include <rdma/ib_verbs.h>
39219820Sjeff
40219820Sjeff/**
41219820Sjeff * ib_get_cached_gid - Returns a cached GID table entry
42219820Sjeff * @device: The device to query.
43219820Sjeff * @port_num: The port number of the device to query.
44219820Sjeff * @index: The index into the cached GID table to query.
45219820Sjeff * @gid: The GID value found at the specified index.
46219820Sjeff *
47219820Sjeff * ib_get_cached_gid() fetches the specified GID table entry stored in
48219820Sjeff * the local software cache.
49219820Sjeff */
50219820Sjeffint ib_get_cached_gid(struct ib_device    *device,
51219820Sjeff		      u8                   port_num,
52219820Sjeff		      int                  index,
53219820Sjeff		      union ib_gid        *gid);
54219820Sjeff
55219820Sjeff/**
56219820Sjeff * ib_find_cached_gid - Returns the port number and GID table index where
57219820Sjeff *   a specified GID value occurs.
58219820Sjeff * @device: The device to query.
59219820Sjeff * @gid: The GID value to search for.
60219820Sjeff * @port_num: The port number of the device where the GID value was found.
61219820Sjeff * @index: The index into the cached GID table where the GID was found.  This
62219820Sjeff *   parameter may be NULL.
63219820Sjeff *
64219820Sjeff * ib_find_cached_gid() searches for the specified GID value in
65219820Sjeff * the local software cache.
66219820Sjeff */
67219820Sjeffint ib_find_cached_gid(struct ib_device *device,
68219820Sjeff		       union ib_gid	*gid,
69219820Sjeff		       u8               *port_num,
70219820Sjeff		       u16              *index);
71219820Sjeff
72219820Sjeff/**
73219820Sjeff * ib_get_cached_pkey - Returns a cached PKey table entry
74219820Sjeff * @device: The device to query.
75219820Sjeff * @port_num: The port number of the device to query.
76219820Sjeff * @index: The index into the cached PKey table to query.
77219820Sjeff * @pkey: The PKey value found at the specified index.
78219820Sjeff *
79219820Sjeff * ib_get_cached_pkey() fetches the specified PKey table entry stored in
80219820Sjeff * the local software cache.
81219820Sjeff */
82219820Sjeffint ib_get_cached_pkey(struct ib_device    *device_handle,
83219820Sjeff		       u8                   port_num,
84219820Sjeff		       int                  index,
85219820Sjeff		       u16                 *pkey);
86219820Sjeff
87219820Sjeff/**
88219820Sjeff * ib_find_cached_pkey - Returns the PKey table index where a specified
89219820Sjeff *   PKey value occurs.
90219820Sjeff * @device: The device to query.
91219820Sjeff * @port_num: The port number of the device to search for the PKey.
92219820Sjeff * @pkey: The PKey value to search for.
93219820Sjeff * @index: The index into the cached PKey table where the PKey was found.
94219820Sjeff *
95219820Sjeff * ib_find_cached_pkey() searches the specified PKey table in
96219820Sjeff * the local software cache.
97219820Sjeff */
98219820Sjeffint ib_find_cached_pkey(struct ib_device    *device,
99219820Sjeff			u8                   port_num,
100219820Sjeff			u16                  pkey,
101219820Sjeff			u16                 *index);
102219820Sjeff
103219820Sjeff/**
104219820Sjeff * ib_get_cached_lmc - Returns a cached lmc table entry
105219820Sjeff * @device: The device to query.
106219820Sjeff * @port_num: The port number of the device to query.
107219820Sjeff * @lmc: The lmc value for the specified port for that device.
108219820Sjeff *
109219820Sjeff * ib_get_cached_lmc() fetches the specified lmc table entry stored in
110219820Sjeff * the local software cache.
111219820Sjeff */
112219820Sjeffint ib_get_cached_lmc(struct ib_device *device,
113219820Sjeff		      u8                port_num,
114219820Sjeff		      u8                *lmc);
115219820Sjeff
116219820Sjeff#endif /* _IB_CACHE_H */
117