ib_cache.h revision 1da177e4c3f41524e886b7f1b8a0c1fc7321cac
11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*
21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Copyright (c) 2004 Topspin Communications.  All rights reserved.
31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * This software is available to you under a choice of one of two
51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * licenses.  You may choose to be licensed under the terms of the GNU
61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * General Public License (GPL) Version 2, available from the file
71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * COPYING in the main directory of this source tree, or the
81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * OpenIB.org BSD license below:
91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *     Redistribution and use in source and binary forms, with or
111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *     without modification, are permitted provided that the following
121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *     conditions are met:
131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *      - Redistributions of source code must retain the above
151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *        copyright notice, this list of conditions and the following
161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *        disclaimer.
171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *      - Redistributions in binary form must reproduce the above
191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *        copyright notice, this list of conditions and the following
201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *        disclaimer in the documentation and/or other materials
211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *        provided with the distribution.
221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * SOFTWARE.
311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * $Id: ib_cache.h 1349 2004-12-16 21:09:43Z roland $
331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef _IB_CACHE_H
361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _IB_CACHE_H
371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <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
1031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif /* _IB_CACHE_H */
104