Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2004 Topspin Communications. All rights reserved. |
Roland Dreier | 2a1d9b7 | 2005-08-10 23:03:10 -0700 | [diff] [blame] | 3 | * Copyright (c) 2005 Intel Corporation. All rights reserved. |
| 4 | * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * |
| 6 | * This software is available to you under a choice of one of two |
| 7 | * licenses. You may choose to be licensed under the terms of the GNU |
| 8 | * General Public License (GPL) Version 2, available from the file |
| 9 | * COPYING in the main directory of this source tree, or the |
| 10 | * OpenIB.org BSD license below: |
| 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or |
| 13 | * without modification, are permitted provided that the following |
| 14 | * conditions are met: |
| 15 | * |
| 16 | * - Redistributions of source code must retain the above |
| 17 | * copyright notice, this list of conditions and the following |
| 18 | * disclaimer. |
| 19 | * |
| 20 | * - Redistributions in binary form must reproduce the above |
| 21 | * copyright notice, this list of conditions and the following |
| 22 | * disclaimer in the documentation and/or other materials |
| 23 | * provided with the distribution. |
| 24 | * |
| 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 32 | * SOFTWARE. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | */ |
| 34 | |
| 35 | #ifndef _IB_CACHE_H |
| 36 | #define _IB_CACHE_H |
| 37 | |
Roland Dreier | a4d61e8 | 2005-08-25 13:40:04 -0700 | [diff] [blame] | 38 | #include <rdma/ib_verbs.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
Jason Gunthorpe | c3d71b6 | 2018-06-05 08:40:20 +0300 | [diff] [blame] | 40 | int rdma_query_gid(struct ib_device *device, u8 port_num, int index, |
| 41 | union ib_gid *gid); |
Jason Gunthorpe | c3d71b6 | 2018-06-05 08:40:20 +0300 | [diff] [blame] | 42 | const struct ib_gid_attr *rdma_find_gid(struct ib_device *device, |
| 43 | const union ib_gid *gid, |
| 44 | enum ib_gid_type gid_type, |
| 45 | struct net_device *ndev); |
Jason Gunthorpe | c3d71b6 | 2018-06-05 08:40:20 +0300 | [diff] [blame] | 46 | const struct ib_gid_attr *rdma_find_gid_by_port(struct ib_device *ib_dev, |
| 47 | const union ib_gid *gid, |
| 48 | enum ib_gid_type gid_type, |
| 49 | u8 port, |
| 50 | struct net_device *ndev); |
Jason Gunthorpe | c3d71b6 | 2018-06-05 08:40:20 +0300 | [diff] [blame] | 51 | const struct ib_gid_attr *rdma_find_gid_by_filter( |
| 52 | struct ib_device *device, const union ib_gid *gid, u8 port_num, |
| 53 | bool (*filter)(const union ib_gid *gid, const struct ib_gid_attr *, |
| 54 | void *), |
| 55 | void *context); |
| 56 | |
Matan Barak | d300ec5 | 2015-10-15 18:38:46 +0300 | [diff] [blame] | 57 | /** |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | * ib_get_cached_pkey - Returns a cached PKey table entry |
| 59 | * @device: The device to query. |
| 60 | * @port_num: The port number of the device to query. |
| 61 | * @index: The index into the cached PKey table to query. |
| 62 | * @pkey: The PKey value found at the specified index. |
| 63 | * |
| 64 | * ib_get_cached_pkey() fetches the specified PKey table entry stored in |
| 65 | * the local software cache. |
| 66 | */ |
| 67 | int ib_get_cached_pkey(struct ib_device *device_handle, |
| 68 | u8 port_num, |
| 69 | int index, |
| 70 | u16 *pkey); |
| 71 | |
| 72 | /** |
| 73 | * ib_find_cached_pkey - Returns the PKey table index where a specified |
| 74 | * PKey value occurs. |
| 75 | * @device: The device to query. |
| 76 | * @port_num: The port number of the device to search for the PKey. |
| 77 | * @pkey: The PKey value to search for. |
| 78 | * @index: The index into the cached PKey table where the PKey was found. |
| 79 | * |
| 80 | * ib_find_cached_pkey() searches the specified PKey table in |
| 81 | * the local software cache. |
| 82 | */ |
| 83 | int ib_find_cached_pkey(struct ib_device *device, |
| 84 | u8 port_num, |
| 85 | u16 pkey, |
| 86 | u16 *index); |
| 87 | |
Jack Morgenstein | 6fb9cdb | 2006-06-17 20:37:34 -0700 | [diff] [blame] | 88 | /** |
Jack Morgenstein | 73aaa74 | 2012-08-03 08:40:39 +0000 | [diff] [blame] | 89 | * ib_find_exact_cached_pkey - Returns the PKey table index where a specified |
| 90 | * PKey value occurs. Comparison uses the FULL 16 bits (incl membership bit) |
| 91 | * @device: The device to query. |
| 92 | * @port_num: The port number of the device to search for the PKey. |
| 93 | * @pkey: The PKey value to search for. |
| 94 | * @index: The index into the cached PKey table where the PKey was found. |
| 95 | * |
| 96 | * ib_find_exact_cached_pkey() searches the specified PKey table in |
| 97 | * the local software cache. |
| 98 | */ |
| 99 | int ib_find_exact_cached_pkey(struct ib_device *device, |
| 100 | u8 port_num, |
| 101 | u16 pkey, |
| 102 | u16 *index); |
| 103 | |
| 104 | /** |
Jack Morgenstein | 6fb9cdb | 2006-06-17 20:37:34 -0700 | [diff] [blame] | 105 | * ib_get_cached_lmc - Returns a cached lmc table entry |
| 106 | * @device: The device to query. |
| 107 | * @port_num: The port number of the device to query. |
| 108 | * @lmc: The lmc value for the specified port for that device. |
| 109 | * |
| 110 | * ib_get_cached_lmc() fetches the specified lmc table entry stored in |
| 111 | * the local software cache. |
| 112 | */ |
| 113 | int ib_get_cached_lmc(struct ib_device *device, |
| 114 | u8 port_num, |
| 115 | u8 *lmc); |
| 116 | |
Jack Wang | 9e2c3f1 | 2017-01-02 13:19:24 +0100 | [diff] [blame] | 117 | /** |
| 118 | * ib_get_cached_port_state - Returns a cached port state table entry |
| 119 | * @device: The device to query. |
| 120 | * @port_num: The port number of the device to query. |
| 121 | * @port_state: port_state for the specified port for that device. |
| 122 | * |
| 123 | * ib_get_cached_port_state() fetches the specified port_state table entry stored in |
| 124 | * the local software cache. |
| 125 | */ |
| 126 | int ib_get_cached_port_state(struct ib_device *device, |
| 127 | u8 port_num, |
| 128 | enum ib_port_state *port_active); |
| 129 | |
Parav Pandit | 25e6265 | 2018-05-22 20:33:45 +0300 | [diff] [blame] | 130 | bool rdma_is_zero_gid(const union ib_gid *gid); |
Parav Pandit | bf399c2 | 2018-06-05 08:40:17 +0300 | [diff] [blame] | 131 | const struct ib_gid_attr *rdma_get_gid_attr(struct ib_device *device, |
| 132 | u8 port_num, int index); |
| 133 | void rdma_put_gid_attr(const struct ib_gid_attr *attr); |
| 134 | void rdma_hold_gid_attr(const struct ib_gid_attr *attr); |
Jason Gunthorpe | 7aaa180 | 2018-07-27 09:48:30 -0600 | [diff] [blame] | 135 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | #endif /* _IB_CACHE_H */ |