11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*
21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Copyright (c) 2004 Topspin Communications.  All rights reserved.
32a1d9b7f09aaaacf235656cb32a40ba2c79590b3Roland Dreier * Copyright (c) 2005 Intel Corporation. All rights reserved.
42a1d9b7f09aaaacf235656cb32a40ba2c79590b3Roland Dreier * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * This software is available to you under a choice of one of two
71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * licenses.  You may choose to be licensed under the terms of the GNU
81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * General Public License (GPL) Version 2, available from the file
91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * COPYING in the main directory of this source tree, or the
101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * OpenIB.org BSD license below:
111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *     Redistribution and use in source and binary forms, with or
131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *     without modification, are permitted provided that the following
141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *     conditions are met:
151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *      - Redistributions of source code must retain the above
171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *        copyright notice, this list of conditions and the following
181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *        disclaimer.
191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *      - Redistributions in binary form must reproduce the above
211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *        copyright notice, this list of conditions and the following
221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *        disclaimer in the documentation and/or other materials
231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *        provided with the distribution.
241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * SOFTWARE.
331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef _IB_CACHE_H
361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _IB_CACHE_H
371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
38a4d61e84804f3b14cc35c5e2af768a07c0f64ef6Roland Dreier#include <rdma/ib_verbs.h>
391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/**
411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_get_cached_gid - Returns a cached GID table entry
421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @device: The device to query.
431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @port_num: The port number of the device to query.
441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @index: The index into the cached GID table to query.
451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @gid: The GID value found at the specified index.
461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_get_cached_gid() fetches the specified GID table entry stored in
481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * the local software cache.
491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint ib_get_cached_gid(struct ib_device    *device,
511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		      u8                   port_num,
521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		      int                  index,
531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		      union ib_gid        *gid);
541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/**
561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_find_cached_gid - Returns the port number and GID table index where
571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *   a specified GID value occurs.
581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @device: The device to query.
591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @gid: The GID value to search for.
601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @port_num: The port number of the device where the GID value was found.
611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @index: The index into the cached GID table where the GID was found.  This
621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *   parameter may be NULL.
631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_find_cached_gid() searches for the specified GID value in
651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * the local software cache.
661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint ib_find_cached_gid(struct ib_device *device,
681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		       union ib_gid	*gid,
691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		       u8               *port_num,
701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		       u16              *index);
711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/**
731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_get_cached_pkey - Returns a cached PKey table entry
741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @device: The device to query.
751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @port_num: The port number of the device to query.
761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @index: The index into the cached PKey table to query.
771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @pkey: The PKey value found at the specified index.
781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_get_cached_pkey() fetches the specified PKey table entry stored in
801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * the local software cache.
811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint ib_get_cached_pkey(struct ib_device    *device_handle,
831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		       u8                   port_num,
841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		       int                  index,
851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		       u16                 *pkey);
861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/**
881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_find_cached_pkey - Returns the PKey table index where a specified
891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *   PKey value occurs.
901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @device: The device to query.
911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @port_num: The port number of the device to search for the PKey.
921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @pkey: The PKey value to search for.
931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @index: The index into the cached PKey table where the PKey was found.
941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_find_cached_pkey() searches the specified PKey table in
961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * the local software cache.
971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint ib_find_cached_pkey(struct ib_device    *device,
991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds			u8                   port_num,
1001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds			u16                  pkey,
1011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds			u16                 *index);
1021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1036fb9cdbf2cdb2ea187e57ec2e16cc59df2adf86aJack Morgenstein/**
1046fb9cdbf2cdb2ea187e57ec2e16cc59df2adf86aJack Morgenstein * ib_get_cached_lmc - Returns a cached lmc table entry
1056fb9cdbf2cdb2ea187e57ec2e16cc59df2adf86aJack Morgenstein * @device: The device to query.
1066fb9cdbf2cdb2ea187e57ec2e16cc59df2adf86aJack Morgenstein * @port_num: The port number of the device to query.
1076fb9cdbf2cdb2ea187e57ec2e16cc59df2adf86aJack Morgenstein * @lmc: The lmc value for the specified port for that device.
1086fb9cdbf2cdb2ea187e57ec2e16cc59df2adf86aJack Morgenstein *
1096fb9cdbf2cdb2ea187e57ec2e16cc59df2adf86aJack Morgenstein * ib_get_cached_lmc() fetches the specified lmc table entry stored in
1106fb9cdbf2cdb2ea187e57ec2e16cc59df2adf86aJack Morgenstein * the local software cache.
1116fb9cdbf2cdb2ea187e57ec2e16cc59df2adf86aJack Morgenstein */
1126fb9cdbf2cdb2ea187e57ec2e16cc59df2adf86aJack Morgensteinint ib_get_cached_lmc(struct ib_device *device,
1136fb9cdbf2cdb2ea187e57ec2e16cc59df2adf86aJack Morgenstein		      u8                port_num,
1146fb9cdbf2cdb2ea187e57ec2e16cc59df2adf86aJack Morgenstein		      u8                *lmc);
1156fb9cdbf2cdb2ea187e57ec2e16cc59df2adf86aJack Morgenstein
1161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif /* _IB_CACHE_H */
117