ib_cache.h revision 2a1d9b7f09aaaacf235656cb32a40ba2c79590b3
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 * $Id: ib_cache.h 1349 2004-12-16 21:09:43Z roland $
351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef _IB_CACHE_H
381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _IB_CACHE_H
391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <ib_verbs.h>
411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/**
431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_get_cached_gid - Returns a cached GID table entry
441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @device: The device to query.
451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @port_num: The port number of the device to query.
461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @index: The index into the cached GID table to query.
471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @gid: The GID value found at the specified index.
481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_get_cached_gid() fetches the specified GID table entry stored in
501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * the local software cache.
511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint ib_get_cached_gid(struct ib_device    *device,
531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		      u8                   port_num,
541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		      int                  index,
551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		      union ib_gid        *gid);
561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/**
581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_find_cached_gid - Returns the port number and GID table index where
591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *   a specified GID value occurs.
601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @device: The device to query.
611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @gid: The GID value to search for.
621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @port_num: The port number of the device where the GID value was found.
631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @index: The index into the cached GID table where the GID was found.  This
641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *   parameter may be NULL.
651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_find_cached_gid() searches for the specified GID value in
671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * the local software cache.
681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint ib_find_cached_gid(struct ib_device *device,
701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		       union ib_gid	*gid,
711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		       u8               *port_num,
721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		       u16              *index);
731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/**
751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_get_cached_pkey - Returns a cached PKey table entry
761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @device: The device to query.
771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @port_num: The port number of the device to query.
781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @index: The index into the cached PKey table to query.
791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @pkey: The PKey value found at the specified index.
801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_get_cached_pkey() fetches the specified PKey table entry stored in
821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * the local software cache.
831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint ib_get_cached_pkey(struct ib_device    *device_handle,
851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		       u8                   port_num,
861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		       int                  index,
871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		       u16                 *pkey);
881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/**
901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_find_cached_pkey - Returns the PKey table index where a specified
911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *   PKey value occurs.
921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @device: The device to query.
931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @port_num: The port number of the device to search for the PKey.
941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @pkey: The PKey value to search for.
951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * @index: The index into the cached PKey table where the PKey was found.
961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ib_find_cached_pkey() searches the specified PKey table in
981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * the local software cache.
991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
1001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint ib_find_cached_pkey(struct ib_device    *device,
1011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds			u8                   port_num,
1021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds			u16                  pkey,
1031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds			u16                 *index);
1041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif /* _IB_CACHE_H */
106