1178784Skmacy/*
2178784Skmacy * Copyright (c) 2004 Topspin Communications.  All rights reserved.
3178784Skmacy * Copyright (c) 2005 Intel Corporation. All rights reserved.
4178784Skmacy * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
5178784Skmacy *
6178784Skmacy * This software is available to you under a choice of one of two
7178784Skmacy * licenses.  You may choose to be licensed under the terms of the GNU
8178784Skmacy * General Public License (GPL) Version 2, available from the file
9178784Skmacy * COPYING in the main directory of this source tree, or the
10178784Skmacy * OpenIB.org BSD license below:
11178784Skmacy *
12178784Skmacy *     Redistribution and use in source and binary forms, with or
13178784Skmacy *     without modification, are permitted provided that the following
14178784Skmacy *     conditions are met:
15178784Skmacy *
16178784Skmacy *      - Redistributions of source code must retain the above
17178784Skmacy *        copyright notice, this list of conditions and the following
18178784Skmacy *        disclaimer.
19178784Skmacy *
20178784Skmacy *      - Redistributions in binary form must reproduce the above
21178784Skmacy *        copyright notice, this list of conditions and the following
22178784Skmacy *        disclaimer in the documentation and/or other materials
23178784Skmacy *        provided with the distribution.
24178784Skmacy *
25178784Skmacy * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26178784Skmacy * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27178784Skmacy * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28178784Skmacy * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29178784Skmacy * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30178784Skmacy * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31178784Skmacy * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32178784Skmacy * SOFTWARE.
33178784Skmacy *
34178784Skmacy * $Id: ib_cache.h 1349 2004-12-16 21:09:43Z roland $
35178784Skmacy *
36178784Skmacy * $FreeBSD$
37178784Skmacy */
38178784Skmacy
39178784Skmacy#ifndef _IB_CACHE_H
40178784Skmacy#define _IB_CACHE_H
41178784Skmacy
42178784Skmacy#include <contrib/rdma/ib_verbs.h>
43178784Skmacy
44178784Skmacy/**
45178784Skmacy * ib_get_cached_gid - Returns a cached GID table entry
46178784Skmacy * @device: The device to query.
47178784Skmacy * @port_num: The port number of the device to query.
48178784Skmacy * @index: The index into the cached GID table to query.
49178784Skmacy * @gid: The GID value found at the specified index.
50178784Skmacy *
51178784Skmacy * ib_get_cached_gid() fetches the specified GID table entry stored in
52178784Skmacy * the local software cache.
53178784Skmacy */
54178784Skmacyint ib_get_cached_gid(struct ib_device    *device,
55178784Skmacy		      u8                   port_num,
56178784Skmacy		      int                  index,
57178784Skmacy		      union ib_gid        *gid);
58178784Skmacy
59178784Skmacy/**
60178784Skmacy * ib_find_cached_gid - Returns the port number and GID table index where
61178784Skmacy *   a specified GID value occurs.
62178784Skmacy * @device: The device to query.
63178784Skmacy * @gid: The GID value to search for.
64178784Skmacy * @port_num: The port number of the device where the GID value was found.
65178784Skmacy * @index: The index into the cached GID table where the GID was found.  This
66178784Skmacy *   parameter may be NULL.
67178784Skmacy *
68178784Skmacy * ib_find_cached_gid() searches for the specified GID value in
69178784Skmacy * the local software cache.
70178784Skmacy */
71178784Skmacyint ib_find_cached_gid(struct ib_device *device,
72178784Skmacy		       union ib_gid	*gid,
73178784Skmacy		       u8               *port_num,
74178784Skmacy		       u16              *index);
75178784Skmacy
76178784Skmacy/**
77178784Skmacy * ib_get_cached_pkey - Returns a cached PKey table entry
78178784Skmacy * @device: The device to query.
79178784Skmacy * @port_num: The port number of the device to query.
80178784Skmacy * @index: The index into the cached PKey table to query.
81178784Skmacy * @pkey: The PKey value found at the specified index.
82178784Skmacy *
83178784Skmacy * ib_get_cached_pkey() fetches the specified PKey table entry stored in
84178784Skmacy * the local software cache.
85178784Skmacy */
86178784Skmacyint ib_get_cached_pkey(struct ib_device    *device_handle,
87178784Skmacy		       u8                   port_num,
88178784Skmacy		       int                  index,
89178784Skmacy		       u16                 *pkey);
90178784Skmacy
91178784Skmacy/**
92178784Skmacy * ib_find_cached_pkey - Returns the PKey table index where a specified
93178784Skmacy *   PKey value occurs.
94178784Skmacy * @device: The device to query.
95178784Skmacy * @port_num: The port number of the device to search for the PKey.
96178784Skmacy * @pkey: The PKey value to search for.
97178784Skmacy * @index: The index into the cached PKey table where the PKey was found.
98178784Skmacy *
99178784Skmacy * ib_find_cached_pkey() searches the specified PKey table in
100178784Skmacy * the local software cache.
101178784Skmacy */
102178784Skmacyint ib_find_cached_pkey(struct ib_device    *device,
103178784Skmacy			u8                   port_num,
104178784Skmacy			u16                  pkey,
105178784Skmacy			u16                 *index);
106178784Skmacy
107178784Skmacy/**
108178784Skmacy * ib_get_cached_lmc - Returns a cached lmc table entry
109178784Skmacy * @device: The device to query.
110178784Skmacy * @port_num: The port number of the device to query.
111178784Skmacy * @lmc: The lmc value for the specified port for that device.
112178784Skmacy *
113178784Skmacy * ib_get_cached_lmc() fetches the specified lmc table entry stored in
114178784Skmacy * the local software cache.
115178784Skmacy */
116178784Skmacyint ib_get_cached_lmc(struct ib_device *device,
117178784Skmacy		      u8                port_num,
118178784Skmacy		      u8                *lmc);
119178784Skmacy
120178784Skmacy#endif /* _IB_CACHE_H */
121